From 34719c2bbb27128cf4092c7cc9dc91adf10f95bb Mon Sep 17 00:00:00 2001 From: Hilko Bengen Date: Mon, 27 Nov 2023 21:44:34 +0100 Subject: [PATCH 1/1] Import nbdkit_1.36.2.orig.tar.gz [dgit import orig nbdkit_1.36.2.orig.tar.gz] --- .dir-locals.el | 5 + .gitignore | 172 + .vscode/settings.json | 9 + .vscode/tasks.json | 21 + BENCHMARKING | 187 + LICENSE | 30 + Makefile.am | 153 + Makefile.in | 1222 + OTHER_PLUGINS | 13 + README.md | 486 + SECURITY | 15 + TODO | 413 + aclocal.m4 | 1501 + bash-completion/Makefile.am | 40 + bash-completion/Makefile.in | 687 + bash-completion/README | 8 + bash-completion/nbdkit | 112 + common-rules.mk | 38 + common/allocators/Makefile.am | 56 + common/allocators/Makefile.in | 850 + common/allocators/allocator-internal.h | 43 + common/allocators/allocator.c | 168 + common/allocators/allocator.h | 153 + common/allocators/malloc.c | 324 + common/allocators/sparse.c | 617 + common/allocators/zstd.c | 656 + common/bitmap/Makefile.am | 57 + common/bitmap/Makefile.in | 1242 + common/bitmap/bitmap.c | 115 + common/bitmap/bitmap.h | 183 + common/bitmap/test-bitmap.c | 163 + common/gpt/Makefile.am | 41 + common/gpt/Makefile.in | 798 + common/gpt/efi-crc32.c | 140 + common/gpt/efi-crc32.h | 41 + common/gpt/gpt.h | 79 + common/include/Makefile.am | 129 + common/include/Makefile.in | 1697 + common/include/ansi-colours.h | 98 + common/include/array-size.h | 41 + common/include/ascii-ctype.h | 75 + common/include/ascii-string.h | 77 + common/include/byte-swapping.h | 130 + common/include/checked-overflow.h | 208 + common/include/compiler-macros.h | 90 + common/include/hexdigit.h | 73 + common/include/human-size-test-cases.h | 106 + common/include/human-size.h | 137 + common/include/isaligned.h | 47 + common/include/ispowerof2.h | 84 + common/include/iszero.h | 63 + common/include/minmax.h | 84 + common/include/nextnonzero.h | 58 + common/include/random.h | 106 + common/include/rounding.h | 57 + common/include/static-assert.h | 48 + common/include/test-array-size.c | 87 + common/include/test-ascii-ctype.c | 88 + common/include/test-ascii-string.c | 80 + common/include/test-byte-swapping.c | 108 + common/include/test-checked-overflow.c | 177 + common/include/test-human-size.c | 70 + common/include/test-isaligned.c | 62 + common/include/test-ispowerof2.c | 88 + common/include/test-iszero.c | 66 + common/include/test-minmax.c | 172 + common/include/test-nextnonzero.c | 63 + common/include/test-random.c | 193 + common/include/test-tvdiff.c | 130 + common/include/tvdiff.h | 64 + common/include/unique-name.h | 43 + common/include/unix-path-max.h | 42 + common/protocol/Makefile.am | 60 + common/protocol/Makefile.in | 880 + common/protocol/generate-protostrings.sh.in | 79 + common/protocol/nbd-protocol.h | 319 + common/protocol/protostrings.c | 271 + common/protocol/protostrings.h | 51 + common/regions/Makefile.am | 46 + common/regions/Makefile.in | 804 + common/regions/regions.c | 191 + common/regions/regions.h | 135 + common/replacements/Makefile.am | 88 + common/replacements/Makefile.in | 1437 + common/replacements/fdatasync.c | 51 + common/replacements/fdatasync.h | 44 + common/replacements/fsync.c | 76 + common/replacements/fsync.h | 44 + common/replacements/get_current_dir_name.c | 60 + common/replacements/get_current_dir_name.h | 48 + common/replacements/getdelim.c | 84 + common/replacements/getline.c | 46 + common/replacements/getline.h | 48 + common/replacements/open_memstream.c | 150 + common/replacements/open_memstream.h | 54 + common/replacements/openlog.c | 61 + common/replacements/poll.c | 120 + common/replacements/poll.h | 73 + common/replacements/posix_memalign.c | 75 + common/replacements/posix_memalign.h | 54 + common/replacements/pread.c | 88 + common/replacements/pread.h | 44 + common/replacements/pwrite.c | 86 + common/replacements/pwrite.h | 44 + common/replacements/realpath.c | 80 + common/replacements/realpath.h | 47 + common/replacements/strndup.c | 58 + common/replacements/strndup.h | 47 + common/replacements/sysconf.c | 68 + common/replacements/sysconf.h | 56 + common/replacements/syslog.c | 61 + common/replacements/syslog.h | 66 + common/replacements/test-current-dir-name.c | 54 + common/replacements/vsyslog.c | 73 + common/replacements/win32/Makefile.am | 45 + common/replacements/win32/Makefile.in | 637 + common/replacements/win32/nbdkit-cat.mc | 37 + common/utils/Makefile.am | 130 + common/utils/Makefile.in | 1489 + common/utils/bench.h | 72 + common/utils/cleanup-nbdkit.c | 51 + common/utils/cleanup.c | 59 + common/utils/cleanup.h | 101 + common/utils/const-string-vector.h | 46 + common/utils/environ.c | 116 + common/utils/exit-with-parent.c | 174 + common/utils/exit-with-parent.h | 46 + common/utils/full-rw.c | 84 + common/utils/nbdkit-string.h | 43 + common/utils/quote.c | 138 + common/utils/string-vector.h | 46 + common/utils/test-quotes.c | 114 + common/utils/test-vector.c | 263 + common/utils/utils.c | 234 + common/utils/utils.h | 48 + common/utils/vector.c | 159 + common/utils/vector.h | 256 + common/utils/windows-compat.c | 221 + common/utils/windows-compat.h | 157 + common/utils/windows-errors.c | 291 + common/utils/windows-errors.txt | 105 + compile | 348 + config.guess | 1768 + config.h.in | 580 + config.sub | 1890 + configure | 30485 ++++++++++++++++ configure.ac | 1748 + contrib/Makefile.am | 44 + contrib/Makefile.in | 805 + contrib/sparseloadtest.c | 399 + depcomp | 791 + docs/Makefile.am | 194 + docs/Makefile.in | 909 + docs/make-links.sh | 46 + docs/nbdkit-captive.pod | 180 + docs/nbdkit-client.pod | 100 + docs/nbdkit-filter.pod | 1209 + docs/nbdkit-loop.pod | 155 + docs/nbdkit-plugin.pod | 1986 + docs/nbdkit-probing.pod | 171 + docs/nbdkit-protocol.pod | 239 + docs/nbdkit-release-notes-1.10.pod | 131 + docs/nbdkit-release-notes-1.12.pod | 105 + docs/nbdkit-release-notes-1.14.pod | 145 + docs/nbdkit-release-notes-1.16.pod | 172 + docs/nbdkit-release-notes-1.18.pod | 210 + docs/nbdkit-release-notes-1.20.pod | 181 + docs/nbdkit-release-notes-1.22.pod | 250 + docs/nbdkit-release-notes-1.24.pod | 164 + docs/nbdkit-release-notes-1.26.pod | 196 + docs/nbdkit-release-notes-1.28.pod | 164 + docs/nbdkit-release-notes-1.30.pod | 222 + docs/nbdkit-release-notes-1.32.pod | 191 + docs/nbdkit-release-notes-1.34.pod | 184 + docs/nbdkit-release-notes-1.36.pod | 180 + docs/nbdkit-release-notes-1.4.pod | 107 + docs/nbdkit-release-notes-1.6.pod | 112 + docs/nbdkit-release-notes-1.8.pod | 118 + docs/nbdkit-security.pod | 48 + docs/nbdkit-service.pod | 187 + docs/nbdkit-tls.pod | 435 + docs/nbdkit.pod | 804 + docs/synopsis.txt | 24 + filters/Makefile.am | 36 + filters/Makefile.in | 807 + filters/blocksize-policy/Makefile.am | 74 + filters/blocksize-policy/Makefile.in | 937 + .../nbdkit-blocksize-policy-filter.pod | 158 + filters/blocksize-policy/policy.c | 398 + filters/blocksize/Makefile.am | 74 + filters/blocksize/Makefile.in | 937 + filters/blocksize/blocksize.c | 549 + filters/blocksize/nbdkit-blocksize-filter.pod | 130 + filters/cache/Makefile.am | 87 + filters/cache/Makefile.in | 990 + filters/cache/blk.c | 451 + filters/cache/blk.h | 93 + filters/cache/cache.c | 754 + filters/cache/cache.h | 64 + filters/cache/lru.c | 160 + filters/cache/lru.h | 53 + filters/cache/nbdkit-cache-filter.pod | 195 + filters/cache/reclaim.c | 206 + filters/cache/reclaim.h | 52 + filters/cacheextents/Makefile.am | 74 + filters/cacheextents/Makefile.in | 937 + filters/cacheextents/cacheextents.c | 212 + .../nbdkit-cacheextents-filter.pod | 68 + filters/checkwrite/Makefile.am | 74 + filters/checkwrite/Makefile.in | 937 + filters/checkwrite/checkwrite.c | 275 + .../checkwrite/nbdkit-checkwrite-filter.pod | 94 + filters/cow/Makefile.am | 80 + filters/cow/Makefile.in | 953 + filters/cow/blk.c | 424 + filters/cow/blk.h | 83 + filters/cow/cow.c | 804 + filters/cow/cow.h | 39 + filters/cow/nbdkit-cow-filter.pod | 181 + filters/ddrescue/Makefile.am | 81 + filters/ddrescue/Makefile.in | 947 + filters/ddrescue/ddrescue.c | 211 + filters/ddrescue/nbdkit-ddrescue-filter.pod | 78 + filters/delay/Makefile.am | 70 + filters/delay/Makefile.in | 929 + filters/delay/delay.c | 370 + filters/delay/nbdkit-delay-filter.pod | 174 + filters/error/Makefile.am | 74 + filters/error/Makefile.in | 935 + filters/error/error.c | 379 + filters/error/nbdkit-error-filter.pod | 181 + filters/evil/Makefile.am | 77 + filters/evil/Makefile.in | 941 + filters/evil/evil.c | 427 + filters/evil/nbdkit-evil-filter.pod | 170 + filters/exitlast/Makefile.am | 70 + filters/exitlast/Makefile.in | 931 + filters/exitlast/exitlast.c | 80 + filters/exitlast/nbdkit-exitlast-filter.pod | 62 + filters/exitwhen/Makefile.am | 75 + filters/exitwhen/Makefile.in | 938 + filters/exitwhen/exitwhen.c | 535 + filters/exitwhen/nbdkit-exitwhen-filter.pod | 201 + filters/exportname/Makefile.am | 75 + filters/exportname/Makefile.in | 938 + filters/exportname/exportname.c | 348 + .../exportname/nbdkit-exportname-filter.pod | 154 + filters/ext2/Makefile.am | 82 + filters/ext2/Makefile.in | 957 + filters/ext2/ext2.c | 531 + filters/ext2/io.c | 474 + filters/ext2/io.h | 52 + filters/ext2/nbdkit-ext2-filter.pod | 113 + filters/extentlist/Makefile.am | 75 + filters/extentlist/Makefile.in | 938 + filters/extentlist/extentlist.c | 332 + .../extentlist/nbdkit-extentlist-filter.pod | 99 + filters/filters.syms | 46 + filters/fua/Makefile.am | 70 + filters/fua/Makefile.in | 929 + filters/fua/fua.c | 293 + filters/fua/nbdkit-fua-filter.pod | 158 + filters/gzip/Makefile.am | 83 + filters/gzip/Makefile.in | 946 + filters/gzip/gzip.c | 379 + filters/gzip/nbdkit-gzip-filter.pod | 85 + filters/ip/Makefile.am | 74 + filters/ip/Makefile.in | 935 + filters/ip/ip.c | 717 + filters/ip/nbdkit-ip-filter.pod | 257 + filters/limit/Makefile.am | 74 + filters/limit/Makefile.in | 935 + filters/limit/limit.c | 129 + filters/limit/nbdkit-limit-filter.pod | 62 + filters/log/Makefile.am | 79 + filters/log/Makefile.in | 955 + filters/log/log.c | 473 + filters/log/log.h | 108 + filters/log/nbdkit-log-filter.pod | 219 + filters/log/output.c | 254 + filters/luks/Makefile.am | 85 + filters/luks/Makefile.in | 963 + filters/luks/luks-encryption.c | 959 + filters/luks/luks-encryption.h | 78 + filters/luks/luks.c | 450 + filters/luks/nbdkit-luks-filter.pod | 120 + filters/multi-conn/Makefile.am | 74 + filters/multi-conn/Makefile.in | 937 + filters/multi-conn/multi-conn.c | 527 + .../multi-conn/nbdkit-multi-conn-filter.pod | 237 + filters/nocache/Makefile.am | 71 + filters/nocache/Makefile.in | 932 + filters/nocache/nbdkit-nocache-filter.pod | 91 + filters/nocache/nocache.c | 110 + filters/noextents/Makefile.am | 70 + filters/noextents/Makefile.in | 931 + filters/noextents/nbdkit-noextents-filter.pod | 64 + filters/noextents/noextents.c | 50 + filters/nofilter/Makefile.am | 71 + filters/nofilter/Makefile.in | 932 + filters/nofilter/nbdkit-nofilter-filter.pod | 41 + filters/nofilter/nofilter.c | 42 + filters/noparallel/Makefile.am | 71 + filters/noparallel/Makefile.in | 932 + .../noparallel/nbdkit-noparallel-filter.pod | 90 + filters/noparallel/noparallel.c | 85 + filters/nozero/Makefile.am | 71 + filters/nozero/Makefile.in | 931 + filters/nozero/nbdkit-nozero-filter.pod | 145 + filters/nozero/nozero.c | 189 + filters/offset/Makefile.am | 74 + filters/offset/Makefile.in | 936 + filters/offset/nbdkit-offset-filter.pod | 99 + filters/offset/offset.c | 193 + filters/partition/Makefile.am | 78 + filters/partition/Makefile.in | 965 + filters/partition/nbdkit-partition-filter.pod | 91 + filters/partition/partition-gpt.c | 147 + filters/partition/partition-mbr.c | 198 + filters/partition/partition.c | 350 + filters/partition/partition.h | 53 + filters/pause/Makefile.am | 77 + filters/pause/Makefile.in | 942 + filters/pause/nbdkit-pause-filter.pod | 114 + filters/pause/pause.c | 373 + filters/protect/Makefile.am | 77 + filters/protect/Makefile.in | 941 + filters/protect/nbdkit-protect-filter.pod | 122 + filters/protect/protect.c | 367 + filters/qcow2dec/Makefile.am | 84 + filters/qcow2dec/Makefile.in | 950 + filters/qcow2dec/nbdkit-qcow2dec-filter.pod | 117 + filters/qcow2dec/qcow2.h | 87 + filters/qcow2dec/qcow2dec.c | 995 + filters/rate/Makefile.am | 77 + filters/rate/Makefile.in | 949 + filters/rate/bucket.c | 180 + filters/rate/bucket.h | 77 + filters/rate/nbdkit-rate-filter.pod | 154 + filters/rate/rate.c | 339 + filters/readahead/Makefile.am | 76 + filters/readahead/Makefile.in | 951 + filters/readahead/bgthread.c | 76 + filters/readahead/nbdkit-readahead-filter.pod | 114 + filters/readahead/readahead.c | 251 + filters/readahead/readahead.h | 60 + filters/retry-request/Makefile.am | 74 + filters/retry-request/Makefile.in | 938 + .../nbdkit-retry-request-filter.pod | 74 + filters/retry-request/retry-request.c | 292 + filters/retry/Makefile.am | 74 + filters/retry/Makefile.in | 935 + filters/retry/nbdkit-retry-filter.pod | 129 + filters/retry/retry.c | 515 + filters/scan/Makefile.am | 76 + filters/scan/Makefile.in | 948 + filters/scan/bgthread.c | 131 + filters/scan/nbdkit-scan-filter.pod | 163 + filters/scan/scan.c | 274 + filters/scan/scan.h | 63 + filters/stats/Makefile.am | 77 + filters/stats/Makefile.in | 958 + filters/stats/nbdkit-stats-filter.pod | 126 + filters/stats/stats.cpp | 605 + filters/swab/Makefile.am | 80 + filters/swab/Makefile.in | 944 + filters/swab/nbdkit-swab-filter.pod | 111 + filters/swab/swab.c | 253 + filters/tar/Makefile.am | 79 + filters/tar/Makefile.in | 943 + filters/tar/nbdkit-tar-filter.pod | 153 + filters/tar/tar.c | 443 + filters/tls-fallback/Makefile.am | 71 + filters/tls-fallback/Makefile.in | 932 + .../nbdkit-tls-fallback-filter.pod | 73 + filters/tls-fallback/tls-fallback.c | 246 + filters/truncate/Makefile.am | 74 + filters/truncate/Makefile.in | 937 + filters/truncate/nbdkit-truncate-filter.pod | 121 + filters/truncate/truncate.c | 438 + filters/xz/Makefile.am | 86 + filters/xz/Makefile.in | 975 + filters/xz/blkcache.c | 145 + filters/xz/blkcache.h | 53 + filters/xz/nbdkit-xz-filter.pod | 112 + filters/xz/xz.c | 286 + filters/xz/xzfile.c | 501 + filters/xz/xzfile.h | 70 + fuzzing/Makefile.am | 43 + fuzzing/Makefile.in | 639 + fuzzing/README | 133 + fuzzing/testcase_dir/newstyle-cflags | Bin 0 -> 4 bytes .../testcase_dir/newstyle-cflags-exportname | Bin 0 -> 21 bytes .../newstyle-cflags-exportname-read4 | Bin 0 -> 133 bytes fuzzing/testcase_dir/newstyle-cflags-go | Bin 0 -> 26 bytes fuzzing/testcase_dir/newstyle-cflags-go-read | Bin 0 -> 54 bytes fuzzing/testcase_dir/newstyle-cflags-go-read4 | Bin 0 -> 138 bytes fuzzing/testcase_dir/newstyle-cflags-go-write | Bin 0 -> 70 bytes html/pod.css | 155 + include/Makefile.am | 39 + include/Makefile.in | 756 + include/nbdkit-common.h | 182 + include/nbdkit-filter.h | 285 + include/nbdkit-plugin.h | 175 + include/nbdkit-version.h | 45 + include/nbdkit-version.h.in | 45 + install-sh | 541 + ltmain.sh | 11429 ++++++ m4/.gitignore | 5 + m4/ax_pthread.m4 | 522 + m4/libtool.m4 | 8403 +++++ m4/ltoptions.m4 | 437 + m4/ltsugar.m4 | 124 + m4/ltversion.m4 | 24 + m4/lt~obsolete.m4 | 99 + m4/ocaml.m4 | 240 + missing | 215 + plugins/Makefile.am | 36 + plugins/Makefile.in | 807 + plugins/S3/Makefile.am | 67 + plugins/S3/Makefile.in | 770 + plugins/S3/S3.py | 830 + plugins/S3/nbdkit-S3-plugin.pod | 200 + plugins/S3/nbdkit.py | 26 + plugins/blkio/Makefile.am | 81 + plugins/blkio/Makefile.in | 947 + plugins/blkio/blkio.c | 558 + plugins/blkio/nbdkit-blkio-plugin.pod | 124 + plugins/cc/Makefile.am | 83 + plugins/cc/Makefile.in | 946 + plugins/cc/cc.c | 646 + plugins/cc/nbdkit-cc-plugin.pod | 218 + plugins/cdi/Makefile.am | 82 + plugins/cdi/Makefile.in | 946 + plugins/cdi/cdi.c | 268 + plugins/cdi/nbdkit-cdi-plugin.pod | 115 + plugins/curl/Makefile.am | 91 + plugins/curl/Makefile.in | 1005 + plugins/curl/config.c | 763 + plugins/curl/curl.c | 595 + plugins/curl/curldefs.h | 165 + plugins/curl/nbdkit-curl-plugin.pod | 652 + plugins/curl/scripts.c | 363 + plugins/curl/times.c | 130 + plugins/curl/worker.c | 402 + plugins/data/Makefile.am | 87 + plugins/data/Makefile.in | 963 + plugins/data/data.c | 389 + plugins/data/data.h | 38 + plugins/data/disk2data.pl | 239 + plugins/data/format.c | 2023 + plugins/data/format.h | 44 + plugins/data/nbdkit-data-plugin.pod | 423 + plugins/eval/Makefile.am | 94 + plugins/eval/Makefile.in | 992 + plugins/eval/call.c | 604 + plugins/eval/eval.c | 433 + plugins/eval/methods.c | 1163 + plugins/eval/nbdkit-eval-plugin.pod | 212 + plugins/example1/Makefile.am | 70 + plugins/example1/Makefile.in | 931 + plugins/example1/example1.c | 173 + plugins/example1/nbdkit-example1-plugin.pod | 48 + plugins/example2/Makefile.am | 74 + plugins/example2/Makefile.in | 948 + plugins/example2/example2.c | 231 + plugins/example2/nbdkit-example2-plugin.pod | 57 + plugins/example2/winexample2.c | 229 + plugins/example3/Makefile.am | 76 + plugins/example3/Makefile.in | 942 + plugins/example3/example3.c | 240 + plugins/example3/nbdkit-example3-plugin.pod | 56 + plugins/example4/Makefile.am | 65 + plugins/example4/Makefile.in | 768 + plugins/example4/example4.pl | 139 + plugins/file/Makefile.am | 77 + plugins/file/Makefile.in | 948 + plugins/file/file.c | 1190 + plugins/file/nbdkit-file-plugin.pod | 277 + plugins/file/winfile.c | 519 + plugins/floppy/Makefile.am | 84 + plugins/floppy/Makefile.in | 975 + plugins/floppy/directory-lfn.c | 621 + plugins/floppy/floppy.c | 234 + plugins/floppy/nbdkit-floppy-plugin.pod | 115 + plugins/floppy/virtual-floppy.c | 737 + plugins/floppy/virtual-floppy.h | 247 + plugins/full/Makefile.am | 70 + plugins/full/Makefile.in | 929 + plugins/full/full.c | 180 + plugins/full/nbdkit-full-plugin.pod | 80 + plugins/golang/Makefile.am | 116 + plugins/golang/Makefile.in | 1133 + plugins/golang/config-test.go | 38 + plugins/golang/dump-plugin-examples.sh | 43 + plugins/golang/examples/disk/disk.go | 185 + plugins/golang/examples/disk/go.mod | 4 + .../golang/examples/dump-plugin/dumpplugin.go | 91 + plugins/golang/examples/dump-plugin/go.mod | 4 + plugins/golang/examples/minimal/go.mod | 4 + plugins/golang/examples/minimal/minimal.go | 86 + plugins/golang/examples/ramdisk/go.mod | 4 + plugins/golang/examples/ramdisk/ramdisk.go | 131 + plugins/golang/nbdkit-golang-plugin.pod | 168 + .../golang/src/libguestfs.org/nbdkit/go.mod | 4 + .../src/libguestfs.org/nbdkit/nbdkit.go | 570 + .../golang/src/libguestfs.org/nbdkit/utils.go | 75 + .../src/libguestfs.org/nbdkit/wrappers.go | 196 + .../src/libguestfs.org/nbdkit/wrappers.h | 57 + plugins/guestfs/Makefile.am | 81 + plugins/guestfs/Makefile.in | 947 + plugins/guestfs/guestfs-plugin.c | 603 + plugins/guestfs/nbdkit-guestfs-plugin.pod | 223 + plugins/info/Makefile.am | 75 + plugins/info/Makefile.in | 935 + plugins/info/info.c | 478 + plugins/info/nbdkit-info-plugin.pod | 221 + plugins/iso/Makefile.am | 81 + plugins/iso/Makefile.in | 945 + plugins/iso/iso.c | 273 + plugins/iso/nbdkit-iso-plugin.pod | 146 + plugins/libvirt/Makefile.am | 78 + plugins/libvirt/Makefile.in | 944 + plugins/libvirt/libvirt-plugin.c | 220 + plugins/libvirt/nbdkit-libvirt-plugin.pod | 78 + plugins/linuxdisk/Makefile.am | 89 + plugins/linuxdisk/Makefile.in | 995 + plugins/linuxdisk/filesystem.c | 245 + plugins/linuxdisk/linuxdisk.c | 246 + plugins/linuxdisk/nbdkit-linuxdisk-plugin.pod | 198 + plugins/linuxdisk/partition-gpt.c | 211 + plugins/linuxdisk/subdir/.gitignore | 0 plugins/linuxdisk/virtual-disk.c | 160 + plugins/linuxdisk/virtual-disk.h | 91 + plugins/lua/Makefile.am | 81 + plugins/lua/Makefile.in | 941 + plugins/lua/example.lua | 82 + plugins/lua/lua.c | 554 + plugins/lua/nbdkit-lua-plugin.pod | 303 + plugins/memory/Makefile.am | 77 + plugins/memory/Makefile.in | 940 + plugins/memory/memory.c | 256 + plugins/memory/nbdkit-memory-plugin.pod | 200 + plugins/nbd/Makefile.am | 82 + plugins/nbd/Makefile.in | 945 + plugins/nbd/nbd.c | 1240 + plugins/nbd/nbdkit-nbd-plugin.pod | 355 + plugins/null/Makefile.am | 70 + plugins/null/Makefile.in | 929 + plugins/null/nbdkit-null-plugin.pod | 70 + plugins/null/null.c | 191 + plugins/ocaml/Makefile.am | 114 + plugins/ocaml/Makefile.in | 1008 + plugins/ocaml/NBDKit.ml | 183 + plugins/ocaml/NBDKit.mli | 210 + plugins/ocaml/bindings.c | 330 + plugins/ocaml/callbacks.h | 69 + plugins/ocaml/example.ml | 115 + plugins/ocaml/nbdkit-ocaml-plugin.pod | 167 + plugins/ocaml/plugin.c | 945 + plugins/ocaml/plugin.h | 95 + plugins/ondemand/Makefile.am | 99 + plugins/ondemand/Makefile.in | 984 + plugins/ondemand/default-command.c | 26 + plugins/ondemand/default-command.sh.in | 57 + plugins/ondemand/nbdkit-ondemand-plugin.pod | 211 + plugins/ondemand/ondemand.c | 669 + plugins/ones/Makefile.am | 70 + plugins/ones/Makefile.in | 929 + plugins/ones/nbdkit-ones-plugin.pod | 77 + plugins/ones/ones.c | 199 + plugins/partitioning/Makefile.am | 84 + plugins/partitioning/Makefile.in | 985 + .../nbdkit-partitioning-plugin.pod | 211 + plugins/partitioning/partition-gpt.c | 267 + plugins/partitioning/partition-mbr.c | 210 + plugins/partitioning/partitioning.c | 457 + plugins/partitioning/virtual-disk.c | 203 + plugins/partitioning/virtual-disk.h | 118 + plugins/pattern/Makefile.am | 71 + plugins/pattern/Makefile.in | 932 + plugins/pattern/nbdkit-pattern-plugin.pod | 105 + plugins/pattern/pattern.c | 147 + plugins/perl/Makefile.am | 85 + plugins/perl/Makefile.in | 946 + plugins/perl/example.pl | 102 + plugins/perl/nbdkit-perl-plugin.pod | 393 + plugins/perl/perl.c | 703 + plugins/plugins.syms | 46 + plugins/python/Makefile.am | 94 + plugins/python/Makefile.in | 996 + plugins/python/errors.c | 127 + plugins/python/examples/error.py | 85 + plugins/python/examples/file.py | 76 + plugins/python/examples/imageio.py | 175 + plugins/python/examples/ramdisk.py | 84 + plugins/python/examples/url.py | 79 + plugins/python/helpers.c | 79 + plugins/python/modfunctions.c | 215 + plugins/python/nbdkit-python-plugin.pod | 590 + plugins/python/plugin.c | 1137 + plugins/python/plugin.h | 74 + plugins/random/Makefile.am | 74 + plugins/random/Makefile.in | 936 + plugins/random/nbdkit-random-plugin.pod | 92 + plugins/random/random.c | 221 + plugins/ruby/Makefile.am | 83 + plugins/ruby/Makefile.in | 944 + plugins/ruby/example.rb | 62 + plugins/ruby/nbdkit-ruby-plugin.pod | 318 + plugins/ruby/ruby.c | 549 + plugins/rust/CHANGELOG.md | 44 + plugins/rust/Cargo.lock.msrv | 303 + plugins/rust/Cargo.toml | 35 + plugins/rust/LICENSE | 25 + plugins/rust/Makefile.am | 94 + plugins/rust/Makefile.in | 1114 + plugins/rust/README.md | 48 + plugins/rust/examples/ramdisk.rs | 102 + plugins/rust/nbdkit-rust-plugin.pod | 100 + plugins/rust/run-cargo-tests.sh | 20 + plugins/rust/src/lib.rs | 1565 + plugins/rust/test-ramdisk.sh | 63 + plugins/rust/tests/bare_bones.rs | 147 + plugins/rust/tests/common/mod.rs | 133 + plugins/rust/tests/full_featured.rs | 758 + plugins/sh/Makefile.am | 85 + plugins/sh/Makefile.in | 972 + plugins/sh/assemble.sh | 63 + plugins/sh/call.c | 604 + plugins/sh/call.h | 72 + plugins/sh/example.sh | 200 + plugins/sh/methods.c | 1163 + plugins/sh/methods.h | 81 + plugins/sh/nbdkit-sh-plugin.pod | 619 + plugins/sh/sh.c | 332 + plugins/sparse-random/Makefile.am | 76 + plugins/sparse-random/Makefile.in | 941 + .../nbdkit-sparse-random-plugin.pod | 126 + plugins/sparse-random/sparse-random.c | 571 + plugins/split/Makefile.am | 75 + plugins/split/Makefile.in | 936 + plugins/split/nbdkit-split-plugin.pod | 102 + plugins/split/split.c | 468 + plugins/ssh/Makefile.am | 81 + plugins/ssh/Makefile.in | 943 + plugins/ssh/nbdkit-ssh-plugin.pod | 364 + plugins/ssh/ssh.c | 779 + plugins/tcl/Makefile.am | 81 + plugins/tcl/Makefile.in | 943 + plugins/tcl/example.tcl | 90 + plugins/tcl/nbdkit-tcl-plugin.pod | 309 + plugins/tcl/tcl.c | 563 + plugins/tmpdisk/Makefile.am | 92 + plugins/tmpdisk/Makefile.in | 977 + plugins/tmpdisk/default-command.c | 26 + plugins/tmpdisk/default-command.sh.in | 57 + plugins/tmpdisk/nbdkit-tmpdisk-plugin.pod | 214 + plugins/tmpdisk/tmpdisk.c | 523 + plugins/torrent/Makefile.am | 86 + plugins/torrent/Makefile.in | 970 + plugins/torrent/nbdkit-torrent-plugin.pod | 189 + plugins/torrent/torrent.cpp | 572 + plugins/vddk/Makefile.am | 92 + plugins/vddk/Makefile.in | 1005 + plugins/vddk/README.VDDK | 23 + plugins/vddk/nbdkit-vddk-plugin.pod | 753 + plugins/vddk/reexec.c | 238 + plugins/vddk/stats.c | 118 + plugins/vddk/utils.c | 51 + plugins/vddk/vddk-structs.h | 184 + plugins/vddk/vddk-stubs.h | 144 + plugins/vddk/vddk.c | 1058 + plugins/vddk/vddk.h | 199 + plugins/vddk/worker.c | 556 + plugins/zero/Makefile.am | 70 + plugins/zero/Makefile.in | 929 + plugins/zero/nbdkit-zero-plugin.pod | 51 + plugins/zero/zero.c | 100 + podwrapper.pl.in | 631 + scripts/git.orderfile | 81 + server/Makefile.am | 191 + server/Makefile.in | 2038 ++ server/backend.c | 868 + server/background.c | 106 + server/captive.c | 187 + server/connections.c | 528 + server/crypto.c | 827 + server/debug-flags.c | 172 + server/debug.c | 164 + server/exports.c | 167 + server/extents.c | 349 + server/filters.c | 778 + server/fuzzer.c | 201 + server/internal.h | 594 + server/local/nbdkit.pc.in | 43 + server/locks.c | 139 + server/log-stderr.c | 83 + server/log-syslog.c | 82 + server/log.c | 84 + server/main.c | 1309 + server/nbdkit.pc.in | 47 + server/nbdkit.syms | 102 + server/options.h | 119 + server/plugins.c | 978 + server/protocol-handshake-newstyle.c | 989 + server/protocol-handshake-oldstyle.c | 79 + server/protocol-handshake.c | 173 + server/protocol.c | 755 + server/public.c | 1168 + server/quit.c | 149 + server/signals.c | 74 + server/socket-activation.c | 119 + server/sockets.c | 589 + server/synopsis.c | 24 + server/test-public.c | 537 + server/threadlocal.c | 285 + server/usergroup.c | 161 + server/vfprintf.c | 65 + test-driver | 153 + tests/Makefile.am | 2191 ++ tests/Makefile.in | 7651 ++++ tests/README.tests | 111 + tests/cc-shebang.c | 52 + tests/cc_shebang.ml | 46 + tests/dummy-vddk.c | 248 + tests/functions.sh.in | 510 + tests/generate-file-data.sh | 40 + tests/make-pki.sh | 108 + tests/make-pki.sh.in | 108 + tests/make-psk.sh | 53 + tests/old-plugins/README | 25 + .../i686/Linux/v1.0.0/nbdkit-file-plugin.so | Bin 0 -> 23744 bytes .../v1.12.8-2-g1e2ccc27/nbdkit-file-plugin.so | Bin 0 -> 39264 bytes .../i686/Linux/v1.18.4/nbdkit-file-plugin.so | Bin 0 -> 56356 bytes .../v1.2.8-3-g0560f8f/nbdkit-file-plugin.so | Bin 0 -> 9804 bytes .../v1.8.4-3-g11f5a90d/nbdkit-file-plugin.so | Bin 0 -> 30700 bytes .../x86_64/Linux/v1.0.0/nbdkit-file-plugin.so | Bin 0 -> 27616 bytes .../Linux/v1.12.8/nbdkit-file-plugin.so | Bin 0 -> 15248 bytes .../Linux/v1.18.2/nbdkit-file-plugin.so | Bin 0 -> 28064 bytes .../x86_64/Linux/v1.2.8/nbdkit-file-plugin.so | Bin 0 -> 10568 bytes .../x86_64/Linux/v1.8.4/nbdkit-file-plugin.so | Bin 0 -> 15224 bytes tests/pycodestyle.sh | 43 + tests/python-exception.py | 71 + tests/python-export-list.py | 59 + tests/python-export-name.py | 52 + tests/python-thread-model.py | 54 + tests/shebang.pl | 31 + tests/shebang.py | 19 + tests/shebang.rb | 18 + tests/test-S3-unit.sh | 44 + tests/test-S3.sh | 75 + tests/test-S3/boto3/__init__.py | 92 + tests/test-S3/botocore/exceptions.py | 53 + tests/test-ansi-c-plugin.c | 175 + tests/test-ansi-c.sh | 38 + tests/test-binary.sh | 56 + tests/test-blkio.sh | 54 + tests/test-block-size-constraints.sh | 52 + tests/test-blocksize-default.sh | 90 + tests/test-blocksize-error-policy.sh | 95 + tests/test-blocksize-extents.sh | 105 + tests/test-blocksize-policy.sh | 119 + tests/test-blocksize-sharding.sh | 170 + tests/test-blocksize-write-disconnect.sh | 118 + tests/test-blocksize.sh | 131 + tests/test-cache-block-size.sh | 81 + tests/test-cache-max-size.sh | 89 + tests/test-cache-on-read-caches.sh | 87 + tests/test-cache-on-read.sh | 59 + tests/test-cache-unaligned.sh | 66 + tests/test-cache.sh | 69 + tests/test-cacheextents.sh | 112 + tests/test-captive-tls.sh | 72 + tests/test-captive.sh | 98 + tests/test-cc-cpp.cpp | 155 + tests/test-cc-cpp.sh | 60 + tests/test-cc-ocaml.sh | 62 + tests/test-cc.sh | 58 + tests/test-cdi.sh | 81 + tests/test-checkwrite-bounds.sh | 59 + tests/test-checkwrite-fail.sh | 60 + tests/test-checkwrite.sh | 76 + tests/test-client-death-tls.sh | 88 + tests/test-client-death.sh | 68 + tests/test-connect.c | 88 + tests/test-cow-block-size.sh | 73 + tests/test-cow-extents-large.sh | 52 + tests/test-cow-extents1.sh | 121 + tests/test-cow-extents2.sh | 78 + tests/test-cow-null.sh | 43 + tests/test-cow-on-read-caches.sh | 94 + tests/test-cow-on-read.sh | 66 + tests/test-cow-unaligned.sh | 63 + tests/test-cow.sh | 83 + tests/test-curl-cookie-script.c | 142 + tests/test-curl-head-forbidden.c | 134 + tests/test-curl-header-script-fail.script | 36 + tests/test-curl-header-script-fail.sh | 58 + tests/test-curl-header-script.c | 164 + tests/test-curl-options.sh | 109 + tests/test-curl.c | 142 + tests/test-cxx-filter.cpp | 57 + tests/test-cxx-plugin.cpp | 156 + tests/test-cxx.sh | 40 + tests/test-data-64b.sh | 74 + tests/test-data-7E.sh | 93 + tests/test-data-bad.sh | 169 + tests/test-data-base64.sh | 60 + tests/test-data-extents.sh | 103 + tests/test-data-file.sh | 66 + tests/test-data-format.sh | 354 + tests/test-data-optimum.sh | 149 + tests/test-data-partition.sh | 69 + tests/test-data-random-slice.sh | 68 + tests/test-data-random-slice2.sh | 66 + tests/test-data-raw-copy.sh | 54 + tests/test-data-raw.sh | 53 + tests/test-data-reloffset.sh | 56 + tests/test-data-sectors.sh | 67 + tests/test-data-size.sh | 108 + tests/test-data.c | 126 + tests/test-ddrescue-filter.sh | 81 + tests/test-debug-flags.sh | 115 + tests/test-delay-close.sh | 54 + tests/test-delay-open.sh | 49 + tests/test-delay-shutdown.sh | 95 + tests/test-delay.c | 94 + tests/test-disconnect-plugin.c | 95 + tests/test-disconnect-tls.sh | 139 + tests/test-disconnect.sh | 113 + tests/test-disk2data.sh | 115 + tests/test-dump-config-major-1.sh | 42 + tests/test-dump-config-version-major-minor.sh | 53 + tests/test-dump-config.sh | 45 + tests/test-dump-plugin-and-single.sh | 64 + tests/test-dump-plugin-example1.sh | 43 + tests/test-dump-plugin-example2.sh | 46 + tests/test-dump-plugin-example4.sh | 41 + tests/test-dump-plugin-filter.sh | 42 + tests/test-dump-plugin-name.sh | 44 + tests/test-dump-plugin-thread-model.sh | 107 + tests/test-dump-plugin.sh | 71 + tests/test-eflags.sh | 580 + tests/test-error-triggered.sh | 77 + tests/test-error0.sh | 55 + tests/test-error10.sh | 64 + tests/test-error100.sh | 61 + tests/test-eval-cache.sh | 92 + tests/test-eval-disconnect.sh | 236 + tests/test-eval-dump-plugin.sh | 43 + tests/test-eval-exports.sh | 157 + tests/test-eval-file.sh | 67 + tests/test-eval.sh | 73 + tests/test-evil-cosmic.sh | 78 + tests/test-evil-large-p.sh | 56 + tests/test-evil-small-p.sh | 58 + tests/test-evil-stuck-high-bits.sh | 91 + tests/test-evil-stuck-low-bits.sh | 84 + tests/test-evil-stuck-wires.sh | 85 + tests/test-exit-with-parent.c | 238 + tests/test-exitlast.sh | 73 + tests/test-exitwhen-file-already-created.sh | 45 + .../test-exitwhen-file-created-reject-new.sh | 88 + tests/test-exitwhen-file-created-when-idle.sh | 63 + tests/test-exitwhen-file-created.sh | 91 + tests/test-exitwhen-file-deleted.sh | 68 + tests/test-exitwhen-pipe-closed.c | 104 + tests/test-exitwhen-process-exits.sh | 74 + tests/test-exitwhen-script.sh | 75 + tests/test-export-info.sh | 111 + tests/test-export-name.sh | 91 + tests/test-exportname.sh | 203 + tests/test-ext2-exportname.sh | 79 + tests/test-ext2.c | 93 + tests/test-extentlist.sh | 176 + tests/test-file-block.c | 229 + tests/test-file-dir.sh | 148 + tests/test-file-dirfd.sh | 72 + tests/test-file-extents.sh | 70 + tests/test-file-fd.sh | 72 + tests/test-file-readonly.sh | 64 + tests/test-file.sh | 78 + tests/test-floppy-size.sh | 61 + tests/test-floppy.sh | 70 + tests/test-flush-plugin.c | 119 + tests/test-flush.sh | 143 + tests/test-foreground.sh | 86 + tests/test-fua.sh | 153 + tests/test-full.sh | 69 + tests/test-golang.c | 152 + tests/test-gzip-curl.c | 123 + tests/test-gzip.c | 101 + tests/test-help-example1.sh | 43 + tests/test-help-plugin.sh | 71 + tests/test-help.sh | 42 + tests/test-info-address.sh | 70 + tests/test-info-base64.sh | 94 + tests/test-info-conntime.sh | 65 + tests/test-info-raw.sh | 68 + tests/test-info-time.sh | 68 + tests/test-info-uptime.sh | 65 + tests/test-ip-filter-anyunix.sh | 56 + tests/test-ip-filter-anyvsock.sh | 87 + tests/test-ip-filter-gid.sh | 56 + tests/test-ip-filter-pid.sh | 71 + tests/test-ip-filter-security.sh | 56 + tests/test-ip-filter-uid.sh | 56 + tests/test-ip-filter.sh | 58 + tests/test-ipv4-lo.sh | 71 + tests/test-ipv6-lo.sh | 72 + tests/test-iso.sh | 53 + tests/test-just-filter-header.c | 39 + tests/test-just-plugin-header.c | 39 + tests/test-lang-plugins.c | 141 + tests/test-layers-filter.c | 461 + tests/test-layers-plugin.c | 316 + tests/test-layers.c | 773 + tests/test-layers.sh | 54 + tests/test-limit.sh | 81 + tests/test-linuxdisk-copy-out.sh | 78 + tests/test-linuxdisk.sh | 96 + tests/test-log-error.sh | 63 + tests/test-log-extents.sh | 60 + tests/test-log-script-info.sh | 74 + tests/test-log-script.sh | 67 + tests/test-log.sh | 73 + tests/test-long-name.sh | 108 + tests/test-long-options.sh | 39 + tests/test-luks-copy-zero.sh | 75 + tests/test-luks-copy.sh | 129 + tests/test-luks-info.sh | 61 + tests/test-manual.sh | 51 + tests/test-memory-allocator-malloc-mlock.sh | 90 + tests/test-memory-allocator-malloc.sh | 66 + tests/test-memory-largest-for-qemu.sh | 253 + tests/test-memory-largest.sh | 68 + tests/test-memory.c | 119 + tests/test-multi-conn-name.sh | 89 + tests/test-multi-conn-plugin.sh | 141 + tests/test-multi-conn.sh | 294 + tests/test-nbd-block-size.sh | 56 + tests/test-nbd-client-tls.sh | 101 + tests/test-nbd-client.sh | 82 + tests/test-nbd-dynamic-content.sh | 80 + tests/test-nbd-dynamic-list.sh | 170 + tests/test-nbd-extents.sh | 119 + tests/test-nbd-qcow2.sh | 68 + tests/test-nbd-tls-psk.sh | 90 + tests/test-nbd-tls.sh | 85 + tests/test-nbd-vsock.sh | 69 + tests/test-nbd.c | 127 + tests/test-nbdkit-backend-debug.sh | 80 + tests/test-newstyle.c | 79 + tests/test-nofilter.sh | 45 + tests/test-not-linked-to-libssl.sh | 54 + tests/test-nozero.sh | 157 + tests/test-null-extents.sh | 76 + tests/test-null.c | 87 + tests/test-ocaml-dump-plugin.sh | 47 + tests/test-ocaml-errorcodes.c | 111 + tests/test-ocaml-fork.sh | 47 + tests/test-ocaml-list-exports.sh | 59 + tests/test-ocaml.c | 140 + tests/test-offset-extents.sh | 99 + tests/test-offset-truncate.sh | 123 + tests/test-offset.c | 196 + tests/test-offset2.sh | 55 + tests/test-old-plugins.sh | 82 + tests/test-oldstyle.c | 79 + tests/test-ondemand-list.sh | 72 + tests/test-ondemand-locking.sh | 79 + tests/test-ondemand.sh | 92 + tests/test-ones.sh | 54 + tests/test-parallel-file.sh | 90 + tests/test-parallel-nbd.sh | 85 + tests/test-parallel-sh.sh | 147 + tests/test-partition-4k-gpt.sh | 78 + tests/test-partition-4k-mbr.sh | 77 + tests/test-partition1.sh | 167 + tests/test-partition2.sh | 84 + tests/test-partitioning1.sh | 111 + tests/test-partitioning2.sh | 72 + tests/test-partitioning3.sh | 77 + tests/test-partitioning4.sh | 84 + tests/test-partitioning5.sh | 93 + tests/test-partitioning6.sh | 87 + tests/test-pattern-largest-for-qemu.sh | 125 + tests/test-pattern-largest.sh | 68 + tests/test-pattern.sh | 112 + tests/test-pause.c | 175 + tests/test-plugin-docs.sh | 132 + tests/test-probe-filter-dump-plugin.sh | 40 + tests/test-probe-filter.sh | 46 + tests/test-probe-plugin.sh | 46 + tests/test-protect-ranges.sh | 70 + tests/test-protect.c | 123 + tests/test-python-exception.sh | 56 + tests/test-python-export-list.sh | 65 + tests/test-python-export-name.sh | 74 + tests/test-python-plugin.py | 197 + tests/test-python-thread-model.sh | 87 + tests/test-python.sh | 44 + tests/test-qcow2dec-map.sh | 68 + tests/test-qcow2dec.sh | 71 + tests/test-random-copy.sh | 46 + tests/test-random-sock.sh | 41 + tests/test-random.c | 127 + tests/test-rate-dynamic.sh | 76 + tests/test-rate.sh | 66 + tests/test-read-password-interactive.sh | 86 + tests/test-read-password-plugin.c | 136 + tests/test-read-password.sh | 92 + tests/test-readahead-copy.sh | 64 + tests/test-readahead.sh | 88 + tests/test-retry-extents.sh | 117 + tests/test-retry-open.sh | 88 + tests/test-retry-readonly.sh | 98 + tests/test-retry-reopen-fail.sh | 164 + tests/test-retry-request-mirror.c | 148 + tests/test-retry-request-open.sh | 99 + tests/test-retry-request.sh | 95 + tests/test-retry-size.sh | 128 + tests/test-retry-zero-flags.sh | 130 + tests/test-retry.sh | 101 + tests/test-scan-copy.sh | 43 + tests/test-scan-info.sh | 47 + tests/test-sh-errors.sh | 134 + tests/test-sh-extents.sh | 164 + tests/test-sh-pwrite-ignore-stdin.sh | 81 + tests/test-sh-tmpdir-leak.sh | 56 + tests/test-shebang-cc-ocaml.sh | 57 + tests/test-shebang-cc.sh | 60 + tests/test-shebang-perl.sh | 83 + tests/test-shebang-python.sh | 83 + tests/test-shebang-ruby.sh | 78 + tests/test-shell.sh | 96 + tests/test-short-options.sh | 39 + tests/test-shutdown-plugin.c | 89 + tests/test-shutdown.sh | 78 + tests/test-single-from-file.sh | 45 + tests/test-single-sh.sh | 80 + tests/test-single.sh | 70 + tests/test-socket-activation.c | 239 + tests/test-sparse-random-copy.sh | 46 + tests/test-sparse-random-info.sh | 46 + tests/test-split-extents.sh | 76 + tests/test-split.c | 83 + tests/test-ssh.sh | 73 + tests/test-start.sh | 73 + tests/test-stdio-plugin.c | 182 + tests/test-stdio.sh | 96 + tests/test-swab-16r.sh | 67 + tests/test-swab-16w.sh | 64 + tests/test-swab-32r.sh | 68 + tests/test-swab-32w.sh | 64 + tests/test-swab-64r.sh | 68 + tests/test-swab-64w.sh | 64 + tests/test-swab-8.sh | 51 + tests/test-swab-extents.sh | 133 + tests/test-swap.sh | 48 + tests/test-synopsis.sh | 68 + tests/test-tar-gzip-curl.c | 124 + tests/test-tar-info-xz-qcow2dec.sh | 87 + tests/test-tar-info-xz.sh | 73 + tests/test-tar-info.sh | 69 + tests/test-tar-limit.sh | 66 + tests/test-tar-xz-curl.c | 124 + tests/test-tar.sh | 64 + tests/test-tests-requires-nbdcopy.sh | 59 + tests/test-tests-requires-nbdinfo.sh | 59 + tests/test-tests-requires-nbdsh.sh | 63 + tests/test-tests-requires-run.sh | 59 + tests/test-tls-fallback.sh | 137 + tests/test-tls-psk.sh | 83 + tests/test-tls.sh | 81 + tests/test-tmpdisk-command.sh | 55 + tests/test-tmpdisk.c | 157 + tests/test-truncate-extents.sh | 106 + tests/test-truncate1.sh | 55 + tests/test-truncate2.sh | 55 + tests/test-truncate3.sh | 58 + tests/test-truncate4.sh | 106 + tests/test-vddk-dump-plugin.sh | 46 + tests/test-vddk-password-fd.sh | 82 + tests/test-vddk-password-interactive.sh | 71 + tests/test-vddk-real-create.sh | 65 + tests/test-vddk-real-dump-plugin.sh | 65 + tests/test-vddk-real.sh | 100 + tests/test-vddk-reexec.sh | 51 + tests/test-vddk-run.sh | 50 + tests/test-vddk.c | 110 + tests/test-verbose.sh | 61 + tests/test-version-example1.sh | 43 + tests/test-version-filter.sh | 44 + tests/test-version-plugin.sh | 71 + tests/test-version.sh | 42 + tests/test-vsock.sh | 63 + tests/test-xz-curl.c | 123 + tests/test-xz.c | 98 + tests/test-zero.sh | 48 + tests/test.c | 259 + tests/test.h | 58 + tests/test.lua | 27 + tests/test.pl | 94 + tests/test.rb | 43 + tests/test.tcl | 28 + tests/test_ocaml_errorcodes_plugin.ml | 62 + tests/test_ocaml_plugin.ml | 229 + tests/test_python.py | 303 + tests/web-server.c | 566 + tests/web-server.h | 73 + valgrind/Makefile.am | 46 + valgrind/Makefile.in | 640 + valgrind/ext2fs.suppressions | 38 + valgrind/glibc.suppressions | 111 + valgrind/gnutls.suppressions | 39 + valgrind/nbdkit.suppressions | 95 + valgrind/ocaml.suppressions | 66 + valgrind/perl.suppressions | 56 + valgrind/sh.suppressions | 40 + wrapper.c | 377 + 1122 files changed, 330959 insertions(+) create mode 100644 .dir-locals.el create mode 100644 .gitignore create mode 100644 .vscode/settings.json create mode 100644 .vscode/tasks.json create mode 100644 BENCHMARKING create mode 100644 LICENSE create mode 100644 Makefile.am create mode 100644 Makefile.in create mode 100644 OTHER_PLUGINS create mode 100644 README.md create mode 100644 SECURITY create mode 100644 TODO create mode 100644 aclocal.m4 create mode 100644 bash-completion/Makefile.am create mode 100644 bash-completion/Makefile.in create mode 100644 bash-completion/README create mode 100644 bash-completion/nbdkit create mode 100644 common-rules.mk create mode 100644 common/allocators/Makefile.am create mode 100644 common/allocators/Makefile.in create mode 100644 common/allocators/allocator-internal.h create mode 100644 common/allocators/allocator.c create mode 100644 common/allocators/allocator.h create mode 100644 common/allocators/malloc.c create mode 100644 common/allocators/sparse.c create mode 100644 common/allocators/zstd.c create mode 100644 common/bitmap/Makefile.am create mode 100644 common/bitmap/Makefile.in create mode 100644 common/bitmap/bitmap.c create mode 100644 common/bitmap/bitmap.h create mode 100644 common/bitmap/test-bitmap.c create mode 100644 common/gpt/Makefile.am create mode 100644 common/gpt/Makefile.in create mode 100644 common/gpt/efi-crc32.c create mode 100644 common/gpt/efi-crc32.h create mode 100644 common/gpt/gpt.h create mode 100644 common/include/Makefile.am create mode 100644 common/include/Makefile.in create mode 100644 common/include/ansi-colours.h create mode 100644 common/include/array-size.h create mode 100644 common/include/ascii-ctype.h create mode 100644 common/include/ascii-string.h create mode 100644 common/include/byte-swapping.h create mode 100644 common/include/checked-overflow.h create mode 100644 common/include/compiler-macros.h create mode 100644 common/include/hexdigit.h create mode 100644 common/include/human-size-test-cases.h create mode 100644 common/include/human-size.h create mode 100644 common/include/isaligned.h create mode 100644 common/include/ispowerof2.h create mode 100644 common/include/iszero.h create mode 100644 common/include/minmax.h create mode 100644 common/include/nextnonzero.h create mode 100644 common/include/random.h create mode 100644 common/include/rounding.h create mode 100644 common/include/static-assert.h create mode 100644 common/include/test-array-size.c create mode 100644 common/include/test-ascii-ctype.c create mode 100644 common/include/test-ascii-string.c create mode 100644 common/include/test-byte-swapping.c create mode 100644 common/include/test-checked-overflow.c create mode 100644 common/include/test-human-size.c create mode 100644 common/include/test-isaligned.c create mode 100644 common/include/test-ispowerof2.c create mode 100644 common/include/test-iszero.c create mode 100644 common/include/test-minmax.c create mode 100644 common/include/test-nextnonzero.c create mode 100644 common/include/test-random.c create mode 100644 common/include/test-tvdiff.c create mode 100644 common/include/tvdiff.h create mode 100644 common/include/unique-name.h create mode 100644 common/include/unix-path-max.h create mode 100644 common/protocol/Makefile.am create mode 100644 common/protocol/Makefile.in create mode 100755 common/protocol/generate-protostrings.sh.in create mode 100644 common/protocol/nbd-protocol.h create mode 100644 common/protocol/protostrings.c create mode 100644 common/protocol/protostrings.h create mode 100644 common/regions/Makefile.am create mode 100644 common/regions/Makefile.in create mode 100644 common/regions/regions.c create mode 100644 common/regions/regions.h create mode 100644 common/replacements/Makefile.am create mode 100644 common/replacements/Makefile.in create mode 100644 common/replacements/fdatasync.c create mode 100644 common/replacements/fdatasync.h create mode 100644 common/replacements/fsync.c create mode 100644 common/replacements/fsync.h create mode 100644 common/replacements/get_current_dir_name.c create mode 100644 common/replacements/get_current_dir_name.h create mode 100644 common/replacements/getdelim.c create mode 100644 common/replacements/getline.c create mode 100644 common/replacements/getline.h create mode 100644 common/replacements/open_memstream.c create mode 100644 common/replacements/open_memstream.h create mode 100644 common/replacements/openlog.c create mode 100644 common/replacements/poll.c create mode 100644 common/replacements/poll.h create mode 100644 common/replacements/posix_memalign.c create mode 100644 common/replacements/posix_memalign.h create mode 100644 common/replacements/pread.c create mode 100644 common/replacements/pread.h create mode 100644 common/replacements/pwrite.c create mode 100644 common/replacements/pwrite.h create mode 100644 common/replacements/realpath.c create mode 100644 common/replacements/realpath.h create mode 100644 common/replacements/strndup.c create mode 100644 common/replacements/strndup.h create mode 100644 common/replacements/sysconf.c create mode 100644 common/replacements/sysconf.h create mode 100644 common/replacements/syslog.c create mode 100644 common/replacements/syslog.h create mode 100644 common/replacements/test-current-dir-name.c create mode 100644 common/replacements/vsyslog.c create mode 100644 common/replacements/win32/Makefile.am create mode 100644 common/replacements/win32/Makefile.in create mode 100644 common/replacements/win32/nbdkit-cat.mc create mode 100644 common/utils/Makefile.am create mode 100644 common/utils/Makefile.in create mode 100644 common/utils/bench.h create mode 100644 common/utils/cleanup-nbdkit.c create mode 100644 common/utils/cleanup.c create mode 100644 common/utils/cleanup.h create mode 100644 common/utils/const-string-vector.h create mode 100644 common/utils/environ.c create mode 100644 common/utils/exit-with-parent.c create mode 100644 common/utils/exit-with-parent.h create mode 100644 common/utils/full-rw.c create mode 100644 common/utils/nbdkit-string.h create mode 100644 common/utils/quote.c create mode 100644 common/utils/string-vector.h create mode 100644 common/utils/test-quotes.c create mode 100644 common/utils/test-vector.c create mode 100644 common/utils/utils.c create mode 100644 common/utils/utils.h create mode 100644 common/utils/vector.c create mode 100644 common/utils/vector.h create mode 100644 common/utils/windows-compat.c create mode 100644 common/utils/windows-compat.h create mode 100644 common/utils/windows-errors.c create mode 100644 common/utils/windows-errors.txt create mode 100755 compile create mode 100755 config.guess create mode 100644 config.h.in create mode 100755 config.sub create mode 100755 configure create mode 100644 configure.ac create mode 100644 contrib/Makefile.am create mode 100644 contrib/Makefile.in create mode 100644 contrib/sparseloadtest.c create mode 100755 depcomp create mode 100644 docs/Makefile.am create mode 100644 docs/Makefile.in create mode 100755 docs/make-links.sh create mode 100644 docs/nbdkit-captive.pod create mode 100644 docs/nbdkit-client.pod create mode 100644 docs/nbdkit-filter.pod create mode 100644 docs/nbdkit-loop.pod create mode 100644 docs/nbdkit-plugin.pod create mode 100644 docs/nbdkit-probing.pod create mode 100644 docs/nbdkit-protocol.pod create mode 100644 docs/nbdkit-release-notes-1.10.pod create mode 100644 docs/nbdkit-release-notes-1.12.pod create mode 100644 docs/nbdkit-release-notes-1.14.pod create mode 100644 docs/nbdkit-release-notes-1.16.pod create mode 100644 docs/nbdkit-release-notes-1.18.pod create mode 100644 docs/nbdkit-release-notes-1.20.pod create mode 100644 docs/nbdkit-release-notes-1.22.pod create mode 100644 docs/nbdkit-release-notes-1.24.pod create mode 100644 docs/nbdkit-release-notes-1.26.pod create mode 100644 docs/nbdkit-release-notes-1.28.pod create mode 100644 docs/nbdkit-release-notes-1.30.pod create mode 100644 docs/nbdkit-release-notes-1.32.pod create mode 100644 docs/nbdkit-release-notes-1.34.pod create mode 100644 docs/nbdkit-release-notes-1.36.pod create mode 100644 docs/nbdkit-release-notes-1.4.pod create mode 100644 docs/nbdkit-release-notes-1.6.pod create mode 100644 docs/nbdkit-release-notes-1.8.pod create mode 100644 docs/nbdkit-security.pod create mode 100644 docs/nbdkit-service.pod create mode 100644 docs/nbdkit-tls.pod create mode 100644 docs/nbdkit.pod create mode 100644 docs/synopsis.txt create mode 100644 filters/Makefile.am create mode 100644 filters/Makefile.in create mode 100644 filters/blocksize-policy/Makefile.am create mode 100644 filters/blocksize-policy/Makefile.in create mode 100644 filters/blocksize-policy/nbdkit-blocksize-policy-filter.pod create mode 100644 filters/blocksize-policy/policy.c create mode 100644 filters/blocksize/Makefile.am create mode 100644 filters/blocksize/Makefile.in create mode 100644 filters/blocksize/blocksize.c create mode 100644 filters/blocksize/nbdkit-blocksize-filter.pod create mode 100644 filters/cache/Makefile.am create mode 100644 filters/cache/Makefile.in create mode 100644 filters/cache/blk.c create mode 100644 filters/cache/blk.h create mode 100644 filters/cache/cache.c create mode 100644 filters/cache/cache.h create mode 100644 filters/cache/lru.c create mode 100644 filters/cache/lru.h create mode 100644 filters/cache/nbdkit-cache-filter.pod create mode 100644 filters/cache/reclaim.c create mode 100644 filters/cache/reclaim.h create mode 100644 filters/cacheextents/Makefile.am create mode 100644 filters/cacheextents/Makefile.in create mode 100644 filters/cacheextents/cacheextents.c create mode 100644 filters/cacheextents/nbdkit-cacheextents-filter.pod create mode 100644 filters/checkwrite/Makefile.am create mode 100644 filters/checkwrite/Makefile.in create mode 100644 filters/checkwrite/checkwrite.c create mode 100644 filters/checkwrite/nbdkit-checkwrite-filter.pod create mode 100644 filters/cow/Makefile.am create mode 100644 filters/cow/Makefile.in create mode 100644 filters/cow/blk.c create mode 100644 filters/cow/blk.h create mode 100644 filters/cow/cow.c create mode 100644 filters/cow/cow.h create mode 100644 filters/cow/nbdkit-cow-filter.pod create mode 100644 filters/ddrescue/Makefile.am create mode 100644 filters/ddrescue/Makefile.in create mode 100644 filters/ddrescue/ddrescue.c create mode 100644 filters/ddrescue/nbdkit-ddrescue-filter.pod create mode 100644 filters/delay/Makefile.am create mode 100644 filters/delay/Makefile.in create mode 100644 filters/delay/delay.c create mode 100644 filters/delay/nbdkit-delay-filter.pod create mode 100644 filters/error/Makefile.am create mode 100644 filters/error/Makefile.in create mode 100644 filters/error/error.c create mode 100644 filters/error/nbdkit-error-filter.pod create mode 100644 filters/evil/Makefile.am create mode 100644 filters/evil/Makefile.in create mode 100644 filters/evil/evil.c create mode 100644 filters/evil/nbdkit-evil-filter.pod create mode 100644 filters/exitlast/Makefile.am create mode 100644 filters/exitlast/Makefile.in create mode 100644 filters/exitlast/exitlast.c create mode 100644 filters/exitlast/nbdkit-exitlast-filter.pod create mode 100644 filters/exitwhen/Makefile.am create mode 100644 filters/exitwhen/Makefile.in create mode 100644 filters/exitwhen/exitwhen.c create mode 100644 filters/exitwhen/nbdkit-exitwhen-filter.pod create mode 100644 filters/exportname/Makefile.am create mode 100644 filters/exportname/Makefile.in create mode 100644 filters/exportname/exportname.c create mode 100644 filters/exportname/nbdkit-exportname-filter.pod create mode 100644 filters/ext2/Makefile.am create mode 100644 filters/ext2/Makefile.in create mode 100644 filters/ext2/ext2.c create mode 100644 filters/ext2/io.c create mode 100644 filters/ext2/io.h create mode 100644 filters/ext2/nbdkit-ext2-filter.pod create mode 100644 filters/extentlist/Makefile.am create mode 100644 filters/extentlist/Makefile.in create mode 100644 filters/extentlist/extentlist.c create mode 100644 filters/extentlist/nbdkit-extentlist-filter.pod create mode 100644 filters/filters.syms create mode 100644 filters/fua/Makefile.am create mode 100644 filters/fua/Makefile.in create mode 100644 filters/fua/fua.c create mode 100644 filters/fua/nbdkit-fua-filter.pod create mode 100644 filters/gzip/Makefile.am create mode 100644 filters/gzip/Makefile.in create mode 100644 filters/gzip/gzip.c create mode 100644 filters/gzip/nbdkit-gzip-filter.pod create mode 100644 filters/ip/Makefile.am create mode 100644 filters/ip/Makefile.in create mode 100644 filters/ip/ip.c create mode 100644 filters/ip/nbdkit-ip-filter.pod create mode 100644 filters/limit/Makefile.am create mode 100644 filters/limit/Makefile.in create mode 100644 filters/limit/limit.c create mode 100644 filters/limit/nbdkit-limit-filter.pod create mode 100644 filters/log/Makefile.am create mode 100644 filters/log/Makefile.in create mode 100644 filters/log/log.c create mode 100644 filters/log/log.h create mode 100644 filters/log/nbdkit-log-filter.pod create mode 100644 filters/log/output.c create mode 100644 filters/luks/Makefile.am create mode 100644 filters/luks/Makefile.in create mode 100644 filters/luks/luks-encryption.c create mode 100644 filters/luks/luks-encryption.h create mode 100644 filters/luks/luks.c create mode 100644 filters/luks/nbdkit-luks-filter.pod create mode 100644 filters/multi-conn/Makefile.am create mode 100644 filters/multi-conn/Makefile.in create mode 100644 filters/multi-conn/multi-conn.c create mode 100644 filters/multi-conn/nbdkit-multi-conn-filter.pod create mode 100644 filters/nocache/Makefile.am create mode 100644 filters/nocache/Makefile.in create mode 100644 filters/nocache/nbdkit-nocache-filter.pod create mode 100644 filters/nocache/nocache.c create mode 100644 filters/noextents/Makefile.am create mode 100644 filters/noextents/Makefile.in create mode 100644 filters/noextents/nbdkit-noextents-filter.pod create mode 100644 filters/noextents/noextents.c create mode 100644 filters/nofilter/Makefile.am create mode 100644 filters/nofilter/Makefile.in create mode 100644 filters/nofilter/nbdkit-nofilter-filter.pod create mode 100644 filters/nofilter/nofilter.c create mode 100644 filters/noparallel/Makefile.am create mode 100644 filters/noparallel/Makefile.in create mode 100644 filters/noparallel/nbdkit-noparallel-filter.pod create mode 100644 filters/noparallel/noparallel.c create mode 100644 filters/nozero/Makefile.am create mode 100644 filters/nozero/Makefile.in create mode 100644 filters/nozero/nbdkit-nozero-filter.pod create mode 100644 filters/nozero/nozero.c create mode 100644 filters/offset/Makefile.am create mode 100644 filters/offset/Makefile.in create mode 100644 filters/offset/nbdkit-offset-filter.pod create mode 100644 filters/offset/offset.c create mode 100644 filters/partition/Makefile.am create mode 100644 filters/partition/Makefile.in create mode 100644 filters/partition/nbdkit-partition-filter.pod create mode 100644 filters/partition/partition-gpt.c create mode 100644 filters/partition/partition-mbr.c create mode 100644 filters/partition/partition.c create mode 100644 filters/partition/partition.h create mode 100644 filters/pause/Makefile.am create mode 100644 filters/pause/Makefile.in create mode 100644 filters/pause/nbdkit-pause-filter.pod create mode 100644 filters/pause/pause.c create mode 100644 filters/protect/Makefile.am create mode 100644 filters/protect/Makefile.in create mode 100644 filters/protect/nbdkit-protect-filter.pod create mode 100644 filters/protect/protect.c create mode 100644 filters/qcow2dec/Makefile.am create mode 100644 filters/qcow2dec/Makefile.in create mode 100644 filters/qcow2dec/nbdkit-qcow2dec-filter.pod create mode 100644 filters/qcow2dec/qcow2.h create mode 100644 filters/qcow2dec/qcow2dec.c create mode 100644 filters/rate/Makefile.am create mode 100644 filters/rate/Makefile.in create mode 100644 filters/rate/bucket.c create mode 100644 filters/rate/bucket.h create mode 100644 filters/rate/nbdkit-rate-filter.pod create mode 100644 filters/rate/rate.c create mode 100644 filters/readahead/Makefile.am create mode 100644 filters/readahead/Makefile.in create mode 100644 filters/readahead/bgthread.c create mode 100644 filters/readahead/nbdkit-readahead-filter.pod create mode 100644 filters/readahead/readahead.c create mode 100644 filters/readahead/readahead.h create mode 100644 filters/retry-request/Makefile.am create mode 100644 filters/retry-request/Makefile.in create mode 100644 filters/retry-request/nbdkit-retry-request-filter.pod create mode 100644 filters/retry-request/retry-request.c create mode 100644 filters/retry/Makefile.am create mode 100644 filters/retry/Makefile.in create mode 100644 filters/retry/nbdkit-retry-filter.pod create mode 100644 filters/retry/retry.c create mode 100644 filters/scan/Makefile.am create mode 100644 filters/scan/Makefile.in create mode 100644 filters/scan/bgthread.c create mode 100644 filters/scan/nbdkit-scan-filter.pod create mode 100644 filters/scan/scan.c create mode 100644 filters/scan/scan.h create mode 100644 filters/stats/Makefile.am create mode 100644 filters/stats/Makefile.in create mode 100644 filters/stats/nbdkit-stats-filter.pod create mode 100644 filters/stats/stats.cpp create mode 100644 filters/swab/Makefile.am create mode 100644 filters/swab/Makefile.in create mode 100644 filters/swab/nbdkit-swab-filter.pod create mode 100644 filters/swab/swab.c create mode 100644 filters/tar/Makefile.am create mode 100644 filters/tar/Makefile.in create mode 100644 filters/tar/nbdkit-tar-filter.pod create mode 100644 filters/tar/tar.c create mode 100644 filters/tls-fallback/Makefile.am create mode 100644 filters/tls-fallback/Makefile.in create mode 100644 filters/tls-fallback/nbdkit-tls-fallback-filter.pod create mode 100644 filters/tls-fallback/tls-fallback.c create mode 100644 filters/truncate/Makefile.am create mode 100644 filters/truncate/Makefile.in create mode 100644 filters/truncate/nbdkit-truncate-filter.pod create mode 100644 filters/truncate/truncate.c create mode 100644 filters/xz/Makefile.am create mode 100644 filters/xz/Makefile.in create mode 100644 filters/xz/blkcache.c create mode 100644 filters/xz/blkcache.h create mode 100644 filters/xz/nbdkit-xz-filter.pod create mode 100644 filters/xz/xz.c create mode 100644 filters/xz/xzfile.c create mode 100644 filters/xz/xzfile.h create mode 100644 fuzzing/Makefile.am create mode 100644 fuzzing/Makefile.in create mode 100644 fuzzing/README create mode 100644 fuzzing/testcase_dir/newstyle-cflags create mode 100644 fuzzing/testcase_dir/newstyle-cflags-exportname create mode 100644 fuzzing/testcase_dir/newstyle-cflags-exportname-read4 create mode 100644 fuzzing/testcase_dir/newstyle-cflags-go create mode 100644 fuzzing/testcase_dir/newstyle-cflags-go-read create mode 100644 fuzzing/testcase_dir/newstyle-cflags-go-read4 create mode 100644 fuzzing/testcase_dir/newstyle-cflags-go-write create mode 100644 html/pod.css create mode 100644 include/Makefile.am create mode 100644 include/Makefile.in create mode 100644 include/nbdkit-common.h create mode 100644 include/nbdkit-filter.h create mode 100644 include/nbdkit-plugin.h create mode 100644 include/nbdkit-version.h create mode 100644 include/nbdkit-version.h.in create mode 100755 install-sh create mode 100644 ltmain.sh create mode 100644 m4/.gitignore create mode 100644 m4/ax_pthread.m4 create mode 100644 m4/libtool.m4 create mode 100644 m4/ltoptions.m4 create mode 100644 m4/ltsugar.m4 create mode 100644 m4/ltversion.m4 create mode 100644 m4/lt~obsolete.m4 create mode 100644 m4/ocaml.m4 create mode 100755 missing create mode 100644 plugins/Makefile.am create mode 100644 plugins/Makefile.in create mode 100644 plugins/S3/Makefile.am create mode 100644 plugins/S3/Makefile.in create mode 100755 plugins/S3/S3.py create mode 100644 plugins/S3/nbdkit-S3-plugin.pod create mode 100644 plugins/S3/nbdkit.py create mode 100644 plugins/blkio/Makefile.am create mode 100644 plugins/blkio/Makefile.in create mode 100644 plugins/blkio/blkio.c create mode 100644 plugins/blkio/nbdkit-blkio-plugin.pod create mode 100644 plugins/cc/Makefile.am create mode 100644 plugins/cc/Makefile.in create mode 100644 plugins/cc/cc.c create mode 100644 plugins/cc/nbdkit-cc-plugin.pod create mode 100644 plugins/cdi/Makefile.am create mode 100644 plugins/cdi/Makefile.in create mode 100644 plugins/cdi/cdi.c create mode 100644 plugins/cdi/nbdkit-cdi-plugin.pod create mode 100644 plugins/curl/Makefile.am create mode 100644 plugins/curl/Makefile.in create mode 100644 plugins/curl/config.c create mode 100644 plugins/curl/curl.c create mode 100644 plugins/curl/curldefs.h create mode 100644 plugins/curl/nbdkit-curl-plugin.pod create mode 100644 plugins/curl/scripts.c create mode 100644 plugins/curl/times.c create mode 100644 plugins/curl/worker.c create mode 100644 plugins/data/Makefile.am create mode 100644 plugins/data/Makefile.in create mode 100644 plugins/data/data.c create mode 100644 plugins/data/data.h create mode 100755 plugins/data/disk2data.pl create mode 100644 plugins/data/format.c create mode 100644 plugins/data/format.h create mode 100644 plugins/data/nbdkit-data-plugin.pod create mode 100644 plugins/eval/Makefile.am create mode 100644 plugins/eval/Makefile.in create mode 100644 plugins/eval/call.c create mode 100644 plugins/eval/eval.c create mode 100644 plugins/eval/methods.c create mode 100644 plugins/eval/nbdkit-eval-plugin.pod create mode 100644 plugins/example1/Makefile.am create mode 100644 plugins/example1/Makefile.in create mode 100644 plugins/example1/example1.c create mode 100644 plugins/example1/nbdkit-example1-plugin.pod create mode 100644 plugins/example2/Makefile.am create mode 100644 plugins/example2/Makefile.in create mode 100644 plugins/example2/example2.c create mode 100644 plugins/example2/nbdkit-example2-plugin.pod create mode 100644 plugins/example2/winexample2.c create mode 100644 plugins/example3/Makefile.am create mode 100644 plugins/example3/Makefile.in create mode 100644 plugins/example3/example3.c create mode 100644 plugins/example3/nbdkit-example3-plugin.pod create mode 100644 plugins/example4/Makefile.am create mode 100644 plugins/example4/Makefile.in create mode 100644 plugins/example4/example4.pl create mode 100644 plugins/file/Makefile.am create mode 100644 plugins/file/Makefile.in create mode 100644 plugins/file/file.c create mode 100644 plugins/file/nbdkit-file-plugin.pod create mode 100644 plugins/file/winfile.c create mode 100644 plugins/floppy/Makefile.am create mode 100644 plugins/floppy/Makefile.in create mode 100644 plugins/floppy/directory-lfn.c create mode 100644 plugins/floppy/floppy.c create mode 100644 plugins/floppy/nbdkit-floppy-plugin.pod create mode 100644 plugins/floppy/virtual-floppy.c create mode 100644 plugins/floppy/virtual-floppy.h create mode 100644 plugins/full/Makefile.am create mode 100644 plugins/full/Makefile.in create mode 100644 plugins/full/full.c create mode 100644 plugins/full/nbdkit-full-plugin.pod create mode 100644 plugins/golang/Makefile.am create mode 100644 plugins/golang/Makefile.in create mode 100644 plugins/golang/config-test.go create mode 100755 plugins/golang/dump-plugin-examples.sh create mode 100644 plugins/golang/examples/disk/disk.go create mode 100644 plugins/golang/examples/disk/go.mod create mode 100644 plugins/golang/examples/dump-plugin/dumpplugin.go create mode 100644 plugins/golang/examples/dump-plugin/go.mod create mode 100644 plugins/golang/examples/minimal/go.mod create mode 100644 plugins/golang/examples/minimal/minimal.go create mode 100644 plugins/golang/examples/ramdisk/go.mod create mode 100644 plugins/golang/examples/ramdisk/ramdisk.go create mode 100644 plugins/golang/nbdkit-golang-plugin.pod create mode 100644 plugins/golang/src/libguestfs.org/nbdkit/go.mod create mode 100644 plugins/golang/src/libguestfs.org/nbdkit/nbdkit.go create mode 100644 plugins/golang/src/libguestfs.org/nbdkit/utils.go create mode 100644 plugins/golang/src/libguestfs.org/nbdkit/wrappers.go create mode 100644 plugins/golang/src/libguestfs.org/nbdkit/wrappers.h create mode 100644 plugins/guestfs/Makefile.am create mode 100644 plugins/guestfs/Makefile.in create mode 100644 plugins/guestfs/guestfs-plugin.c create mode 100644 plugins/guestfs/nbdkit-guestfs-plugin.pod create mode 100644 plugins/info/Makefile.am create mode 100644 plugins/info/Makefile.in create mode 100644 plugins/info/info.c create mode 100644 plugins/info/nbdkit-info-plugin.pod create mode 100644 plugins/iso/Makefile.am create mode 100644 plugins/iso/Makefile.in create mode 100644 plugins/iso/iso.c create mode 100644 plugins/iso/nbdkit-iso-plugin.pod create mode 100644 plugins/libvirt/Makefile.am create mode 100644 plugins/libvirt/Makefile.in create mode 100644 plugins/libvirt/libvirt-plugin.c create mode 100644 plugins/libvirt/nbdkit-libvirt-plugin.pod create mode 100644 plugins/linuxdisk/Makefile.am create mode 100644 plugins/linuxdisk/Makefile.in create mode 100644 plugins/linuxdisk/filesystem.c create mode 100644 plugins/linuxdisk/linuxdisk.c create mode 100644 plugins/linuxdisk/nbdkit-linuxdisk-plugin.pod create mode 100644 plugins/linuxdisk/partition-gpt.c create mode 100644 plugins/linuxdisk/subdir/.gitignore create mode 100644 plugins/linuxdisk/virtual-disk.c create mode 100644 plugins/linuxdisk/virtual-disk.h create mode 100644 plugins/lua/Makefile.am create mode 100644 plugins/lua/Makefile.in create mode 100644 plugins/lua/example.lua create mode 100644 plugins/lua/lua.c create mode 100644 plugins/lua/nbdkit-lua-plugin.pod create mode 100644 plugins/memory/Makefile.am create mode 100644 plugins/memory/Makefile.in create mode 100644 plugins/memory/memory.c create mode 100644 plugins/memory/nbdkit-memory-plugin.pod create mode 100644 plugins/nbd/Makefile.am create mode 100644 plugins/nbd/Makefile.in create mode 100644 plugins/nbd/nbd.c create mode 100644 plugins/nbd/nbdkit-nbd-plugin.pod create mode 100644 plugins/null/Makefile.am create mode 100644 plugins/null/Makefile.in create mode 100644 plugins/null/nbdkit-null-plugin.pod create mode 100644 plugins/null/null.c create mode 100644 plugins/ocaml/Makefile.am create mode 100644 plugins/ocaml/Makefile.in create mode 100644 plugins/ocaml/NBDKit.ml create mode 100644 plugins/ocaml/NBDKit.mli create mode 100644 plugins/ocaml/bindings.c create mode 100644 plugins/ocaml/callbacks.h create mode 100644 plugins/ocaml/example.ml create mode 100644 plugins/ocaml/nbdkit-ocaml-plugin.pod create mode 100644 plugins/ocaml/plugin.c create mode 100644 plugins/ocaml/plugin.h create mode 100644 plugins/ondemand/Makefile.am create mode 100644 plugins/ondemand/Makefile.in create mode 100644 plugins/ondemand/default-command.c create mode 100644 plugins/ondemand/default-command.sh.in create mode 100644 plugins/ondemand/nbdkit-ondemand-plugin.pod create mode 100644 plugins/ondemand/ondemand.c create mode 100644 plugins/ones/Makefile.am create mode 100644 plugins/ones/Makefile.in create mode 100644 plugins/ones/nbdkit-ones-plugin.pod create mode 100644 plugins/ones/ones.c create mode 100644 plugins/partitioning/Makefile.am create mode 100644 plugins/partitioning/Makefile.in create mode 100644 plugins/partitioning/nbdkit-partitioning-plugin.pod create mode 100644 plugins/partitioning/partition-gpt.c create mode 100644 plugins/partitioning/partition-mbr.c create mode 100644 plugins/partitioning/partitioning.c create mode 100644 plugins/partitioning/virtual-disk.c create mode 100644 plugins/partitioning/virtual-disk.h create mode 100644 plugins/pattern/Makefile.am create mode 100644 plugins/pattern/Makefile.in create mode 100644 plugins/pattern/nbdkit-pattern-plugin.pod create mode 100644 plugins/pattern/pattern.c create mode 100644 plugins/perl/Makefile.am create mode 100644 plugins/perl/Makefile.in create mode 100644 plugins/perl/example.pl create mode 100644 plugins/perl/nbdkit-perl-plugin.pod create mode 100644 plugins/perl/perl.c create mode 100644 plugins/plugins.syms create mode 100644 plugins/python/Makefile.am create mode 100644 plugins/python/Makefile.in create mode 100644 plugins/python/errors.c create mode 100644 plugins/python/examples/error.py create mode 100644 plugins/python/examples/file.py create mode 100644 plugins/python/examples/imageio.py create mode 100644 plugins/python/examples/ramdisk.py create mode 100644 plugins/python/examples/url.py create mode 100644 plugins/python/helpers.c create mode 100644 plugins/python/modfunctions.c create mode 100644 plugins/python/nbdkit-python-plugin.pod create mode 100644 plugins/python/plugin.c create mode 100644 plugins/python/plugin.h create mode 100644 plugins/random/Makefile.am create mode 100644 plugins/random/Makefile.in create mode 100644 plugins/random/nbdkit-random-plugin.pod create mode 100644 plugins/random/random.c create mode 100644 plugins/ruby/Makefile.am create mode 100644 plugins/ruby/Makefile.in create mode 100644 plugins/ruby/example.rb create mode 100644 plugins/ruby/nbdkit-ruby-plugin.pod create mode 100644 plugins/ruby/ruby.c create mode 100644 plugins/rust/CHANGELOG.md create mode 100644 plugins/rust/Cargo.lock.msrv create mode 100644 plugins/rust/Cargo.toml create mode 100644 plugins/rust/LICENSE create mode 100644 plugins/rust/Makefile.am create mode 100644 plugins/rust/Makefile.in create mode 100644 plugins/rust/README.md create mode 100644 plugins/rust/examples/ramdisk.rs create mode 100644 plugins/rust/nbdkit-rust-plugin.pod create mode 100755 plugins/rust/run-cargo-tests.sh create mode 100644 plugins/rust/src/lib.rs create mode 100755 plugins/rust/test-ramdisk.sh create mode 100644 plugins/rust/tests/bare_bones.rs create mode 100644 plugins/rust/tests/common/mod.rs create mode 100644 plugins/rust/tests/full_featured.rs create mode 100644 plugins/sh/Makefile.am create mode 100644 plugins/sh/Makefile.in create mode 100755 plugins/sh/assemble.sh create mode 100644 plugins/sh/call.c create mode 100644 plugins/sh/call.h create mode 100755 plugins/sh/example.sh create mode 100644 plugins/sh/methods.c create mode 100644 plugins/sh/methods.h create mode 100644 plugins/sh/nbdkit-sh-plugin.pod create mode 100644 plugins/sh/sh.c create mode 100644 plugins/sparse-random/Makefile.am create mode 100644 plugins/sparse-random/Makefile.in create mode 100644 plugins/sparse-random/nbdkit-sparse-random-plugin.pod create mode 100644 plugins/sparse-random/sparse-random.c create mode 100644 plugins/split/Makefile.am create mode 100644 plugins/split/Makefile.in create mode 100644 plugins/split/nbdkit-split-plugin.pod create mode 100644 plugins/split/split.c create mode 100644 plugins/ssh/Makefile.am create mode 100644 plugins/ssh/Makefile.in create mode 100644 plugins/ssh/nbdkit-ssh-plugin.pod create mode 100644 plugins/ssh/ssh.c create mode 100644 plugins/tcl/Makefile.am create mode 100644 plugins/tcl/Makefile.in create mode 100644 plugins/tcl/example.tcl create mode 100644 plugins/tcl/nbdkit-tcl-plugin.pod create mode 100644 plugins/tcl/tcl.c create mode 100644 plugins/tmpdisk/Makefile.am create mode 100644 plugins/tmpdisk/Makefile.in create mode 100644 plugins/tmpdisk/default-command.c create mode 100644 plugins/tmpdisk/default-command.sh.in create mode 100644 plugins/tmpdisk/nbdkit-tmpdisk-plugin.pod create mode 100644 plugins/tmpdisk/tmpdisk.c create mode 100644 plugins/torrent/Makefile.am create mode 100644 plugins/torrent/Makefile.in create mode 100644 plugins/torrent/nbdkit-torrent-plugin.pod create mode 100644 plugins/torrent/torrent.cpp create mode 100644 plugins/vddk/Makefile.am create mode 100644 plugins/vddk/Makefile.in create mode 100644 plugins/vddk/README.VDDK create mode 100644 plugins/vddk/nbdkit-vddk-plugin.pod create mode 100644 plugins/vddk/reexec.c create mode 100644 plugins/vddk/stats.c create mode 100644 plugins/vddk/utils.c create mode 100644 plugins/vddk/vddk-structs.h create mode 100644 plugins/vddk/vddk-stubs.h create mode 100644 plugins/vddk/vddk.c create mode 100644 plugins/vddk/vddk.h create mode 100644 plugins/vddk/worker.c create mode 100644 plugins/zero/Makefile.am create mode 100644 plugins/zero/Makefile.in create mode 100644 plugins/zero/nbdkit-zero-plugin.pod create mode 100644 plugins/zero/zero.c create mode 100755 podwrapper.pl.in create mode 100644 scripts/git.orderfile create mode 100644 server/Makefile.am create mode 100644 server/Makefile.in create mode 100644 server/backend.c create mode 100644 server/background.c create mode 100644 server/captive.c create mode 100644 server/connections.c create mode 100644 server/crypto.c create mode 100644 server/debug-flags.c create mode 100644 server/debug.c create mode 100644 server/exports.c create mode 100644 server/extents.c create mode 100644 server/filters.c create mode 100644 server/fuzzer.c create mode 100644 server/internal.h create mode 100644 server/local/nbdkit.pc.in create mode 100644 server/locks.c create mode 100644 server/log-stderr.c create mode 100644 server/log-syslog.c create mode 100644 server/log.c create mode 100644 server/main.c create mode 100644 server/nbdkit.pc.in create mode 100644 server/nbdkit.syms create mode 100644 server/options.h create mode 100644 server/plugins.c create mode 100644 server/protocol-handshake-newstyle.c create mode 100644 server/protocol-handshake-oldstyle.c create mode 100644 server/protocol-handshake.c create mode 100644 server/protocol.c create mode 100644 server/public.c create mode 100644 server/quit.c create mode 100644 server/signals.c create mode 100644 server/socket-activation.c create mode 100644 server/sockets.c create mode 100644 server/synopsis.c create mode 100644 server/test-public.c create mode 100644 server/threadlocal.c create mode 100644 server/usergroup.c create mode 100644 server/vfprintf.c create mode 100755 test-driver create mode 100644 tests/Makefile.am create mode 100644 tests/Makefile.in create mode 100644 tests/README.tests create mode 100755 tests/cc-shebang.c create mode 100755 tests/cc_shebang.ml create mode 100644 tests/dummy-vddk.c create mode 100644 tests/functions.sh.in create mode 100755 tests/generate-file-data.sh create mode 100755 tests/make-pki.sh create mode 100644 tests/make-pki.sh.in create mode 100755 tests/make-psk.sh create mode 100644 tests/old-plugins/README create mode 100755 tests/old-plugins/i686/Linux/v1.0.0/nbdkit-file-plugin.so create mode 100755 tests/old-plugins/i686/Linux/v1.12.8-2-g1e2ccc27/nbdkit-file-plugin.so create mode 100755 tests/old-plugins/i686/Linux/v1.18.4/nbdkit-file-plugin.so create mode 100755 tests/old-plugins/i686/Linux/v1.2.8-3-g0560f8f/nbdkit-file-plugin.so create mode 100755 tests/old-plugins/i686/Linux/v1.8.4-3-g11f5a90d/nbdkit-file-plugin.so create mode 100755 tests/old-plugins/x86_64/Linux/v1.0.0/nbdkit-file-plugin.so create mode 100755 tests/old-plugins/x86_64/Linux/v1.12.8/nbdkit-file-plugin.so create mode 100755 tests/old-plugins/x86_64/Linux/v1.18.2/nbdkit-file-plugin.so create mode 100755 tests/old-plugins/x86_64/Linux/v1.2.8/nbdkit-file-plugin.so create mode 100755 tests/old-plugins/x86_64/Linux/v1.8.4/nbdkit-file-plugin.so create mode 100755 tests/pycodestyle.sh create mode 100644 tests/python-exception.py create mode 100644 tests/python-export-list.py create mode 100644 tests/python-export-name.py create mode 100644 tests/python-thread-model.py create mode 100755 tests/shebang.pl create mode 100755 tests/shebang.py create mode 100755 tests/shebang.rb create mode 100755 tests/test-S3-unit.sh create mode 100755 tests/test-S3.sh create mode 100644 tests/test-S3/boto3/__init__.py create mode 100644 tests/test-S3/botocore/exceptions.py create mode 100644 tests/test-ansi-c-plugin.c create mode 100755 tests/test-ansi-c.sh create mode 100755 tests/test-binary.sh create mode 100755 tests/test-blkio.sh create mode 100755 tests/test-block-size-constraints.sh create mode 100755 tests/test-blocksize-default.sh create mode 100755 tests/test-blocksize-error-policy.sh create mode 100755 tests/test-blocksize-extents.sh create mode 100755 tests/test-blocksize-policy.sh create mode 100755 tests/test-blocksize-sharding.sh create mode 100755 tests/test-blocksize-write-disconnect.sh create mode 100755 tests/test-blocksize.sh create mode 100755 tests/test-cache-block-size.sh create mode 100755 tests/test-cache-max-size.sh create mode 100755 tests/test-cache-on-read-caches.sh create mode 100755 tests/test-cache-on-read.sh create mode 100755 tests/test-cache-unaligned.sh create mode 100755 tests/test-cache.sh create mode 100755 tests/test-cacheextents.sh create mode 100755 tests/test-captive-tls.sh create mode 100755 tests/test-captive.sh create mode 100644 tests/test-cc-cpp.cpp create mode 100755 tests/test-cc-cpp.sh create mode 100755 tests/test-cc-ocaml.sh create mode 100755 tests/test-cc.sh create mode 100755 tests/test-cdi.sh create mode 100755 tests/test-checkwrite-bounds.sh create mode 100755 tests/test-checkwrite-fail.sh create mode 100755 tests/test-checkwrite.sh create mode 100755 tests/test-client-death-tls.sh create mode 100755 tests/test-client-death.sh create mode 100644 tests/test-connect.c create mode 100755 tests/test-cow-block-size.sh create mode 100755 tests/test-cow-extents-large.sh create mode 100755 tests/test-cow-extents1.sh create mode 100755 tests/test-cow-extents2.sh create mode 100755 tests/test-cow-null.sh create mode 100755 tests/test-cow-on-read-caches.sh create mode 100755 tests/test-cow-on-read.sh create mode 100755 tests/test-cow-unaligned.sh create mode 100755 tests/test-cow.sh create mode 100644 tests/test-curl-cookie-script.c create mode 100644 tests/test-curl-head-forbidden.c create mode 100755 tests/test-curl-header-script-fail.script create mode 100755 tests/test-curl-header-script-fail.sh create mode 100644 tests/test-curl-header-script.c create mode 100755 tests/test-curl-options.sh create mode 100644 tests/test-curl.c create mode 100644 tests/test-cxx-filter.cpp create mode 100644 tests/test-cxx-plugin.cpp create mode 100755 tests/test-cxx.sh create mode 100755 tests/test-data-64b.sh create mode 100755 tests/test-data-7E.sh create mode 100755 tests/test-data-bad.sh create mode 100755 tests/test-data-base64.sh create mode 100755 tests/test-data-extents.sh create mode 100755 tests/test-data-file.sh create mode 100755 tests/test-data-format.sh create mode 100755 tests/test-data-optimum.sh create mode 100755 tests/test-data-partition.sh create mode 100755 tests/test-data-random-slice.sh create mode 100755 tests/test-data-random-slice2.sh create mode 100755 tests/test-data-raw-copy.sh create mode 100755 tests/test-data-raw.sh create mode 100755 tests/test-data-reloffset.sh create mode 100755 tests/test-data-sectors.sh create mode 100755 tests/test-data-size.sh create mode 100644 tests/test-data.c create mode 100755 tests/test-ddrescue-filter.sh create mode 100755 tests/test-debug-flags.sh create mode 100755 tests/test-delay-close.sh create mode 100755 tests/test-delay-open.sh create mode 100755 tests/test-delay-shutdown.sh create mode 100644 tests/test-delay.c create mode 100644 tests/test-disconnect-plugin.c create mode 100755 tests/test-disconnect-tls.sh create mode 100755 tests/test-disconnect.sh create mode 100755 tests/test-disk2data.sh create mode 100755 tests/test-dump-config-major-1.sh create mode 100755 tests/test-dump-config-version-major-minor.sh create mode 100755 tests/test-dump-config.sh create mode 100755 tests/test-dump-plugin-and-single.sh create mode 100755 tests/test-dump-plugin-example1.sh create mode 100755 tests/test-dump-plugin-example2.sh create mode 100755 tests/test-dump-plugin-example4.sh create mode 100755 tests/test-dump-plugin-filter.sh create mode 100755 tests/test-dump-plugin-name.sh create mode 100755 tests/test-dump-plugin-thread-model.sh create mode 100755 tests/test-dump-plugin.sh create mode 100755 tests/test-eflags.sh create mode 100755 tests/test-error-triggered.sh create mode 100755 tests/test-error0.sh create mode 100755 tests/test-error10.sh create mode 100755 tests/test-error100.sh create mode 100755 tests/test-eval-cache.sh create mode 100755 tests/test-eval-disconnect.sh create mode 100755 tests/test-eval-dump-plugin.sh create mode 100755 tests/test-eval-exports.sh create mode 100755 tests/test-eval-file.sh create mode 100755 tests/test-eval.sh create mode 100755 tests/test-evil-cosmic.sh create mode 100755 tests/test-evil-large-p.sh create mode 100755 tests/test-evil-small-p.sh create mode 100755 tests/test-evil-stuck-high-bits.sh create mode 100755 tests/test-evil-stuck-low-bits.sh create mode 100755 tests/test-evil-stuck-wires.sh create mode 100644 tests/test-exit-with-parent.c create mode 100755 tests/test-exitlast.sh create mode 100755 tests/test-exitwhen-file-already-created.sh create mode 100755 tests/test-exitwhen-file-created-reject-new.sh create mode 100755 tests/test-exitwhen-file-created-when-idle.sh create mode 100755 tests/test-exitwhen-file-created.sh create mode 100755 tests/test-exitwhen-file-deleted.sh create mode 100644 tests/test-exitwhen-pipe-closed.c create mode 100755 tests/test-exitwhen-process-exits.sh create mode 100755 tests/test-exitwhen-script.sh create mode 100755 tests/test-export-info.sh create mode 100755 tests/test-export-name.sh create mode 100755 tests/test-exportname.sh create mode 100755 tests/test-ext2-exportname.sh create mode 100644 tests/test-ext2.c create mode 100755 tests/test-extentlist.sh create mode 100644 tests/test-file-block.c create mode 100755 tests/test-file-dir.sh create mode 100755 tests/test-file-dirfd.sh create mode 100755 tests/test-file-extents.sh create mode 100755 tests/test-file-fd.sh create mode 100755 tests/test-file-readonly.sh create mode 100755 tests/test-file.sh create mode 100755 tests/test-floppy-size.sh create mode 100755 tests/test-floppy.sh create mode 100644 tests/test-flush-plugin.c create mode 100755 tests/test-flush.sh create mode 100755 tests/test-foreground.sh create mode 100755 tests/test-fua.sh create mode 100755 tests/test-full.sh create mode 100644 tests/test-golang.c create mode 100644 tests/test-gzip-curl.c create mode 100644 tests/test-gzip.c create mode 100755 tests/test-help-example1.sh create mode 100755 tests/test-help-plugin.sh create mode 100755 tests/test-help.sh create mode 100755 tests/test-info-address.sh create mode 100755 tests/test-info-base64.sh create mode 100755 tests/test-info-conntime.sh create mode 100755 tests/test-info-raw.sh create mode 100755 tests/test-info-time.sh create mode 100755 tests/test-info-uptime.sh create mode 100755 tests/test-ip-filter-anyunix.sh create mode 100755 tests/test-ip-filter-anyvsock.sh create mode 100755 tests/test-ip-filter-gid.sh create mode 100755 tests/test-ip-filter-pid.sh create mode 100755 tests/test-ip-filter-security.sh create mode 100755 tests/test-ip-filter-uid.sh create mode 100755 tests/test-ip-filter.sh create mode 100755 tests/test-ipv4-lo.sh create mode 100755 tests/test-ipv6-lo.sh create mode 100755 tests/test-iso.sh create mode 100644 tests/test-just-filter-header.c create mode 100644 tests/test-just-plugin-header.c create mode 100644 tests/test-lang-plugins.c create mode 100644 tests/test-layers-filter.c create mode 100644 tests/test-layers-plugin.c create mode 100644 tests/test-layers.c create mode 100755 tests/test-layers.sh create mode 100755 tests/test-limit.sh create mode 100755 tests/test-linuxdisk-copy-out.sh create mode 100755 tests/test-linuxdisk.sh create mode 100755 tests/test-log-error.sh create mode 100755 tests/test-log-extents.sh create mode 100755 tests/test-log-script-info.sh create mode 100755 tests/test-log-script.sh create mode 100755 tests/test-log.sh create mode 100755 tests/test-long-name.sh create mode 100755 tests/test-long-options.sh create mode 100755 tests/test-luks-copy-zero.sh create mode 100755 tests/test-luks-copy.sh create mode 100755 tests/test-luks-info.sh create mode 100755 tests/test-manual.sh create mode 100755 tests/test-memory-allocator-malloc-mlock.sh create mode 100755 tests/test-memory-allocator-malloc.sh create mode 100755 tests/test-memory-largest-for-qemu.sh create mode 100755 tests/test-memory-largest.sh create mode 100644 tests/test-memory.c create mode 100755 tests/test-multi-conn-name.sh create mode 100755 tests/test-multi-conn-plugin.sh create mode 100755 tests/test-multi-conn.sh create mode 100755 tests/test-nbd-block-size.sh create mode 100755 tests/test-nbd-client-tls.sh create mode 100755 tests/test-nbd-client.sh create mode 100755 tests/test-nbd-dynamic-content.sh create mode 100755 tests/test-nbd-dynamic-list.sh create mode 100755 tests/test-nbd-extents.sh create mode 100755 tests/test-nbd-qcow2.sh create mode 100755 tests/test-nbd-tls-psk.sh create mode 100755 tests/test-nbd-tls.sh create mode 100755 tests/test-nbd-vsock.sh create mode 100644 tests/test-nbd.c create mode 100755 tests/test-nbdkit-backend-debug.sh create mode 100644 tests/test-newstyle.c create mode 100755 tests/test-nofilter.sh create mode 100755 tests/test-not-linked-to-libssl.sh create mode 100755 tests/test-nozero.sh create mode 100755 tests/test-null-extents.sh create mode 100644 tests/test-null.c create mode 100755 tests/test-ocaml-dump-plugin.sh create mode 100644 tests/test-ocaml-errorcodes.c create mode 100755 tests/test-ocaml-fork.sh create mode 100755 tests/test-ocaml-list-exports.sh create mode 100644 tests/test-ocaml.c create mode 100755 tests/test-offset-extents.sh create mode 100755 tests/test-offset-truncate.sh create mode 100644 tests/test-offset.c create mode 100755 tests/test-offset2.sh create mode 100755 tests/test-old-plugins.sh create mode 100644 tests/test-oldstyle.c create mode 100755 tests/test-ondemand-list.sh create mode 100755 tests/test-ondemand-locking.sh create mode 100755 tests/test-ondemand.sh create mode 100755 tests/test-ones.sh create mode 100755 tests/test-parallel-file.sh create mode 100755 tests/test-parallel-nbd.sh create mode 100755 tests/test-parallel-sh.sh create mode 100755 tests/test-partition-4k-gpt.sh create mode 100755 tests/test-partition-4k-mbr.sh create mode 100755 tests/test-partition1.sh create mode 100755 tests/test-partition2.sh create mode 100755 tests/test-partitioning1.sh create mode 100755 tests/test-partitioning2.sh create mode 100755 tests/test-partitioning3.sh create mode 100755 tests/test-partitioning4.sh create mode 100755 tests/test-partitioning5.sh create mode 100755 tests/test-partitioning6.sh create mode 100755 tests/test-pattern-largest-for-qemu.sh create mode 100755 tests/test-pattern-largest.sh create mode 100755 tests/test-pattern.sh create mode 100644 tests/test-pause.c create mode 100755 tests/test-plugin-docs.sh create mode 100755 tests/test-probe-filter-dump-plugin.sh create mode 100755 tests/test-probe-filter.sh create mode 100755 tests/test-probe-plugin.sh create mode 100755 tests/test-protect-ranges.sh create mode 100644 tests/test-protect.c create mode 100755 tests/test-python-exception.sh create mode 100755 tests/test-python-export-list.sh create mode 100755 tests/test-python-export-name.sh create mode 100644 tests/test-python-plugin.py create mode 100755 tests/test-python-thread-model.sh create mode 100755 tests/test-python.sh create mode 100755 tests/test-qcow2dec-map.sh create mode 100755 tests/test-qcow2dec.sh create mode 100755 tests/test-random-copy.sh create mode 100755 tests/test-random-sock.sh create mode 100644 tests/test-random.c create mode 100755 tests/test-rate-dynamic.sh create mode 100755 tests/test-rate.sh create mode 100755 tests/test-read-password-interactive.sh create mode 100755 tests/test-read-password-plugin.c create mode 100755 tests/test-read-password.sh create mode 100755 tests/test-readahead-copy.sh create mode 100755 tests/test-readahead.sh create mode 100755 tests/test-retry-extents.sh create mode 100755 tests/test-retry-open.sh create mode 100755 tests/test-retry-readonly.sh create mode 100755 tests/test-retry-reopen-fail.sh create mode 100644 tests/test-retry-request-mirror.c create mode 100755 tests/test-retry-request-open.sh create mode 100755 tests/test-retry-request.sh create mode 100755 tests/test-retry-size.sh create mode 100755 tests/test-retry-zero-flags.sh create mode 100755 tests/test-retry.sh create mode 100755 tests/test-scan-copy.sh create mode 100755 tests/test-scan-info.sh create mode 100755 tests/test-sh-errors.sh create mode 100755 tests/test-sh-extents.sh create mode 100755 tests/test-sh-pwrite-ignore-stdin.sh create mode 100755 tests/test-sh-tmpdir-leak.sh create mode 100755 tests/test-shebang-cc-ocaml.sh create mode 100755 tests/test-shebang-cc.sh create mode 100755 tests/test-shebang-perl.sh create mode 100755 tests/test-shebang-python.sh create mode 100755 tests/test-shebang-ruby.sh create mode 100755 tests/test-shell.sh create mode 100755 tests/test-short-options.sh create mode 100644 tests/test-shutdown-plugin.c create mode 100755 tests/test-shutdown.sh create mode 100755 tests/test-single-from-file.sh create mode 100755 tests/test-single-sh.sh create mode 100755 tests/test-single.sh create mode 100644 tests/test-socket-activation.c create mode 100755 tests/test-sparse-random-copy.sh create mode 100755 tests/test-sparse-random-info.sh create mode 100755 tests/test-split-extents.sh create mode 100644 tests/test-split.c create mode 100755 tests/test-ssh.sh create mode 100755 tests/test-start.sh create mode 100644 tests/test-stdio-plugin.c create mode 100755 tests/test-stdio.sh create mode 100755 tests/test-swab-16r.sh create mode 100755 tests/test-swab-16w.sh create mode 100755 tests/test-swab-32r.sh create mode 100755 tests/test-swab-32w.sh create mode 100755 tests/test-swab-64r.sh create mode 100755 tests/test-swab-64w.sh create mode 100755 tests/test-swab-8.sh create mode 100755 tests/test-swab-extents.sh create mode 100755 tests/test-swap.sh create mode 100755 tests/test-synopsis.sh create mode 100644 tests/test-tar-gzip-curl.c create mode 100755 tests/test-tar-info-xz-qcow2dec.sh create mode 100755 tests/test-tar-info-xz.sh create mode 100755 tests/test-tar-info.sh create mode 100755 tests/test-tar-limit.sh create mode 100644 tests/test-tar-xz-curl.c create mode 100755 tests/test-tar.sh create mode 100755 tests/test-tests-requires-nbdcopy.sh create mode 100755 tests/test-tests-requires-nbdinfo.sh create mode 100755 tests/test-tests-requires-nbdsh.sh create mode 100755 tests/test-tests-requires-run.sh create mode 100755 tests/test-tls-fallback.sh create mode 100755 tests/test-tls-psk.sh create mode 100755 tests/test-tls.sh create mode 100755 tests/test-tmpdisk-command.sh create mode 100644 tests/test-tmpdisk.c create mode 100755 tests/test-truncate-extents.sh create mode 100755 tests/test-truncate1.sh create mode 100755 tests/test-truncate2.sh create mode 100755 tests/test-truncate3.sh create mode 100755 tests/test-truncate4.sh create mode 100755 tests/test-vddk-dump-plugin.sh create mode 100755 tests/test-vddk-password-fd.sh create mode 100755 tests/test-vddk-password-interactive.sh create mode 100755 tests/test-vddk-real-create.sh create mode 100755 tests/test-vddk-real-dump-plugin.sh create mode 100755 tests/test-vddk-real.sh create mode 100755 tests/test-vddk-reexec.sh create mode 100755 tests/test-vddk-run.sh create mode 100644 tests/test-vddk.c create mode 100755 tests/test-verbose.sh create mode 100755 tests/test-version-example1.sh create mode 100755 tests/test-version-filter.sh create mode 100755 tests/test-version-plugin.sh create mode 100755 tests/test-version.sh create mode 100755 tests/test-vsock.sh create mode 100644 tests/test-xz-curl.c create mode 100644 tests/test-xz.c create mode 100755 tests/test-zero.sh create mode 100644 tests/test.c create mode 100644 tests/test.h create mode 100644 tests/test.lua create mode 100644 tests/test.pl create mode 100644 tests/test.rb create mode 100644 tests/test.tcl create mode 100644 tests/test_ocaml_errorcodes_plugin.ml create mode 100644 tests/test_ocaml_plugin.ml create mode 100755 tests/test_python.py create mode 100644 tests/web-server.c create mode 100644 tests/web-server.h create mode 100644 valgrind/Makefile.am create mode 100644 valgrind/Makefile.in create mode 100644 valgrind/ext2fs.suppressions create mode 100644 valgrind/glibc.suppressions create mode 100644 valgrind/gnutls.suppressions create mode 100644 valgrind/nbdkit.suppressions create mode 100644 valgrind/ocaml.suppressions create mode 100644 valgrind/perl.suppressions create mode 100644 valgrind/sh.suppressions create mode 100644 wrapper.c diff --git a/.dir-locals.el b/.dir-locals.el new file mode 100644 index 0000000..3c95379 --- /dev/null +++ b/.dir-locals.el @@ -0,0 +1,5 @@ +;;; Directory Local Variables +;;; For more information see (info "(emacs) Directory Variables") +((autoconf-mode . ((indent-tabs-mode . nil))) + (c-mode . ((indent-tabs-mode . nil) + (c-basic-offset . 2)))) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..04fdcd7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,172 @@ +*~ +*.bak +*.cmi +*.cmx +*.dll +*.exe +*.la +*.lo +*.log +*.o +*.trs + +.deps +.dirstamp +.gdb_history +.libs +Makefile +Makefile.in +__pycache__ + +/local* +/nbdkit-*.tar.gz +/nbdkit-*.tar.gz.sig +/nbdkit-*.*/ + +docs/*.1 +docs/*.3 +filters/*/*.1 +plugins/*/*.1 +plugins/*/*.3 + +.libs/*.so +/tests/*.so + +/aclocal.m4 +/autom4te.cache +/common/bitmap/test-bitmap +/common/include/test-array-size +/common/include/test-ascii-ctype +/common/include/test-ascii-string +/common/include/test-byte-swapping +/common/include/test-checked-overflow +/common/include/test-human-size +/common/include/test-isaligned +/common/include/test-ispowerof2 +/common/include/test-iszero +/common/include/test-minmax +/common/include/test-nextnonzero +/common/include/test-random +/common/include/test-tvdiff +/common/protocol/generate-protostrings.sh +/common/protocol/protostrings.c +/common/replacements/libcompat.a +/common/replacements/test-current-dir-name +/common/replacements/win32/MSG00001.bin +/common/replacements/win32/nbdkit-cat.h +/common/replacements/win32/nbdkit-cat.rc +/common/utils/test-quotes +/common/utils/test-vector +/common/utils/windows-errors.c +/compile +/config.cache +/config.guess +/config.h +/config.h.in +/config.log +/config.status +/config.sub +/configure +/contrib/sparseloadtest +/depcomp +/docs/filter-links.pod +/docs/lang-plugin-links.pod +/docs/plugin-links.pod +/fuzzing/sync_dir/ +/fuzzing/testcase_dir/[0-f]* +/html/*.html +/include/nbdkit-version.h +/INSTALL +/install-sh +/libtool +/ltmain.sh +/missing +/nbdkit +/plugins/example4/nbdkit-example4-plugin +/plugins/eval/call.c +/plugins/eval/methods.c +/plugins/golang/examples/*/nbdkit-*-plugin.h +/plugins/golang/examples/*/nbdkit-*-plugin.so +/plugins/ocaml/nbdkit-ocamlexample-plugin.so +/plugins/ondemand/default-command.c +/plugins/rust/Cargo.lock +/plugins/rust/target +/plugins/S3/nbdkit-S3-plugin +/plugins/tmpdisk/default-command.c +/podwrapper.pl +/server/libnbdkit.a +/server/local/nbdkit.pc +/server/nbdkit +/server/nbdkit.def +/server/nbdkit.pc +/server/synopsis.c +/server/test-public +/stamp-h1 +/tests/disk +/tests/disk.gz +/tests/disk.tar +/tests/disk.tar.gz +/tests/disk.tar.xz +/tests/disk.xz +/tests/ext2.img +/tests/file-data +/tests/functions.sh +/tests/keys.psk +/tests/make-pki.sh +/tests/nbdkit +/tests/partition-disk +/tests/pki +/tests/split1 +/tests/split2 +/tests/split3 +/tests/test-connect +/tests/test-curl +/tests/test-curl-cookie-script +/tests/test-curl-header-script +/tests/test-curl-head-forbidden +/tests/test-data +/tests/test-delay +/tests/test-exit-with-parent +/tests/test-exitwhen-pipe-closed +/tests/test-ext2 +/tests/test-file-block +/tests/test-golang +/tests/test-gzip +/tests/test-gzip-curl +/tests/test-just-filter-header +/tests/test-just-plugin-header +/tests/test-layers +/tests/test-lua +/tests/test-memory +/tests/test-memory-allocator-malloc +/tests/test-memory-allocator-zstd +/tests/test-newstyle +/tests/test-nbd +/tests/test-null +/tests/test-ocaml +/tests/test-ocaml-errorcodes +/tests/test-offset +/tests/test-oldstyle +/tests/test-old-plugins-*.sh +/tests/test-partition +/tests/test-pause +/tests/test-perl +/tests/test-protect +/tests/test-python +/tests/test-random +/tests/test-readahead +/tests/test-retry-request-mirror +/tests/test-ruby +/tests/test-shell +/tests/test-shell.img +/tests/test-socket-activation +/tests/test-split +/tests/test-tar-gzip-curl +/tests/test-tar-xz-curl +/tests/test-tcl +/tests/test-tmpdisk +/tests/test-vddk +/tests/test-xz +/tests/test-xz-curl +/test-driver +/valgrind/suppressions diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..a2c001f --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,9 @@ +{ + "C_Cpp.vcFormat.newLine.beforeOpenBrace.function": "newLine", + "C_Cpp.vcFormat.space.beforeFunctionOpenParenthesis": "insert", + "C_Cpp.vcFormat.space.pointerReferenceAlignment": "right", + "C_Cpp.formatting": "vcFormat", + "C_Cpp.vcFormat.indent.withinParentheses": "alignToParenthesis", + "python.linting.flake8Enabled": true, + "rewrap.wrappingColumn": 79 +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..27838bd --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,21 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "type": "process", + "label": "Build project", + "command": "/usr/bin/make", + "args": [], + "options": { + "cwd": "${workspaceFolder}" + }, + "problemMatcher": [ + "$gcc" + ], + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} \ No newline at end of file diff --git a/BENCHMARKING b/BENCHMARKING new file mode 100644 index 0000000..195cd73 --- /dev/null +++ b/BENCHMARKING @@ -0,0 +1,187 @@ +A GUIDE TO BENCHMARKING NBDKIT + + +General comments +================ + +* The plugin matters! Different plugins have completely different + uses, implementations and threading models. There is little point + in talking generically about “the performance of nbdkit” without + mentioning what plugin you are testing. + +* The client matters! Does the client support multi-conn? Does the + client use the oldstyle or newstyle protocol? Has the client been + written with performance in mind? The currently best clients are + (a) the Linux kernel (nbd.ko), (b) qemu, and (c) fio. Make sure you + are using recent versions and have multi-conn enabled. + +* Filters impair performance! When benchmarking you should never use + filters unless filters are what you are trying to benchmark. + + +Testing using fio +================= + +FIO is a Flexible I/O tester written by Jens Axboe, and it is the +primary tool used for generating the load to test filesystems and +block devices. + +(1) Install libnbd. + +(2) Clone and compile fio: + + https://github.com/axboe/fio + +using: + + ./configure --enable-libnbd + +(3) Edit the test file in examples/nbd.fio, if required. + +(4) Run nbdkit and fio together. From the fio source directory: + + rm -f /tmp/socket + nbdkit -f -U /tmp/socket null 1G --run './fio examples/nbd.fio' + +If you want to use nbdkit from the source directory too, change +‘nbdkit’ to the path of the wrapper, eg: + + rm -f /tmp/socket + ../nbdkit/nbdkit -f -U /tmp/socket null 1G --run './fio examples/nbd.fio' + + +Variations +---------- + +* Try adjusting the number of fio jobs (threads). + +* Try adjusting the number of nbdkit threads (nbdkit -t option). + +* Use other plugins. Both nbdkit-memory-plugin and nbdkit-file-plugin + are important ones to test. + +* Run nbdkit under perf: + + perf record -a -g --call-graph=dwarf -- \ + server/nbdkit -f -U /tmp/socket \ + ./plugins/null/.libs/nbdkit-null-plugin.so 1G + + +Testing using the Linux kernel client +===================================== + +Step (1) is the same as above - obtain or compile fio. + +(2) Create the fio configuation file. + +Create /var/tmp/test.fio containing: + +---------------------------------------------------------------------- +[test] +rw=randrw +size=64m +directory=/var/tmp/nbd +ioengine=libaio +iodepth=4 +direct=1 +numjobs=8 +group_reporting +time_based +runtime=120 +---------------------------------------------------------------------- + +(3) Run nbdkit. + +From the nbdkit source directory: + +rm -f /tmp/socket +./nbdkit -f -U /tmp/socket memory 1G + +(4) Loop mount the NBD server: + +modprobe nbd +nbd-client -C 8 -unix /tmp/socket /dev/nbd0 +mkfs.xfs -f /dev/nbd0 +mkdir /var/tmp/nbd +mount /dev/nbd0 /var/tmp/nbd + +(5) Run the fio test: + +fio /var/tmp/test.fio + + +Testing using qemu +================== + +Qemu contains an NBD client with excellent performance. However it's +not very useful for general benchmarking. But two tests you can +perform are described below. + + +Test linear copying performance +------------------------------- + +In some situations, linear copying is important, particularly when +copying large disk images or virtual machines around. Both nbdkit and +the qemu client support sparseness detection and efficient zeroing. + +To test copying speed you can use ‘qemu-img convert’, to or from +nbdkit: + + nbdkit memory 1G --run 'qemu-img convert file.qcow2 -O raw $nbd' + + nbdkit memory 1G --run 'qemu-img convert $nbd -O qcow2 file.qcow2' + +Notes: + + * In the second case, because the memory plugin is entirely sparse + and zero, the convert command should do almost no work. A more + realistic test might use the file, data or pattern plugins. + + * Try copying to and from remote sources like nbdkit-curl-plugin and + nbdkit-ssh-plugin. + + * nbdkit-readahead-filter can optimize copying when reading from + nbdkit. This filter can particularly affect performance when the + nbdkit plugin source is remote (eg. nbdkit-curl-plugin). + + * qemu-img has options for optimizing number of threads and whether + out of order writes are permitted. + +Test end-to-end VM block device performance +------------------------------------------- + +Set up a virtual machine using an NBD block device, connected to +nbdkit. On the qemu command line you would use: + + qemu ... -drive file=nbd:unix:/tmp/sock,if=virtio,format=raw ... + +In libvirt you would use: + + + + + + + + + + + +Set up nbdkit to serve on the Unix domain socket: + + nbdkit -U /tmp/sock memory 1G + +Inside the guest you will see a block device like /dev/vdX which is +backed by the nbdkit instance, and you can use fio or other filesystem +testing tools to evaluate performance. + +This is very much a real world, end-to-end test which tests many +different things together, including the client, guest kernel, qemu, +virtio transport, host kernel and nbdkit. So it's more useful as a +way to detect that there is a problem, rather than as a way to +identify which component is at fault. + +If you have sufficiently recent kernel and qemu you can try using +virtio-vsock as the transport (instead of a Unix domain socket), see +AF_VSOCK in nbdkit-service(1). diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f4e7951 --- /dev/null +++ b/LICENSE @@ -0,0 +1,30 @@ +nbdkit +Copyright Red Hat + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +* Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +* Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..a3a495f --- /dev/null +++ b/Makefile.am @@ -0,0 +1,153 @@ +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 $(top_srcdir)/common-rules.mk + +ACLOCAL_AMFLAGS = -I m4 + +EXTRA_DIST = \ + BENCHMARKING \ + .dir-locals.el \ + .gitignore \ + html/pod.css \ + LICENSE \ + m4/.gitignore \ + OTHER_PLUGINS \ + README.md \ + scripts/git.orderfile \ + SECURITY \ + .vscode/settings.json \ + .vscode/tasks.json \ + $(NULL) + +CLEANFILES += html/*.html scripts/*~ + +if !ENABLE_LIBFUZZER +# NB: This is not the real nbdkit binary. It's a wrapper that allows +# you to run nbdkit from the build directory before it is installed. +noinst_PROGRAMS = nbdkit +nbdkit_SOURCES = wrapper.c server/options.h +nbdkit_CPPFLAGS = \ + -I$(top_srcdir)/server \ + -I$(top_srcdir)/common/include \ + -I$(top_srcdir)/common/utils \ + -I$(top_srcdir)/common/replacements \ + -Dbuilddir=\"$(abs_top_builddir)\" \ + -Dsrcdir=\"$(abs_top_srcdir)\" \ + -DVALGRIND=\"$(VALGRIND)\" \ + $(NULL) +nbdkit_CFLAGS = $(WARNINGS_CFLAGS) +nbdkit_LDADD = \ + $(top_builddir)/common/utils/libutils.la \ + $(top_builddir)/common/replacements/libcompat.la \ + $(NULL) +EXTRA_nbdkit_DEPENDENCIES = config.status +endif !ENABLE_LIBFUZZER + +SUBDIRS = \ + bash-completion \ + docs \ + fuzzing \ + valgrind \ + include \ + common/include \ + common/protocol \ + common/replacements \ + common/utils \ + server \ + contrib + $(NULL) + +if HAVE_PLUGINS +SUBDIRS += \ + common/allocators \ + common/bitmap \ + common/gpt \ + common/regions \ + plugins \ + filters \ + $(NULL) +endif + +SUBDIRS += . tests + +check-valgrind: + $(MAKE) -C tests check-valgrind + +check-root: + $(MAKE) -C tests check-root + +check-vddk: + $(MAKE) -C tests check-vddk + +bench: all + @for d in common/utils; do \ + $(MAKE) -C $$d bench || exit 1; \ + done + +#---------------------------------------------------------------------- +# Maintainers only! + +# Check no files are missing from EXTRA_DIST rules, and that all +# generated files have been included in the tarball. (Note you must +# have done 'make dist') +maintainer-check-extra-dist: + @zcat $(PACKAGE_NAME)-$(VERSION).tar.gz | tar tf - | sort | \ + sed 's,^$(PACKAGE_NAME)-$(VERSION)/,,' > tarfiles + @git ls-files | \ + grep -v \ + -e '^\.cirrus.yml' \ + -e '^\.gitlab-ci.yml' \ + -e '^ci/' | \ + sort > gitfiles + @comm -13 tarfiles gitfiles > comm-out + @echo Checking for differences between EXTRA_DIST and git ... + @cat comm-out + @[ ! -s comm-out ] + @rm tarfiles gitfiles comm-out + @echo PASS: EXTRA_DIST tests + +# Commit everything in the current directory and set the commit +# message to the current version number. +maintainer-commit: + git commit -a -m "Version $(VERSION)." + +# Tag HEAD with the current version. +maintainer-tag: + git tag -a v$(VERSION) -m "Version $(VERSION)." -f + +# Run tests and display the time taken to run each test, which is +# useful for diagnosing slow-running tests. +# +# Try also setting LIBGUESTFS_BACKEND_SETTINGS=force_tcg which +# emulates what happens in Koji. +maintainer-check-times: + make check -j1 | ts -i diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..6c620b9 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,1222 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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@ +@ENABLE_LIBFUZZER_FALSE@noinst_PROGRAMS = nbdkit$(EXEEXT) +@HAVE_PLUGINS_TRUE@am__append_1 = \ +@HAVE_PLUGINS_TRUE@ common/allocators \ +@HAVE_PLUGINS_TRUE@ common/bitmap \ +@HAVE_PLUGINS_TRUE@ common/gpt \ +@HAVE_PLUGINS_TRUE@ common/regions \ +@HAVE_PLUGINS_TRUE@ plugins \ +@HAVE_PLUGINS_TRUE@ filters \ +@HAVE_PLUGINS_TRUE@ $(NULL) + +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ocaml.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ + $(am__configure_deps) $(am__DIST_COMMON) +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 = podwrapper.pl server/local/nbdkit.pc +CONFIG_CLEAN_VPATH_FILES = +PROGRAMS = $(noinst_PROGRAMS) +am__nbdkit_SOURCES_DIST = wrapper.c server/options.h +@ENABLE_LIBFUZZER_FALSE@am_nbdkit_OBJECTS = nbdkit-wrapper.$(OBJEXT) +nbdkit_OBJECTS = $(am_nbdkit_OBJECTS) +am__DEPENDENCIES_1 = +@ENABLE_LIBFUZZER_FALSE@nbdkit_DEPENDENCIES = $(top_builddir)/common/utils/libutils.la \ +@ENABLE_LIBFUZZER_FALSE@ $(top_builddir)/common/replacements/libcompat.la \ +@ENABLE_LIBFUZZER_FALSE@ $(am__DEPENDENCIES_1) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +nbdkit_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(nbdkit_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/nbdkit-wrapper.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(nbdkit_SOURCES) +DIST_SOURCES = $(am__nbdkit_SOURCES_DIST) +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + cscope distdir distdir-am dist dist-all distcheck +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \ + config.h.in +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +DIST_SUBDIRS = bash-completion docs fuzzing valgrind include \ + common/include common/protocol common/replacements \ + common/utils server contrib common/allocators common/bitmap \ + common/gpt common/regions plugins filters . tests +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(srcdir)/podwrapper.pl.in $(top_srcdir)/common-rules.mk \ + $(top_srcdir)/server/local/nbdkit.pc.in README.md TODO compile \ + config.guess config.sub depcomp install-sh ltmain.sh missing +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + if test -d "$(distdir)"; then \ + find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -rf "$(distdir)" \ + || { sleep 5 && rm -rf "$(distdir)"; }; \ + else :; fi +am__post_remove_distdir = $(am__remove_distdir) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +DIST_TARGETS = dist-gzip +# Exists only to be overridden by the user if desired. +AM_DISTCHECK_DVI_TARGET = dvi +distuninstallcheck_listfiles = find . -type f -print +am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ + | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ +BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ +CARGO = @CARGO@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_PLUGIN_CC = @CC_PLUGIN_CC@ +CC_PLUGIN_CFLAGS = @CC_PLUGIN_CFLAGS@ +CERTTOOL = @CERTTOOL@ +CFLAGS = @CFLAGS@ +COM_ERR_CFLAGS = @COM_ERR_CFLAGS@ +COM_ERR_LIBS = @COM_ERR_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CUT = @CUT@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LDFLAGS = @DL_LDFLAGS@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXT2FS_CFLAGS = @EXT2FS_CFLAGS@ +EXT2FS_LIBS = @EXT2FS_LIBS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GENISOIMAGE = @GENISOIMAGE@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GOARCH = @GOARCH@ +GOLANG = @GOLANG@ +GOOS = @GOOS@ +GOROOT = @GOROOT@ +GREP = @GREP@ +IMPORT_LIBRARY_ON_WINDOWS = @IMPORT_LIBRARY_ON_WINDOWS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +ISOPROG = @ISOPROG@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBLKIO_CFLAGS = @LIBBLKIO_CFLAGS@ +LIBBLKIO_LIBS = @LIBBLKIO_LIBS@ +LIBGUESTFS_CFLAGS = @LIBGUESTFS_CFLAGS@ +LIBGUESTFS_LIBS = @LIBGUESTFS_LIBS@ +LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ +LIBLZMA_LIBS = @LIBLZMA_LIBS@ +LIBNBD_CFLAGS = @LIBNBD_CFLAGS@ +LIBNBD_LIBS = @LIBNBD_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSELINUX_CFLAGS = @LIBSELINUX_CFLAGS@ +LIBSELINUX_LIBS = @LIBSELINUX_LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTORRENT_CFLAGS = @LIBTORRENT_CFLAGS@ +LIBTORRENT_LIBS = @LIBTORRENT_LIBS@ +LIBVIRT_CFLAGS = @LIBVIRT_CFLAGS@ +LIBVIRT_LIBS = @LIBVIRT_LIBS@ +LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ +LIBZSTD_LIBS = @LIBZSTD_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LUA_CFLAGS = @LUA_CFLAGS@ +LUA_LIBS = @LUA_LIBS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MC = @MC@ +MKDIR_P = @MKDIR_P@ +MKISOFS = @MKISOFS@ +NBDKIT_VERSION_MAJOR = @NBDKIT_VERSION_MAJOR@ +NBDKIT_VERSION_MICRO = @NBDKIT_VERSION_MICRO@ +NBDKIT_VERSION_MINOR = @NBDKIT_VERSION_MINOR@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_ON_WINDOWS = @NO_UNDEFINED_ON_WINDOWS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OCAML = @OCAML@ +OCAMLBEST = @OCAMLBEST@ +OCAMLBUILD = @OCAMLBUILD@ +OCAMLC = @OCAMLC@ +OCAMLCDOTOPT = @OCAMLCDOTOPT@ +OCAMLDEP = @OCAMLDEP@ +OCAMLDOC = @OCAMLDOC@ +OCAMLLIB = @OCAMLLIB@ +OCAMLMKLIB = @OCAMLMKLIB@ +OCAMLMKTOP = @OCAMLMKTOP@ +OCAMLOPT = @OCAMLOPT@ +OCAMLOPTDOTOPT = @OCAMLOPTDOTOPT@ +OCAMLOPTFLAGS = @OCAMLOPTFLAGS@ +OCAMLVERSION = @OCAMLVERSION@ +OCAML_MAJOR = @OCAML_MAJOR@ +OCAML_PLUGIN_LIBRARIES = @OCAML_PLUGIN_LIBRARIES@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PERL_ARCHLIB = @PERL_ARCHLIB@ +PERL_CFLAGS = @PERL_CFLAGS@ +PERL_LDOPTS = @PERL_LDOPTS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PODWRAPPER = @PODWRAPPER@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_CXX = @PTHREAD_CXX@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CFLAGS = @PYTHON_CFLAGS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +RUBY_CFLAGS = @RUBY_CFLAGS@ +RUBY_LIBS = @RUBY_LIBS@ +RUSTC = @RUSTC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOEXT = @SOEXT@ +SSH_CFLAGS = @SSH_CFLAGS@ +SSH_LIBS = @SSH_LIBS@ +STAT = @STAT@ +STRIP = @STRIP@ +TCL_CFLAGS = @TCL_CFLAGS@ +TCL_LIBS = @TCL_LIBS@ +TRUNCATE = @TRUNCATE@ +VALGRIND = @VALGRIND@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VERSION = @VERSION@ +WARNINGS_CFLAGS = @WARNINGS_CFLAGS@ +XORRISO = @XORRISO@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +ZLIB_NG_CFLAGS = @ZLIB_NG_CFLAGS@ +ZLIB_NG_LIBS = @ZLIB_NG_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DLLTOOL = @ac_ct_DLLTOOL@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_MC = @ac_ct_MC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bashcompdir = @bashcompdir@ +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@ +filters = @filters@ +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@ +lang_plugins = @lang_plugins@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +non_lang_plugins = @non_lang_plugins@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugins = @plugins@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +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@ + +# Convenient list terminator +NULL = +plugindir = $(libdir)/nbdkit/plugins +filterdir = $(libdir)/nbdkit/filters +CLEANFILES = *~ *.cmi *.cmx *.cmxa *.so *.dll html/*.html scripts/*~ +ACLOCAL_AMFLAGS = -I m4 +EXTRA_DIST = \ + BENCHMARKING \ + .dir-locals.el \ + .gitignore \ + html/pod.css \ + LICENSE \ + m4/.gitignore \ + OTHER_PLUGINS \ + README.md \ + scripts/git.orderfile \ + SECURITY \ + .vscode/settings.json \ + .vscode/tasks.json \ + $(NULL) + +@ENABLE_LIBFUZZER_FALSE@nbdkit_SOURCES = wrapper.c server/options.h +@ENABLE_LIBFUZZER_FALSE@nbdkit_CPPFLAGS = \ +@ENABLE_LIBFUZZER_FALSE@ -I$(top_srcdir)/server \ +@ENABLE_LIBFUZZER_FALSE@ -I$(top_srcdir)/common/include \ +@ENABLE_LIBFUZZER_FALSE@ -I$(top_srcdir)/common/utils \ +@ENABLE_LIBFUZZER_FALSE@ -I$(top_srcdir)/common/replacements \ +@ENABLE_LIBFUZZER_FALSE@ -Dbuilddir=\"$(abs_top_builddir)\" \ +@ENABLE_LIBFUZZER_FALSE@ -Dsrcdir=\"$(abs_top_srcdir)\" \ +@ENABLE_LIBFUZZER_FALSE@ -DVALGRIND=\"$(VALGRIND)\" \ +@ENABLE_LIBFUZZER_FALSE@ $(NULL) + +@ENABLE_LIBFUZZER_FALSE@nbdkit_CFLAGS = $(WARNINGS_CFLAGS) +@ENABLE_LIBFUZZER_FALSE@nbdkit_LDADD = \ +@ENABLE_LIBFUZZER_FALSE@ $(top_builddir)/common/utils/libutils.la \ +@ENABLE_LIBFUZZER_FALSE@ $(top_builddir)/common/replacements/libcompat.la \ +@ENABLE_LIBFUZZER_FALSE@ $(NULL) + +@ENABLE_LIBFUZZER_FALSE@EXTRA_nbdkit_DEPENDENCIES = config.status +SUBDIRS = bash-completion docs fuzzing valgrind include common/include \ + common/protocol common/replacements common/utils server \ + contrib $(am__append_1) . tests +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +am--refresh: Makefile + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common-rules.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ + $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign 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__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ + esac; +$(top_srcdir)/common-rules.mk $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: $(am__configure_deps) + $(am__cd) $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +$(am__aclocal_m4_deps): + +config.h: stamp-h1 + @test -f $@ || rm -f stamp-h1 + @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 + +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) + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 +podwrapper.pl: $(top_builddir)/config.status $(srcdir)/podwrapper.pl.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +server/local/nbdkit.pc: $(top_builddir)/config.status $(top_srcdir)/server/local/nbdkit.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $@ + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +nbdkit$(EXEEXT): $(nbdkit_OBJECTS) $(nbdkit_DEPENDENCIES) $(EXTRA_nbdkit_DEPENDENCIES) + @rm -f nbdkit$(EXEEXT) + $(AM_V_CCLD)$(nbdkit_LINK) $(nbdkit_OBJECTS) $(nbdkit_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nbdkit-wrapper.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +nbdkit-wrapper.o: wrapper.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_CPPFLAGS) $(CPPFLAGS) $(nbdkit_CFLAGS) $(CFLAGS) -MT nbdkit-wrapper.o -MD -MP -MF $(DEPDIR)/nbdkit-wrapper.Tpo -c -o nbdkit-wrapper.o `test -f 'wrapper.c' || echo '$(srcdir)/'`wrapper.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nbdkit-wrapper.Tpo $(DEPDIR)/nbdkit-wrapper.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='wrapper.c' object='nbdkit-wrapper.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_CPPFLAGS) $(CPPFLAGS) $(nbdkit_CFLAGS) $(CFLAGS) -c -o nbdkit-wrapper.o `test -f 'wrapper.c' || echo '$(srcdir)/'`wrapper.c + +nbdkit-wrapper.obj: wrapper.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_CPPFLAGS) $(CPPFLAGS) $(nbdkit_CFLAGS) $(CFLAGS) -MT nbdkit-wrapper.obj -MD -MP -MF $(DEPDIR)/nbdkit-wrapper.Tpo -c -o nbdkit-wrapper.obj `if test -f 'wrapper.c'; then $(CYGPATH_W) 'wrapper.c'; else $(CYGPATH_W) '$(srcdir)/wrapper.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nbdkit-wrapper.Tpo $(DEPDIR)/nbdkit-wrapper.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='wrapper.c' object='nbdkit-wrapper.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_CPPFLAGS) $(CPPFLAGS) $(nbdkit_CFLAGS) $(CFLAGS) -c -o nbdkit-wrapper.obj `if test -f 'wrapper.c'; then $(CYGPATH_W) 'wrapper.c'; else $(CYGPATH_W) '$(srcdir)/wrapper.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool config.lt + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscope: cscope.files + test ! -s cscope.files \ + || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) +clean-cscope: + -rm -f cscope.files +cscope.files: clean-cscope cscopelist +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + -rm -f cscope.out cscope.in.out cscope.po.out cscope.files +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done + -test -n "$(am__skip_mode_fix)" \ + || find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -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) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz + $(am__post_remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 + $(am__post_remove_distdir) + +dist-lzip: distdir + tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz + $(am__post_remove_distdir) + +dist-xz: distdir + tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz + $(am__post_remove_distdir) + +dist-zstd: distdir + tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst + $(am__post_remove_distdir) + +dist-tarZ: distdir + @echo WARNING: "Support for distribution archives compressed with" \ + "legacy program 'compress' is deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__post_remove_distdir) + +dist-shar: distdir + @echo WARNING: "Support for shar distribution archives is" \ + "deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 + shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz + $(am__post_remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__post_remove_distdir) + +dist dist-all: + $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' + $(am__post_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*) \ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lz*) \ + lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ + *.tar.xz*) \ + xz -dc $(distdir).tar.xz | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + *.tar.zst*) \ + zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ + esac + chmod -R a-w $(distdir) + chmod u+w $(distdir) + mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst + chmod a-w $(distdir) + test -d $(distdir)/_build || exit 0; \ + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && am__cwd=`pwd` \ + && $(am__cd) $(distdir)/_build/sub \ + && ../../configure \ + $(AM_DISTCHECK_CONFIGURE_FLAGS) \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + --srcdir=../.. --prefix="$$dc_install_base" \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \ + && $(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 \ + && cd "$$am__cwd" \ + || exit 1 + $(am__post_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: + @test -n '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: trying to run $@ with an empty' \ + '$$(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + $(am__cd) '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ + || { 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 +check: check-recursive +all-am: Makefile $(PROGRAMS) config.h +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f ./$(DEPDIR)/nbdkit-wrapper.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-hdr distclean-libtool distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f ./$(DEPDIR)/nbdkit-wrapper.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) all install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--depfiles am--refresh check check-am clean clean-cscope \ + clean-generic clean-libtool clean-noinstPROGRAMS cscope \ + cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ + dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \ + dist-zstd distcheck distclean distclean-compile \ + distclean-generic distclean-hdr distclean-libtool \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + $(NULL) + +check-valgrind: + $(MAKE) -C tests check-valgrind + +check-root: + $(MAKE) -C tests check-root + +check-vddk: + $(MAKE) -C tests check-vddk + +bench: all + @for d in common/utils; do \ + $(MAKE) -C $$d bench || exit 1; \ + done + +#---------------------------------------------------------------------- +# Maintainers only! + +# Check no files are missing from EXTRA_DIST rules, and that all +# generated files have been included in the tarball. (Note you must +# have done 'make dist') +maintainer-check-extra-dist: + @zcat $(PACKAGE_NAME)-$(VERSION).tar.gz | tar tf - | sort | \ + sed 's,^$(PACKAGE_NAME)-$(VERSION)/,,' > tarfiles + @git ls-files | \ + grep -v \ + -e '^\.cirrus.yml' \ + -e '^\.gitlab-ci.yml' \ + -e '^ci/' | \ + sort > gitfiles + @comm -13 tarfiles gitfiles > comm-out + @echo Checking for differences between EXTRA_DIST and git ... + @cat comm-out + @[ ! -s comm-out ] + @rm tarfiles gitfiles comm-out + @echo PASS: EXTRA_DIST tests + +# Commit everything in the current directory and set the commit +# message to the current version number. +maintainer-commit: + git commit -a -m "Version $(VERSION)." + +# Tag HEAD with the current version. +maintainer-tag: + git tag -a v$(VERSION) -m "Version $(VERSION)." -f + +# Run tests and display the time taken to run each test, which is +# useful for diagnosing slow-running tests. +# +# Try also setting LIBGUESTFS_BACKEND_SETTINGS=force_tcg which +# emulates what happens in Koji. +maintainer-check-times: + make check -j1 | ts -i + +# 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/OTHER_PLUGINS b/OTHER_PLUGINS new file mode 100644 index 0000000..ee77c79 --- /dev/null +++ b/OTHER_PLUGINS @@ -0,0 +1,13 @@ +Have you written an nbdkit plugin that you're willing to share? +Email to get it added to this list. + +* XVA (XenServer Virtual Appliance) + +This simple plugin written in Perl lets you read these files and +reexport them as NBD. It does not require that the XVA is unpacked: +https://lists.gnu.org/archive/html/qemu-devel/2017-11/msg02971.html +https://lists.gnu.org/archive/html/qemu-devel/2017-11/plHKJ062x5Uo.pl + +The whole thread is worth reading because several different approaches +to dealing with XVA files are presented: +https://lists.gnu.org/archive/html/qemu-devel/2017-11/threads.html#02839 diff --git a/README.md b/README.md new file mode 100644 index 0000000..2a4b068 --- /dev/null +++ b/README.md @@ -0,0 +1,486 @@ +## NBD server with stable plugin ABI and permissive license + +nbdkit is an NBD server. NBD — Network Block Device — is a protocol +for accessing Block Devices (hard disks and disk-like things) over a +Network. + +The key features of nbdkit are: + +* Multithreaded NBD server written in C with good performance. +* Minimal dependencies for the basic server. +* Liberal license (BSD) allows nbdkit to be linked to proprietary + libraries or included in proprietary code. +* Well-documented, simple plugin API with a stable ABI guarantee. + Lets you export “unconventional” block devices easily. +* You can write plugins in C/C++, Go, Lua, Perl, Python, OCaml, Ruby, + Rust, shell script or Tcl. +* Filters can be stacked in front of plugins to transform the output. + +For documentation, see the [docs directory](docs/). + +For plugins and filters, see the [plugins](plugins/) and +[filters](filters/) directories. Example plugins can be found in +`plugins/example*`. + +There are many NBD clients, but the nbdkit project has a companion +client library called https://gitlab.com/nbdkit/libnbd + +https://gitlab.com/nbdkit/nbdkit + +## License + +This software is Copyright Red Hat and licensed under a BSD +license. See [LICENSE](LICENSE) for details. + +## Building from source + +### Requirements + +* Linux, macOS, Windows, FreeBSD, OpenBSD or Haiku +* GCC or Clang +* bash +* GNU make + +Recommended for TLS (authentication and encryption) support, but it is +possible to build without it: + +* gnutls >= 3.3.0 + +For Windows support see [the Windows section below](README.md#windows). + +For macOS support see [the macOS section below](README.md#macos). + +### Optional dependencies + +To build the man pages, you will optionally need to install: + +* Perl +* Pod::Man and Pod::Simple (Perl libraries) + +For SELinux socket labelling support: + +* libselinux + +For the gzip filter and supporting compressed qcow2: + +* zlib or zlib-ng + +For the xz filter: + +* liblzma + +For the memory plugin with allocator=zstd and supporting compressed qcow2: + +* zstd + +For the curl (HTTP/FTP) plugin: + +* libcurl + +For the ssh plugin: + +* libssh >= 0.8.0 + (this is a different library from libssh2 - that will not work) + +For the iso plugin: + +* xorriso or genisoimage or mkisofs + +For the floppy plugin: + +* iconv (on Linux this is built into glibc, on other systems + it may be a separate library) + +For the libvirt plugin: + +* libvirt + +For the libguestfs plugin, and to run parts of the test suite: + +* libguestfs +* guestfish (from libguestfs) + +For the ext2 filter: + +* ext2fs +* com_err + +For the linuxdisk plugin: + +* mke2fs >= 1.42.10 (from e2fsprogs) + +For the nbd plugin, to get URI and TLS support, and also to run parts +of the test suite: + +* libnbd >= 0.9.8 + +For the bittorrent plugin: + +* [libtorrent-rasterbar](https://www.libtorrent.org) + +For the blkio plugin: + +* [libblkio](https://libblkio.gitlab.io/libblkio) + +For the containerized data importer (CDI) plugin: + +* podman +* jq + +For the Perl and example4 plugins: + +* perl interpreter +* perl development libraries +* perl modules ExtUtils::Embed + +For the Python plugin: + +* python interpreter (version 3 only) +* python development libraries +* python unittest to run the test suite +* boto3 is required to run the S3 plugin written in Python + +For the OCaml plugin: + +* OCaml >= 4.03 + +For the Tcl plugin: + +* Tcl development library and headers + +For the Lua plugin: + +* Lua development library and headers + +For the Rust plugin: + +* cargo (other dependencies will be downloaded at build time) + +To be able to write plugins in golang: + +* go >= 1.13 + +For bash tab completion: + +* bash-completion >= 1.99 + +To test for memory leaks (`make check-valgrind`): + +* valgrind program and development headers + +For non-essential enhancements to the test suite: + +* expect +* fdisk, sfdisk (from util-linux) +* flake8 +* hexdump +* ip, ss (from iproute package) +* jq +* losetup (from util-linux package) +* mke2fs (from e2fsprogs) +* nbdcopy, nbdinfo, nbdsh (from libnbd) +* qemu-img, qemu-io, qemu-nbd (usually shipped with qemu) +* socat +* stat (from coreutils) + +### Building + +``` +To build from tarball: To build from git: + + autoreconf -i +./configure ./configure +make make +make check make check +``` + +On FreeBSD and OpenBSD which do not have GNU make by default you must +use `gmake` instead of `make`. + +To run nbdkit from the source directory, use the top level ./nbdkit +wrapper. It will run nbdkit and plugins from the locally compiled +directory: + +``` +$ ./nbdkit example1 -f -v +./server/nbdkit ./plugins/example1/.libs/nbdkit-example1-plugin.so -f -v +[etc] +``` + +Optionally run this command as root to install everything: + +``` +make install +``` + +### Python + +Since nbdkit >= 1.16, only Python >= 3.6 is supported. + +By default nbdkit uses the Python version of the Python interpreter +called “python” on the current $PATH. If you have parallel versions +of Python installed then you can choose a different version by setting +the PYTHON variable when configuring. For example: + +``` +./configure PYTHON=/usr/bin/python3.8 +``` + +### OCaml + +Most recent (less than, say, 8 years old) versions of the OCaml +compiler should work. By default the configure script should detect +the bytecode and native code compilers and enable either one or both. + +To enable OCaml warnings and turn them into hard errors (developers only): + +``` +./configure OCAMLOPTFLAGS="-warn-error +A-3" +``` + +### Running the tests + +To run the test suite: + +``` +make check +``` + +If there is a failure, look at the corresponding `tests/*.log` file +for debug information. + +A few tests require root privileges, and are skipped by default. To +run them you must do: + +``` +make check-root +``` + +If you have the proprietary VDDK library, you can test +[nbdkit-vddk-plugin](plugins/vddk/) against the library like this: + +``` +make check-vddk vddkdir=vmware-vix-disklib-distrib +``` + +### Running the benchmarks + +To run benchmarks: + +``` +make bench +``` + +## Download tarballs + +Tarballs are available from: +http://libguestfs.org/download/nbdkit + +## Downstream packagers + +If you are packaging nbdkit, use: + +``` +./configure --with-extra='...' +``` + +providing extra information about the distribution, and/or +distro-specific versions. It helps us with troubleshooting bug +reports. (Also, talk to us!) + +## Developers + +Install the valgrind program and development headers. + +Use: + +``` +./configure --enable-gcc-warnings --enable-valgrind +``` + +When testing use: + +``` +make check +make check-valgrind +``` + +For development ideas, see the [TODO](TODO) file. + +The upstream git repository is: +https://gitlab.com/nbdkit/nbdkit + +Please send patches to the libguestfs mailing list: +https://lists.libguestfs.org + +For further information, see: +https://libguestfs.org/ +https://github.com/NetworkBlockDevice/nbd/blob/master/doc/proto.md + +## Address sanitizer (ASAN) + +You can compile nbdkit with clang and ASAN with: + +``` +./configure CC=clang CXX=clang++ \ + CFLAGS="-O0 -g -fsanitize=address -fno-omit-frame-pointer" \ + --disable-linker-script \ + --disable-golang +make clean +make +ASAN_OPTIONS="allocator_may_return_null=1:detect_leaks=0" make check +``` + +## Test coverage + +``` +./configure CFLAGS="--coverage -g" LDFLAGS="--coverage -g" +make clean +make +make check + +lcov -c -d . -o gcov.info +genhtml -o coverage gcov.info +``` + +Open your browser and examine the `coverage/` directory. At the time +of writing (2020-04) test coverage of the server is reasonable, but +things are much worse for certain plugins and filters. + +## macOS + +nbdkit works on macOS and is mostly feature complete. Some tests may +fail or be skipped. + +We have tested macOS 12 (Monterey) using MacPorts. Other versions of +macOS and Homebrew may work too. + +We installed the following MacPorts packages: + +* autoconf +* autoconf-archive +* automake +* bash +* coreutils +* gcc +* gmake +* gsed +* jq +* libtool +* m4 +* ocaml +* pkg-config +* qemu +* ranlib + +We configured nbdkit using: + +``` +./configure --enable-gcc-warnings --disable-perl \ + CFLAGS="-g -O2 -I/opt/local/include" \ + LDFLAGS="-L/opt/local/lib" +``` + +## Windows + +Experimentally, the server can be compiled on Windows or +cross-compiled from Linux using mingw-w64. Only a small subset of +features are available. To find out what is missing read the TODO +"Windows port". + +Note that GCC or Clang is required even if you are compiling on +Windows because of some C language extensions we use. MSVC will not +work. + +### Cross-compiling from Linux to Windows + +For the rest of this section we talk about cross-compiling for Windows +using Linux and mingw-w64. At a minimum you will need: + +* mingw-w64 gcc +* mingw-w64 dlfcn +* mingw-w64 winpthreads +* mingw-w64 gnutls (optional, but highly recommended) +* wine (if you want to run it on Linux) + +You may want to patch Wine with this patch which adds support for +AF_UNIX sockets. It is needed to get most of the test suite to work, +but if you don't care about the -U option then it is not needed. +https://www.winehq.org/pipermail/wine-devel/2021-May/187049.html + +Other mingw-w64 libraries may be installed which will add +functionality (see full list of requirements above), but you may end +up hitting areas we have not compiled or tested before. + +To cross compile under Fedora or RHEL, ensure you have the following +prerequisites: + +``` +dnf install -y mingw64-{gcc,dlfcn,winpthreads,gnutls} +dnf install -y autoconf automake libtool make +``` + +then do: + +``` +autoreconf -i # when building from git +mingw64-configure --disable-ocaml --disable-perl +make +``` + +You can test if the server is working by doing: + +``` +./nbdkit.exe --dump-config +``` + +(This usually runs wine automatically. If not, you may need to prefix +the command "wine nbdkit.exe ...") + +To see which plugins and filters were compiled: + +``` +find plugins filters -name '*.dll' +``` + +You can run them under Wine without installing using eg: + +``` +./nbdkit.exe -f -v memory 1G +``` + +You can run the test suite in the usual way: + +``` +make check +``` + +### Running the cross-compiled binary on Windows + +To test the binary on a real Windows system you will need to copy +server/.libs/nbdkit.exe, any plugins and filters you need +(`plugins/*/.libs/*.dll` and `filters/*/.libs/*.dll`), and many mingw +DLLs (`libdl.dll`, `libgnutls.dll`, `libwinpthread.dll`, etc.). + +Notes: + +1. libtool creates files called nbdkit.exe in the top level directory +and in [server](server/). These are the stripped binaries. The +"real" binaries are located in hidden `.libs/` subdirectories. + +2. The top level `.libs/nbdkit.exe` is the wrapper used to run nbdkit +from the build directory, not the server binary. You need +`server/.libs/nbdkit.exe` instead. + +3. To find the list of mingw DLLs I ran nbdkit.exe iteratively until +Windows stopped complaining about missing libraries. You could also +use a tool like Dependency Walker. + +If you copy everything into a single directory on the Windows server +then you should be able to run nbdkit normally, eg: + +``` +nbdkit.exe -f -v nbdkit-memory-plugin.dll 1G +``` + +You will probably need to open port 10809 on the Windows Firewall. diff --git a/SECURITY b/SECURITY new file mode 100644 index 0000000..a5632bc --- /dev/null +++ b/SECURITY @@ -0,0 +1,15 @@ +If you think you've found a serious or potential security bug that you +don't want to report on a public mailing list, then send email to both + and . + +Make it clear in the email Subject line that it's a serious or +security-related bug in nbdkit. + +You can also sign and/or encrypt messages using our GPG public keys +available on the usual keyservers, or online here: +https://download.libguestfs.org/libguestfs.keyring + +For information about past security issues, see +docs/nbdkit-security.pod, or the nbdkit-security(1) man page if you +have installed nbdkit, also available online here: +http://libguestfs.org/nbdkit-security.1.html diff --git a/TODO b/TODO new file mode 100644 index 0000000..687e343 --- /dev/null +++ b/TODO @@ -0,0 +1,413 @@ +To-do list for nbdkit +====================================================================== + +General ideas for improvements +------------------------------ + +* Listen on specific interfaces or protocols. + +* Performance - measure and improve it. Chart it over various buffer + sizes and threads, as that should make it easier to identify + systematic issues. + +* For parallel plugins, only create threads on demand from parallel + client requests, rather than pre-creating all threads at connection + time, up to the thread pool size limit. Of course, once created, a + thread is reused as possible until the connection closes. + +* A new threading model, SERIALIZE_RETIREMENT, which lets the client + queue up multiple requests and processes them in parallel in the + plugin, but where the responses sent back to the client are in the + same order as the client's request rather than the plugin's + completion. This is stricter than fully parallel, but looser than + SERIALIZE_REQUESTS (in particular, a client can get + non-deterministic behavior if batched requests touch the same area + of the export). + +* Async callbacks. The current parallel support requires one thread + per pending message; a solution with fewer threads would split + low-level code between request and response, where the callback has + to inform nbdkit when the response is ready: + https://www.redhat.com/archives/libguestfs/2018-January/msg00149.html + +* More NBD protocol features. The currently missing features are + structured replies for sparse reads, and online resize. + +* Test that zero-length read/write/extents requests behave sanely + (NBD protocol says they are unspecified). + +* If a client negotiates structured replies, and issues a read/extents + call that exceeds EOF (qemu 3.1 is one such client, when nbdkit + serves non-sector-aligned images), return the valid answer for the + subset of the request in range and then NBD_REPLY_TYPE_ERROR_OFFSET + for the tail, rather than erroring the entire request. + +* Audit the code base to get rid of strerror() usage (the function is + not thread-safe); however, using strerror_r() can be tricky as it + has a different signature in glibc than in POSIX. + +* Teach nbdkit_error() to have smart newline appending (for existing + inconsistent clients), while fixing internal uses to omit the + newline. Commit ef4f72ef has some ideas on smart newlines, but that + should probably be factored into a utility function. + +* Add a mode of operation where nbdkit is handed a pre-opened fd to be + used immediately in transmission phase (skipping handshake). There + are already third-party clients of the kernel's /dev/nbdX which rely + on their own protocol instead of NBD handshake, before calling + ioctl(NBD_SET_SOCK); this mode would let the third-party client + continue to keep their non-standard handshake while utilizing nbdkit + to prototype new behaviors in serving the kernel. + +* "nbdkit.so": nbdkit as a loadable shared library. The aim of nbdkit + is to make it reusable from other programs (see nbdkit-captive(1)). + If it was a loadable shared library it would be even more reusable. + API would allow you to create an nbdkit instance, configure it (same + as the current command line), start it serving on a socket, etc. + However perhaps the current ability to work well as a subprocess is + good enough? Also allowing multiple instances of nbdkit to be + loaded in the same process is probably impossible. + +* common/utils/vector.h could be extended and used in other places: + - there are some more possible places in the server (anywhere using + realloc is suspect) + - add more iterators, map function, etc, as required. + +* password=- to mean read a password interactively from /dev/tty (not + stdin). + +Suggestions for plugins +----------------------- + +Note: qemu supports other formats such as libnfs, iscsi, gluster and +ceph/rbd, and while similar plugins could be written for nbdkit there +is no compelling reason unless the result is better than qemu-nbd. +For the majority of users it would be better if they were directed to +qemu-nbd for these use cases. + +* XVA files + + https://lists.gnu.org/archive/html/qemu-devel/2017-11/msg02971.html + is a partial solution but it needs cleaning up. + +nbdkit-floppy-plugin: + +* Add boot sector support. In theory this is easy (eg. using + SYSLINUX), but the practical reality of making a fully bootable + floppy is rather more complex. + +* Add multiple dir merging. + +nbdkit-linuxdisk-plugin: + +* Add multiple dir merging (in e2fsprogs mke2fs). + +VDDK: + +* Map export name to file parameter, allowing clients to access + multiple disks from a single VM. + +* For testing VDDK, try to come up with delay filter + sparse plugin + settings which behave closely (in terms of performance and API + latency) to the real thing. This would allow us to tune some + performance tools without needing VMware all the time. + +nbdkit-torrent-plugin: + +* There are lots of settings we could map into parameters: + https://www.libtorrent.org/reference-Settings.html#settings_pack + +* The C++ could be a lot more natural. At the moment it's a kind of + “C with C++ extensions”. + +nbdkit-ondemand-plugin: + +* Implement more callbacks, eg. .zero + +* Allow client to select size up to a limit, eg. by sending export + names like ‘export:4G’. + +nbdkit-data-plugin: + +* Allow expressions to evaluate to numbers, offsets, etc so that this + works: + + nbdkit data '(0x55 0xAA)*n' n=1000 + +* Allow inclusion of files where the file is not binary but is written + in the data format. + +* Like $VAR but the variable is either binary or base64. + +nbdkit-cdi-plugin: + +* Look at using skopeo instead of podman pull + (https://github.com/containers/skopeo) + +nbdkit-blkio-plugin: + +* Use event-driven mode instead of blocking mode. This involves + restructuring the plugin so that there is one or more background + threads to handle the events, and nbdkit threads issue requests to + these threads. (See how it is done in the VDDK plugin.) + +Suggestions for language plugins +-------------------------------- + +Python: + +* Get the __docstring__ from the module and print it in --help output. + This requires changes to the core API so that config_help is a + function rather than a variable (see V3 suggestions below). + +Suggestions for filters +----------------------- + +* Add shared filter. Take advantage of filter context APIs to open a + single context into the backend shared among multiple client + connections. This may even allow a filter to offer a more parallel + threading model than the underlying plugin. + +* CBT filter to track dirty blocks. See these links for inspiration: + https://www.cloudandheat.com/block-level-data-tracking-using-davice-mappers-dm-era/ + https://github.com/qemu/qemu/blob/master/docs/interop/bitmaps.rst + +* masking plugin features for testing clients (see 'nozero' and 'fua' + filters for examples) + +* "bandwidth quota" filter which would close a connection after it + exceeded a certain amount of bandwidth up or down. + +* "forward-only" filter. This would turn random access requests from + the client into serial requests in the plugin, meaning that the + plugin could be written to assume that requests only happen from + beginning to end. This is would be useful for plugins that have to + deal with non-seekable compressed data. Note the filter would have + to work by caching already-read data in a temporary file. + +* nbdkit-cache-filter should handle ENOSPC errors automatically by + reclaiming blocks from the cache + +* nbdkit-cache-filter could use a background thread for reclaiming. + +* zstd filter was requested as a way to do what we currently do with + xz but saving many hours on compression (at the cost of hundreds of + MBs of extra data) + https://github.com/facebook/zstd/issues/395#issuecomment-535875379 + +* nbdkit-exitlast-filter could probably use a configurable timeout so + that there is a grace period in case another connection comes along. + +* nbdkit-pause-filter would probably be more useful if the filter + could inject a flush after pausing. However this requires that + filter background threads have access to the plugin (see above). + +nbdkit-luks-filter: + +* This filter should also support LUKSv2 (and so should qemu). + +* There are some missing features: ESSIV, more ciphers. + +* Implement trim and zero if possible. + +nbdkit-readahead-filter: + +* The filter should open a new connection to the plugin per background + thread so it is able to work with plugins that use the + serialize_requests thread model (like curl). At the moment it makes + requests on the same connection, so it requires plugins to use the + parallel thread model. + +* It should combine (or avoid) overlapping cache requests. + +nbdkit-rate-filter: + +* allow other kinds of traffic shaping such as VBR + +* limit traffic per client (ie. per IP address) + +* split large requests to avoid long, lumpy sleeps when request size + is much larger than rate limit + +nbdkit-retry-filter: + +* allow user to specify which errors cause a retry and which ones are + passed through; for example there's probably no point retrying on + ENOMEM + +* there are all kinds of extra complications possible here, + eg. specifying a pattern of retrying and reopening: + retry-method=RRRORRRRRORRRRR meaning to retry the data command 3 + times, reopen, retry 5 times, etc. + +* subsecond times + +nbdkit-ip-filter: + +* permit hostnames and hostname wildcards to be used in the + allow and deny lists + +* the allow and deny lists should be updatable while nbdkit is + running, for example by storing them in a database file + +nbdkit-extentlist-filter: + +* read the extents generated by qemu-img map, allowing extents to be + ported from a qemu block device + +* make non-read-only access safe by updating the extent list when the + filter sees writes and trims + +nbdkit-exportname-filter: + +* find a way to call the plugin's .list_exports during .open, so that + we can enforce exportname-strict=true without command line redundancy + +* add a mode for passing in a file containing exportnames in the same + manner accepted by the sh/eval plugins, rather than one name (and no + description) per config parameter + +nbdkit-evil-filter: + +* improve the algorithm so it can simulate bursts of corrupted bits + (https://listman.redhat.com/archives/libguestfs/2023-May/031567.html) + +nbdkit-qcow2dec-filter: + +* implement extents - we know which clusters are preallocated and + sparse, so map that into extent information + +* implement internal snapshots - it should be possible to select an + internal snapshot by name + +Filters for security +-------------------- + +Things like filtering by IP address can be done using external +wrappers (TCP wrappers, systemd), or nbdkit-ip-filter. + +However it might be nice to have a configurable filter for preventing +valid but not sensible requests. The server already filters invalid +requests. This would be like seccomp, and could be implemented using +an eBPF-based parser. Unfortunately actual eBPF is difficult to use +for userspace processes. The "standard" isn't solidly defined - the +Linux kernel implementation is the standard - and Linux has by far the +best implementation, particularly around bytecode verification and +JITting. There is a userspace VM (ubpf) but it has very limited +capabilities compared to Linux. + +Composing nbdkit +---------------- + +Filters allow certain types of composition, but others would not be +possible, for example RAIDing over multiple nbd sources. Because the +plugin API limits us to loading a single plugin to the server, the +best way to do this (and the most robust) is to compose multiple +nbdkit processes. Perhaps libnbd will prove useful for this purpose. + +Build-related +------------- + +* Figure out how to get 'make distcheck' working. VPATH builds are + working, but various pkg-config results that try to stick + bash-completion and ocaml add-ons into their system-wide home do + not play nicely with --prefix builds for a non-root user. + +* Right now, 'make check' builds keys with an expiration of 1 year + only if they don't exist, and we leave the keys around except under + 'make distclean'. This leads to testsuite failures when + (re-)building in an incremental tree first started more than a year + ago. Better would be having make unconditionally run the generator + scripts, but tweak the scripts themselves to be a no-op unless the + keys don't exist or have expired. + +Windows port +------------ + +Currently many features are missing, including: + +* Daemonization. This is not really applicable for Windows where you + would instead want to run nbdkit as a service using something like + SRVANY. You must use the -f option or one of the other options that + implies -f. + +* These options are all unimplemented: + --exit-with-parent, --group, --run, --selinux-label, --single, --swap, + --user, --vsock + +* Many other plugins and filters. + +* errno_is_preserved should use GetLastError and/or WSAGetLastError + but currently does neither so errors from plugins are probably wrong + in many cases. + +* Most tests are skipped because of the missing features above. + +V3 plugin protocol +------------------ + +From time to time we may update the plugin protocol. This section +collects ideas for things which might be fixed in the next version of +the protocol. + +Note that we keep the old protocol(s) around so that source +compatibility is retained. Plugins must opt in to the new protocol +using ‘#define NBDKIT_API_VERSION ’. + +* All methods taking a ‘count’ field should be uint64_t (instead of + uint32_t). Although the NBD protocol does not support 64 bit + lengths, it might do in future. + +* v2 .can_zero is tri-state for filters, but bool for plugins; in v3, + even plugins should get a say on whether to emulate + +* v2 .can_extents is bool, and cannot affect our response to + NBD_OPT_SET_META_CONTEXT (that is, we are blindly emulating extent + support regardless of the export name). In v3, .can_extents should + be tri-state, with an explicit way to disable that context on a + per-export basis. + +* pread could be changed to allow it to support Structured Replies + (SRs). This could mean allowing it to return partial data, holes, + zeroes, etc. For a client that negotiates SR coupled with a plugin + that supports .extents, the v2 protocol would allow us to at least + synthesize NBD_REPLY_TYPE_OFFSET_HOLE for less network traffic, even + though the plugin will still have to fully populate the .pread + buffer; the v3 protocol should make sparse reads more direct. + +* Parameters should be systematized so that they aren't just (key, + value) strings. nbdkit should know the possible keys for the plugin + and filters, and the type of the values, and both check and parse + them for the plugin. + +* Modify open() API so it takes an export name and tls parameter. + +* Modify get_ready() API to pass final selected thread model. Filters + already get this information, but to date, we have not yet seen a + reason to add nbdkit_get_thread_model for use by v2 plugins. + +* Change config_help from a variable to a function. + +* Consider extra parameters to .block_size(). First so that we can + separately control maximum data request (eg. pread) vs maximum + virtual request (eg. zero). Note that the NBD protocol does not yet + support this distinction. We may also need a 'bool strict' + parameter to specify whether the client requested block size + information or not. qemu-nbd can distinguish these two cases. + +* Renumber thread models. Redefine existing thread models like this: + + model existing value new value + SERIALIZE_CONNECTIONS 0 1000 + SERIALIZE_ALL_REQUESTS 1 2000 + SERIALIZE_REQUESTS 2 3000 + PARALLEL 3 4000 + + This allows new thread models to be inserted before and between the + existing ones. In particular SERIALIZE_RETIREMENT has been + suggested above (inserted between SERIALIZE_REQUESTS and PARALLEL). + We could also imagine a thread model more like the one VDDK really + wants which calls open and close from the main thread. + + For backwards compatibility the old numbers 0-3 can be transparently + mapped to the new values. diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..d9cd618 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,1501 @@ +# generated automatically by aclocal 1.16.5 -*- Autoconf -*- + +# Copyright (C) 1996-2021 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_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],, +[m4_warning([this file was generated for autoconf 2.71. +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'.])]) + +# pkg.m4 - Macros to locate and use pkg-config. -*- Autoconf -*- +# serial 12 (pkg-config-0.29.2) + +dnl Copyright © 2004 Scott James Remnant . +dnl Copyright © 2012-2015 Dan Nicholson +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +dnl 02111-1307, USA. +dnl +dnl As a special exception to the GNU General Public License, if you +dnl distribute this file as part of a program that contains a +dnl configuration script generated by Autoconf, you may include it under +dnl the same distribution terms that you use for the rest of that +dnl program. + +dnl PKG_PREREQ(MIN-VERSION) +dnl ----------------------- +dnl Since: 0.29 +dnl +dnl Verify that the version of the pkg-config macros are at least +dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's +dnl installed version of pkg-config, this checks the developer's version +dnl of pkg.m4 when generating configure. +dnl +dnl To ensure that this macro is defined, also add: +dnl m4_ifndef([PKG_PREREQ], +dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])]) +dnl +dnl See the "Since" comment for each macro you use to see what version +dnl of the macros you require. +m4_defun([PKG_PREREQ], +[m4_define([PKG_MACROS_VERSION], [0.29.2]) +m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, + [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) +])dnl PKG_PREREQ + +dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) +dnl ---------------------------------- +dnl Since: 0.16 +dnl +dnl Search for the pkg-config tool and set the PKG_CONFIG variable to +dnl first found in the path. Checks that the version of pkg-config found +dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is +dnl used since that's the first version where most current features of +dnl pkg-config existed. +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi +fi[]dnl +])dnl PKG_PROG_PKG_CONFIG + +dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------------------------------- +dnl Since: 0.18 +dnl +dnl Check to see whether a particular set of modules exists. Similar to +dnl PKG_CHECK_MODULES(), but does not set variables or print errors. +dnl +dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +dnl only at the first occurrence in configure.ac, so if the first place +dnl it's called might be skipped (such as if it is within an "if", you +dnl have to call PKG_CHECK_EXISTS manually +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +dnl --------------------------------------------- +dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting +dnl pkg_failed based on the result. +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes ], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])dnl _PKG_CONFIG + +dnl _PKG_SHORT_ERRORS_SUPPORTED +dnl --------------------------- +dnl Internal check to see if pkg-config supports short errors. +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])dnl _PKG_SHORT_ERRORS_SUPPORTED + + +dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl -------------------------------------------------------------- +dnl Since: 0.4.0 +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES might not happen, you should be sure to include an +dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $2]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT])[]dnl + ]) +elif test $pkg_failed = untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])[]dnl + ]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])dnl PKG_CHECK_MODULES + + +dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl --------------------------------------------------------------------- +dnl Since: 0.29 +dnl +dnl Checks for existence of MODULES and gathers its build flags with +dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags +dnl and VARIABLE-PREFIX_LIBS from --libs. +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to +dnl include an explicit call to PKG_PROG_PKG_CONFIG in your +dnl configure.ac. +AC_DEFUN([PKG_CHECK_MODULES_STATIC], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +_save_PKG_CONFIG=$PKG_CONFIG +PKG_CONFIG="$PKG_CONFIG --static" +PKG_CHECK_MODULES($@) +PKG_CONFIG=$_save_PKG_CONFIG[]dnl +])dnl PKG_CHECK_MODULES_STATIC + + +dnl PKG_INSTALLDIR([DIRECTORY]) +dnl ------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable pkgconfigdir as the location where a module +dnl should install pkg-config .pc files. By default the directory is +dnl $libdir/pkgconfig, but the default can be changed by passing +dnl DIRECTORY. The user can override through the --with-pkgconfigdir +dnl parameter. +AC_DEFUN([PKG_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([pkgconfigdir], + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, + [with_pkgconfigdir=]pkg_default) +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +])dnl PKG_INSTALLDIR + + +dnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) +dnl -------------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable noarch_pkgconfigdir as the location where a +dnl module should install arch-independent pkg-config .pc files. By +dnl default the directory is $datadir/pkgconfig, but the default can be +dnl changed by passing DIRECTORY. The user can override through the +dnl --with-noarch-pkgconfigdir parameter. +AC_DEFUN([PKG_NOARCH_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([noarch-pkgconfigdir], + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, + [with_noarch_pkgconfigdir=]pkg_default) +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +])dnl PKG_NOARCH_INSTALLDIR + + +dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, +dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------- +dnl Since: 0.28 +dnl +dnl Retrieves the value of the pkg-config variable for the given module. +AC_DEFUN([PKG_CHECK_VAR], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl + +_PKG_CONFIG([$1], [variable="][$3]["], [$2]) +AS_VAR_COPY([$1], [pkg_cv_][$1]) + +AS_VAR_IF([$1], [""], [$5], [$4])dnl +])dnl PKG_CHECK_VAR + +dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND], +dnl [DESCRIPTION], [DEFAULT]) +dnl ------------------------------------------ +dnl +dnl Prepare a "--with-" configure option using the lowercase +dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and +dnl PKG_CHECK_MODULES in a single macro. +AC_DEFUN([PKG_WITH_MODULES], +[ +m4_pushdef([with_arg], m4_tolower([$1])) + +m4_pushdef([description], + [m4_default([$5], [build with ]with_arg[ support])]) + +m4_pushdef([def_arg], [m4_default([$6], [auto])]) +m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes]) +m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no]) + +m4_case(def_arg, + [yes],[m4_pushdef([with_without], [--without-]with_arg)], + [m4_pushdef([with_without],[--with-]with_arg)]) + +AC_ARG_WITH(with_arg, + AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),, + [AS_TR_SH([with_]with_arg)=def_arg]) + +AS_CASE([$AS_TR_SH([with_]with_arg)], + [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)], + [auto],[PKG_CHECK_MODULES([$1],[$2], + [m4_n([def_action_if_found]) $3], + [m4_n([def_action_if_not_found]) $4])]) + +m4_popdef([with_arg]) +m4_popdef([description]) +m4_popdef([def_arg]) + +])dnl PKG_WITH_MODULES + +dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [DESCRIPTION], [DEFAULT]) +dnl ----------------------------------------------- +dnl +dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES +dnl check._[VARIABLE-PREFIX] is exported as make variable. +AC_DEFUN([PKG_HAVE_WITH_MODULES], +[ +PKG_WITH_MODULES([$1],[$2],,,[$3],[$4]) + +AM_CONDITIONAL([HAVE_][$1], + [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"]) +])dnl PKG_HAVE_WITH_MODULES + +dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [DESCRIPTION], [DEFAULT]) +dnl ------------------------------------------------------ +dnl +dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after +dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make +dnl and preprocessor variable. +AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES], +[ +PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4]) + +AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"], + [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])]) +])dnl PKG_HAVE_DEFINE_WITH_MODULES + +# Copyright (C) 2002-2021 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.16' +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.16.5], [], + [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 AM_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.16.5])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001-2021 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], +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997-2021 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_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ([2.52])dnl + m4_if([$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 +m4_define([_AM_COND_VALUE_$1], [$2])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-2021 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. + + +# 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", "OBJC", "OBJCXX", "UPC", or "GJC". +# 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 + +m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], + [$1], [CXX], [depcc="$CXX" am_compiler_list=], + [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], [OBJCXX], [depcc="$OBJCXX" 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". + rm -rf conftest.dir + 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 + am__universal=false + m4_case([$1], [CC], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac], + [CXX], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac]) + + 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 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # 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. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + 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 + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj 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 $am__obj 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], [dnl +AS_HELP_STRING( + [--enable-dependency-tracking], + [do not reject slow dependency extractors]) +AS_HELP_STRING( + [--disable-dependency-tracking], + [speeds up one-time build])]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +AC_SUBST([am__nodep])dnl +_AM_SUBST_NOTMAKE([am__nodep])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999-2021 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_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[{ + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + AS_CASE([$CONFIG_FILES], + [*\'*], [eval set x "$CONFIG_FILES"], + [*], [set x $CONFIG_FILES]) + shift + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf + do + # Strip MF so we end up with the name of the file. + am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`AS_DIRNAME(["$am_mf"])` + am_filepart=`AS_BASENAME(["$am_mf"])` + AM_RUN_LOG([cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles]) || am_rc=$? + done + if test $am_rc -ne 0; then + AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE="gmake" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking).]) + fi + AS_UNSET([am_dirpart]) + AS_UNSET([am_filepart]) + AS_UNSET([am_mf]) + AS_UNSET([am_rc]) + rm -f conftest-deps.mk +} +])# _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. +# This creates each '.Po' and '.Plo' makefile fragment that we'll 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" MAKE="${MAKE-make}"])]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996-2021 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 macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. +m4_define([AC_PROG_CC], +m4_defn([AC_PROG_CC]) +[_AM_PROG_CC_C_O +]) + +# 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.65])dnl +m4_ifdef([_$0_ALREADY_INIT], + [m4_fatal([$0 expanded multiple times +]m4_defn([_$0_ALREADY_INIT]))], + [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])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], +[AC_DIAGNOSE([obsolete], + [$0: two- and three-arguments forms are deprecated.]) +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_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]), + [ok:ok],, + [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]) +AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +AC_SUBST([mkdir_p], ['$(MKDIR_P)']) +# We need awk for the "check" target (and possibly the TAP driver). 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])], + [m4_define([AC_PROG_CC], + m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES([CXX])], + [m4_define([AC_PROG_CXX], + m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES([OBJC])], + [m4_define([AC_PROG_OBJC], + m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], + [_AM_DEPENDENCIES([OBJCXX])], + [m4_define([AC_PROG_OBJCXX], + m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl +]) +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi +AC_SUBST([CTAGS]) +if test -z "$ETAGS"; then + ETAGS=etags +fi +AC_SUBST([ETAGS]) +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi +AC_SUBST([CSCOPE]) + +AC_REQUIRE([AM_SILENT_RULES])dnl +dnl The testsuite driver may need to know about EXEEXT, so add the +dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This +dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. +AC_CONFIG_COMMANDS_PRE(dnl +[m4_provide_if([_AM_COMPILER_EXEEXT], + [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) + fi +fi +dnl The trailing newline in this macro's definition is deliberate, for +dnl backward compatibility and to allow trailing 'dnl'-style comments +dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. +]) + +dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further +dnl mangled by Autoconf and run in a shell conditional statement. +m4_define([_AC_COMPILER_EXEEXT], +m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) + +# 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-2021 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 +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi +AC_SUBST([install_sh])]) + +# Copyright (C) 2003-2021 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. + +# 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-2021 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_MAKE_INCLUDE() +# ----------------- +# Check whether make has an 'include' directive that can support all +# the idioms we need for our automatic dependency tracking code. +AC_DEFUN([AM_MAKE_INCLUDE], +[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) +cat > confinc.mk << 'END' +am__doit: + @echo this is the am__doit target >confinc.out +.PHONY: am__doit +END +am__include="#" +am__quote= +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) + AS_CASE([$?:`cat confinc.out 2>/dev/null`], + ['0:this is the am__doit target'], + [AS_CASE([$s], + [BSD], [am__include='.include' am__quote='"'], + [am__include='include' am__quote=''])]) + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +AC_MSG_RESULT([${_am_result}]) +AC_SUBST([am__include])]) +AC_SUBST([am__quote])]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997-2021 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_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 is modern enough. +# If it is, 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 +if test x"${MISSING+set}" != xset; then + MISSING="\${SHELL} '$am_aux_dir/missing'" +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + AC_MSG_WARN(['missing' script is too old or missing]) +fi +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001-2021 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_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], +[m4_foreach_w([_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])]) + +# Copyright (C) 1999-2021 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_CC_C_O +# --------------- +# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC +# to automatically call this. +AC_DEFUN([_AM_PROG_CC_C_O], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([compile])dnl +AC_LANG_PUSH([C])dnl +AC_CACHE_CHECK( + [whether $CC understands -c and -o together], + [am_cv_prog_cc_c_o], + [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i]) +if test "$am_cv_prog_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_LANG_POP([C])]) + +# For backward compatibility. +AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) + +# Copyright (C) 2001-2021 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_RUN_LOG(COMMAND) +# ------------------- +# Run COMMAND, save the exit status in ac_status, and log it. +# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) +AC_DEFUN([AM_RUN_LOG], +[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD + ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + (exit $ac_status); }]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996-2021 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_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[[\\\"\#\$\&\'\`$am_lf]]*) + AC_MSG_ERROR([unsafe absolute working directory name]);; +esac +case $srcdir in + *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) + AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; +esac + +# 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 ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + 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 + 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 + if test "$[2]" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + 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]) +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi +AC_CONFIG_COMMANDS_PRE( + [AC_MSG_CHECKING([that generated files are newer than configure]) + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + AC_MSG_RESULT([done])]) +rm -f conftest.file +]) + +# Copyright (C) 2009-2021 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_SILENT_RULES([DEFAULT]) +# -------------------------- +# Enable less verbose build rules; with the default set to DEFAULT +# ("yes" being less verbose, "no" or empty being verbose). +AC_DEFUN([AM_SILENT_RULES], +[AC_ARG_ENABLE([silent-rules], [dnl +AS_HELP_STRING( + [--enable-silent-rules], + [less verbose build output (undo: "make V=1")]) +AS_HELP_STRING( + [--disable-silent-rules], + [verbose build output (undo: "make V=0")])dnl +]) +case $enable_silent_rules in @%:@ ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; +esac +dnl +dnl A few 'make' implementations (e.g., NonStop OS and NextStep) +dnl do not support nested variable expansions. +dnl See automake bug#9928 and bug#10237. +am_make=${MAKE-make} +AC_CACHE_CHECK([whether $am_make supports nested variables], + [am_cv_make_support_nested_variables], + [if AS_ECHO([['TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi]) +if test $am_cv_make_support_nested_variables = yes; then + dnl Using '$V' instead of '$(V)' breaks IRIX make. + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AC_SUBST([AM_V])dnl +AM_SUBST_NOTMAKE([AM_V])dnl +AC_SUBST([AM_DEFAULT_V])dnl +AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl +AC_SUBST([AM_DEFAULT_VERBOSITY])dnl +AM_BACKSLASH='\' +AC_SUBST([AM_BACKSLASH])dnl +_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl +]) + +# Copyright (C) 2001-2021 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-2021 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]) + +# AM_SUBST_NOTMAKE(VARIABLE) +# -------------------------- +# Public sister of _AM_SUBST_NOTMAKE. +AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004-2021 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_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. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AC_SUBST([AMTAR], ['$${TAR-tar}']) + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' + +m4_if([$1], [v7], + [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], + + [m4_case([$1], + [ustar], + [# The POSIX 1988 'ustar' format is defined with fixed-size fields. + # There is notably a 21 bits limit for the UID and the GID. In fact, + # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 + # and bug#13588). + am_max_uid=2097151 # 2^21 - 1 + am_max_gid=$am_max_uid + # The $UID and $GID variables are not portable, so we need to resort + # to the POSIX-mandated id(1) utility. Errors in the 'id' calls + # below are definitely unexpected, so allow the users to see them + # (that is, avoid stderr redirection). + am_uid=`id -u || echo unknown` + am_gid=`id -g || echo unknown` + AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) + if test $am_uid -le $am_max_uid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi + AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) + if test $am_gid -le $am_max_gid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi], + + [pax], + [], + + [m4_fatal([Unknown tar format])]) + + AC_MSG_CHECKING([how to create a $1 tar archive]) + + # Go ahead even if we have the value already cached. We do so because we + # need to set the values for the 'am__tar' and 'am__untar' variables. + _am_tools=${am_cv_prog_tar_$1-$_am_tools} + + 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 /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([m4/ax_pthread.m4]) +m4_include([m4/libtool.m4]) +m4_include([m4/ltoptions.m4]) +m4_include([m4/ltsugar.m4]) +m4_include([m4/ltversion.m4]) +m4_include([m4/lt~obsolete.m4]) +m4_include([m4/ocaml.m4]) diff --git a/bash-completion/Makefile.am b/bash-completion/Makefile.am new file mode 100644 index 0000000..51b8ea1 --- /dev/null +++ b/bash-completion/Makefile.am @@ -0,0 +1,40 @@ +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 $(top_srcdir)/common-rules.mk + +EXTRA_DIST = README + +if HAVE_BASH_COMPLETION + +dist_bashcomp_DATA = nbdkit + +endif diff --git a/bash-completion/Makefile.in b/bash-completion/Makefile.in new file mode 100644 index 0000000..c726254 --- /dev/null +++ b/bash-completion/Makefile.in @@ -0,0 +1,687 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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@ +subdir = bash-completion +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ocaml.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__dist_bashcomp_DATA_DIST) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__dist_bashcomp_DATA_DIST = nbdkit +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 = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(bashcompdir)" +DATA = $(dist_bashcomp_DATA) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/common-rules.mk \ + README +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ +BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ +CARGO = @CARGO@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_PLUGIN_CC = @CC_PLUGIN_CC@ +CC_PLUGIN_CFLAGS = @CC_PLUGIN_CFLAGS@ +CERTTOOL = @CERTTOOL@ +CFLAGS = @CFLAGS@ +COM_ERR_CFLAGS = @COM_ERR_CFLAGS@ +COM_ERR_LIBS = @COM_ERR_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CUT = @CUT@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LDFLAGS = @DL_LDFLAGS@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXT2FS_CFLAGS = @EXT2FS_CFLAGS@ +EXT2FS_LIBS = @EXT2FS_LIBS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GENISOIMAGE = @GENISOIMAGE@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GOARCH = @GOARCH@ +GOLANG = @GOLANG@ +GOOS = @GOOS@ +GOROOT = @GOROOT@ +GREP = @GREP@ +IMPORT_LIBRARY_ON_WINDOWS = @IMPORT_LIBRARY_ON_WINDOWS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +ISOPROG = @ISOPROG@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBLKIO_CFLAGS = @LIBBLKIO_CFLAGS@ +LIBBLKIO_LIBS = @LIBBLKIO_LIBS@ +LIBGUESTFS_CFLAGS = @LIBGUESTFS_CFLAGS@ +LIBGUESTFS_LIBS = @LIBGUESTFS_LIBS@ +LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ +LIBLZMA_LIBS = @LIBLZMA_LIBS@ +LIBNBD_CFLAGS = @LIBNBD_CFLAGS@ +LIBNBD_LIBS = @LIBNBD_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSELINUX_CFLAGS = @LIBSELINUX_CFLAGS@ +LIBSELINUX_LIBS = @LIBSELINUX_LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTORRENT_CFLAGS = @LIBTORRENT_CFLAGS@ +LIBTORRENT_LIBS = @LIBTORRENT_LIBS@ +LIBVIRT_CFLAGS = @LIBVIRT_CFLAGS@ +LIBVIRT_LIBS = @LIBVIRT_LIBS@ +LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ +LIBZSTD_LIBS = @LIBZSTD_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LUA_CFLAGS = @LUA_CFLAGS@ +LUA_LIBS = @LUA_LIBS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MC = @MC@ +MKDIR_P = @MKDIR_P@ +MKISOFS = @MKISOFS@ +NBDKIT_VERSION_MAJOR = @NBDKIT_VERSION_MAJOR@ +NBDKIT_VERSION_MICRO = @NBDKIT_VERSION_MICRO@ +NBDKIT_VERSION_MINOR = @NBDKIT_VERSION_MINOR@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_ON_WINDOWS = @NO_UNDEFINED_ON_WINDOWS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OCAML = @OCAML@ +OCAMLBEST = @OCAMLBEST@ +OCAMLBUILD = @OCAMLBUILD@ +OCAMLC = @OCAMLC@ +OCAMLCDOTOPT = @OCAMLCDOTOPT@ +OCAMLDEP = @OCAMLDEP@ +OCAMLDOC = @OCAMLDOC@ +OCAMLLIB = @OCAMLLIB@ +OCAMLMKLIB = @OCAMLMKLIB@ +OCAMLMKTOP = @OCAMLMKTOP@ +OCAMLOPT = @OCAMLOPT@ +OCAMLOPTDOTOPT = @OCAMLOPTDOTOPT@ +OCAMLOPTFLAGS = @OCAMLOPTFLAGS@ +OCAMLVERSION = @OCAMLVERSION@ +OCAML_MAJOR = @OCAML_MAJOR@ +OCAML_PLUGIN_LIBRARIES = @OCAML_PLUGIN_LIBRARIES@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PERL_ARCHLIB = @PERL_ARCHLIB@ +PERL_CFLAGS = @PERL_CFLAGS@ +PERL_LDOPTS = @PERL_LDOPTS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PODWRAPPER = @PODWRAPPER@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_CXX = @PTHREAD_CXX@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CFLAGS = @PYTHON_CFLAGS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +RUBY_CFLAGS = @RUBY_CFLAGS@ +RUBY_LIBS = @RUBY_LIBS@ +RUSTC = @RUSTC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOEXT = @SOEXT@ +SSH_CFLAGS = @SSH_CFLAGS@ +SSH_LIBS = @SSH_LIBS@ +STAT = @STAT@ +STRIP = @STRIP@ +TCL_CFLAGS = @TCL_CFLAGS@ +TCL_LIBS = @TCL_LIBS@ +TRUNCATE = @TRUNCATE@ +VALGRIND = @VALGRIND@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VERSION = @VERSION@ +WARNINGS_CFLAGS = @WARNINGS_CFLAGS@ +XORRISO = @XORRISO@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +ZLIB_NG_CFLAGS = @ZLIB_NG_CFLAGS@ +ZLIB_NG_LIBS = @ZLIB_NG_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DLLTOOL = @ac_ct_DLLTOOL@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_MC = @ac_ct_MC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bashcompdir = @bashcompdir@ +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@ +filters = @filters@ +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@ +lang_plugins = @lang_plugins@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +non_lang_plugins = @non_lang_plugins@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugins = @plugins@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +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@ + +# Convenient list terminator +NULL = +plugindir = $(libdir)/nbdkit/plugins +filterdir = $(libdir)/nbdkit/filters +CLEANFILES = *~ *.cmi *.cmx *.cmxa *.so *.dll +EXTRA_DIST = README +@HAVE_BASH_COMPLETION_TRUE@dist_bashcomp_DATA = nbdkit +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common-rules.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign bash-completion/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign bash-completion/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; +$(top_srcdir)/common-rules.mk $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-dist_bashcompDATA: $(dist_bashcomp_DATA) + @$(NORMAL_INSTALL) + @list='$(dist_bashcomp_DATA)'; test -n "$(bashcompdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bashcompdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bashcompdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(bashcompdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(bashcompdir)" || exit $$?; \ + done + +uninstall-dist_bashcompDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_bashcomp_DATA)'; test -n "$(bashcompdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(bashcompdir)'; $(am__uninstall_files_from_dir) +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(DATA) +installdirs: + for dir in "$(DESTDIR)$(bashcompdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: 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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-dist_bashcompDATA + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-dist_bashcompDATA + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am \ + install-dist_bashcompDATA install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ + uninstall-am uninstall-dist_bashcompDATA + +.PRECIOUS: Makefile + + +# 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/bash-completion/README b/bash-completion/README new file mode 100644 index 0000000..5708638 --- /dev/null +++ b/bash-completion/README @@ -0,0 +1,8 @@ +This directory contains the scripts for tab-completing commands in +bash. Note these new-style demand-loaded scripts require +bash-completion >= 1.99. + +Tip: To test the bash completions without having to install them, +simply start a new shell and do: + + source ./bash-completion/nbdkit; PATH=$PWD:$PATH diff --git a/bash-completion/nbdkit b/bash-completion/nbdkit new file mode 100644 index 0000000..90d0f22 --- /dev/null +++ b/bash-completion/nbdkit @@ -0,0 +1,112 @@ +# nbdkit bash completion script -*- shell-script -*- +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +_nbdkit_list_plugins () +{ + local plugindir + plugindir="$( + nbdkit --dump-config | grep ^plugindir= | sed 's/^plugindir=//' + )" + ls -1 "$plugindir" | sed 's/^nbdkit-//' | sed 's/-plugin.*//' +} + +_nbdkit_list_filters () +{ + local filterdir + filterdir="$( + nbdkit --dump-config | grep ^filterdir= | sed 's/^filterdir=//' + )" + ls -1 "$filterdir" | sed 's/^nbdkit-//' | sed 's/-filter.*//' +} + +# This handler function is called when the user presses tab. +_nbdkit () +{ + local cur prev words cword split + local shortopts longopts plugin plugins filters args i + + _init_completion -s || return + + # Did we get the plugin name yet? + # This is only a heuristic because it can be confused by + # long opt parameters with an arguments. XXX + plugin= + for (( i=1; i < ${#words[@]}; ++i)) ; do + if [[ "${words[i]}" =~ ^[a-zA-Z0-9]+$ ]]; then + plugin="${words[i]}" + break + fi + done + + # Previous item on the current line is a completable flag or plugin name? + case "$prev" in + --filter) + filters="$(_nbdkit_list_filters)" + COMPREPLY=( $(compgen -W "$filters" "$cur") ) + return ;; + --tls) + COMPREPLY=( $(compgen -W "off on require" "$cur") ) + return ;; + # Could complete -u and -g options too. XXX + esac + + # Current item is an option we can expand? + case "$cur" in + --*) + longopts="$(nbdkit --long-options)" + COMPREPLY=( $(compgen -W "$longopts" -- "$cur") ) + return ;; + -*) + shortopts="$(nbdkit --short-options)" + longopts="$(nbdkit --long-options)" + COMPREPLY=( $(compgen -W "$shortopts $longopts" -- "$cur") ) + return ;; + *) + if [ "$plugin" = "" ] || [ "$plugin" = "$cur" ]; then + # Complete plugin name. + plugins="$(_nbdkit_list_plugins)" + COMPREPLY=( $(compgen -W "$plugins" "$cur") ) + return + else + # Complete plugin args. + args="$( + nbdkit $plugin --help 2>/dev/null | + grep -E '^[-a-z0-9]+=' | sed 's/=.*/=/' + )" + COMPREPLY=( $(compgen -W "$args" "$cur") ) + return + fi + ;; + esac +} + +# Install the handler function. +complete -o default -F _nbdkit nbdkit diff --git a/common-rules.mk b/common-rules.mk new file mode 100644 index 0000000..f7f4eed --- /dev/null +++ b/common-rules.mk @@ -0,0 +1,38 @@ +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +# Convenient list terminator +NULL = + +plugindir = $(libdir)/nbdkit/plugins +filterdir = $(libdir)/nbdkit/filters + +CLEANFILES = *~ *.cmi *.cmx *.cmxa *.so *.dll diff --git a/common/allocators/Makefile.am b/common/allocators/Makefile.am new file mode 100644 index 0000000..8ad31e7 --- /dev/null +++ b/common/allocators/Makefile.am @@ -0,0 +1,56 @@ +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 $(top_srcdir)/common-rules.mk + +noinst_LTLIBRARIES = liballocators.la + +liballocators_la_SOURCES = \ + allocator.c \ + allocator.h \ + allocator-internal.h \ + malloc.c \ + sparse.c \ + zstd.c \ + $(NULL) +liballocators_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/common/replacements \ + -I$(top_srcdir)/common/include \ + -I$(top_srcdir)/common/utils \ + $(NULL) +liballocators_la_CFLAGS = $(WARNINGS_CFLAGS) +liballocators_la_LIBADD = +if HAVE_LIBZSTD +liballocators_la_CFLAGS += $(LIBZSTD_CFLAGS) +liballocators_la_LIBADD += $(LIBZSTD_LIBS) +endif diff --git a/common/allocators/Makefile.in b/common/allocators/Makefile.in new file mode 100644 index 0000000..33549d5 --- /dev/null +++ b/common/allocators/Makefile.in @@ -0,0 +1,850 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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@ +@HAVE_LIBZSTD_TRUE@am__append_1 = $(LIBZSTD_CFLAGS) +@HAVE_LIBZSTD_TRUE@am__append_2 = $(LIBZSTD_LIBS) +subdir = common/allocators +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ocaml.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +am__DEPENDENCIES_1 = +@HAVE_LIBZSTD_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) +liballocators_la_DEPENDENCIES = $(am__DEPENDENCIES_2) +am__objects_1 = +am_liballocators_la_OBJECTS = liballocators_la-allocator.lo \ + liballocators_la-malloc.lo liballocators_la-sparse.lo \ + liballocators_la-zstd.lo $(am__objects_1) +liballocators_la_OBJECTS = $(am_liballocators_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +liballocators_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(liballocators_la_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/liballocators_la-allocator.Plo \ + ./$(DEPDIR)/liballocators_la-malloc.Plo \ + ./$(DEPDIR)/liballocators_la-sparse.Plo \ + ./$(DEPDIR)/liballocators_la-zstd.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(liballocators_la_SOURCES) +DIST_SOURCES = $(liballocators_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/common-rules.mk \ + $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ +BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ +CARGO = @CARGO@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_PLUGIN_CC = @CC_PLUGIN_CC@ +CC_PLUGIN_CFLAGS = @CC_PLUGIN_CFLAGS@ +CERTTOOL = @CERTTOOL@ +CFLAGS = @CFLAGS@ +COM_ERR_CFLAGS = @COM_ERR_CFLAGS@ +COM_ERR_LIBS = @COM_ERR_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CUT = @CUT@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LDFLAGS = @DL_LDFLAGS@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXT2FS_CFLAGS = @EXT2FS_CFLAGS@ +EXT2FS_LIBS = @EXT2FS_LIBS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GENISOIMAGE = @GENISOIMAGE@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GOARCH = @GOARCH@ +GOLANG = @GOLANG@ +GOOS = @GOOS@ +GOROOT = @GOROOT@ +GREP = @GREP@ +IMPORT_LIBRARY_ON_WINDOWS = @IMPORT_LIBRARY_ON_WINDOWS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +ISOPROG = @ISOPROG@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBLKIO_CFLAGS = @LIBBLKIO_CFLAGS@ +LIBBLKIO_LIBS = @LIBBLKIO_LIBS@ +LIBGUESTFS_CFLAGS = @LIBGUESTFS_CFLAGS@ +LIBGUESTFS_LIBS = @LIBGUESTFS_LIBS@ +LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ +LIBLZMA_LIBS = @LIBLZMA_LIBS@ +LIBNBD_CFLAGS = @LIBNBD_CFLAGS@ +LIBNBD_LIBS = @LIBNBD_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSELINUX_CFLAGS = @LIBSELINUX_CFLAGS@ +LIBSELINUX_LIBS = @LIBSELINUX_LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTORRENT_CFLAGS = @LIBTORRENT_CFLAGS@ +LIBTORRENT_LIBS = @LIBTORRENT_LIBS@ +LIBVIRT_CFLAGS = @LIBVIRT_CFLAGS@ +LIBVIRT_LIBS = @LIBVIRT_LIBS@ +LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ +LIBZSTD_LIBS = @LIBZSTD_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LUA_CFLAGS = @LUA_CFLAGS@ +LUA_LIBS = @LUA_LIBS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MC = @MC@ +MKDIR_P = @MKDIR_P@ +MKISOFS = @MKISOFS@ +NBDKIT_VERSION_MAJOR = @NBDKIT_VERSION_MAJOR@ +NBDKIT_VERSION_MICRO = @NBDKIT_VERSION_MICRO@ +NBDKIT_VERSION_MINOR = @NBDKIT_VERSION_MINOR@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_ON_WINDOWS = @NO_UNDEFINED_ON_WINDOWS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OCAML = @OCAML@ +OCAMLBEST = @OCAMLBEST@ +OCAMLBUILD = @OCAMLBUILD@ +OCAMLC = @OCAMLC@ +OCAMLCDOTOPT = @OCAMLCDOTOPT@ +OCAMLDEP = @OCAMLDEP@ +OCAMLDOC = @OCAMLDOC@ +OCAMLLIB = @OCAMLLIB@ +OCAMLMKLIB = @OCAMLMKLIB@ +OCAMLMKTOP = @OCAMLMKTOP@ +OCAMLOPT = @OCAMLOPT@ +OCAMLOPTDOTOPT = @OCAMLOPTDOTOPT@ +OCAMLOPTFLAGS = @OCAMLOPTFLAGS@ +OCAMLVERSION = @OCAMLVERSION@ +OCAML_MAJOR = @OCAML_MAJOR@ +OCAML_PLUGIN_LIBRARIES = @OCAML_PLUGIN_LIBRARIES@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PERL_ARCHLIB = @PERL_ARCHLIB@ +PERL_CFLAGS = @PERL_CFLAGS@ +PERL_LDOPTS = @PERL_LDOPTS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PODWRAPPER = @PODWRAPPER@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_CXX = @PTHREAD_CXX@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CFLAGS = @PYTHON_CFLAGS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +RUBY_CFLAGS = @RUBY_CFLAGS@ +RUBY_LIBS = @RUBY_LIBS@ +RUSTC = @RUSTC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOEXT = @SOEXT@ +SSH_CFLAGS = @SSH_CFLAGS@ +SSH_LIBS = @SSH_LIBS@ +STAT = @STAT@ +STRIP = @STRIP@ +TCL_CFLAGS = @TCL_CFLAGS@ +TCL_LIBS = @TCL_LIBS@ +TRUNCATE = @TRUNCATE@ +VALGRIND = @VALGRIND@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VERSION = @VERSION@ +WARNINGS_CFLAGS = @WARNINGS_CFLAGS@ +XORRISO = @XORRISO@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +ZLIB_NG_CFLAGS = @ZLIB_NG_CFLAGS@ +ZLIB_NG_LIBS = @ZLIB_NG_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DLLTOOL = @ac_ct_DLLTOOL@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_MC = @ac_ct_MC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bashcompdir = @bashcompdir@ +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@ +filters = @filters@ +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@ +lang_plugins = @lang_plugins@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +non_lang_plugins = @non_lang_plugins@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugins = @plugins@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +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@ + +# Convenient list terminator +NULL = +plugindir = $(libdir)/nbdkit/plugins +filterdir = $(libdir)/nbdkit/filters +CLEANFILES = *~ *.cmi *.cmx *.cmxa *.so *.dll +noinst_LTLIBRARIES = liballocators.la +liballocators_la_SOURCES = \ + allocator.c \ + allocator.h \ + allocator-internal.h \ + malloc.c \ + sparse.c \ + zstd.c \ + $(NULL) + +liballocators_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/common/replacements \ + -I$(top_srcdir)/common/include \ + -I$(top_srcdir)/common/utils \ + $(NULL) + +liballocators_la_CFLAGS = $(WARNINGS_CFLAGS) $(am__append_1) +liballocators_la_LIBADD = $(am__append_2) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common-rules.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign common/allocators/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign common/allocators/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; +$(top_srcdir)/common-rules.mk $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +liballocators.la: $(liballocators_la_OBJECTS) $(liballocators_la_DEPENDENCIES) $(EXTRA_liballocators_la_DEPENDENCIES) + $(AM_V_CCLD)$(liballocators_la_LINK) $(liballocators_la_OBJECTS) $(liballocators_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liballocators_la-allocator.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liballocators_la-malloc.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liballocators_la-sparse.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liballocators_la-zstd.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +liballocators_la-allocator.lo: allocator.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liballocators_la_CPPFLAGS) $(CPPFLAGS) $(liballocators_la_CFLAGS) $(CFLAGS) -MT liballocators_la-allocator.lo -MD -MP -MF $(DEPDIR)/liballocators_la-allocator.Tpo -c -o liballocators_la-allocator.lo `test -f 'allocator.c' || echo '$(srcdir)/'`allocator.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liballocators_la-allocator.Tpo $(DEPDIR)/liballocators_la-allocator.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='allocator.c' object='liballocators_la-allocator.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liballocators_la_CPPFLAGS) $(CPPFLAGS) $(liballocators_la_CFLAGS) $(CFLAGS) -c -o liballocators_la-allocator.lo `test -f 'allocator.c' || echo '$(srcdir)/'`allocator.c + +liballocators_la-malloc.lo: malloc.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liballocators_la_CPPFLAGS) $(CPPFLAGS) $(liballocators_la_CFLAGS) $(CFLAGS) -MT liballocators_la-malloc.lo -MD -MP -MF $(DEPDIR)/liballocators_la-malloc.Tpo -c -o liballocators_la-malloc.lo `test -f 'malloc.c' || echo '$(srcdir)/'`malloc.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liballocators_la-malloc.Tpo $(DEPDIR)/liballocators_la-malloc.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='malloc.c' object='liballocators_la-malloc.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liballocators_la_CPPFLAGS) $(CPPFLAGS) $(liballocators_la_CFLAGS) $(CFLAGS) -c -o liballocators_la-malloc.lo `test -f 'malloc.c' || echo '$(srcdir)/'`malloc.c + +liballocators_la-sparse.lo: sparse.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liballocators_la_CPPFLAGS) $(CPPFLAGS) $(liballocators_la_CFLAGS) $(CFLAGS) -MT liballocators_la-sparse.lo -MD -MP -MF $(DEPDIR)/liballocators_la-sparse.Tpo -c -o liballocators_la-sparse.lo `test -f 'sparse.c' || echo '$(srcdir)/'`sparse.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liballocators_la-sparse.Tpo $(DEPDIR)/liballocators_la-sparse.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sparse.c' object='liballocators_la-sparse.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liballocators_la_CPPFLAGS) $(CPPFLAGS) $(liballocators_la_CFLAGS) $(CFLAGS) -c -o liballocators_la-sparse.lo `test -f 'sparse.c' || echo '$(srcdir)/'`sparse.c + +liballocators_la-zstd.lo: zstd.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liballocators_la_CPPFLAGS) $(CPPFLAGS) $(liballocators_la_CFLAGS) $(CFLAGS) -MT liballocators_la-zstd.lo -MD -MP -MF $(DEPDIR)/liballocators_la-zstd.Tpo -c -o liballocators_la-zstd.lo `test -f 'zstd.c' || echo '$(srcdir)/'`zstd.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liballocators_la-zstd.Tpo $(DEPDIR)/liballocators_la-zstd.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='zstd.c' object='liballocators_la-zstd.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liballocators_la_CPPFLAGS) $(CPPFLAGS) $(liballocators_la_CFLAGS) $(CFLAGS) -c -o liballocators_la-zstd.lo `test -f 'zstd.c' || echo '$(srcdir)/'`zstd.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: 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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/liballocators_la-allocator.Plo + -rm -f ./$(DEPDIR)/liballocators_la-malloc.Plo + -rm -f ./$(DEPDIR)/liballocators_la-sparse.Plo + -rm -f ./$(DEPDIR)/liballocators_la-zstd.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/liballocators_la-allocator.Plo + -rm -f ./$(DEPDIR)/liballocators_la-malloc.Plo + -rm -f ./$(DEPDIR)/liballocators_la-sparse.Plo + -rm -f ./$(DEPDIR)/liballocators_la-zstd.Plo + -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: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am 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 tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# 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/common/allocators/allocator-internal.h b/common/allocators/allocator-internal.h new file mode 100644 index 0000000..66a4970 --- /dev/null +++ b/common/allocators/allocator-internal.h @@ -0,0 +1,43 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_ALLOCATOR_INTERNAL_H +#define NBDKIT_ALLOCATOR_INTERNAL_H + +#include "vector.h" + +struct key_value { char *key, *value; }; +DEFINE_VECTOR_TYPE (allocator_parameters, struct key_value); + +extern void register_allocator (const struct allocator_functions *); + +#endif /* NBDKIT_ALLOCATOR_INTERNAL_H */ diff --git a/common/allocators/allocator.c b/common/allocators/allocator.c new file mode 100644 index 0000000..6c2d809 --- /dev/null +++ b/common/allocators/allocator.c @@ -0,0 +1,168 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include +#include + +#include + +#include "allocator.h" +#include "allocator-internal.h" +#include "strndup.h" +#include "vector.h" + +/* The list of registered allocators. */ +DEFINE_VECTOR_TYPE (allocator_list, const struct allocator_functions *); +static allocator_list allocators = empty_vector; + +void +register_allocator (const struct allocator_functions *f) +{ + if (allocator_list_append (&allocators, f) == -1) { + perror ("realloc"); + exit (EXIT_FAILURE); + } +} + +static void +free_key_value (struct key_value kv) +{ + free (kv.key); + free (kv.value); +} + +static void +free_allocator_parameters (allocator_parameters *params) +{ + allocator_parameters_iter (params, free_key_value); + free (params->ptr); +} + +/* The type may be followed by parameters "type,key=value[,...]" */ +static int +parse_parameters (const char *type, size_t *type_len, + allocator_parameters *params) +{ + size_t i, j, len; + + *type_len = strcspn (type, ","); + + nbdkit_debug ("allocator: %*s", (int) *type_len, type); + + /* Split the parameters. */ + for (i = *type_len; type[i] == ',';) { + struct key_value kv; + + i++; + len = strcspn (&type[i], ","); + if (len == 0) { + i++; + continue; + } + + j = strcspn (&type[i], "="); + if (j == 0) { + nbdkit_error ("invalid allocator parameter"); + free_allocator_parameters (params); + return -1; + } + if (j < len) { + kv.key = strndup (&type[i], j); + kv.value = strndup (&type[i+j+1], len-j-1); + } + else { + kv.key = strndup (&type[i], len); + kv.value = strdup ("1"); + } + if (kv.key == NULL || kv.value == NULL) { + nbdkit_error ("strdup: %m"); + free (kv.key); + free (kv.value); + free_allocator_parameters (params); + return -1; + } + + nbdkit_debug ("allocator parameter: %s=%s", kv.key, kv.value); + if (allocator_parameters_append (params, kv) == -1) { + nbdkit_error ("realloc: %m"); + free_allocator_parameters (params); + return -1; + } + i += len; + } + + return 0; +} + +struct allocator * +create_allocator (const char *type, bool debug) +{ + struct allocator *ret = NULL; + allocator_parameters params = empty_vector; + size_t i, type_len; + + if (parse_parameters (type, &type_len, ¶ms) == -1) + return NULL; + + /* See if we can find the allocator. */ + for (i = 0; i < allocators.len; ++i) { + if (strncmp (type, allocators.ptr[i]->type, type_len) == 0) { + ret = allocators.ptr[i]->create (¶ms); + break; + } + } + + if (ret == NULL) + nbdkit_error ("unknown allocator \"%s\"", type); + + /* Free the parameters allocated above. */ + free_allocator_parameters (¶ms); + + if (ret) { + ret->debug = debug; + ret->f = allocators.ptr[i]; + } + return ret; +} + +void +cleanup_free_allocator (struct allocator **ap) +{ + struct allocator *a = *ap; + + if (a && a->f) + a->f->free (a); +} diff --git a/common/allocators/allocator.h b/common/allocators/allocator.h new file mode 100644 index 0000000..03034ba --- /dev/null +++ b/common/allocators/allocator.h @@ -0,0 +1,153 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +/* This defines the generic allocator interface used by + * nbdkit-memory-plugin (and elsewhere) allocator=. It is + * implemented by specific allocators such as sparse.c. + * + * All allocators have an implicit size and grow when required. + * + * All allocators do their own locking if required. + */ + +#ifndef NBDKIT_ALLOCATOR_H +#define NBDKIT_ALLOCATOR_H + +#include +#include + +struct nbdkit_extents; + +struct allocator_functions { + /* Allocator type (eg. "sparse"). + * This does not include the parameters. + */ + const char *type; + + /* Private function called to create an allocator. It should return + * a new struct which is at least as large as struct allocator. It + * may have extra fields for the specific allocator to use. + */ + struct allocator *(*create) (const void *); + + /* Free the allocator instance. */ + void (*free) (struct allocator *a); + + /* Set the size hint. The size hint is used in various ways by some + * allocators, and ignored by others. + * + * The sparse and zstd array allocators ignore the size hint. + * + * The malloc allocator uses it to reserve the expected size of disk + * in memory (especially important if using mlock so we fail during + * start-up if there's not enough RAM). + * + * Note this does not set or enforce the virtual size of the disk, + * nor does it implement bounds checking. + */ + int (*set_size_hint) (struct allocator *a, uint64_t size) + __attribute__ ((__nonnull__ (1))); + + /* Read bytes from [offset, offset+count-1] and copy into buf. + */ + int (*read) (struct allocator *a, void *buf, + uint64_t count, uint64_t offset) + __attribute__ ((__nonnull__ (1, 2))); + + /* Write bytes from buf to [offset, offset+count-1]. Because this + * can allocate memory, it can fail (returning -1). + */ + int (*write) (struct allocator *a, const void *buf, + uint64_t count, uint64_t offset) + __attribute__ ((__nonnull__ (1, 2))); + + /* Fill range [offset, offset+count-1] with a single byte ‘c’. + * If c == '\0', this is the same as .zero below. + */ + int (*fill) (struct allocator *a, char c, uint64_t count, uint64_t offset) + __attribute__ ((__nonnull__ (1))); + + /* Zero range [offset, offset+count-1]. For all allocators zero and + * trim are the same operation. + */ + int (*zero) (struct allocator *a, uint64_t count, uint64_t offset) + __attribute__ ((__nonnull__ (1))); + + /* Blit (copy) between two allocators. Copy count bytes from + * a1.[offset1, offset1+count-1] to a2.[offset2, offset2+count-1]. + * + * Note you have to call the destination blit function, ie: + * a2->blit (a1, a2, ...) + * + * It's permitted for the allocators to have different types. + * However you cannot use this to copy within a single allocator + * (because of locks), ie. a1 must != a2. + */ + int (*blit) (struct allocator *a1, struct allocator *a2, + uint64_t count, uint64_t offset1, uint64_t offset2) + __attribute__ ((__nonnull__ (1, 2))); + + /* Return information about allocated pages and holes. */ + int (*extents) (struct allocator *a, + uint64_t count, uint64_t offset, + struct nbdkit_extents *extents) + __attribute__ ((__nonnull__ (1, 4))); +}; + +struct allocator { + const struct allocator_functions *f; + + /* Debug flag. */ + bool debug; +}; + +/* Create a new allocator, usually from the type passed in the + * allocator= parameter on the nbdkit command line (but you can + * also create your own internal allocators this way). + * + * The debug parameter can be attached to a plugin-specific -D option + * to provide extra debugging. + * + * Note that the type pointer is copied to the first field of the + * returned struct allocator, so it must be statically allocated (or + * at least live as long as the allocator). + * + * On error, calls nbdkit_error and returns NULL. + */ +extern struct allocator *create_allocator (const char *type, bool debug) + __attribute__ ((__nonnull__ (1))); + +#define CLEANUP_FREE_ALLOCATOR \ + __attribute__ ((cleanup (cleanup_free_allocator))) +extern void cleanup_free_allocator (struct allocator **ap); + +#endif /* NBDKIT_ALLOCATOR_H */ diff --git a/common/allocators/malloc.c b/common/allocators/malloc.c new file mode 100644 index 0000000..20772a5 --- /dev/null +++ b/common/allocators/malloc.c @@ -0,0 +1,324 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include +#include + +#ifdef HAVE_SYS_MMAN_H +#include +#endif + +#include + +#include + +#include "cleanup.h" +#include "vector.h" + +#include "allocator.h" +#include "allocator-internal.h" + +/* This allocator implements a direct-mapped non-sparse RAM disk using + * malloc, with optional mlock. + */ + +DEFINE_VECTOR_TYPE (bytearray, uint8_t); + +struct m_alloc { + struct allocator a; /* Must come first. */ + bool use_mlock; + + /* Byte array (vector) implementing the direct-mapped disk. Note we + * don't use the .size field. Accesses must be protected by the + * lock since writes may try to extend the array. + */ + pthread_rwlock_t lock; + bytearray ba; +}; + +static void +m_alloc_free (struct allocator *a) +{ + struct m_alloc *ma = (struct m_alloc *) a; + + if (ma) { + free (ma->ba.ptr); + pthread_rwlock_destroy (&ma->lock); + free (ma); + } +} + +/* Extend the underlying bytearray if needed. */ +static int +extend_without_mlock (struct m_alloc *ma, uint64_t new_size) +{ + size_t old_size, n; + + if (ma->ba.cap < new_size) { + old_size = ma->ba.cap; + n = new_size - ma->ba.cap; + + if (bytearray_reserve (&ma->ba, n) == -1) { + nbdkit_error ("realloc: %m"); + return -1; + } + + /* Initialize the newly allocated memory to 0. */ + memset (ma->ba.ptr + old_size, 0, n); + } + + return 0; +} + +#ifdef HAVE_MLOCK +static int +extend_with_mlock (struct m_alloc *ma, uint64_t new_size) +{ + size_t old_size, n; + + if (ma->ba.cap < new_size) { + old_size = ma->ba.cap; + n = new_size - ma->ba.cap; + +#ifdef HAVE_MUNLOCK + /* Since the memory might be moved by realloc, we must unlock the + * original array. + */ + if (ma->use_mlock && ma->ba.ptr != NULL) + munlock (ma->ba.ptr, ma->ba.cap); +#endif + + if (bytearray_reserve_page_aligned (&ma->ba, n) == -1) { + nbdkit_error ("realloc: %m"); + return -1; + } + + /* Initialize the newly allocated memory to 0. */ + memset (ma->ba.ptr + old_size, 0, n); + + if (mlock (ma->ba.ptr, ma->ba.cap) == -1) { + nbdkit_error ("allocator=malloc: mlock: %m"); + return -1; + } + } + + return 0; +} +#endif /* HAVE_MLOCK */ + +static int +extend (struct m_alloc *ma, uint64_t new_size) +{ + ACQUIRE_WRLOCK_FOR_CURRENT_SCOPE (&ma->lock); + +#ifdef HAVE_MLOCK + if (ma->use_mlock) + return extend_with_mlock (ma, new_size); +#endif + + return extend_without_mlock (ma, new_size); +} + +static int +m_alloc_set_size_hint (struct allocator *a, uint64_t size_hint) +{ + struct m_alloc *ma = (struct m_alloc *) a; + return extend (ma, size_hint); +} + +static int +m_alloc_read (struct allocator *a, void *buf, + uint64_t count, uint64_t offset) +{ + struct m_alloc *ma = (struct m_alloc *) a; + ACQUIRE_RDLOCK_FOR_CURRENT_SCOPE (&ma->lock); + + /* Avoid reading beyond the end of the allocated array. Return + * zeroes for that part. + */ + if (offset >= ma->ba.cap) + memset (buf, 0, count); + else if (offset + count > ma->ba.cap) { + memcpy (buf, ma->ba.ptr + offset, ma->ba.cap - offset); + memset (buf + ma->ba.cap - offset, 0, offset + count - ma->ba.cap); + } + else + memcpy (buf, ma->ba.ptr + offset, count); + + return 0; +} + +static int +m_alloc_write (struct allocator *a, const void *buf, + uint64_t count, uint64_t offset) +{ + struct m_alloc *ma = (struct m_alloc *) a; + + if (extend (ma, offset+count) == -1) + return -1; + + /* This is correct: Even though we are writing, we only need to + * acquire the read lock here. The write lock applies to changing + * the metadata and it was acquired if we called extend(). + */ + ACQUIRE_RDLOCK_FOR_CURRENT_SCOPE (&ma->lock); + memcpy (ma->ba.ptr + offset, buf, count); + return 0; +} + +static int +m_alloc_fill (struct allocator *a, char c, uint64_t count, uint64_t offset) +{ + struct m_alloc *ma = (struct m_alloc *) a; + + if (extend (ma, offset+count) == -1) + return -1; + + /* See comment in m_alloc_write. */ + ACQUIRE_RDLOCK_FOR_CURRENT_SCOPE (&ma->lock); + memset (ma->ba.ptr + offset, c, count); + return 0; +} + +static int +m_alloc_zero (struct allocator *a, uint64_t count, uint64_t offset) +{ + struct m_alloc *ma = (struct m_alloc *) a; + ACQUIRE_RDLOCK_FOR_CURRENT_SCOPE (&ma->lock); + + /* Try to avoid extending the array, since the unallocated part + * always reads as zero. + */ + if (offset < ma->ba.cap) { + if (offset + count > ma->ba.cap) + memset (ma->ba.ptr + offset, 0, ma->ba.cap - offset); + else + memset (ma->ba.ptr + offset, 0, count); + } + + return 0; +} + +static int +m_alloc_blit (struct allocator *a1, struct allocator *a2, + uint64_t count, uint64_t offset1, uint64_t offset2) +{ + struct m_alloc *ma2 = (struct m_alloc *) a2; + + assert (a1 != a2); + assert (strcmp (a2->f->type, "malloc") == 0); + + if (extend (ma2, offset2+count) == -1) + return -1; + + /* See comment in m_alloc_write. */ + ACQUIRE_RDLOCK_FOR_CURRENT_SCOPE (&ma2->lock); + return a1->f->read (a1, ma2->ba.ptr + offset2, count, offset1); +} + +static int +m_alloc_extents (struct allocator *a, + uint64_t count, uint64_t offset, + struct nbdkit_extents *extents) +{ + /* Always fully allocated. XXX In theory we could detect zeroes + * quite quickly and return that information, allowing the client to + * avoid reads. However we'd probably want to store a bitmap of + * which sectors we are known to have written to, and that + * complicates the implementation quite a lot. + */ + return nbdkit_add_extent (extents, offset, count, 0); +} + +struct allocator * +m_alloc_create (const void *paramsv) +{ + const allocator_parameters *params = paramsv; + struct m_alloc *ma; + bool use_mlock = false; + size_t i; + + /* Parse the optional mlock=true|false parameter. */ + for (i = 0; i < params->len; ++i) { + if (strcmp (params->ptr[i].key, "mlock") == 0) { + int r = nbdkit_parse_bool (params->ptr[i].value); + if (r == -1) return NULL; + use_mlock = r; +#ifndef HAVE_MLOCK + if (use_mlock) { + nbdkit_error ("mlock is not supported on this platform"); + return NULL; + } +#endif + } + else { + nbdkit_error ("allocator=malloc: unknown parameter %s", + params->ptr[i].key); + return NULL; + } + } + + ma = calloc (1, sizeof *ma); + if (ma == NULL) { + nbdkit_error ("calloc: %m"); + return NULL; + } + ma->use_mlock = use_mlock; + pthread_rwlock_init (&ma->lock, NULL); + ma->ba = (bytearray) empty_vector; + return (struct allocator *) ma; +} + +static struct allocator_functions functions = { + .type = "malloc", + .create = m_alloc_create, + .free = m_alloc_free, + .set_size_hint = m_alloc_set_size_hint, + .read = m_alloc_read, + .write = m_alloc_write, + .fill = m_alloc_fill, + .zero = m_alloc_zero, + .blit = m_alloc_blit, + .extents = m_alloc_extents, +}; + +static void register_malloc (void) __attribute__ ((constructor)); + +static void +register_malloc (void) +{ + register_allocator (&functions); +} diff --git a/common/allocators/sparse.c b/common/allocators/sparse.c new file mode 100644 index 0000000..7f2abbf --- /dev/null +++ b/common/allocators/sparse.c @@ -0,0 +1,617 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include "cleanup.h" +#include "iszero.h" +#include "vector.h" + +#include "allocator.h" +#include "allocator-internal.h" + +/* This allocator implements a sparse array of any size up to 2⁶³-1 + * bytes. + * + * The array reads as zeroes until something is written. + * + * The implementation aims to be reasonably efficient for ordinary + * sized disks, while permitting huge (but sparse) disks for testing. + * Everything allocated has to be stored in memory. There is no + * temporary file backing. + */ + +/* Two level directory for the sparse array. + * + * nbdkit supports disk sizes up to 2⁶³-1. The aim of the sparse + * array is to support up to 63 bit images for testing, although it + * won't necessarily be efficient for that use. However it should + * also be efficient for more reasonable sized disks. + * + * Although the CPU implements effectively the same kind of data + * structure (page tables) there are some advantages of reimplementing + * this: + * + * 1. Support for 32 bit (or even 64 bit since the virtual memory + * address space on 64 bit machines is not 63 bits in size). + * + * 2. In Linux, overcommit defaults prevent use of virtual memory as a + * sparse array without intrusive system configuration changes. + * + * 3. Could choose a page size which is more appropriate for disk + * images, plus some architectures have much larger page sizes than + * others making behaviour inconsistent across arches. + * + * To achieve this we use a B-Tree-like structure. The L1 directory + * contains an ordered, non-overlapping, non-contiguous list of + * (offset, pointer to L2 directory). + * + * Updating the L1 directory requires a linear scan but that operation + * should be very rare. Because the L1 directory is stored in order + * of offset, we can use an efficient binary search for lookups. + * + * Each L1 directory entry can address up to SPARSE_PAGE*L2_SIZE bytes + * in the virtual disk image. With the current parameters this is + * 128MB, which is enough for a 100MB image to fit into a single L1 + * directory, or a 10GB image to fit into 80 L1 entries. The page + * pointers in the L2 directory can be NULL (meaning no page / all + * zeroes). + * + * ┌────────────────────┐ + * │ L1 directory │ ┌────────────────────┐ + * │ offset, entry 0 ─────────▶ | L2 directory | + * │ offset, entry 1 │ | page 0 ─────────▶ page + * │ offset, entry 2 │ │ page 1 ─────────▶ page + * │ ... │ │ page 2 ─────────▶ page + * └────────────────────┘ │ ... │ + * │ page L2_SIZE-1 ─────────▶ page + * └────────────────────┘ + */ +#define SPARSE_PAGE 32768 +#define L2_SIZE 4096 + +struct l2_entry { + void *page; /* Pointer to page (array of SPARSE_PAGE bytes).*/ +}; + +struct l1_entry { + uint64_t offset; /* Virtual offset of this entry. */ + struct l2_entry *l2_dir; /* Pointer to L2 directory (L2_SIZE entries). */ +}; + +DEFINE_VECTOR_TYPE (l1_dir, struct l1_entry); + +struct sparse_array { + struct allocator a; /* Must come first. */ + + /* The shared (read) lock must be held if you just want to access + * the data without modifying any of the L1/L2 metadata or + * allocating or freeing any page. + * + * To modify the L1/L2 metadata including allocating or freeing any + * page you must hold the exclusive (write) lock. + * + * Because POSIX rwlocks are not upgradable this presents a problem. + * We solve it below by speculatively performing the request while + * holding the shared lock, but if we run into an operation that + * needs to update the metadata, we restart the entire request + * holding the exclusive lock. + */ + pthread_rwlock_t lock; + l1_dir l1_dir; /* L1 directory. */ +}; + +/* Free L1 and/or L2 directories. */ +static void +free_l2_dir (struct l2_entry *l2_dir) +{ + size_t i; + + for (i = 0; i < L2_SIZE; ++i) + free (l2_dir[i].page); + free (l2_dir); +} + +static void +sparse_array_free (struct allocator *a) +{ + struct sparse_array *sa = (struct sparse_array *) a; + size_t i; + + if (sa) { + for (i = 0; i < sa->l1_dir.len; ++i) + free_l2_dir (sa->l1_dir.ptr[i].l2_dir); + free (sa->l1_dir.ptr); + pthread_rwlock_destroy (&sa->lock); + free (sa); + } +} + +static int +sparse_array_set_size_hint (struct allocator *a, uint64_t size) +{ + /* Ignored. */ + return 0; +} + +/* Comparison function used when searching through the L1 directory. */ +static int +compare_l1_offsets (const void *offsetp, const struct l1_entry *e) +{ + const uint64_t offset = *(uint64_t *)offsetp; + + if (offset < e->offset) return -1; + if (offset >= e->offset + SPARSE_PAGE*L2_SIZE) return 1; + return 0; +} + +/* Insert an entry in the L1 directory, keeping it ordered by offset. + * This involves an expensive linear scan but should be very rare. + */ +static int +insert_l1_entry (struct sparse_array *sa, const struct l1_entry *entry) +{ + size_t i; + + for (i = 0; i < sa->l1_dir.len; ++i) { + if (entry->offset < sa->l1_dir.ptr[i].offset) { + /* Insert new entry before i'th directory entry. */ + if (l1_dir_insert (&sa->l1_dir, *entry, i) == -1) { + nbdkit_error ("realloc: %m"); + return -1; + } + if (sa->a.debug) + nbdkit_debug ("%s: inserted new L1 entry for %" PRIu64 + " at l1_dir.ptr[%zu]", + __func__, entry->offset, i); + return 0; + } + + /* This should never happens since each entry in the the L1 + * directory is supposed to be unique. + */ + assert (entry->offset != sa->l1_dir.ptr[i].offset); + } + + /* Insert new entry at the end. */ + if (l1_dir_append (&sa->l1_dir, *entry) == -1) { + nbdkit_error ("realloc: %m"); + return -1; + } + if (sa->a.debug) + nbdkit_debug ("%s: inserted new L1 entry for %" PRIu64 + " at end of l1_dir", __func__, entry->offset); + return 0; +} + +/* Look up a virtual offset, returning the address of the offset, the + * count of bytes to the end of the page, and a pointer to the L2 + * directory entry containing the page pointer. + * + * If the create flag is set then a new page and/or directory will be + * allocated if necessary. Use this flag when writing. + * + * NULL may be returned normally if the page is not mapped (meaning it + * reads as zero). However if the create flag is set and NULL is + * returned, this indicates an error. + */ +static void * +lookup (struct sparse_array *sa, uint64_t offset, bool create, + uint64_t *remaining, struct l2_entry **l2_entry) +{ + struct l1_entry *entry; + struct l2_entry *l2_dir; + uint64_t o; + void *page; + struct l1_entry new_entry; + + *remaining = SPARSE_PAGE - (offset & (SPARSE_PAGE-1)); + + again: + /* Search the L1 directory. */ + entry = l1_dir_search (&sa->l1_dir, &offset, compare_l1_offsets); + + if (sa->a.debug) { + if (entry) + nbdkit_debug ("%s: search L1 dir: entry found: offset %" PRIu64, + __func__, entry->offset); + else + nbdkit_debug ("%s: search L1 dir: no entry found", __func__); + } + + if (entry) { + l2_dir = entry->l2_dir; + + /* Which page in the L2 directory? */ + o = (offset - entry->offset) / SPARSE_PAGE; + if (l2_entry) + *l2_entry = &l2_dir[o]; + page = l2_dir[o].page; + if (!page && create) { + /* No page allocated. Allocate one if creating. */ + page = calloc (SPARSE_PAGE, 1); + if (page == NULL) { + nbdkit_error ("calloc: %m"); + return NULL; + } + l2_dir[o].page = page; + } + if (!page) + return NULL; + else + return page + (offset & (SPARSE_PAGE-1)); + } + + /* No L1 directory entry found. */ + if (!create) + return NULL; + + /* No L1 directory entry, and we're creating, so we need to allocate + * a new L1 directory entry and insert it in the L1 directory, and + * allocate the L2 directory with NULL page pointers. Then we can + * repeat the above search to create the page. + */ + new_entry.offset = offset & ~(SPARSE_PAGE*L2_SIZE-1); + new_entry.l2_dir = calloc (L2_SIZE, sizeof (struct l2_entry)); + if (new_entry.l2_dir == NULL) { + nbdkit_error ("calloc: %m"); + return NULL; + } + if (insert_l1_entry (sa, &new_entry) == -1) { + free (new_entry.l2_dir); + return NULL; + } + goto again; +} + +static int +sparse_array_read (struct allocator *a, + void *buf, uint64_t count, uint64_t offset) +{ + struct sparse_array *sa = (struct sparse_array *) a; + /* Because reads never modify any metadata, it is always safe to + * only hold the shared (read) lock. + */ + ACQUIRE_RDLOCK_FOR_CURRENT_SCOPE (&sa->lock); + uint64_t n; + void *p; + + while (count > 0) { + p = lookup (sa, offset, false, &n, NULL); + if (n > count) + n = count; + + if (p == NULL) + memset (buf, 0, n); + else + memcpy (buf, p, n); + + buf += n; + count -= n; + offset += n; + } + + return 0; +} + +#define RESTART_EXCLUSIVE -2 + +static int +do_write (bool exclusive, struct sparse_array *sa, + const void *buf, uint64_t count, uint64_t offset) +{ + uint64_t n; + void *p; + + while (count > 0) { + if (!exclusive) { + /* If we only hold the shared lock, try it without allocating. */ + p = lookup (sa, offset, false, &n, NULL); + if (p == NULL) + return RESTART_EXCLUSIVE; + } + else { + p = lookup (sa, offset, true, &n, NULL); + if (p == NULL) + return -1; + } + + if (n > count) + n = count; + memcpy (p, buf, n); + + buf += n; + count -= n; + offset += n; + } + + return 0; +} + +static int +sparse_array_write (struct allocator *a, + const void *buf, uint64_t count, uint64_t offset) +{ + struct sparse_array *sa = (struct sparse_array *) a; + int r; + + /* First try the write with the shared (read) lock held. */ + { + ACQUIRE_RDLOCK_FOR_CURRENT_SCOPE (&sa->lock); + r = do_write (false, sa, buf, count, offset); + } + + /* If that failed because we need the exclusive lock, restart. */ + if (r == RESTART_EXCLUSIVE) { + ACQUIRE_WRLOCK_FOR_CURRENT_SCOPE (&sa->lock); + r = do_write (true, sa, buf, count, offset); + } + + return r; +} + +static int sparse_array_zero (struct allocator *a, + uint64_t count, uint64_t offset); + +static int +sparse_array_fill (struct allocator *a, char c, + uint64_t count, uint64_t offset) +{ + struct sparse_array *sa = (struct sparse_array *) a; + uint64_t n; + void *p; + + if (c == 0) + return sparse_array_zero (a, count, offset); + + /* Since fill is never called on a hot path, use the exclusive lock. */ + ACQUIRE_WRLOCK_FOR_CURRENT_SCOPE (&sa->lock); + + while (count > 0) { + p = lookup (sa, offset, true, &n, NULL); + if (p == NULL) + return -1; + + if (n > count) + n = count; + memset (p, c, n); + + count -= n; + offset += n; + } + + return 0; +} + +static int +do_zero (bool exclusive, struct sparse_array *sa, + uint64_t count, uint64_t offset) +{ + uint64_t n; + void *p; + struct l2_entry *l2_entry; + + while (count > 0) { + p = lookup (sa, offset, false, &n, &l2_entry); + if (n > count) + n = count; + + if (p) { + if (n < SPARSE_PAGE) + memset (p, 0, n); + else + assert (p == l2_entry->page); + + /* If the whole page is now zero, free it. */ + if (n >= SPARSE_PAGE || is_zero (l2_entry->page, SPARSE_PAGE)) { + if (!exclusive) + return RESTART_EXCLUSIVE; + + if (sa->a.debug) + nbdkit_debug ("%s: freeing zero page at offset %" PRIu64, + __func__, offset); + free (l2_entry->page); + l2_entry->page = NULL; + } + } + + count -= n; + offset += n; + } + + return 0; +} + +static int +sparse_array_zero (struct allocator *a, uint64_t count, uint64_t offset) +{ + struct sparse_array *sa = (struct sparse_array *) a; + int r; + + /* First try the zero with the shared (read) lock held. */ + { + ACQUIRE_RDLOCK_FOR_CURRENT_SCOPE (&sa->lock); + r = do_zero (false, sa, count, offset); + } + + /* If that failed because we need the exclusive lock, restart. */ + if (r == RESTART_EXCLUSIVE) { + ACQUIRE_WRLOCK_FOR_CURRENT_SCOPE (&sa->lock); + r = do_zero (true, sa, count, offset); + } + + return r; +} + +static int +sparse_array_blit (struct allocator *a1, + struct allocator *a2, + uint64_t count, + uint64_t offset1, uint64_t offset2) +{ + struct sparse_array *sa2 = (struct sparse_array *) a2; + /* Since blit is never called on a hot path, use the exclusive lock. */ + ACQUIRE_WRLOCK_FOR_CURRENT_SCOPE (&sa2->lock); + uint64_t n; + void *p; + struct l2_entry *l2_entry; + + assert (a1 != a2); + assert (strcmp (a2->f->type, "sparse") == 0); + + while (count > 0) { + p = lookup (sa2, offset2, true, &n, &l2_entry); + if (p == NULL) + return -1; + + if (n > count) + n = count; + + /* Read the source allocator (a1) directly to p which points into + * the right place in sa2. + */ + if (a1->f->read (a1, p, n, offset1) == -1) + return -1; + + /* If the whole page is now zero, free it. */ + if (is_zero (l2_entry->page, SPARSE_PAGE)) { + if (sa2->a.debug) + nbdkit_debug ("%s: freeing zero page at offset %" PRIu64, + __func__, offset2); + free (l2_entry->page); + l2_entry->page = NULL; + } + + count -= n; + offset1 += n; + offset2 += n; + } + + return 0; +} + +static int +sparse_array_extents (struct allocator *a, + uint64_t count, uint64_t offset, + struct nbdkit_extents *extents) +{ + struct sparse_array *sa = (struct sparse_array *) a; + /* Reading extents never modifies any metadata, so it is always safe + * to only hold the shared (read) lock. + */ + ACQUIRE_RDLOCK_FOR_CURRENT_SCOPE (&sa->lock); + uint64_t n; + uint32_t type; + void *p; + + while (count > 0) { + p = lookup (sa, offset, false, &n, NULL); + + /* Work out the type of this extent. */ + if (p == NULL) + /* No backing page, so it's a hole. */ + type = NBDKIT_EXTENT_HOLE | NBDKIT_EXTENT_ZERO; + else { + if (is_zero (p, n)) + /* A backing page and it's all zero, it's a zero extent. */ + type = NBDKIT_EXTENT_ZERO; + else + /* Normal allocated data. */ + type = 0; + } + if (nbdkit_add_extent (extents, offset, n, type) == -1) + return -1; + + if (n > count) + n = count; + + count -= n; + offset += n; + } + + return 0; +} + +static struct allocator * +sparse_array_create (const void *paramsv) +{ + const allocator_parameters *params = paramsv; + struct sparse_array *sa; + + if (params->len > 0) { + nbdkit_error ("allocator=sparse does not take extra parameters"); + return NULL; + } + + sa = calloc (1, sizeof *sa); + if (sa == NULL) { + nbdkit_error ("calloc: %m"); + return NULL; + } + pthread_rwlock_init (&sa->lock, NULL); + + return (struct allocator *) sa; +} + +static struct allocator_functions functions = { + .type = "sparse", + .create = sparse_array_create, + .free = sparse_array_free, + .set_size_hint = sparse_array_set_size_hint, + .read = sparse_array_read, + .write = sparse_array_write, + .fill = sparse_array_fill, + .zero = sparse_array_zero, + .blit = sparse_array_blit, + .extents = sparse_array_extents, +}; + +static void register_sparse_array (void) __attribute__ ((constructor)); + +static void +register_sparse_array (void) +{ + register_allocator (&functions); +} diff --git a/common/allocators/zstd.c b/common/allocators/zstd.c new file mode 100644 index 0000000..7b063b0 --- /dev/null +++ b/common/allocators/zstd.c @@ -0,0 +1,656 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include "cleanup.h" +#include "iszero.h" +#include "vector.h" + +#include "allocator.h" +#include "allocator-internal.h" + +#ifdef HAVE_LIBZSTD + +#include + +/* This is derived from the sparse array implementation - see + * common/allocators/sparse.c for details of how it works. + * + * TO DO: + * + * (1) We can avoid decompressing a page if we know we are going to + * write over / trim / zero the whole page. + * + * (2) Locking is correct but very naive. It should be possible to + * take much more fine-grained locks. + * + * (3) Better stats: Can we iterate over the page table in order to + * find the ratio of uncompressed : compressed? + * + * Once some optimizations are made it would be worth profiling to + * find the hot spots. + */ +#define ZSTD_PAGE 32768 +#define L2_SIZE 4096 + +struct l2_entry { + void *page; /* Pointer to compressed data. */ +}; + +struct l1_entry { + uint64_t offset; /* Virtual offset of this entry. */ + struct l2_entry *l2_dir; /* Pointer to L2 directory (L2_SIZE entries). */ +}; + +DEFINE_VECTOR_TYPE (l1_dir, struct l1_entry); + +struct zstd_array { + struct allocator a; /* Must come first. */ + pthread_mutex_t lock; + l1_dir l1_dir; /* L1 directory. */ + + /* Compression context and decompression stream. We use the + * streaming API for decompression because it allows us to + * decompress without storing the compressed size, so we need a + * streaming object. But in fact decompression context and stream + * are the same thing since zstd 1.3.0. + * + * If we ever get serious about making this allocator work well + * multi-threaded [at the moment the locking is too course-grained], + * then the zstd documentation recommends creating a context per + * thread. + */ + ZSTD_CCtx *zcctx; + ZSTD_DStream *zdstrm; + + /* Collect stats when we compress a page. */ + uint64_t stats_uncompressed_bytes; + uint64_t stats_compressed_bytes; +}; + +/* Free L1 and/or L2 directories. */ +static void +free_l2_dir (struct l2_entry *l2_dir) +{ + size_t i; + + for (i = 0; i < L2_SIZE; ++i) + free (l2_dir[i].page); + free (l2_dir); +} + +static void +zstd_array_free (struct allocator *a) +{ + struct zstd_array *za = (struct zstd_array *) a; + size_t i; + + if (za) { + if (za->stats_compressed_bytes > 0) + nbdkit_debug ("zstd: compression ratio: %g : 1", + (double) za->stats_uncompressed_bytes / + za->stats_compressed_bytes); + + ZSTD_freeCCtx (za->zcctx); + ZSTD_freeDStream (za->zdstrm); + for (i = 0; i < za->l1_dir.len; ++i) + free_l2_dir (za->l1_dir.ptr[i].l2_dir); + free (za->l1_dir.ptr); + pthread_mutex_destroy (&za->lock); + free (za); + } +} + +static int +zstd_array_set_size_hint (struct allocator *a, uint64_t size) +{ + /* Ignored. */ + return 0; +} + +/* Comparison function used when searching through the L1 directory. */ +static int +compare_l1_offsets (const void *offsetp, const struct l1_entry *e) +{ + const uint64_t offset = *(uint64_t *)offsetp; + + if (offset < e->offset) return -1; + if (offset >= e->offset + ZSTD_PAGE*L2_SIZE) return 1; + return 0; +} + +/* Insert an entry in the L1 directory, keeping it ordered by offset. + * This involves an expensive linear scan but should be very rare. + */ +static int +insert_l1_entry (struct zstd_array *za, const struct l1_entry *entry) +{ + size_t i; + + for (i = 0; i < za->l1_dir.len; ++i) { + if (entry->offset < za->l1_dir.ptr[i].offset) { + /* Insert new entry before i'th directory entry. */ + if (l1_dir_insert (&za->l1_dir, *entry, i) == -1) { + nbdkit_error ("realloc: %m"); + return -1; + } + if (za->a.debug) + nbdkit_debug ("%s: inserted new L1 entry for %" PRIu64 + " at l1_dir.ptr[%zu]", + __func__, entry->offset, i); + return 0; + } + + /* This should never happens since each entry in the the L1 + * directory is supposed to be unique. + */ + assert (entry->offset != za->l1_dir.ptr[i].offset); + } + + /* Insert new entry at the end. */ + if (l1_dir_append (&za->l1_dir, *entry) == -1) { + nbdkit_error ("realloc: %m"); + return -1; + } + if (za->a.debug) + nbdkit_debug ("%s: inserted new L1 entry for %" PRIu64 + " at end of l1_dir", __func__, entry->offset); + return 0; +} + +/* Look up a virtual offset. + * + * If the L2 page is mapped then this uncompresses the page into the + * caller's buffer (of size ZSTD_PAGE), returning the address of the + * offset, the count of bytes to the end of the page, and a pointer to + * the L2 directory entry containing the page pointer. + * + * If the L2 page is not mapped this clears the caller's buffer, also + * returning the pointer. + * + * To read data you don't need to do anything else. + * + * To write data, after updating the buffer, you must subsequently + * call compress() below. + * + * This function cannot return an error. + */ +static void * +lookup_decompress (struct zstd_array *za, uint64_t offset, void *buf, + uint64_t *remaining, struct l2_entry **l2_entry) +{ + struct l1_entry *entry; + struct l2_entry *l2_dir; + uint64_t o; + void *page; + + *remaining = ZSTD_PAGE - (offset & (ZSTD_PAGE-1)); + + /* Search the L1 directory. */ + entry = l1_dir_search (&za->l1_dir, &offset, compare_l1_offsets); + + if (za->a.debug) { + if (entry) + nbdkit_debug ("%s: search L1 dir: entry found: offset %" PRIu64, + __func__, entry->offset); + else + nbdkit_debug ("%s: search L1 dir: no entry found", __func__); + } + + if (entry) { + l2_dir = entry->l2_dir; + + /* Which page in the L2 directory? */ + o = (offset - entry->offset) / ZSTD_PAGE; + if (l2_entry) + *l2_entry = &l2_dir[o]; + page = l2_dir[o].page; + + if (page) { + /* Decompress the page into the user buffer. We assume this can + * never fail since the only pages we decompress are ones we + * have compressed. We use the streaming API because the normal + * ZSTD_decompressDCtx function requires the compressed size, + * whereas the streaming API does not. + */ + ZSTD_inBuffer inb = { .src = page, .size = SIZE_MAX, .pos = 0 }; + ZSTD_outBuffer outb = { .dst = buf, .size = ZSTD_PAGE, .pos = 0 }; + + ZSTD_initDStream (za->zdstrm); + while (outb.pos < outb.size) + ZSTD_decompressStream (za->zdstrm, &outb, &inb); + assert (outb.pos == ZSTD_PAGE); + } + else + memset (buf, 0, ZSTD_PAGE); + + return buf + (offset & (ZSTD_PAGE-1)); + } + + /* No L1 directory entry found. */ + memset (buf, 0, ZSTD_PAGE); + return buf + (offset & (ZSTD_PAGE-1)); +} + +/* Compress a page back after modifying it. + * + * This replaces a L2 page with a new version compressed from the + * modified user buffer. + * + * It may fail, calling nbdkit_error and returning -1. + */ +static int +compress (struct zstd_array *za, uint64_t offset, void *buf) +{ + struct l1_entry *entry; + struct l2_entry *l2_dir; + uint64_t o; + void *page; + struct l1_entry new_entry; + size_t n; + + again: + /* Search the L1 directory. */ + entry = l1_dir_search (&za->l1_dir, &offset, compare_l1_offsets); + + if (za->a.debug) { + if (entry) + nbdkit_debug ("%s: search L1 dir: entry found: offset %" PRIu64, + __func__, entry->offset); + else + nbdkit_debug ("%s: search L1 dir: no entry found", __func__); + } + + if (entry) { + l2_dir = entry->l2_dir; + + /* Which page in the L2 directory? */ + o = (offset - entry->offset) / ZSTD_PAGE; + free (l2_dir[o].page); + l2_dir[o].page = NULL; + + /* Allocate a new page. */ + n = ZSTD_compressBound (ZSTD_PAGE); + page = malloc (n); + if (page == NULL) { + nbdkit_error ("malloc: %m"); + return -1; + } + n = ZSTD_compressCCtx (za->zcctx, page, n, + buf, ZSTD_PAGE, ZSTD_CLEVEL_DEFAULT); + if (ZSTD_isError (n)) { + nbdkit_error ("ZSTD_compressCCtx: %s", ZSTD_getErrorName (n)); + return -1; + } + page = realloc (page, n); + assert (page != NULL); + l2_dir[o].page = page; + za->stats_uncompressed_bytes += ZSTD_PAGE; + za->stats_compressed_bytes += n; + return 0; + } + + /* No L1 directory entry, so we need to allocate a new L1 directory + * entry and insert it in the L1 directory, and allocate the L2 + * directory with NULL page pointers. Then we can repeat the above + * search to create the page. + */ + new_entry.offset = offset & ~(ZSTD_PAGE*L2_SIZE-1); + new_entry.l2_dir = calloc (L2_SIZE, sizeof (struct l2_entry)); + if (new_entry.l2_dir == NULL) { + nbdkit_error ("calloc: %m"); + return -1; + } + if (insert_l1_entry (za, &new_entry) == -1) { + free (new_entry.l2_dir); + return -1; + } + goto again; +} + +static int +zstd_array_read (struct allocator *a, + void *buf, uint64_t count, uint64_t offset) +{ + struct zstd_array *za = (struct zstd_array *) a; + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&za->lock); + CLEANUP_FREE void *tbuf = NULL; + uint64_t n; + void *p; + + tbuf = malloc (ZSTD_PAGE); + if (tbuf == NULL) { + nbdkit_error ("malloc: %m"); + return -1; + } + + while (count > 0) { + p = lookup_decompress (za, offset, tbuf, &n, NULL); + if (n > count) + n = count; + + memcpy (buf, p, n); + + buf += n; + count -= n; + offset += n; + } + + return 0; +} + +static int +zstd_array_write (struct allocator *a, + const void *buf, uint64_t count, uint64_t offset) +{ + struct zstd_array *za = (struct zstd_array *) a; + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&za->lock); + CLEANUP_FREE void *tbuf = NULL; + uint64_t n; + void *p; + + tbuf = malloc (ZSTD_PAGE); + if (tbuf == NULL) { + nbdkit_error ("malloc: %m"); + return -1; + } + + while (count > 0) { + p = lookup_decompress (za, offset, tbuf, &n, NULL); + + if (n > count) + n = count; + memcpy (p, buf, n); + + if (compress (za, offset, tbuf) == -1) + return -1; + + buf += n; + count -= n; + offset += n; + } + + return 0; +} + +static int zstd_array_zero (struct allocator *a, + uint64_t count, uint64_t offset); + +static int +zstd_array_fill (struct allocator *a, char c, + uint64_t count, uint64_t offset) +{ + struct zstd_array *za = (struct zstd_array *) a; + CLEANUP_FREE void *tbuf = NULL; + uint64_t n; + void *p; + + if (c == 0) { + zstd_array_zero (a, count, offset); + return 0; + } + + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&za->lock); + + tbuf = malloc (ZSTD_PAGE); + if (tbuf == NULL) { + nbdkit_error ("malloc: %m"); + return -1; + } + + while (count > 0) { + p = lookup_decompress (za, offset, tbuf, &n, NULL); + + if (n > count) + n = count; + memset (p, c, n); + + if (compress (za, offset, tbuf) == -1) + return -1; + + count -= n; + offset += n; + } + + return 0; +} + +static int +zstd_array_zero (struct allocator *a, uint64_t count, uint64_t offset) +{ + struct zstd_array *za = (struct zstd_array *) a; + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&za->lock); + CLEANUP_FREE void *tbuf = NULL; + uint64_t n; + void *p; + struct l2_entry *l2_entry = NULL; + + tbuf = malloc (ZSTD_PAGE); + if (tbuf == NULL) { + nbdkit_error ("malloc: %m"); + return -1; + } + + while (count > 0) { + p = lookup_decompress (za, offset, tbuf, &n, &l2_entry); + + if (n > count) + n = count; + memset (p, 0, n); + + if (l2_entry && l2_entry->page) { + /* If the whole page is now zero, free it. */ + if (n >= ZSTD_PAGE || is_zero (l2_entry->page, ZSTD_PAGE)) { + if (za->a.debug) + nbdkit_debug ("%s: freeing zero page at offset %" PRIu64, + __func__, offset); + free (l2_entry->page); + l2_entry->page = NULL; + } + else { + if (compress (za, offset, tbuf) == -1) + return -1; + } + } + + count -= n; + offset += n; + } + + return 0; +} + +static int +zstd_array_blit (struct allocator *a1, + struct allocator *a2, + uint64_t count, + uint64_t offset1, uint64_t offset2) +{ + struct zstd_array *za2 = (struct zstd_array *) a2; + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&za2->lock); + CLEANUP_FREE void *tbuf = NULL; + uint64_t n; + void *p; + + assert (a1 != a2); + assert (strcmp (a2->f->type, "zstd") == 0); + + tbuf = malloc (ZSTD_PAGE); + if (tbuf == NULL) { + nbdkit_error ("malloc: %m"); + return -1; + } + + while (count > 0) { + p = lookup_decompress (za2, offset2, tbuf, &n, NULL); + + if (n > count) + n = count; + + /* Read the source allocator (a1) directly to p which points into + * the right place in za2. + */ + if (a1->f->read (a1, p, n, offset1) == -1) + return -1; + + if (compress (za2, offset2, tbuf) == -1) + return -1; + + count -= n; + offset1 += n; + offset2 += n; + } + + return 0; +} + +static int +zstd_array_extents (struct allocator *a, + uint64_t count, uint64_t offset, + struct nbdkit_extents *extents) +{ + struct zstd_array *za = (struct zstd_array *) a; + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&za->lock); + CLEANUP_FREE void *buf = NULL; + uint64_t n; + uint32_t type; + void *p; + struct l2_entry *l2_entry; + + buf = malloc (ZSTD_PAGE); + if (buf == NULL) { + nbdkit_error ("malloc: %m"); + return -1; + } + + while (count > 0) { + p = lookup_decompress (za, offset, buf, &n, &l2_entry); + + /* Work out the type of this extent. */ + if (l2_entry->page == NULL) + /* No backing page, so it's a hole. */ + type = NBDKIT_EXTENT_HOLE | NBDKIT_EXTENT_ZERO; + else { + if (is_zero (p, n)) + /* A backing page and it's all zero, it's a zero extent. */ + type = NBDKIT_EXTENT_ZERO; + else + /* Normal allocated data. */ + type = 0; + } + if (nbdkit_add_extent (extents, offset, n, type) == -1) + return -1; + + if (n > count) + n = count; + + count -= n; + offset += n; + } + + return 0; +} + +struct allocator * +zstd_array_create (const void *paramsv) +{ + const allocator_parameters *params = paramsv; + struct zstd_array *za; + + if (params->len > 0) { + nbdkit_error ("allocator=zstd does not take extra parameters"); + return NULL; + } + + za = calloc (1, sizeof *za); + if (za == NULL) { + nbdkit_error ("calloc: %m"); + return NULL; + } + + pthread_mutex_init (&za->lock, NULL); + + za->zcctx = ZSTD_createCCtx (); + if (za->zcctx == NULL) { + nbdkit_error ("ZSTD_createCCtx: %m"); + free (za); + return NULL; + } + za->zdstrm = ZSTD_createDStream (); + if (za->zdstrm == NULL) { + nbdkit_error ("ZSTD_createDStream: %m"); + ZSTD_freeCCtx (za->zcctx); + free (za); + return NULL; + } + + za->stats_uncompressed_bytes = za->stats_compressed_bytes = 0; + + return (struct allocator *) za; +} + +static struct allocator_functions functions = { + .type = "zstd", + .create = zstd_array_create, + .free = zstd_array_free, + .set_size_hint = zstd_array_set_size_hint, + .read = zstd_array_read, + .write = zstd_array_write, + .fill = zstd_array_fill, + .zero = zstd_array_zero, + .blit = zstd_array_blit, + .extents = zstd_array_extents, +}; + +static void register_zstd_array (void) __attribute__ ((constructor)); + +static void +register_zstd_array (void) +{ + register_allocator (&functions); +} + +#endif /* !HAVE_LIBZSTD */ diff --git a/common/bitmap/Makefile.am b/common/bitmap/Makefile.am new file mode 100644 index 0000000..3b7f4b4 --- /dev/null +++ b/common/bitmap/Makefile.am @@ -0,0 +1,57 @@ +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 $(top_srcdir)/common-rules.mk + +noinst_LTLIBRARIES = libbitmap.la + +libbitmap_la_SOURCES = \ + bitmap.c \ + bitmap.h \ + $(NULL) +libbitmap_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/common/include \ + $(NULL) +libbitmap_la_CFLAGS = $(WARNINGS_CFLAGS) + +# Unit tests. + +TESTS = test-bitmap +check_PROGRAMS = test-bitmap + +test_bitmap_SOURCES = test-bitmap.c bitmap.c bitmap.h +test_bitmap_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/common/include \ + $(NULL) +test_bitmap_CFLAGS = $(WARNINGS_CFLAGS) diff --git a/common/bitmap/Makefile.in b/common/bitmap/Makefile.in new file mode 100644 index 0000000..b6fe81c --- /dev/null +++ b/common/bitmap/Makefile.in @@ -0,0 +1,1242 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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@ +TESTS = test-bitmap$(EXEEXT) +check_PROGRAMS = test-bitmap$(EXEEXT) +subdir = common/bitmap +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ocaml.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libbitmap_la_LIBADD = +am__objects_1 = +am_libbitmap_la_OBJECTS = libbitmap_la-bitmap.lo $(am__objects_1) +libbitmap_la_OBJECTS = $(am_libbitmap_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libbitmap_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libbitmap_la_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_test_bitmap_OBJECTS = test_bitmap-test-bitmap.$(OBJEXT) \ + test_bitmap-bitmap.$(OBJEXT) +test_bitmap_OBJECTS = $(am_test_bitmap_OBJECTS) +test_bitmap_LDADD = $(LDADD) +test_bitmap_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(test_bitmap_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/libbitmap_la-bitmap.Plo \ + ./$(DEPDIR)/test_bitmap-bitmap.Po \ + ./$(DEPDIR)/test_bitmap-test-bitmap.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libbitmap_la_SOURCES) $(test_bitmap_SOURCES) +DIST_SOURCES = $(libbitmap_la_SOURCES) $(test_bitmap_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = { \ + $(am__tty_colors_dummy); \ + if test "X$(AM_COLOR_TESTS)" = Xno; then \ + am__color_tests=no; \ + elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ + am__color_tests=yes; \ + elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ + am__color_tests=yes; \ + fi; \ + if test $$am__color_tests = yes; then \ + red=''; \ + grn=''; \ + lgn=''; \ + blu=''; \ + mgn=''; \ + brg=''; \ + std=''; \ + fi; \ +} +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 = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__recheck_rx = ^[ ]*:recheck:[ ]* +am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* +am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* +# A command that, given a newline-separated list of test names on the +# standard input, print the name of the tests that are to be re-run +# upon "make recheck". +am__list_recheck_tests = $(AWK) '{ \ + recheck = 1; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + { \ + if ((getline line2 < ($$0 ".log")) < 0) \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ + { \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ + { \ + break; \ + } \ + }; \ + if (recheck) \ + print $$0; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# A command that, given a newline-separated list of test names on the +# standard input, create the global log from their .trs and .log files. +am__create_global_log = $(AWK) ' \ +function fatal(msg) \ +{ \ + print "fatal: making $@: " msg | "cat >&2"; \ + exit 1; \ +} \ +function rst_section(header) \ +{ \ + print header; \ + len = length(header); \ + for (i = 1; i <= len; i = i + 1) \ + printf "="; \ + printf "\n\n"; \ +} \ +{ \ + copy_in_global_log = 1; \ + global_test_result = "RUN"; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".trs"); \ + if (line ~ /$(am__global_test_result_rx)/) \ + { \ + sub("$(am__global_test_result_rx)", "", line); \ + sub("[ ]*$$", "", line); \ + global_test_result = line; \ + } \ + else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ + copy_in_global_log = 0; \ + }; \ + if (copy_in_global_log) \ + { \ + rst_section(global_test_result ": " $$0); \ + while ((rc = (getline line < ($$0 ".log"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".log"); \ + print line; \ + }; \ + printf "\n"; \ + }; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# Restructured Text title. +am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } +# Solaris 10 'make', and several other traditional 'make' implementations, +# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it +# by disabling -e (using the XSI extension "set +e") if it's set. +am__sh_e_setup = case $$- in *e*) set +e;; esac +# Default flags passed to test drivers. +am__common_driver_flags = \ + --color-tests "$$am__color_tests" \ + --enable-hard-errors "$$am__enable_hard_errors" \ + --expect-failure "$$am__expect_failure" +# To be inserted before the command running the test. Creates the +# directory for the log if needed. Stores in $dir the directory +# containing $f, in $tst the test, in $log the log. Executes the +# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and +# passes TESTS_ENVIRONMENT. Set up options for the wrapper that +# will run the test scripts (or their associated LOG_COMPILER, if +# thy have one). +am__check_pre = \ +$(am__sh_e_setup); \ +$(am__vpath_adj_setup) $(am__vpath_adj) \ +$(am__tty_colors); \ +srcdir=$(srcdir); export srcdir; \ +case "$@" in \ + */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ + *) am__odir=.;; \ +esac; \ +test "x$$am__odir" = x"." || test -d "$$am__odir" \ + || $(MKDIR_P) "$$am__odir" || exit $$?; \ +if test -f "./$$f"; then dir=./; \ +elif test -f "$$f"; then dir=; \ +else dir="$(srcdir)/"; fi; \ +tst=$$dir$$f; log='$@'; \ +if test -n '$(DISABLE_HARD_ERRORS)'; then \ + am__enable_hard_errors=no; \ +else \ + am__enable_hard_errors=yes; \ +fi; \ +case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ + am__expect_failure=yes;; \ + *) \ + am__expect_failure=no;; \ +esac; \ +$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) +# A shell command to get the names of the tests scripts with any registered +# extension removed (i.e., equivalently, the names of the test logs, with +# the '.log' extension removed). The result is saved in the shell variable +# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, +# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", +# since that might cause problem with VPATH rewrites for suffix-less tests. +# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. +am__set_TESTS_bases = \ + bases='$(TEST_LOGS)'; \ + bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ + bases=`echo $$bases` +AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)' +RECHECK_LOGS = $(TEST_LOGS) +AM_RECURSIVE_TARGETS = check recheck +TEST_SUITE_LOG = test-suite.log +TEST_EXTENSIONS = @EXEEXT@ .test +LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) +am__set_b = \ + case '$@' in \ + */*) \ + case '$*' in \ + */*) b='$*';; \ + *) b=`echo '$@' | sed 's/\.log$$//'`; \ + esac;; \ + *) \ + b='$*';; \ + esac +am__test_logs1 = $(TESTS:=.log) +am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) +TEST_LOGS = $(am__test_logs2:.test.log=.log) +TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ + $(TEST_LOG_FLAGS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/common-rules.mk \ + $(top_srcdir)/depcomp $(top_srcdir)/test-driver +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ +BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ +CARGO = @CARGO@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_PLUGIN_CC = @CC_PLUGIN_CC@ +CC_PLUGIN_CFLAGS = @CC_PLUGIN_CFLAGS@ +CERTTOOL = @CERTTOOL@ +CFLAGS = @CFLAGS@ +COM_ERR_CFLAGS = @COM_ERR_CFLAGS@ +COM_ERR_LIBS = @COM_ERR_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CUT = @CUT@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LDFLAGS = @DL_LDFLAGS@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXT2FS_CFLAGS = @EXT2FS_CFLAGS@ +EXT2FS_LIBS = @EXT2FS_LIBS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GENISOIMAGE = @GENISOIMAGE@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GOARCH = @GOARCH@ +GOLANG = @GOLANG@ +GOOS = @GOOS@ +GOROOT = @GOROOT@ +GREP = @GREP@ +IMPORT_LIBRARY_ON_WINDOWS = @IMPORT_LIBRARY_ON_WINDOWS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +ISOPROG = @ISOPROG@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBLKIO_CFLAGS = @LIBBLKIO_CFLAGS@ +LIBBLKIO_LIBS = @LIBBLKIO_LIBS@ +LIBGUESTFS_CFLAGS = @LIBGUESTFS_CFLAGS@ +LIBGUESTFS_LIBS = @LIBGUESTFS_LIBS@ +LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ +LIBLZMA_LIBS = @LIBLZMA_LIBS@ +LIBNBD_CFLAGS = @LIBNBD_CFLAGS@ +LIBNBD_LIBS = @LIBNBD_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSELINUX_CFLAGS = @LIBSELINUX_CFLAGS@ +LIBSELINUX_LIBS = @LIBSELINUX_LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTORRENT_CFLAGS = @LIBTORRENT_CFLAGS@ +LIBTORRENT_LIBS = @LIBTORRENT_LIBS@ +LIBVIRT_CFLAGS = @LIBVIRT_CFLAGS@ +LIBVIRT_LIBS = @LIBVIRT_LIBS@ +LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ +LIBZSTD_LIBS = @LIBZSTD_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LUA_CFLAGS = @LUA_CFLAGS@ +LUA_LIBS = @LUA_LIBS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MC = @MC@ +MKDIR_P = @MKDIR_P@ +MKISOFS = @MKISOFS@ +NBDKIT_VERSION_MAJOR = @NBDKIT_VERSION_MAJOR@ +NBDKIT_VERSION_MICRO = @NBDKIT_VERSION_MICRO@ +NBDKIT_VERSION_MINOR = @NBDKIT_VERSION_MINOR@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_ON_WINDOWS = @NO_UNDEFINED_ON_WINDOWS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OCAML = @OCAML@ +OCAMLBEST = @OCAMLBEST@ +OCAMLBUILD = @OCAMLBUILD@ +OCAMLC = @OCAMLC@ +OCAMLCDOTOPT = @OCAMLCDOTOPT@ +OCAMLDEP = @OCAMLDEP@ +OCAMLDOC = @OCAMLDOC@ +OCAMLLIB = @OCAMLLIB@ +OCAMLMKLIB = @OCAMLMKLIB@ +OCAMLMKTOP = @OCAMLMKTOP@ +OCAMLOPT = @OCAMLOPT@ +OCAMLOPTDOTOPT = @OCAMLOPTDOTOPT@ +OCAMLOPTFLAGS = @OCAMLOPTFLAGS@ +OCAMLVERSION = @OCAMLVERSION@ +OCAML_MAJOR = @OCAML_MAJOR@ +OCAML_PLUGIN_LIBRARIES = @OCAML_PLUGIN_LIBRARIES@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PERL_ARCHLIB = @PERL_ARCHLIB@ +PERL_CFLAGS = @PERL_CFLAGS@ +PERL_LDOPTS = @PERL_LDOPTS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PODWRAPPER = @PODWRAPPER@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_CXX = @PTHREAD_CXX@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CFLAGS = @PYTHON_CFLAGS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +RUBY_CFLAGS = @RUBY_CFLAGS@ +RUBY_LIBS = @RUBY_LIBS@ +RUSTC = @RUSTC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOEXT = @SOEXT@ +SSH_CFLAGS = @SSH_CFLAGS@ +SSH_LIBS = @SSH_LIBS@ +STAT = @STAT@ +STRIP = @STRIP@ +TCL_CFLAGS = @TCL_CFLAGS@ +TCL_LIBS = @TCL_LIBS@ +TRUNCATE = @TRUNCATE@ +VALGRIND = @VALGRIND@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VERSION = @VERSION@ +WARNINGS_CFLAGS = @WARNINGS_CFLAGS@ +XORRISO = @XORRISO@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +ZLIB_NG_CFLAGS = @ZLIB_NG_CFLAGS@ +ZLIB_NG_LIBS = @ZLIB_NG_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DLLTOOL = @ac_ct_DLLTOOL@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_MC = @ac_ct_MC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bashcompdir = @bashcompdir@ +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@ +filters = @filters@ +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@ +lang_plugins = @lang_plugins@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +non_lang_plugins = @non_lang_plugins@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugins = @plugins@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +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@ + +# Convenient list terminator +NULL = +plugindir = $(libdir)/nbdkit/plugins +filterdir = $(libdir)/nbdkit/filters +CLEANFILES = *~ *.cmi *.cmx *.cmxa *.so *.dll +noinst_LTLIBRARIES = libbitmap.la +libbitmap_la_SOURCES = \ + bitmap.c \ + bitmap.h \ + $(NULL) + +libbitmap_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/common/include \ + $(NULL) + +libbitmap_la_CFLAGS = $(WARNINGS_CFLAGS) +test_bitmap_SOURCES = test-bitmap.c bitmap.c bitmap.h +test_bitmap_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/common/include \ + $(NULL) + +test_bitmap_CFLAGS = $(WARNINGS_CFLAGS) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common-rules.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign common/bitmap/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign common/bitmap/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; +$(top_srcdir)/common-rules.mk $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libbitmap.la: $(libbitmap_la_OBJECTS) $(libbitmap_la_DEPENDENCIES) $(EXTRA_libbitmap_la_DEPENDENCIES) + $(AM_V_CCLD)$(libbitmap_la_LINK) $(libbitmap_la_OBJECTS) $(libbitmap_la_LIBADD) $(LIBS) + +test-bitmap$(EXEEXT): $(test_bitmap_OBJECTS) $(test_bitmap_DEPENDENCIES) $(EXTRA_test_bitmap_DEPENDENCIES) + @rm -f test-bitmap$(EXEEXT) + $(AM_V_CCLD)$(test_bitmap_LINK) $(test_bitmap_OBJECTS) $(test_bitmap_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbitmap_la-bitmap.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_bitmap-bitmap.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_bitmap-test-bitmap.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libbitmap_la-bitmap.lo: bitmap.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbitmap_la_CPPFLAGS) $(CPPFLAGS) $(libbitmap_la_CFLAGS) $(CFLAGS) -MT libbitmap_la-bitmap.lo -MD -MP -MF $(DEPDIR)/libbitmap_la-bitmap.Tpo -c -o libbitmap_la-bitmap.lo `test -f 'bitmap.c' || echo '$(srcdir)/'`bitmap.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libbitmap_la-bitmap.Tpo $(DEPDIR)/libbitmap_la-bitmap.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bitmap.c' object='libbitmap_la-bitmap.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbitmap_la_CPPFLAGS) $(CPPFLAGS) $(libbitmap_la_CFLAGS) $(CFLAGS) -c -o libbitmap_la-bitmap.lo `test -f 'bitmap.c' || echo '$(srcdir)/'`bitmap.c + +test_bitmap-test-bitmap.o: test-bitmap.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_bitmap_CPPFLAGS) $(CPPFLAGS) $(test_bitmap_CFLAGS) $(CFLAGS) -MT test_bitmap-test-bitmap.o -MD -MP -MF $(DEPDIR)/test_bitmap-test-bitmap.Tpo -c -o test_bitmap-test-bitmap.o `test -f 'test-bitmap.c' || echo '$(srcdir)/'`test-bitmap.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_bitmap-test-bitmap.Tpo $(DEPDIR)/test_bitmap-test-bitmap.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-bitmap.c' object='test_bitmap-test-bitmap.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_bitmap_CPPFLAGS) $(CPPFLAGS) $(test_bitmap_CFLAGS) $(CFLAGS) -c -o test_bitmap-test-bitmap.o `test -f 'test-bitmap.c' || echo '$(srcdir)/'`test-bitmap.c + +test_bitmap-test-bitmap.obj: test-bitmap.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_bitmap_CPPFLAGS) $(CPPFLAGS) $(test_bitmap_CFLAGS) $(CFLAGS) -MT test_bitmap-test-bitmap.obj -MD -MP -MF $(DEPDIR)/test_bitmap-test-bitmap.Tpo -c -o test_bitmap-test-bitmap.obj `if test -f 'test-bitmap.c'; then $(CYGPATH_W) 'test-bitmap.c'; else $(CYGPATH_W) '$(srcdir)/test-bitmap.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_bitmap-test-bitmap.Tpo $(DEPDIR)/test_bitmap-test-bitmap.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-bitmap.c' object='test_bitmap-test-bitmap.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_bitmap_CPPFLAGS) $(CPPFLAGS) $(test_bitmap_CFLAGS) $(CFLAGS) -c -o test_bitmap-test-bitmap.obj `if test -f 'test-bitmap.c'; then $(CYGPATH_W) 'test-bitmap.c'; else $(CYGPATH_W) '$(srcdir)/test-bitmap.c'; fi` + +test_bitmap-bitmap.o: bitmap.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_bitmap_CPPFLAGS) $(CPPFLAGS) $(test_bitmap_CFLAGS) $(CFLAGS) -MT test_bitmap-bitmap.o -MD -MP -MF $(DEPDIR)/test_bitmap-bitmap.Tpo -c -o test_bitmap-bitmap.o `test -f 'bitmap.c' || echo '$(srcdir)/'`bitmap.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_bitmap-bitmap.Tpo $(DEPDIR)/test_bitmap-bitmap.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bitmap.c' object='test_bitmap-bitmap.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_bitmap_CPPFLAGS) $(CPPFLAGS) $(test_bitmap_CFLAGS) $(CFLAGS) -c -o test_bitmap-bitmap.o `test -f 'bitmap.c' || echo '$(srcdir)/'`bitmap.c + +test_bitmap-bitmap.obj: bitmap.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_bitmap_CPPFLAGS) $(CPPFLAGS) $(test_bitmap_CFLAGS) $(CFLAGS) -MT test_bitmap-bitmap.obj -MD -MP -MF $(DEPDIR)/test_bitmap-bitmap.Tpo -c -o test_bitmap-bitmap.obj `if test -f 'bitmap.c'; then $(CYGPATH_W) 'bitmap.c'; else $(CYGPATH_W) '$(srcdir)/bitmap.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_bitmap-bitmap.Tpo $(DEPDIR)/test_bitmap-bitmap.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bitmap.c' object='test_bitmap-bitmap.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_bitmap_CPPFLAGS) $(CPPFLAGS) $(test_bitmap_CFLAGS) $(CFLAGS) -c -o test_bitmap-bitmap.obj `if test -f 'bitmap.c'; then $(CYGPATH_W) 'bitmap.c'; else $(CYGPATH_W) '$(srcdir)/bitmap.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +# Recover from deleted '.trs' file; this should ensure that +# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create +# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells +# to avoid problems with "make -n". +.log.trs: + rm -f $< $@ + $(MAKE) $(AM_MAKEFLAGS) $< + +# Leading 'am--fnord' is there to ensure the list of targets does not +# expand to empty, as could happen e.g. with make check TESTS=''. +am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) +am--force-recheck: + @: + +$(TEST_SUITE_LOG): $(TEST_LOGS) + @$(am__set_TESTS_bases); \ + am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ + redo_bases=`for i in $$bases; do \ + am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ + done`; \ + if test -n "$$redo_bases"; then \ + redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ + redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ + if $(am__make_dryrun); then :; else \ + rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ + fi; \ + fi; \ + if test -n "$$am__remaking_logs"; then \ + echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ + "recursion detected" >&2; \ + elif test -n "$$redo_logs"; then \ + am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ + fi; \ + if $(am__make_dryrun); then :; else \ + st=0; \ + errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ + for i in $$redo_bases; do \ + test -f $$i.trs && test -r $$i.trs \ + || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ + test -f $$i.log && test -r $$i.log \ + || { echo "$$errmsg $$i.log" >&2; st=1; }; \ + done; \ + test $$st -eq 0 || exit 1; \ + fi + @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ + ws='[ ]'; \ + results=`for b in $$bases; do echo $$b.trs; done`; \ + test -n "$$results" || results=/dev/null; \ + all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ + pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ + fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ + skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ + xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ + xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ + error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ + if test `expr $$fail + $$xpass + $$error` -eq 0; then \ + success=true; \ + else \ + success=false; \ + fi; \ + br='==================='; br=$$br$$br$$br$$br; \ + result_count () \ + { \ + if test x"$$1" = x"--maybe-color"; then \ + maybe_colorize=yes; \ + elif test x"$$1" = x"--no-color"; then \ + maybe_colorize=no; \ + else \ + echo "$@: invalid 'result_count' usage" >&2; exit 4; \ + fi; \ + shift; \ + desc=$$1 count=$$2; \ + if test $$maybe_colorize = yes && test $$count -gt 0; then \ + color_start=$$3 color_end=$$std; \ + else \ + color_start= color_end=; \ + fi; \ + echo "$${color_start}# $$desc $$count$${color_end}"; \ + }; \ + create_testsuite_report () \ + { \ + result_count $$1 "TOTAL:" $$all "$$brg"; \ + result_count $$1 "PASS: " $$pass "$$grn"; \ + result_count $$1 "SKIP: " $$skip "$$blu"; \ + result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ + result_count $$1 "FAIL: " $$fail "$$red"; \ + result_count $$1 "XPASS:" $$xpass "$$red"; \ + result_count $$1 "ERROR:" $$error "$$mgn"; \ + }; \ + { \ + echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ + $(am__rst_title); \ + create_testsuite_report --no-color; \ + echo; \ + echo ".. contents:: :depth: 2"; \ + echo; \ + for b in $$bases; do echo $$b; done \ + | $(am__create_global_log); \ + } >$(TEST_SUITE_LOG).tmp || exit 1; \ + mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ + if $$success; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ + fi; \ + echo "$${col}$$br$${std}"; \ + echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \ + echo "$${col}$$br$${std}"; \ + create_testsuite_report --maybe-color; \ + echo "$$col$$br$$std"; \ + if $$success; then :; else \ + echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ + if test -n "$(PACKAGE_BUGREPORT)"; then \ + echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ + fi; \ + echo "$$col$$br$$std"; \ + fi; \ + $$success || exit 1 + +check-TESTS: $(check_PROGRAMS) + @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list + @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + trs_list=`for i in $$bases; do echo $$i.trs; done`; \ + log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ + exit $$?; +recheck: all $(check_PROGRAMS) + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + bases=`for i in $$bases; do echo $$i; done \ + | $(am__list_recheck_tests)` || exit 1; \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + log_list=`echo $$log_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ + am__force_recheck=am--force-recheck \ + TEST_LOGS="$$log_list"; \ + exit $$? +test-bitmap.log: test-bitmap$(EXEEXT) + @p='test-bitmap$(EXEEXT)'; \ + b='test-bitmap'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +.test.log: + @p='$<'; \ + $(am__set_b); \ + $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +@am__EXEEXT_TRUE@.test$(EXEEXT).log: +@am__EXEEXT_TRUE@ @p='$<'; \ +@am__EXEEXT_TRUE@ $(am__set_b); \ +@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ +@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ +@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ +@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: 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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) + -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) + -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ + clean-noinstLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/libbitmap_la-bitmap.Plo + -rm -f ./$(DEPDIR)/test_bitmap-bitmap.Po + -rm -f ./$(DEPDIR)/test_bitmap-test-bitmap.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/libbitmap_la-bitmap.Plo + -rm -f ./$(DEPDIR)/test_bitmap-bitmap.Po + -rm -f ./$(DEPDIR)/test_bitmap-test-bitmap.Po + -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: + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \ + check-am clean clean-checkPROGRAMS clean-generic clean-libtool \ + clean-noinstLTLIBRARIES cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am 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 recheck tags tags-am uninstall \ + uninstall-am + +.PRECIOUS: Makefile + + +# 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/common/bitmap/bitmap.c b/common/bitmap/bitmap.c new file mode 100644 index 0000000..ea61b70 --- /dev/null +++ b/common/bitmap/bitmap.c @@ -0,0 +1,115 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include +#include + +#include + +#include "bitmap.h" +#include "rounding.h" +#include "nextnonzero.h" + +int +bitmap_resize (struct bitmap *bm, uint64_t new_size) +{ + uint8_t *new_bitmap; + const size_t old_bm_size = bm->size; + uint64_t new_bm_size_u64; + size_t new_bm_size; + + new_bm_size_u64 = DIV_ROUND_UP (new_size, + bm->blksize * UINT64_C (8) / bm->bpb); + if (new_bm_size_u64 > SIZE_MAX) { + nbdkit_error ("bitmap too large for this architecture"); + return -1; + } + new_bm_size = (size_t) new_bm_size_u64; + + if (new_bm_size > 0) { + new_bitmap = realloc (bm->bitmap, new_bm_size); + if (new_bitmap == NULL) { + nbdkit_error ("realloc: %m"); + return -1; + } + } + else { + free (bm->bitmap); + new_bitmap = NULL; + } + bm->bitmap = new_bitmap; + bm->size = new_bm_size; + if (old_bm_size < new_bm_size) + memset (&bm->bitmap[old_bm_size], 0, new_bm_size-old_bm_size); + + nbdkit_debug ("bitmap resized to %zu bytes", new_bm_size); + + return 0; +} + +int64_t +bitmap_next (const struct bitmap *bm, uint64_t blk) +{ + uint64_t limit = bm->size * bm->ibpb; + const uint8_t *p; + + /* Align to the next byte boundary. */ + for (; blk < limit && (blk & (bm->ibpb-1)) != 0; ++blk) { + if (bitmap_get_blk (bm, blk, 0) != 0) + return blk; + } + if (blk == limit) + return -1; + + /* Now we're at a byte boundary we can use a fast string function to + * find the next non-zero byte. + */ + p = &bm->bitmap[blk >> (3 - bm->bitshift)]; + p = (const uint8_t *) next_non_zero ((const char *) p, + &bm->bitmap[bm->size] - p); + if (p == NULL) + return -1; + + /* Now check the non-zero byte to find out which bit (ie. block) is set. */ + blk = (p - bm->bitmap) << (3 - bm->bitshift); + for (; blk < limit; ++blk) { + if (bitmap_get_blk (bm, blk, 0) != 0) + return blk; + } + + /* Should never be reached. */ + abort (); +} diff --git a/common/bitmap/bitmap.h b/common/bitmap/bitmap.h new file mode 100644 index 0000000..742c793 --- /dev/null +++ b/common/bitmap/bitmap.h @@ -0,0 +1,183 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +/* This is a very simple structure for creating a bitmap associated + * with a virtual disk. 1, 2, 4 or 8 bits can be associated with each + * block of the disk. You can choose the number of bits and block + * size when creating the bitmap. Entries in the bitmap are + * initialized to 0. + */ + +#ifndef NBDKIT_BITMAP_H +#define NBDKIT_BITMAP_H + +#include +#include +#include + +#include + +#include "ispowerof2.h" + +/* This is the bitmap structure. */ +struct bitmap { + unsigned blksize; /* Block size. */ + uint8_t bpb; /* Bits per block (1, 2, 4, 8 only). */ + /* bpb = 1 << bitshift ibpb = 8 / bpb + 1 0 8 + 2 1 4 + 4 2 2 + 8 3 1 + */ + uint8_t bitshift, ibpb; + + uint8_t *bitmap; /* The bitmap. */ + size_t size; /* Size of bitmap in bytes. */ +}; + +static inline void __attribute__ ((__nonnull__ (1))) +bitmap_init (struct bitmap *bm, unsigned blocksize, unsigned bpb) +{ + assert (is_power_of_2 (blocksize)); + bm->blksize = blocksize; + + /* bpb can be 1, 2, 4 or 8 only. */ + bm->bpb = bpb; + switch (bpb) { + case 1: bm->bitshift = 0; break; + case 2: bm->bitshift = 1; break; + case 4: bm->bitshift = 2; break; + case 8: bm->bitshift = 3; break; + default: abort (); + } + bm->ibpb = 8/bpb; + + bm->bitmap = NULL; + bm->size = 0; +} + +/* Only frees the bitmap itself, since it is assumed that the struct + * bitmap is statically allocated. + */ +static inline void +bitmap_free (struct bitmap *bm) +{ + if (bm) + free (bm->bitmap); +} + +/* Resize the bitmap to the virtual disk size in bytes. + * Returns -1 on error, setting nbdkit_error. + */ +extern int bitmap_resize (struct bitmap *bm, uint64_t new_size) + __attribute__ ((__nonnull__ (1))); + +/* Clear the bitmap (set everything to zero). */ +static inline void __attribute__ ((__nonnull__ (1))) +bitmap_clear (struct bitmap *bm) +{ + memset (bm->bitmap, 0, bm->size); +} + +/* This macro calculates the byte offset in the bitmap and which + * bit/mask we are addressing within that byte. + * + * bpb blk_offset blk_bit mask + * 1 blk >> 3 0,1,2,...,7 any single bit + * 2 blk >> 2 0, 2, 4 or 6 0x03, 0x0c, 0x30 or 0xc0 + * 4 blk >> 1 0 or 4 0x0f or 0xf0 + * 8 blk >> 0 always 0 always 0xff + */ +#define BITMAP_OFFSET_BIT_MASK(bm, blk) \ + uint64_t blk_offset = (blk) >> (3 - (bm)->bitshift); \ + unsigned blk_bit = (bm)->bpb * ((blk) & ((bm)->ibpb - 1)); \ + unsigned mask = ((1 << (bm)->bpb) - 1) << blk_bit + +/* Return the bit(s) associated with the given block. + * If the request is out of range, returns the default value. + */ +static inline unsigned __attribute__ ((__nonnull__ (1))) +bitmap_get_blk (const struct bitmap *bm, uint64_t blk, unsigned default_) +{ + BITMAP_OFFSET_BIT_MASK (bm, blk); + + if (blk_offset >= bm->size) { + nbdkit_debug ("bitmap_get: block number is out of range"); + return default_; + } + + return (bm->bitmap[blk_offset] & mask) >> blk_bit; +} + +/* As above but works with virtual disk offset in bytes. */ +static inline unsigned __attribute__ ((__nonnull__ (1))) +bitmap_get (const struct bitmap *bm, uint64_t offset, unsigned default_) +{ + return bitmap_get_blk (bm, offset / bm->blksize, default_); +} + +/* Set the bit(s) associated with the given block. + * If out of range, it is ignored. + */ +static inline void __attribute__ ((__nonnull__ (1))) +bitmap_set_blk (const struct bitmap *bm, uint64_t blk, unsigned v) +{ + BITMAP_OFFSET_BIT_MASK (bm, blk); + + if (blk_offset >= bm->size) { + nbdkit_debug ("bitmap_set: block number is out of range"); + return; + } + + bm->bitmap[blk_offset] &= ~mask; + bm->bitmap[blk_offset] |= v << blk_bit; +} + +/* As above bit works with virtual disk offset in bytes. */ +static inline void __attribute__ ((__nonnull__ (1))) +bitmap_set (const struct bitmap *bm, uint64_t offset, unsigned v) +{ + return bitmap_set_blk (bm, offset / bm->blksize, v); +} + +/* Iterate over blocks represented in the bitmap. */ +#define bitmap_for(bm, /* uint64_t */ blknum) \ + for ((blknum) = 0; (blknum) < (bm)->size * (bm)->ibpb; ++(blknum)) + +/* Find the next non-zero block in the bitmap, starting at ‘blk’. + * Returns -1 if the bitmap is all zeroes from blk to the end of the + * bitmap. + */ +extern int64_t bitmap_next (const struct bitmap *bm, uint64_t blk) + __attribute__ ((__nonnull__ (1))); + +#endif /* NBDKIT_BITMAP_H */ diff --git a/common/bitmap/test-bitmap.c b/common/bitmap/test-bitmap.c new file mode 100644 index 0000000..6b7283a --- /dev/null +++ b/common/bitmap/test-bitmap.c @@ -0,0 +1,163 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +/* Unit tests of the bitmap code. */ + +#include + +#include +#include +#include +#include +#include +#include +#undef NDEBUG /* Keep test strong even for nbdkit built without assertions */ +#include + +#include + +#include "array-size.h" +#include "bitmap.h" + +static void +test (int bpb, int blksize) +{ + struct bitmap bm; + const int nr_blocks = 1000; + int blks[] = + { + 1, 2, 3, 10, 12, + 90, 91, 92, 93, 94, 99, + 800, 801, 802, 803, + 902, 903, 905, 907, 911, 913, 917, 919, 923, 929, + 999 + }; + unsigned v, vexp; + size_t i, j; + + printf ("bpb = %d, blksize = %d\n", bpb, blksize); + fflush (stdout); + + bitmap_init (&bm, blksize, bpb); + if (bitmap_resize (&bm, nr_blocks * blksize) == -1) + exit (EXIT_FAILURE); + + /* Set some bits at known block numbers. */ + for (j = 0; j < ARRAY_SIZE (blks); ++j) { + v = (j & 1) == 0 ? 1 : (1<&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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@ +subdir = common/gpt +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ocaml.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libgpt_la_LIBADD = +am__objects_1 = +am_libgpt_la_OBJECTS = libgpt_la-efi-crc32.lo $(am__objects_1) +libgpt_la_OBJECTS = $(am_libgpt_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libgpt_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libgpt_la_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/libgpt_la-efi-crc32.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libgpt_la_SOURCES) +DIST_SOURCES = $(libgpt_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/common-rules.mk \ + $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ +BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ +CARGO = @CARGO@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_PLUGIN_CC = @CC_PLUGIN_CC@ +CC_PLUGIN_CFLAGS = @CC_PLUGIN_CFLAGS@ +CERTTOOL = @CERTTOOL@ +CFLAGS = @CFLAGS@ +COM_ERR_CFLAGS = @COM_ERR_CFLAGS@ +COM_ERR_LIBS = @COM_ERR_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CUT = @CUT@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LDFLAGS = @DL_LDFLAGS@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXT2FS_CFLAGS = @EXT2FS_CFLAGS@ +EXT2FS_LIBS = @EXT2FS_LIBS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GENISOIMAGE = @GENISOIMAGE@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GOARCH = @GOARCH@ +GOLANG = @GOLANG@ +GOOS = @GOOS@ +GOROOT = @GOROOT@ +GREP = @GREP@ +IMPORT_LIBRARY_ON_WINDOWS = @IMPORT_LIBRARY_ON_WINDOWS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +ISOPROG = @ISOPROG@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBLKIO_CFLAGS = @LIBBLKIO_CFLAGS@ +LIBBLKIO_LIBS = @LIBBLKIO_LIBS@ +LIBGUESTFS_CFLAGS = @LIBGUESTFS_CFLAGS@ +LIBGUESTFS_LIBS = @LIBGUESTFS_LIBS@ +LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ +LIBLZMA_LIBS = @LIBLZMA_LIBS@ +LIBNBD_CFLAGS = @LIBNBD_CFLAGS@ +LIBNBD_LIBS = @LIBNBD_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSELINUX_CFLAGS = @LIBSELINUX_CFLAGS@ +LIBSELINUX_LIBS = @LIBSELINUX_LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTORRENT_CFLAGS = @LIBTORRENT_CFLAGS@ +LIBTORRENT_LIBS = @LIBTORRENT_LIBS@ +LIBVIRT_CFLAGS = @LIBVIRT_CFLAGS@ +LIBVIRT_LIBS = @LIBVIRT_LIBS@ +LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ +LIBZSTD_LIBS = @LIBZSTD_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LUA_CFLAGS = @LUA_CFLAGS@ +LUA_LIBS = @LUA_LIBS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MC = @MC@ +MKDIR_P = @MKDIR_P@ +MKISOFS = @MKISOFS@ +NBDKIT_VERSION_MAJOR = @NBDKIT_VERSION_MAJOR@ +NBDKIT_VERSION_MICRO = @NBDKIT_VERSION_MICRO@ +NBDKIT_VERSION_MINOR = @NBDKIT_VERSION_MINOR@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_ON_WINDOWS = @NO_UNDEFINED_ON_WINDOWS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OCAML = @OCAML@ +OCAMLBEST = @OCAMLBEST@ +OCAMLBUILD = @OCAMLBUILD@ +OCAMLC = @OCAMLC@ +OCAMLCDOTOPT = @OCAMLCDOTOPT@ +OCAMLDEP = @OCAMLDEP@ +OCAMLDOC = @OCAMLDOC@ +OCAMLLIB = @OCAMLLIB@ +OCAMLMKLIB = @OCAMLMKLIB@ +OCAMLMKTOP = @OCAMLMKTOP@ +OCAMLOPT = @OCAMLOPT@ +OCAMLOPTDOTOPT = @OCAMLOPTDOTOPT@ +OCAMLOPTFLAGS = @OCAMLOPTFLAGS@ +OCAMLVERSION = @OCAMLVERSION@ +OCAML_MAJOR = @OCAML_MAJOR@ +OCAML_PLUGIN_LIBRARIES = @OCAML_PLUGIN_LIBRARIES@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PERL_ARCHLIB = @PERL_ARCHLIB@ +PERL_CFLAGS = @PERL_CFLAGS@ +PERL_LDOPTS = @PERL_LDOPTS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PODWRAPPER = @PODWRAPPER@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_CXX = @PTHREAD_CXX@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CFLAGS = @PYTHON_CFLAGS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +RUBY_CFLAGS = @RUBY_CFLAGS@ +RUBY_LIBS = @RUBY_LIBS@ +RUSTC = @RUSTC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOEXT = @SOEXT@ +SSH_CFLAGS = @SSH_CFLAGS@ +SSH_LIBS = @SSH_LIBS@ +STAT = @STAT@ +STRIP = @STRIP@ +TCL_CFLAGS = @TCL_CFLAGS@ +TCL_LIBS = @TCL_LIBS@ +TRUNCATE = @TRUNCATE@ +VALGRIND = @VALGRIND@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VERSION = @VERSION@ +WARNINGS_CFLAGS = @WARNINGS_CFLAGS@ +XORRISO = @XORRISO@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +ZLIB_NG_CFLAGS = @ZLIB_NG_CFLAGS@ +ZLIB_NG_LIBS = @ZLIB_NG_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DLLTOOL = @ac_ct_DLLTOOL@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_MC = @ac_ct_MC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bashcompdir = @bashcompdir@ +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@ +filters = @filters@ +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@ +lang_plugins = @lang_plugins@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +non_lang_plugins = @non_lang_plugins@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugins = @plugins@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +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@ + +# Convenient list terminator +NULL = +plugindir = $(libdir)/nbdkit/plugins +filterdir = $(libdir)/nbdkit/filters +CLEANFILES = *~ *.cmi *.cmx *.cmxa *.so *.dll +noinst_LTLIBRARIES = libgpt.la +libgpt_la_SOURCES = \ + efi-crc32.c \ + efi-crc32.h \ + gpt.h \ + $(NULL) + +libgpt_la_CFLAGS = $(WARNINGS_CFLAGS) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common-rules.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign common/gpt/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign common/gpt/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; +$(top_srcdir)/common-rules.mk $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libgpt.la: $(libgpt_la_OBJECTS) $(libgpt_la_DEPENDENCIES) $(EXTRA_libgpt_la_DEPENDENCIES) + $(AM_V_CCLD)$(libgpt_la_LINK) $(libgpt_la_OBJECTS) $(libgpt_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgpt_la-efi-crc32.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libgpt_la-efi-crc32.lo: efi-crc32.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgpt_la_CFLAGS) $(CFLAGS) -MT libgpt_la-efi-crc32.lo -MD -MP -MF $(DEPDIR)/libgpt_la-efi-crc32.Tpo -c -o libgpt_la-efi-crc32.lo `test -f 'efi-crc32.c' || echo '$(srcdir)/'`efi-crc32.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgpt_la-efi-crc32.Tpo $(DEPDIR)/libgpt_la-efi-crc32.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='efi-crc32.c' object='libgpt_la-efi-crc32.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgpt_la_CFLAGS) $(CFLAGS) -c -o libgpt_la-efi-crc32.lo `test -f 'efi-crc32.c' || echo '$(srcdir)/'`efi-crc32.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: 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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/libgpt_la-efi-crc32.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/libgpt_la-efi-crc32.Plo + -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: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am 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 tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# 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/common/gpt/efi-crc32.c b/common/gpt/efi-crc32.c new file mode 100644 index 0000000..2b080d3 --- /dev/null +++ b/common/gpt/efi-crc32.c @@ -0,0 +1,140 @@ +/* This code was taken from parted and indirectly from other sources + * as you can see from the messages below. The license is compatible + * with the permissive license used in nbdkit. - RWMJ 2018-09-16 + */ + +/* + * Dec 5, 2000 Matt Domsch + * - Copied crc32.c from the linux/drivers/net/cipe directory. + * - Now pass seed as an arg + * - changed unsigned long to uint32_t, added #include + * - changed len to be an unsigned long + * - changed crc32val to be a register + * - License remains unchanged! It's still GPL-compatable! + */ + + /* ============================================================= */ + /* COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or */ + /* code or tables extracted from it, as desired without restriction. */ + /* */ + /* First, the polynomial itself and its table of feedback terms. The */ + /* polynomial is */ + /* X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 */ + /* */ + /* Note that we take it "backwards" and put the highest-order term in */ + /* the lowest-order bit. The X^32 term is "implied"; the LSB is the */ + /* X^31 term, etc. The X^0 term (usually shown as "+1") results in */ + /* the MSB being 1. */ + /* */ + /* Note that the usual hardware shift register implementation, which */ + /* is what we're using (we're merely optimizing it by doing eight-bit */ + /* chunks at a time) shifts bits into the lowest-order term. In our */ + /* implementation, that means shifting towards the right. Why do we */ + /* do it this way? Because the calculated CRC must be transmitted in */ + /* order from highest-order term to lowest-order term. UARTs transmit */ + /* characters in order from LSB to MSB. By storing the CRC this way, */ + /* we hand it to the UART in the order low-byte to high-byte; the UART */ + /* sends each low-bit to hight-bit; and the result is transmission bit */ + /* by bit from highest- to lowest-order term without requiring any bit */ + /* shuffling on our part. Reception works similarly. */ + /* */ + /* The feedback terms table consists of 256, 32-bit entries. Notes: */ + /* */ + /* The table can be generated at runtime if desired; code to do so */ + /* is shown later. It might not be obvious, but the feedback */ + /* terms simply represent the results of eight shift/xor opera- */ + /* tions for all combinations of data and CRC register values. */ + /* */ + /* The values must be right-shifted by eight bits by the "updcrc" */ + /* logic; the shift must be unsigned (bring in zeroes). On some */ + /* hardware you could probably optimize the shift in assembler by */ + /* using byte-swap instructions. */ + /* polynomial $edb88320 */ + /* */ + /* -------------------------------------------------------------------- */ + +#include + +#include +#include + +#include "efi-crc32.h" + +static const uint32_t crc32_tab[] = { + 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, + 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L, + 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, + 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL, + 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L, + 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L, + 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L, + 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL, + 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L, + 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL, + 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L, + 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L, + 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L, + 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL, + 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL, + 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L, + 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL, + 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L, + 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L, + 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L, + 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL, + 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L, + 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L, + 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL, + 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L, + 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L, + 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L, + 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L, + 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L, + 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL, + 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL, + 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L, + 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L, + 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL, + 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL, + 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L, + 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL, + 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L, + 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL, + 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L, + 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL, + 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L, + 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L, + 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL, + 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L, + 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L, + 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L, + 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L, + 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L, + 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L, + 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, + 0x2d02ef8dL + }; + +/* Return a 32-bit CRC of the contents of the buffer. */ + +static uint32_t +_efi_crc32 (const void *buf, size_t len, uint32_t seed) +{ + size_t i; + uint32_t crc32val; + const unsigned char *s = buf; + + crc32val = seed; + for (i = 0; i < len; i++) { + crc32val = + crc32_tab[(crc32val ^ s[i]) & 0xff] ^ + (crc32val >> 8); + } + return crc32val; +} + +uint32_t +efi_crc32 (const void *buf, size_t len) +{ + return _efi_crc32 (buf, len, ~0L) ^ ~0L; +} diff --git a/common/gpt/efi-crc32.h b/common/gpt/efi-crc32.h new file mode 100644 index 0000000..85a8b63 --- /dev/null +++ b/common/gpt/efi-crc32.h @@ -0,0 +1,41 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_EFI_CRC32_H +#define NBDKIT_EFI_CRC32_H + +#include + +extern uint32_t efi_crc32 (const void *buf, size_t len) + __attribute__ ((__nonnull__ (1))); + +#endif /* NBDKIT_EFI_CRC32_H */ diff --git a/common/gpt/gpt.h b/common/gpt/gpt.h new file mode 100644 index 0000000..d322080 --- /dev/null +++ b/common/gpt/gpt.h @@ -0,0 +1,79 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_GPT_H +#define NBDKIT_GPT_H + +struct gpt_header { + char signature[8]; + char revision[4]; + uint32_t header_size; + uint32_t crc; + uint32_t reserved; + uint64_t current_lba; + uint64_t backup_lba; + uint64_t first_usable_lba; + uint64_t last_usable_lba; + char guid[16]; + uint64_t partition_entries_lba; + uint32_t nr_partition_entries; + uint32_t size_partition_entry; + uint32_t crc_partitions; +}; + +#define GPT_SIGNATURE "EFI PART" +#define GPT_REVISION "\0\0\1\0" /* revision 1.0 */ + +struct gpt_entry { + char partition_type_guid[16]; + char unique_guid[16]; + uint64_t first_lba; + uint64_t last_lba; + uint64_t attributes; + char name[72]; /* UTF-16LE */ +}; + +/* GPT_MIN_PARTITIONS is the minimum number of partitions and is + * defined by the UEFI standard (assuming 512 byte sector size). + * + * In plugins such as the partitioning plugin, if we are requested to + * allocate more than GPT_MIN_PARTITIONS then we increase the + * partition table in chunks of this size. Note that clients may not + * support > GPT_MIN_PARTITIONS. + * + * GPT_PT_ENTRY_SIZE is the minimum specified by the UEFI spec, but + * increasing it is not useful. + */ +#define GPT_MIN_PARTITIONS 128 +#define GPT_PT_ENTRY_SIZE 128 + +#endif /* NBDKIT_GPT_H */ diff --git a/common/include/Makefile.am b/common/include/Makefile.am new file mode 100644 index 0000000..ca488e6 --- /dev/null +++ b/common/include/Makefile.am @@ -0,0 +1,129 @@ +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 $(top_srcdir)/common-rules.mk + +# These headers contain only common code shared by the core server, +# plugins and/or filters. They are not installed. +EXTRA_DIST = \ + ansi-colours.h \ + array-size.h \ + ascii-ctype.h \ + ascii-string.h \ + byte-swapping.h \ + checked-overflow.h \ + compiler-macros.h \ + hexdigit.h \ + human-size.h \ + human-size-test-cases.h \ + isaligned.h \ + ispowerof2.h \ + iszero.h \ + minmax.h \ + nextnonzero.h \ + random.h \ + rounding.h \ + static-assert.h \ + tvdiff.h \ + unique-name.h \ + unix-path-max.h \ + $(NULL) + +# Unit tests. + +TESTS = \ + test-array-size \ + test-ascii-ctype \ + test-ascii-string \ + test-byte-swapping \ + test-checked-overflow \ + test-human-size \ + test-isaligned \ + test-ispowerof2 \ + test-iszero \ + test-minmax \ + test-nextnonzero \ + test-random \ + test-tvdiff \ + $(NULL) +check_PROGRAMS = $(TESTS) + +test_array_size_SOURCES = test-array-size.c array-size.h +test_array_size_CPPFLAGS = -I$(srcdir) +test_array_size_CFLAGS = $(WARNINGS_CFLAGS) + +test_ascii_ctype_SOURCES = test-ascii-ctype.c ascii-ctype.h +test_ascii_ctype_CPPFLAGS = -I$(srcdir) +test_ascii_ctype_CFLAGS = $(WARNINGS_CFLAGS) + +test_ascii_string_SOURCES = test-ascii-string.c ascii-string.h +test_ascii_string_CPPFLAGS = -I$(srcdir) +test_ascii_string_CFLAGS = $(WARNINGS_CFLAGS) + +test_byte_swapping_SOURCES = test-byte-swapping.c byte-swapping.h +test_byte_swapping_CPPFLAGS = -I$(srcdir) +test_byte_swapping_CFLAGS = $(WARNINGS_CFLAGS) + +test_checked_overflow_SOURCES = test-checked-overflow.c checked-overflow.h +test_checked_overflow_CPPFLAGS = -I$(srcdir) +test_checked_overflow_CFLAGS = $(WARNINGS_CFLAGS) + +test_human_size_SOURCES = test-human-size.c human-size.h human-size-test-cases.h +test_human_size_CPPFLAGS = -I$(srcdir) +test_human_size_CFLAGS = $(WARNINGS_CFLAGS) + +test_isaligned_SOURCES = test-isaligned.c isaligned.h +test_isaligned_CPPFLAGS = -I$(srcdir) +test_isaligned_CFLAGS = $(WARNINGS_CFLAGS) + +test_ispowerof2_SOURCES = test-ispowerof2.c ispowerof2.h +test_ispowerof2_CPPFLAGS = -I$(srcdir) +test_ispowerof2_CFLAGS = $(WARNINGS_CFLAGS) + +test_iszero_SOURCES = test-iszero.c iszero.h +test_iszero_CPPFLAGS = -I$(srcdir) +test_iszero_CFLAGS = $(WARNINGS_CFLAGS) + +test_minmax_SOURCES = test-minmax.c minmax.h +test_minmax_CPPFLAGS = -I$(srcdir) +test_minmax_CFLAGS = $(WARNINGS_CFLAGS) + +test_nextnonzero_SOURCES = test-nextnonzero.c nextnonzero.h +test_nextnonzero_CPPFLAGS = -I$(srcdir) +test_nextnonzero_CFLAGS = $(WARNINGS_CFLAGS) + +test_random_SOURCES = test-random.c random.h +test_random_CPPFLAGS = -I$(srcdir) +test_random_CFLAGS = $(WARNINGS_CFLAGS) + +test_tvdiff_SOURCES = test-tvdiff.c tvdiff.h +test_tvdiff_CPPFLAGS = -I$(srcdir) +test_tvdiff_CFLAGS = $(WARNINGS_CFLAGS) diff --git a/common/include/Makefile.in b/common/include/Makefile.in new file mode 100644 index 0000000..2d51416 --- /dev/null +++ b/common/include/Makefile.in @@ -0,0 +1,1697 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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@ +TESTS = test-array-size$(EXEEXT) test-ascii-ctype$(EXEEXT) \ + test-ascii-string$(EXEEXT) test-byte-swapping$(EXEEXT) \ + test-checked-overflow$(EXEEXT) test-human-size$(EXEEXT) \ + test-isaligned$(EXEEXT) test-ispowerof2$(EXEEXT) \ + test-iszero$(EXEEXT) test-minmax$(EXEEXT) \ + test-nextnonzero$(EXEEXT) test-random$(EXEEXT) \ + test-tvdiff$(EXEEXT) $(am__EXEEXT_1) +check_PROGRAMS = $(am__EXEEXT_2) +subdir = common/include +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ocaml.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__EXEEXT_1 = +am__EXEEXT_2 = test-array-size$(EXEEXT) test-ascii-ctype$(EXEEXT) \ + test-ascii-string$(EXEEXT) test-byte-swapping$(EXEEXT) \ + test-checked-overflow$(EXEEXT) test-human-size$(EXEEXT) \ + test-isaligned$(EXEEXT) test-ispowerof2$(EXEEXT) \ + test-iszero$(EXEEXT) test-minmax$(EXEEXT) \ + test-nextnonzero$(EXEEXT) test-random$(EXEEXT) \ + test-tvdiff$(EXEEXT) $(am__EXEEXT_1) +am_test_array_size_OBJECTS = \ + test_array_size-test-array-size.$(OBJEXT) +test_array_size_OBJECTS = $(am_test_array_size_OBJECTS) +test_array_size_LDADD = $(LDADD) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +test_array_size_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_array_size_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +am_test_ascii_ctype_OBJECTS = \ + test_ascii_ctype-test-ascii-ctype.$(OBJEXT) +test_ascii_ctype_OBJECTS = $(am_test_ascii_ctype_OBJECTS) +test_ascii_ctype_LDADD = $(LDADD) +test_ascii_ctype_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_ascii_ctype_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +am_test_ascii_string_OBJECTS = \ + test_ascii_string-test-ascii-string.$(OBJEXT) +test_ascii_string_OBJECTS = $(am_test_ascii_string_OBJECTS) +test_ascii_string_LDADD = $(LDADD) +test_ascii_string_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_ascii_string_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +am_test_byte_swapping_OBJECTS = \ + test_byte_swapping-test-byte-swapping.$(OBJEXT) +test_byte_swapping_OBJECTS = $(am_test_byte_swapping_OBJECTS) +test_byte_swapping_LDADD = $(LDADD) +test_byte_swapping_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_byte_swapping_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_test_checked_overflow_OBJECTS = \ + test_checked_overflow-test-checked-overflow.$(OBJEXT) +test_checked_overflow_OBJECTS = $(am_test_checked_overflow_OBJECTS) +test_checked_overflow_LDADD = $(LDADD) +test_checked_overflow_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_checked_overflow_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_test_human_size_OBJECTS = \ + test_human_size-test-human-size.$(OBJEXT) +test_human_size_OBJECTS = $(am_test_human_size_OBJECTS) +test_human_size_LDADD = $(LDADD) +test_human_size_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_human_size_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +am_test_isaligned_OBJECTS = test_isaligned-test-isaligned.$(OBJEXT) +test_isaligned_OBJECTS = $(am_test_isaligned_OBJECTS) +test_isaligned_LDADD = $(LDADD) +test_isaligned_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_isaligned_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o \ + $@ +am_test_ispowerof2_OBJECTS = \ + test_ispowerof2-test-ispowerof2.$(OBJEXT) +test_ispowerof2_OBJECTS = $(am_test_ispowerof2_OBJECTS) +test_ispowerof2_LDADD = $(LDADD) +test_ispowerof2_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_ispowerof2_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +am_test_iszero_OBJECTS = test_iszero-test-iszero.$(OBJEXT) +test_iszero_OBJECTS = $(am_test_iszero_OBJECTS) +test_iszero_LDADD = $(LDADD) +test_iszero_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(test_iszero_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_test_minmax_OBJECTS = test_minmax-test-minmax.$(OBJEXT) +test_minmax_OBJECTS = $(am_test_minmax_OBJECTS) +test_minmax_LDADD = $(LDADD) +test_minmax_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(test_minmax_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_test_nextnonzero_OBJECTS = \ + test_nextnonzero-test-nextnonzero.$(OBJEXT) +test_nextnonzero_OBJECTS = $(am_test_nextnonzero_OBJECTS) +test_nextnonzero_LDADD = $(LDADD) +test_nextnonzero_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_nextnonzero_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +am_test_random_OBJECTS = test_random-test-random.$(OBJEXT) +test_random_OBJECTS = $(am_test_random_OBJECTS) +test_random_LDADD = $(LDADD) +test_random_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(test_random_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_test_tvdiff_OBJECTS = test_tvdiff-test-tvdiff.$(OBJEXT) +test_tvdiff_OBJECTS = $(am_test_tvdiff_OBJECTS) +test_tvdiff_LDADD = $(LDADD) +test_tvdiff_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(test_tvdiff_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/test_array_size-test-array-size.Po \ + ./$(DEPDIR)/test_ascii_ctype-test-ascii-ctype.Po \ + ./$(DEPDIR)/test_ascii_string-test-ascii-string.Po \ + ./$(DEPDIR)/test_byte_swapping-test-byte-swapping.Po \ + ./$(DEPDIR)/test_checked_overflow-test-checked-overflow.Po \ + ./$(DEPDIR)/test_human_size-test-human-size.Po \ + ./$(DEPDIR)/test_isaligned-test-isaligned.Po \ + ./$(DEPDIR)/test_ispowerof2-test-ispowerof2.Po \ + ./$(DEPDIR)/test_iszero-test-iszero.Po \ + ./$(DEPDIR)/test_minmax-test-minmax.Po \ + ./$(DEPDIR)/test_nextnonzero-test-nextnonzero.Po \ + ./$(DEPDIR)/test_random-test-random.Po \ + ./$(DEPDIR)/test_tvdiff-test-tvdiff.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(test_array_size_SOURCES) $(test_ascii_ctype_SOURCES) \ + $(test_ascii_string_SOURCES) $(test_byte_swapping_SOURCES) \ + $(test_checked_overflow_SOURCES) $(test_human_size_SOURCES) \ + $(test_isaligned_SOURCES) $(test_ispowerof2_SOURCES) \ + $(test_iszero_SOURCES) $(test_minmax_SOURCES) \ + $(test_nextnonzero_SOURCES) $(test_random_SOURCES) \ + $(test_tvdiff_SOURCES) +DIST_SOURCES = $(test_array_size_SOURCES) $(test_ascii_ctype_SOURCES) \ + $(test_ascii_string_SOURCES) $(test_byte_swapping_SOURCES) \ + $(test_checked_overflow_SOURCES) $(test_human_size_SOURCES) \ + $(test_isaligned_SOURCES) $(test_ispowerof2_SOURCES) \ + $(test_iszero_SOURCES) $(test_minmax_SOURCES) \ + $(test_nextnonzero_SOURCES) $(test_random_SOURCES) \ + $(test_tvdiff_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = { \ + $(am__tty_colors_dummy); \ + if test "X$(AM_COLOR_TESTS)" = Xno; then \ + am__color_tests=no; \ + elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ + am__color_tests=yes; \ + elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ + am__color_tests=yes; \ + fi; \ + if test $$am__color_tests = yes; then \ + red=''; \ + grn=''; \ + lgn=''; \ + blu=''; \ + mgn=''; \ + brg=''; \ + std=''; \ + fi; \ +} +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 = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__recheck_rx = ^[ ]*:recheck:[ ]* +am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* +am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* +# A command that, given a newline-separated list of test names on the +# standard input, print the name of the tests that are to be re-run +# upon "make recheck". +am__list_recheck_tests = $(AWK) '{ \ + recheck = 1; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + { \ + if ((getline line2 < ($$0 ".log")) < 0) \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ + { \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ + { \ + break; \ + } \ + }; \ + if (recheck) \ + print $$0; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# A command that, given a newline-separated list of test names on the +# standard input, create the global log from their .trs and .log files. +am__create_global_log = $(AWK) ' \ +function fatal(msg) \ +{ \ + print "fatal: making $@: " msg | "cat >&2"; \ + exit 1; \ +} \ +function rst_section(header) \ +{ \ + print header; \ + len = length(header); \ + for (i = 1; i <= len; i = i + 1) \ + printf "="; \ + printf "\n\n"; \ +} \ +{ \ + copy_in_global_log = 1; \ + global_test_result = "RUN"; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".trs"); \ + if (line ~ /$(am__global_test_result_rx)/) \ + { \ + sub("$(am__global_test_result_rx)", "", line); \ + sub("[ ]*$$", "", line); \ + global_test_result = line; \ + } \ + else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ + copy_in_global_log = 0; \ + }; \ + if (copy_in_global_log) \ + { \ + rst_section(global_test_result ": " $$0); \ + while ((rc = (getline line < ($$0 ".log"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".log"); \ + print line; \ + }; \ + printf "\n"; \ + }; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# Restructured Text title. +am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } +# Solaris 10 'make', and several other traditional 'make' implementations, +# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it +# by disabling -e (using the XSI extension "set +e") if it's set. +am__sh_e_setup = case $$- in *e*) set +e;; esac +# Default flags passed to test drivers. +am__common_driver_flags = \ + --color-tests "$$am__color_tests" \ + --enable-hard-errors "$$am__enable_hard_errors" \ + --expect-failure "$$am__expect_failure" +# To be inserted before the command running the test. Creates the +# directory for the log if needed. Stores in $dir the directory +# containing $f, in $tst the test, in $log the log. Executes the +# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and +# passes TESTS_ENVIRONMENT. Set up options for the wrapper that +# will run the test scripts (or their associated LOG_COMPILER, if +# thy have one). +am__check_pre = \ +$(am__sh_e_setup); \ +$(am__vpath_adj_setup) $(am__vpath_adj) \ +$(am__tty_colors); \ +srcdir=$(srcdir); export srcdir; \ +case "$@" in \ + */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ + *) am__odir=.;; \ +esac; \ +test "x$$am__odir" = x"." || test -d "$$am__odir" \ + || $(MKDIR_P) "$$am__odir" || exit $$?; \ +if test -f "./$$f"; then dir=./; \ +elif test -f "$$f"; then dir=; \ +else dir="$(srcdir)/"; fi; \ +tst=$$dir$$f; log='$@'; \ +if test -n '$(DISABLE_HARD_ERRORS)'; then \ + am__enable_hard_errors=no; \ +else \ + am__enable_hard_errors=yes; \ +fi; \ +case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ + am__expect_failure=yes;; \ + *) \ + am__expect_failure=no;; \ +esac; \ +$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) +# A shell command to get the names of the tests scripts with any registered +# extension removed (i.e., equivalently, the names of the test logs, with +# the '.log' extension removed). The result is saved in the shell variable +# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, +# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", +# since that might cause problem with VPATH rewrites for suffix-less tests. +# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. +am__set_TESTS_bases = \ + bases='$(TEST_LOGS)'; \ + bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ + bases=`echo $$bases` +AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)' +RECHECK_LOGS = $(TEST_LOGS) +AM_RECURSIVE_TARGETS = check recheck +TEST_SUITE_LOG = test-suite.log +TEST_EXTENSIONS = @EXEEXT@ .test +LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) +am__set_b = \ + case '$@' in \ + */*) \ + case '$*' in \ + */*) b='$*';; \ + *) b=`echo '$@' | sed 's/\.log$$//'`; \ + esac;; \ + *) \ + b='$*';; \ + esac +am__test_logs1 = $(TESTS:=.log) +am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) +TEST_LOGS = $(am__test_logs2:.test.log=.log) +TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ + $(TEST_LOG_FLAGS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/common-rules.mk \ + $(top_srcdir)/depcomp $(top_srcdir)/test-driver +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ +BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ +CARGO = @CARGO@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_PLUGIN_CC = @CC_PLUGIN_CC@ +CC_PLUGIN_CFLAGS = @CC_PLUGIN_CFLAGS@ +CERTTOOL = @CERTTOOL@ +CFLAGS = @CFLAGS@ +COM_ERR_CFLAGS = @COM_ERR_CFLAGS@ +COM_ERR_LIBS = @COM_ERR_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CUT = @CUT@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LDFLAGS = @DL_LDFLAGS@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXT2FS_CFLAGS = @EXT2FS_CFLAGS@ +EXT2FS_LIBS = @EXT2FS_LIBS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GENISOIMAGE = @GENISOIMAGE@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GOARCH = @GOARCH@ +GOLANG = @GOLANG@ +GOOS = @GOOS@ +GOROOT = @GOROOT@ +GREP = @GREP@ +IMPORT_LIBRARY_ON_WINDOWS = @IMPORT_LIBRARY_ON_WINDOWS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +ISOPROG = @ISOPROG@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBLKIO_CFLAGS = @LIBBLKIO_CFLAGS@ +LIBBLKIO_LIBS = @LIBBLKIO_LIBS@ +LIBGUESTFS_CFLAGS = @LIBGUESTFS_CFLAGS@ +LIBGUESTFS_LIBS = @LIBGUESTFS_LIBS@ +LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ +LIBLZMA_LIBS = @LIBLZMA_LIBS@ +LIBNBD_CFLAGS = @LIBNBD_CFLAGS@ +LIBNBD_LIBS = @LIBNBD_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSELINUX_CFLAGS = @LIBSELINUX_CFLAGS@ +LIBSELINUX_LIBS = @LIBSELINUX_LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTORRENT_CFLAGS = @LIBTORRENT_CFLAGS@ +LIBTORRENT_LIBS = @LIBTORRENT_LIBS@ +LIBVIRT_CFLAGS = @LIBVIRT_CFLAGS@ +LIBVIRT_LIBS = @LIBVIRT_LIBS@ +LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ +LIBZSTD_LIBS = @LIBZSTD_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LUA_CFLAGS = @LUA_CFLAGS@ +LUA_LIBS = @LUA_LIBS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MC = @MC@ +MKDIR_P = @MKDIR_P@ +MKISOFS = @MKISOFS@ +NBDKIT_VERSION_MAJOR = @NBDKIT_VERSION_MAJOR@ +NBDKIT_VERSION_MICRO = @NBDKIT_VERSION_MICRO@ +NBDKIT_VERSION_MINOR = @NBDKIT_VERSION_MINOR@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_ON_WINDOWS = @NO_UNDEFINED_ON_WINDOWS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OCAML = @OCAML@ +OCAMLBEST = @OCAMLBEST@ +OCAMLBUILD = @OCAMLBUILD@ +OCAMLC = @OCAMLC@ +OCAMLCDOTOPT = @OCAMLCDOTOPT@ +OCAMLDEP = @OCAMLDEP@ +OCAMLDOC = @OCAMLDOC@ +OCAMLLIB = @OCAMLLIB@ +OCAMLMKLIB = @OCAMLMKLIB@ +OCAMLMKTOP = @OCAMLMKTOP@ +OCAMLOPT = @OCAMLOPT@ +OCAMLOPTDOTOPT = @OCAMLOPTDOTOPT@ +OCAMLOPTFLAGS = @OCAMLOPTFLAGS@ +OCAMLVERSION = @OCAMLVERSION@ +OCAML_MAJOR = @OCAML_MAJOR@ +OCAML_PLUGIN_LIBRARIES = @OCAML_PLUGIN_LIBRARIES@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PERL_ARCHLIB = @PERL_ARCHLIB@ +PERL_CFLAGS = @PERL_CFLAGS@ +PERL_LDOPTS = @PERL_LDOPTS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PODWRAPPER = @PODWRAPPER@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_CXX = @PTHREAD_CXX@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CFLAGS = @PYTHON_CFLAGS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +RUBY_CFLAGS = @RUBY_CFLAGS@ +RUBY_LIBS = @RUBY_LIBS@ +RUSTC = @RUSTC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOEXT = @SOEXT@ +SSH_CFLAGS = @SSH_CFLAGS@ +SSH_LIBS = @SSH_LIBS@ +STAT = @STAT@ +STRIP = @STRIP@ +TCL_CFLAGS = @TCL_CFLAGS@ +TCL_LIBS = @TCL_LIBS@ +TRUNCATE = @TRUNCATE@ +VALGRIND = @VALGRIND@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VERSION = @VERSION@ +WARNINGS_CFLAGS = @WARNINGS_CFLAGS@ +XORRISO = @XORRISO@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +ZLIB_NG_CFLAGS = @ZLIB_NG_CFLAGS@ +ZLIB_NG_LIBS = @ZLIB_NG_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DLLTOOL = @ac_ct_DLLTOOL@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_MC = @ac_ct_MC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bashcompdir = @bashcompdir@ +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@ +filters = @filters@ +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@ +lang_plugins = @lang_plugins@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +non_lang_plugins = @non_lang_plugins@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugins = @plugins@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +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@ + +# Convenient list terminator +NULL = +plugindir = $(libdir)/nbdkit/plugins +filterdir = $(libdir)/nbdkit/filters +CLEANFILES = *~ *.cmi *.cmx *.cmxa *.so *.dll + +# These headers contain only common code shared by the core server, +# plugins and/or filters. They are not installed. +EXTRA_DIST = \ + ansi-colours.h \ + array-size.h \ + ascii-ctype.h \ + ascii-string.h \ + byte-swapping.h \ + checked-overflow.h \ + compiler-macros.h \ + hexdigit.h \ + human-size.h \ + human-size-test-cases.h \ + isaligned.h \ + ispowerof2.h \ + iszero.h \ + minmax.h \ + nextnonzero.h \ + random.h \ + rounding.h \ + static-assert.h \ + tvdiff.h \ + unique-name.h \ + unix-path-max.h \ + $(NULL) + +test_array_size_SOURCES = test-array-size.c array-size.h +test_array_size_CPPFLAGS = -I$(srcdir) +test_array_size_CFLAGS = $(WARNINGS_CFLAGS) +test_ascii_ctype_SOURCES = test-ascii-ctype.c ascii-ctype.h +test_ascii_ctype_CPPFLAGS = -I$(srcdir) +test_ascii_ctype_CFLAGS = $(WARNINGS_CFLAGS) +test_ascii_string_SOURCES = test-ascii-string.c ascii-string.h +test_ascii_string_CPPFLAGS = -I$(srcdir) +test_ascii_string_CFLAGS = $(WARNINGS_CFLAGS) +test_byte_swapping_SOURCES = test-byte-swapping.c byte-swapping.h +test_byte_swapping_CPPFLAGS = -I$(srcdir) +test_byte_swapping_CFLAGS = $(WARNINGS_CFLAGS) +test_checked_overflow_SOURCES = test-checked-overflow.c checked-overflow.h +test_checked_overflow_CPPFLAGS = -I$(srcdir) +test_checked_overflow_CFLAGS = $(WARNINGS_CFLAGS) +test_human_size_SOURCES = test-human-size.c human-size.h human-size-test-cases.h +test_human_size_CPPFLAGS = -I$(srcdir) +test_human_size_CFLAGS = $(WARNINGS_CFLAGS) +test_isaligned_SOURCES = test-isaligned.c isaligned.h +test_isaligned_CPPFLAGS = -I$(srcdir) +test_isaligned_CFLAGS = $(WARNINGS_CFLAGS) +test_ispowerof2_SOURCES = test-ispowerof2.c ispowerof2.h +test_ispowerof2_CPPFLAGS = -I$(srcdir) +test_ispowerof2_CFLAGS = $(WARNINGS_CFLAGS) +test_iszero_SOURCES = test-iszero.c iszero.h +test_iszero_CPPFLAGS = -I$(srcdir) +test_iszero_CFLAGS = $(WARNINGS_CFLAGS) +test_minmax_SOURCES = test-minmax.c minmax.h +test_minmax_CPPFLAGS = -I$(srcdir) +test_minmax_CFLAGS = $(WARNINGS_CFLAGS) +test_nextnonzero_SOURCES = test-nextnonzero.c nextnonzero.h +test_nextnonzero_CPPFLAGS = -I$(srcdir) +test_nextnonzero_CFLAGS = $(WARNINGS_CFLAGS) +test_random_SOURCES = test-random.c random.h +test_random_CPPFLAGS = -I$(srcdir) +test_random_CFLAGS = $(WARNINGS_CFLAGS) +test_tvdiff_SOURCES = test-tvdiff.c tvdiff.h +test_tvdiff_CPPFLAGS = -I$(srcdir) +test_tvdiff_CFLAGS = $(WARNINGS_CFLAGS) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common-rules.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign common/include/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign common/include/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; +$(top_srcdir)/common-rules.mk $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +test-array-size$(EXEEXT): $(test_array_size_OBJECTS) $(test_array_size_DEPENDENCIES) $(EXTRA_test_array_size_DEPENDENCIES) + @rm -f test-array-size$(EXEEXT) + $(AM_V_CCLD)$(test_array_size_LINK) $(test_array_size_OBJECTS) $(test_array_size_LDADD) $(LIBS) + +test-ascii-ctype$(EXEEXT): $(test_ascii_ctype_OBJECTS) $(test_ascii_ctype_DEPENDENCIES) $(EXTRA_test_ascii_ctype_DEPENDENCIES) + @rm -f test-ascii-ctype$(EXEEXT) + $(AM_V_CCLD)$(test_ascii_ctype_LINK) $(test_ascii_ctype_OBJECTS) $(test_ascii_ctype_LDADD) $(LIBS) + +test-ascii-string$(EXEEXT): $(test_ascii_string_OBJECTS) $(test_ascii_string_DEPENDENCIES) $(EXTRA_test_ascii_string_DEPENDENCIES) + @rm -f test-ascii-string$(EXEEXT) + $(AM_V_CCLD)$(test_ascii_string_LINK) $(test_ascii_string_OBJECTS) $(test_ascii_string_LDADD) $(LIBS) + +test-byte-swapping$(EXEEXT): $(test_byte_swapping_OBJECTS) $(test_byte_swapping_DEPENDENCIES) $(EXTRA_test_byte_swapping_DEPENDENCIES) + @rm -f test-byte-swapping$(EXEEXT) + $(AM_V_CCLD)$(test_byte_swapping_LINK) $(test_byte_swapping_OBJECTS) $(test_byte_swapping_LDADD) $(LIBS) + +test-checked-overflow$(EXEEXT): $(test_checked_overflow_OBJECTS) $(test_checked_overflow_DEPENDENCIES) $(EXTRA_test_checked_overflow_DEPENDENCIES) + @rm -f test-checked-overflow$(EXEEXT) + $(AM_V_CCLD)$(test_checked_overflow_LINK) $(test_checked_overflow_OBJECTS) $(test_checked_overflow_LDADD) $(LIBS) + +test-human-size$(EXEEXT): $(test_human_size_OBJECTS) $(test_human_size_DEPENDENCIES) $(EXTRA_test_human_size_DEPENDENCIES) + @rm -f test-human-size$(EXEEXT) + $(AM_V_CCLD)$(test_human_size_LINK) $(test_human_size_OBJECTS) $(test_human_size_LDADD) $(LIBS) + +test-isaligned$(EXEEXT): $(test_isaligned_OBJECTS) $(test_isaligned_DEPENDENCIES) $(EXTRA_test_isaligned_DEPENDENCIES) + @rm -f test-isaligned$(EXEEXT) + $(AM_V_CCLD)$(test_isaligned_LINK) $(test_isaligned_OBJECTS) $(test_isaligned_LDADD) $(LIBS) + +test-ispowerof2$(EXEEXT): $(test_ispowerof2_OBJECTS) $(test_ispowerof2_DEPENDENCIES) $(EXTRA_test_ispowerof2_DEPENDENCIES) + @rm -f test-ispowerof2$(EXEEXT) + $(AM_V_CCLD)$(test_ispowerof2_LINK) $(test_ispowerof2_OBJECTS) $(test_ispowerof2_LDADD) $(LIBS) + +test-iszero$(EXEEXT): $(test_iszero_OBJECTS) $(test_iszero_DEPENDENCIES) $(EXTRA_test_iszero_DEPENDENCIES) + @rm -f test-iszero$(EXEEXT) + $(AM_V_CCLD)$(test_iszero_LINK) $(test_iszero_OBJECTS) $(test_iszero_LDADD) $(LIBS) + +test-minmax$(EXEEXT): $(test_minmax_OBJECTS) $(test_minmax_DEPENDENCIES) $(EXTRA_test_minmax_DEPENDENCIES) + @rm -f test-minmax$(EXEEXT) + $(AM_V_CCLD)$(test_minmax_LINK) $(test_minmax_OBJECTS) $(test_minmax_LDADD) $(LIBS) + +test-nextnonzero$(EXEEXT): $(test_nextnonzero_OBJECTS) $(test_nextnonzero_DEPENDENCIES) $(EXTRA_test_nextnonzero_DEPENDENCIES) + @rm -f test-nextnonzero$(EXEEXT) + $(AM_V_CCLD)$(test_nextnonzero_LINK) $(test_nextnonzero_OBJECTS) $(test_nextnonzero_LDADD) $(LIBS) + +test-random$(EXEEXT): $(test_random_OBJECTS) $(test_random_DEPENDENCIES) $(EXTRA_test_random_DEPENDENCIES) + @rm -f test-random$(EXEEXT) + $(AM_V_CCLD)$(test_random_LINK) $(test_random_OBJECTS) $(test_random_LDADD) $(LIBS) + +test-tvdiff$(EXEEXT): $(test_tvdiff_OBJECTS) $(test_tvdiff_DEPENDENCIES) $(EXTRA_test_tvdiff_DEPENDENCIES) + @rm -f test-tvdiff$(EXEEXT) + $(AM_V_CCLD)$(test_tvdiff_LINK) $(test_tvdiff_OBJECTS) $(test_tvdiff_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_array_size-test-array-size.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_ascii_ctype-test-ascii-ctype.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_ascii_string-test-ascii-string.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_byte_swapping-test-byte-swapping.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_checked_overflow-test-checked-overflow.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_human_size-test-human-size.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_isaligned-test-isaligned.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_ispowerof2-test-ispowerof2.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_iszero-test-iszero.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_minmax-test-minmax.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_nextnonzero-test-nextnonzero.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_random-test-random.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_tvdiff-test-tvdiff.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +test_array_size-test-array-size.o: test-array-size.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_array_size_CPPFLAGS) $(CPPFLAGS) $(test_array_size_CFLAGS) $(CFLAGS) -MT test_array_size-test-array-size.o -MD -MP -MF $(DEPDIR)/test_array_size-test-array-size.Tpo -c -o test_array_size-test-array-size.o `test -f 'test-array-size.c' || echo '$(srcdir)/'`test-array-size.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_array_size-test-array-size.Tpo $(DEPDIR)/test_array_size-test-array-size.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-array-size.c' object='test_array_size-test-array-size.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_array_size_CPPFLAGS) $(CPPFLAGS) $(test_array_size_CFLAGS) $(CFLAGS) -c -o test_array_size-test-array-size.o `test -f 'test-array-size.c' || echo '$(srcdir)/'`test-array-size.c + +test_array_size-test-array-size.obj: test-array-size.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_array_size_CPPFLAGS) $(CPPFLAGS) $(test_array_size_CFLAGS) $(CFLAGS) -MT test_array_size-test-array-size.obj -MD -MP -MF $(DEPDIR)/test_array_size-test-array-size.Tpo -c -o test_array_size-test-array-size.obj `if test -f 'test-array-size.c'; then $(CYGPATH_W) 'test-array-size.c'; else $(CYGPATH_W) '$(srcdir)/test-array-size.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_array_size-test-array-size.Tpo $(DEPDIR)/test_array_size-test-array-size.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-array-size.c' object='test_array_size-test-array-size.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_array_size_CPPFLAGS) $(CPPFLAGS) $(test_array_size_CFLAGS) $(CFLAGS) -c -o test_array_size-test-array-size.obj `if test -f 'test-array-size.c'; then $(CYGPATH_W) 'test-array-size.c'; else $(CYGPATH_W) '$(srcdir)/test-array-size.c'; fi` + +test_ascii_ctype-test-ascii-ctype.o: test-ascii-ctype.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_ascii_ctype_CPPFLAGS) $(CPPFLAGS) $(test_ascii_ctype_CFLAGS) $(CFLAGS) -MT test_ascii_ctype-test-ascii-ctype.o -MD -MP -MF $(DEPDIR)/test_ascii_ctype-test-ascii-ctype.Tpo -c -o test_ascii_ctype-test-ascii-ctype.o `test -f 'test-ascii-ctype.c' || echo '$(srcdir)/'`test-ascii-ctype.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_ascii_ctype-test-ascii-ctype.Tpo $(DEPDIR)/test_ascii_ctype-test-ascii-ctype.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-ascii-ctype.c' object='test_ascii_ctype-test-ascii-ctype.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_ascii_ctype_CPPFLAGS) $(CPPFLAGS) $(test_ascii_ctype_CFLAGS) $(CFLAGS) -c -o test_ascii_ctype-test-ascii-ctype.o `test -f 'test-ascii-ctype.c' || echo '$(srcdir)/'`test-ascii-ctype.c + +test_ascii_ctype-test-ascii-ctype.obj: test-ascii-ctype.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_ascii_ctype_CPPFLAGS) $(CPPFLAGS) $(test_ascii_ctype_CFLAGS) $(CFLAGS) -MT test_ascii_ctype-test-ascii-ctype.obj -MD -MP -MF $(DEPDIR)/test_ascii_ctype-test-ascii-ctype.Tpo -c -o test_ascii_ctype-test-ascii-ctype.obj `if test -f 'test-ascii-ctype.c'; then $(CYGPATH_W) 'test-ascii-ctype.c'; else $(CYGPATH_W) '$(srcdir)/test-ascii-ctype.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_ascii_ctype-test-ascii-ctype.Tpo $(DEPDIR)/test_ascii_ctype-test-ascii-ctype.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-ascii-ctype.c' object='test_ascii_ctype-test-ascii-ctype.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_ascii_ctype_CPPFLAGS) $(CPPFLAGS) $(test_ascii_ctype_CFLAGS) $(CFLAGS) -c -o test_ascii_ctype-test-ascii-ctype.obj `if test -f 'test-ascii-ctype.c'; then $(CYGPATH_W) 'test-ascii-ctype.c'; else $(CYGPATH_W) '$(srcdir)/test-ascii-ctype.c'; fi` + +test_ascii_string-test-ascii-string.o: test-ascii-string.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_ascii_string_CPPFLAGS) $(CPPFLAGS) $(test_ascii_string_CFLAGS) $(CFLAGS) -MT test_ascii_string-test-ascii-string.o -MD -MP -MF $(DEPDIR)/test_ascii_string-test-ascii-string.Tpo -c -o test_ascii_string-test-ascii-string.o `test -f 'test-ascii-string.c' || echo '$(srcdir)/'`test-ascii-string.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_ascii_string-test-ascii-string.Tpo $(DEPDIR)/test_ascii_string-test-ascii-string.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-ascii-string.c' object='test_ascii_string-test-ascii-string.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_ascii_string_CPPFLAGS) $(CPPFLAGS) $(test_ascii_string_CFLAGS) $(CFLAGS) -c -o test_ascii_string-test-ascii-string.o `test -f 'test-ascii-string.c' || echo '$(srcdir)/'`test-ascii-string.c + +test_ascii_string-test-ascii-string.obj: test-ascii-string.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_ascii_string_CPPFLAGS) $(CPPFLAGS) $(test_ascii_string_CFLAGS) $(CFLAGS) -MT test_ascii_string-test-ascii-string.obj -MD -MP -MF $(DEPDIR)/test_ascii_string-test-ascii-string.Tpo -c -o test_ascii_string-test-ascii-string.obj `if test -f 'test-ascii-string.c'; then $(CYGPATH_W) 'test-ascii-string.c'; else $(CYGPATH_W) '$(srcdir)/test-ascii-string.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_ascii_string-test-ascii-string.Tpo $(DEPDIR)/test_ascii_string-test-ascii-string.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-ascii-string.c' object='test_ascii_string-test-ascii-string.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_ascii_string_CPPFLAGS) $(CPPFLAGS) $(test_ascii_string_CFLAGS) $(CFLAGS) -c -o test_ascii_string-test-ascii-string.obj `if test -f 'test-ascii-string.c'; then $(CYGPATH_W) 'test-ascii-string.c'; else $(CYGPATH_W) '$(srcdir)/test-ascii-string.c'; fi` + +test_byte_swapping-test-byte-swapping.o: test-byte-swapping.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_byte_swapping_CPPFLAGS) $(CPPFLAGS) $(test_byte_swapping_CFLAGS) $(CFLAGS) -MT test_byte_swapping-test-byte-swapping.o -MD -MP -MF $(DEPDIR)/test_byte_swapping-test-byte-swapping.Tpo -c -o test_byte_swapping-test-byte-swapping.o `test -f 'test-byte-swapping.c' || echo '$(srcdir)/'`test-byte-swapping.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_byte_swapping-test-byte-swapping.Tpo $(DEPDIR)/test_byte_swapping-test-byte-swapping.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-byte-swapping.c' object='test_byte_swapping-test-byte-swapping.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_byte_swapping_CPPFLAGS) $(CPPFLAGS) $(test_byte_swapping_CFLAGS) $(CFLAGS) -c -o test_byte_swapping-test-byte-swapping.o `test -f 'test-byte-swapping.c' || echo '$(srcdir)/'`test-byte-swapping.c + +test_byte_swapping-test-byte-swapping.obj: test-byte-swapping.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_byte_swapping_CPPFLAGS) $(CPPFLAGS) $(test_byte_swapping_CFLAGS) $(CFLAGS) -MT test_byte_swapping-test-byte-swapping.obj -MD -MP -MF $(DEPDIR)/test_byte_swapping-test-byte-swapping.Tpo -c -o test_byte_swapping-test-byte-swapping.obj `if test -f 'test-byte-swapping.c'; then $(CYGPATH_W) 'test-byte-swapping.c'; else $(CYGPATH_W) '$(srcdir)/test-byte-swapping.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_byte_swapping-test-byte-swapping.Tpo $(DEPDIR)/test_byte_swapping-test-byte-swapping.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-byte-swapping.c' object='test_byte_swapping-test-byte-swapping.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_byte_swapping_CPPFLAGS) $(CPPFLAGS) $(test_byte_swapping_CFLAGS) $(CFLAGS) -c -o test_byte_swapping-test-byte-swapping.obj `if test -f 'test-byte-swapping.c'; then $(CYGPATH_W) 'test-byte-swapping.c'; else $(CYGPATH_W) '$(srcdir)/test-byte-swapping.c'; fi` + +test_checked_overflow-test-checked-overflow.o: test-checked-overflow.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_checked_overflow_CPPFLAGS) $(CPPFLAGS) $(test_checked_overflow_CFLAGS) $(CFLAGS) -MT test_checked_overflow-test-checked-overflow.o -MD -MP -MF $(DEPDIR)/test_checked_overflow-test-checked-overflow.Tpo -c -o test_checked_overflow-test-checked-overflow.o `test -f 'test-checked-overflow.c' || echo '$(srcdir)/'`test-checked-overflow.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_checked_overflow-test-checked-overflow.Tpo $(DEPDIR)/test_checked_overflow-test-checked-overflow.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-checked-overflow.c' object='test_checked_overflow-test-checked-overflow.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_checked_overflow_CPPFLAGS) $(CPPFLAGS) $(test_checked_overflow_CFLAGS) $(CFLAGS) -c -o test_checked_overflow-test-checked-overflow.o `test -f 'test-checked-overflow.c' || echo '$(srcdir)/'`test-checked-overflow.c + +test_checked_overflow-test-checked-overflow.obj: test-checked-overflow.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_checked_overflow_CPPFLAGS) $(CPPFLAGS) $(test_checked_overflow_CFLAGS) $(CFLAGS) -MT test_checked_overflow-test-checked-overflow.obj -MD -MP -MF $(DEPDIR)/test_checked_overflow-test-checked-overflow.Tpo -c -o test_checked_overflow-test-checked-overflow.obj `if test -f 'test-checked-overflow.c'; then $(CYGPATH_W) 'test-checked-overflow.c'; else $(CYGPATH_W) '$(srcdir)/test-checked-overflow.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_checked_overflow-test-checked-overflow.Tpo $(DEPDIR)/test_checked_overflow-test-checked-overflow.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-checked-overflow.c' object='test_checked_overflow-test-checked-overflow.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_checked_overflow_CPPFLAGS) $(CPPFLAGS) $(test_checked_overflow_CFLAGS) $(CFLAGS) -c -o test_checked_overflow-test-checked-overflow.obj `if test -f 'test-checked-overflow.c'; then $(CYGPATH_W) 'test-checked-overflow.c'; else $(CYGPATH_W) '$(srcdir)/test-checked-overflow.c'; fi` + +test_human_size-test-human-size.o: test-human-size.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_human_size_CPPFLAGS) $(CPPFLAGS) $(test_human_size_CFLAGS) $(CFLAGS) -MT test_human_size-test-human-size.o -MD -MP -MF $(DEPDIR)/test_human_size-test-human-size.Tpo -c -o test_human_size-test-human-size.o `test -f 'test-human-size.c' || echo '$(srcdir)/'`test-human-size.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_human_size-test-human-size.Tpo $(DEPDIR)/test_human_size-test-human-size.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-human-size.c' object='test_human_size-test-human-size.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_human_size_CPPFLAGS) $(CPPFLAGS) $(test_human_size_CFLAGS) $(CFLAGS) -c -o test_human_size-test-human-size.o `test -f 'test-human-size.c' || echo '$(srcdir)/'`test-human-size.c + +test_human_size-test-human-size.obj: test-human-size.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_human_size_CPPFLAGS) $(CPPFLAGS) $(test_human_size_CFLAGS) $(CFLAGS) -MT test_human_size-test-human-size.obj -MD -MP -MF $(DEPDIR)/test_human_size-test-human-size.Tpo -c -o test_human_size-test-human-size.obj `if test -f 'test-human-size.c'; then $(CYGPATH_W) 'test-human-size.c'; else $(CYGPATH_W) '$(srcdir)/test-human-size.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_human_size-test-human-size.Tpo $(DEPDIR)/test_human_size-test-human-size.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-human-size.c' object='test_human_size-test-human-size.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_human_size_CPPFLAGS) $(CPPFLAGS) $(test_human_size_CFLAGS) $(CFLAGS) -c -o test_human_size-test-human-size.obj `if test -f 'test-human-size.c'; then $(CYGPATH_W) 'test-human-size.c'; else $(CYGPATH_W) '$(srcdir)/test-human-size.c'; fi` + +test_isaligned-test-isaligned.o: test-isaligned.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_isaligned_CPPFLAGS) $(CPPFLAGS) $(test_isaligned_CFLAGS) $(CFLAGS) -MT test_isaligned-test-isaligned.o -MD -MP -MF $(DEPDIR)/test_isaligned-test-isaligned.Tpo -c -o test_isaligned-test-isaligned.o `test -f 'test-isaligned.c' || echo '$(srcdir)/'`test-isaligned.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_isaligned-test-isaligned.Tpo $(DEPDIR)/test_isaligned-test-isaligned.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-isaligned.c' object='test_isaligned-test-isaligned.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_isaligned_CPPFLAGS) $(CPPFLAGS) $(test_isaligned_CFLAGS) $(CFLAGS) -c -o test_isaligned-test-isaligned.o `test -f 'test-isaligned.c' || echo '$(srcdir)/'`test-isaligned.c + +test_isaligned-test-isaligned.obj: test-isaligned.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_isaligned_CPPFLAGS) $(CPPFLAGS) $(test_isaligned_CFLAGS) $(CFLAGS) -MT test_isaligned-test-isaligned.obj -MD -MP -MF $(DEPDIR)/test_isaligned-test-isaligned.Tpo -c -o test_isaligned-test-isaligned.obj `if test -f 'test-isaligned.c'; then $(CYGPATH_W) 'test-isaligned.c'; else $(CYGPATH_W) '$(srcdir)/test-isaligned.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_isaligned-test-isaligned.Tpo $(DEPDIR)/test_isaligned-test-isaligned.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-isaligned.c' object='test_isaligned-test-isaligned.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_isaligned_CPPFLAGS) $(CPPFLAGS) $(test_isaligned_CFLAGS) $(CFLAGS) -c -o test_isaligned-test-isaligned.obj `if test -f 'test-isaligned.c'; then $(CYGPATH_W) 'test-isaligned.c'; else $(CYGPATH_W) '$(srcdir)/test-isaligned.c'; fi` + +test_ispowerof2-test-ispowerof2.o: test-ispowerof2.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_ispowerof2_CPPFLAGS) $(CPPFLAGS) $(test_ispowerof2_CFLAGS) $(CFLAGS) -MT test_ispowerof2-test-ispowerof2.o -MD -MP -MF $(DEPDIR)/test_ispowerof2-test-ispowerof2.Tpo -c -o test_ispowerof2-test-ispowerof2.o `test -f 'test-ispowerof2.c' || echo '$(srcdir)/'`test-ispowerof2.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_ispowerof2-test-ispowerof2.Tpo $(DEPDIR)/test_ispowerof2-test-ispowerof2.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-ispowerof2.c' object='test_ispowerof2-test-ispowerof2.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_ispowerof2_CPPFLAGS) $(CPPFLAGS) $(test_ispowerof2_CFLAGS) $(CFLAGS) -c -o test_ispowerof2-test-ispowerof2.o `test -f 'test-ispowerof2.c' || echo '$(srcdir)/'`test-ispowerof2.c + +test_ispowerof2-test-ispowerof2.obj: test-ispowerof2.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_ispowerof2_CPPFLAGS) $(CPPFLAGS) $(test_ispowerof2_CFLAGS) $(CFLAGS) -MT test_ispowerof2-test-ispowerof2.obj -MD -MP -MF $(DEPDIR)/test_ispowerof2-test-ispowerof2.Tpo -c -o test_ispowerof2-test-ispowerof2.obj `if test -f 'test-ispowerof2.c'; then $(CYGPATH_W) 'test-ispowerof2.c'; else $(CYGPATH_W) '$(srcdir)/test-ispowerof2.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_ispowerof2-test-ispowerof2.Tpo $(DEPDIR)/test_ispowerof2-test-ispowerof2.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-ispowerof2.c' object='test_ispowerof2-test-ispowerof2.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_ispowerof2_CPPFLAGS) $(CPPFLAGS) $(test_ispowerof2_CFLAGS) $(CFLAGS) -c -o test_ispowerof2-test-ispowerof2.obj `if test -f 'test-ispowerof2.c'; then $(CYGPATH_W) 'test-ispowerof2.c'; else $(CYGPATH_W) '$(srcdir)/test-ispowerof2.c'; fi` + +test_iszero-test-iszero.o: test-iszero.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_iszero_CPPFLAGS) $(CPPFLAGS) $(test_iszero_CFLAGS) $(CFLAGS) -MT test_iszero-test-iszero.o -MD -MP -MF $(DEPDIR)/test_iszero-test-iszero.Tpo -c -o test_iszero-test-iszero.o `test -f 'test-iszero.c' || echo '$(srcdir)/'`test-iszero.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_iszero-test-iszero.Tpo $(DEPDIR)/test_iszero-test-iszero.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-iszero.c' object='test_iszero-test-iszero.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_iszero_CPPFLAGS) $(CPPFLAGS) $(test_iszero_CFLAGS) $(CFLAGS) -c -o test_iszero-test-iszero.o `test -f 'test-iszero.c' || echo '$(srcdir)/'`test-iszero.c + +test_iszero-test-iszero.obj: test-iszero.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_iszero_CPPFLAGS) $(CPPFLAGS) $(test_iszero_CFLAGS) $(CFLAGS) -MT test_iszero-test-iszero.obj -MD -MP -MF $(DEPDIR)/test_iszero-test-iszero.Tpo -c -o test_iszero-test-iszero.obj `if test -f 'test-iszero.c'; then $(CYGPATH_W) 'test-iszero.c'; else $(CYGPATH_W) '$(srcdir)/test-iszero.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_iszero-test-iszero.Tpo $(DEPDIR)/test_iszero-test-iszero.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-iszero.c' object='test_iszero-test-iszero.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_iszero_CPPFLAGS) $(CPPFLAGS) $(test_iszero_CFLAGS) $(CFLAGS) -c -o test_iszero-test-iszero.obj `if test -f 'test-iszero.c'; then $(CYGPATH_W) 'test-iszero.c'; else $(CYGPATH_W) '$(srcdir)/test-iszero.c'; fi` + +test_minmax-test-minmax.o: test-minmax.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_minmax_CPPFLAGS) $(CPPFLAGS) $(test_minmax_CFLAGS) $(CFLAGS) -MT test_minmax-test-minmax.o -MD -MP -MF $(DEPDIR)/test_minmax-test-minmax.Tpo -c -o test_minmax-test-minmax.o `test -f 'test-minmax.c' || echo '$(srcdir)/'`test-minmax.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_minmax-test-minmax.Tpo $(DEPDIR)/test_minmax-test-minmax.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-minmax.c' object='test_minmax-test-minmax.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_minmax_CPPFLAGS) $(CPPFLAGS) $(test_minmax_CFLAGS) $(CFLAGS) -c -o test_minmax-test-minmax.o `test -f 'test-minmax.c' || echo '$(srcdir)/'`test-minmax.c + +test_minmax-test-minmax.obj: test-minmax.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_minmax_CPPFLAGS) $(CPPFLAGS) $(test_minmax_CFLAGS) $(CFLAGS) -MT test_minmax-test-minmax.obj -MD -MP -MF $(DEPDIR)/test_minmax-test-minmax.Tpo -c -o test_minmax-test-minmax.obj `if test -f 'test-minmax.c'; then $(CYGPATH_W) 'test-minmax.c'; else $(CYGPATH_W) '$(srcdir)/test-minmax.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_minmax-test-minmax.Tpo $(DEPDIR)/test_minmax-test-minmax.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-minmax.c' object='test_minmax-test-minmax.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_minmax_CPPFLAGS) $(CPPFLAGS) $(test_minmax_CFLAGS) $(CFLAGS) -c -o test_minmax-test-minmax.obj `if test -f 'test-minmax.c'; then $(CYGPATH_W) 'test-minmax.c'; else $(CYGPATH_W) '$(srcdir)/test-minmax.c'; fi` + +test_nextnonzero-test-nextnonzero.o: test-nextnonzero.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_nextnonzero_CPPFLAGS) $(CPPFLAGS) $(test_nextnonzero_CFLAGS) $(CFLAGS) -MT test_nextnonzero-test-nextnonzero.o -MD -MP -MF $(DEPDIR)/test_nextnonzero-test-nextnonzero.Tpo -c -o test_nextnonzero-test-nextnonzero.o `test -f 'test-nextnonzero.c' || echo '$(srcdir)/'`test-nextnonzero.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_nextnonzero-test-nextnonzero.Tpo $(DEPDIR)/test_nextnonzero-test-nextnonzero.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-nextnonzero.c' object='test_nextnonzero-test-nextnonzero.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_nextnonzero_CPPFLAGS) $(CPPFLAGS) $(test_nextnonzero_CFLAGS) $(CFLAGS) -c -o test_nextnonzero-test-nextnonzero.o `test -f 'test-nextnonzero.c' || echo '$(srcdir)/'`test-nextnonzero.c + +test_nextnonzero-test-nextnonzero.obj: test-nextnonzero.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_nextnonzero_CPPFLAGS) $(CPPFLAGS) $(test_nextnonzero_CFLAGS) $(CFLAGS) -MT test_nextnonzero-test-nextnonzero.obj -MD -MP -MF $(DEPDIR)/test_nextnonzero-test-nextnonzero.Tpo -c -o test_nextnonzero-test-nextnonzero.obj `if test -f 'test-nextnonzero.c'; then $(CYGPATH_W) 'test-nextnonzero.c'; else $(CYGPATH_W) '$(srcdir)/test-nextnonzero.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_nextnonzero-test-nextnonzero.Tpo $(DEPDIR)/test_nextnonzero-test-nextnonzero.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-nextnonzero.c' object='test_nextnonzero-test-nextnonzero.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_nextnonzero_CPPFLAGS) $(CPPFLAGS) $(test_nextnonzero_CFLAGS) $(CFLAGS) -c -o test_nextnonzero-test-nextnonzero.obj `if test -f 'test-nextnonzero.c'; then $(CYGPATH_W) 'test-nextnonzero.c'; else $(CYGPATH_W) '$(srcdir)/test-nextnonzero.c'; fi` + +test_random-test-random.o: test-random.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_random_CPPFLAGS) $(CPPFLAGS) $(test_random_CFLAGS) $(CFLAGS) -MT test_random-test-random.o -MD -MP -MF $(DEPDIR)/test_random-test-random.Tpo -c -o test_random-test-random.o `test -f 'test-random.c' || echo '$(srcdir)/'`test-random.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_random-test-random.Tpo $(DEPDIR)/test_random-test-random.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-random.c' object='test_random-test-random.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_random_CPPFLAGS) $(CPPFLAGS) $(test_random_CFLAGS) $(CFLAGS) -c -o test_random-test-random.o `test -f 'test-random.c' || echo '$(srcdir)/'`test-random.c + +test_random-test-random.obj: test-random.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_random_CPPFLAGS) $(CPPFLAGS) $(test_random_CFLAGS) $(CFLAGS) -MT test_random-test-random.obj -MD -MP -MF $(DEPDIR)/test_random-test-random.Tpo -c -o test_random-test-random.obj `if test -f 'test-random.c'; then $(CYGPATH_W) 'test-random.c'; else $(CYGPATH_W) '$(srcdir)/test-random.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_random-test-random.Tpo $(DEPDIR)/test_random-test-random.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-random.c' object='test_random-test-random.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_random_CPPFLAGS) $(CPPFLAGS) $(test_random_CFLAGS) $(CFLAGS) -c -o test_random-test-random.obj `if test -f 'test-random.c'; then $(CYGPATH_W) 'test-random.c'; else $(CYGPATH_W) '$(srcdir)/test-random.c'; fi` + +test_tvdiff-test-tvdiff.o: test-tvdiff.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_tvdiff_CPPFLAGS) $(CPPFLAGS) $(test_tvdiff_CFLAGS) $(CFLAGS) -MT test_tvdiff-test-tvdiff.o -MD -MP -MF $(DEPDIR)/test_tvdiff-test-tvdiff.Tpo -c -o test_tvdiff-test-tvdiff.o `test -f 'test-tvdiff.c' || echo '$(srcdir)/'`test-tvdiff.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_tvdiff-test-tvdiff.Tpo $(DEPDIR)/test_tvdiff-test-tvdiff.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-tvdiff.c' object='test_tvdiff-test-tvdiff.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_tvdiff_CPPFLAGS) $(CPPFLAGS) $(test_tvdiff_CFLAGS) $(CFLAGS) -c -o test_tvdiff-test-tvdiff.o `test -f 'test-tvdiff.c' || echo '$(srcdir)/'`test-tvdiff.c + +test_tvdiff-test-tvdiff.obj: test-tvdiff.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_tvdiff_CPPFLAGS) $(CPPFLAGS) $(test_tvdiff_CFLAGS) $(CFLAGS) -MT test_tvdiff-test-tvdiff.obj -MD -MP -MF $(DEPDIR)/test_tvdiff-test-tvdiff.Tpo -c -o test_tvdiff-test-tvdiff.obj `if test -f 'test-tvdiff.c'; then $(CYGPATH_W) 'test-tvdiff.c'; else $(CYGPATH_W) '$(srcdir)/test-tvdiff.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_tvdiff-test-tvdiff.Tpo $(DEPDIR)/test_tvdiff-test-tvdiff.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-tvdiff.c' object='test_tvdiff-test-tvdiff.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_tvdiff_CPPFLAGS) $(CPPFLAGS) $(test_tvdiff_CFLAGS) $(CFLAGS) -c -o test_tvdiff-test-tvdiff.obj `if test -f 'test-tvdiff.c'; then $(CYGPATH_W) 'test-tvdiff.c'; else $(CYGPATH_W) '$(srcdir)/test-tvdiff.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +# Recover from deleted '.trs' file; this should ensure that +# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create +# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells +# to avoid problems with "make -n". +.log.trs: + rm -f $< $@ + $(MAKE) $(AM_MAKEFLAGS) $< + +# Leading 'am--fnord' is there to ensure the list of targets does not +# expand to empty, as could happen e.g. with make check TESTS=''. +am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) +am--force-recheck: + @: + +$(TEST_SUITE_LOG): $(TEST_LOGS) + @$(am__set_TESTS_bases); \ + am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ + redo_bases=`for i in $$bases; do \ + am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ + done`; \ + if test -n "$$redo_bases"; then \ + redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ + redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ + if $(am__make_dryrun); then :; else \ + rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ + fi; \ + fi; \ + if test -n "$$am__remaking_logs"; then \ + echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ + "recursion detected" >&2; \ + elif test -n "$$redo_logs"; then \ + am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ + fi; \ + if $(am__make_dryrun); then :; else \ + st=0; \ + errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ + for i in $$redo_bases; do \ + test -f $$i.trs && test -r $$i.trs \ + || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ + test -f $$i.log && test -r $$i.log \ + || { echo "$$errmsg $$i.log" >&2; st=1; }; \ + done; \ + test $$st -eq 0 || exit 1; \ + fi + @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ + ws='[ ]'; \ + results=`for b in $$bases; do echo $$b.trs; done`; \ + test -n "$$results" || results=/dev/null; \ + all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ + pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ + fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ + skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ + xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ + xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ + error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ + if test `expr $$fail + $$xpass + $$error` -eq 0; then \ + success=true; \ + else \ + success=false; \ + fi; \ + br='==================='; br=$$br$$br$$br$$br; \ + result_count () \ + { \ + if test x"$$1" = x"--maybe-color"; then \ + maybe_colorize=yes; \ + elif test x"$$1" = x"--no-color"; then \ + maybe_colorize=no; \ + else \ + echo "$@: invalid 'result_count' usage" >&2; exit 4; \ + fi; \ + shift; \ + desc=$$1 count=$$2; \ + if test $$maybe_colorize = yes && test $$count -gt 0; then \ + color_start=$$3 color_end=$$std; \ + else \ + color_start= color_end=; \ + fi; \ + echo "$${color_start}# $$desc $$count$${color_end}"; \ + }; \ + create_testsuite_report () \ + { \ + result_count $$1 "TOTAL:" $$all "$$brg"; \ + result_count $$1 "PASS: " $$pass "$$grn"; \ + result_count $$1 "SKIP: " $$skip "$$blu"; \ + result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ + result_count $$1 "FAIL: " $$fail "$$red"; \ + result_count $$1 "XPASS:" $$xpass "$$red"; \ + result_count $$1 "ERROR:" $$error "$$mgn"; \ + }; \ + { \ + echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ + $(am__rst_title); \ + create_testsuite_report --no-color; \ + echo; \ + echo ".. contents:: :depth: 2"; \ + echo; \ + for b in $$bases; do echo $$b; done \ + | $(am__create_global_log); \ + } >$(TEST_SUITE_LOG).tmp || exit 1; \ + mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ + if $$success; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ + fi; \ + echo "$${col}$$br$${std}"; \ + echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \ + echo "$${col}$$br$${std}"; \ + create_testsuite_report --maybe-color; \ + echo "$$col$$br$$std"; \ + if $$success; then :; else \ + echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ + if test -n "$(PACKAGE_BUGREPORT)"; then \ + echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ + fi; \ + echo "$$col$$br$$std"; \ + fi; \ + $$success || exit 1 + +check-TESTS: $(check_PROGRAMS) + @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list + @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + trs_list=`for i in $$bases; do echo $$i.trs; done`; \ + log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ + exit $$?; +recheck: all $(check_PROGRAMS) + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + bases=`for i in $$bases; do echo $$i; done \ + | $(am__list_recheck_tests)` || exit 1; \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + log_list=`echo $$log_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ + am__force_recheck=am--force-recheck \ + TEST_LOGS="$$log_list"; \ + exit $$? +test-array-size.log: test-array-size$(EXEEXT) + @p='test-array-size$(EXEEXT)'; \ + b='test-array-size'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-ascii-ctype.log: test-ascii-ctype$(EXEEXT) + @p='test-ascii-ctype$(EXEEXT)'; \ + b='test-ascii-ctype'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-ascii-string.log: test-ascii-string$(EXEEXT) + @p='test-ascii-string$(EXEEXT)'; \ + b='test-ascii-string'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-byte-swapping.log: test-byte-swapping$(EXEEXT) + @p='test-byte-swapping$(EXEEXT)'; \ + b='test-byte-swapping'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-checked-overflow.log: test-checked-overflow$(EXEEXT) + @p='test-checked-overflow$(EXEEXT)'; \ + b='test-checked-overflow'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-human-size.log: test-human-size$(EXEEXT) + @p='test-human-size$(EXEEXT)'; \ + b='test-human-size'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-isaligned.log: test-isaligned$(EXEEXT) + @p='test-isaligned$(EXEEXT)'; \ + b='test-isaligned'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-ispowerof2.log: test-ispowerof2$(EXEEXT) + @p='test-ispowerof2$(EXEEXT)'; \ + b='test-ispowerof2'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-iszero.log: test-iszero$(EXEEXT) + @p='test-iszero$(EXEEXT)'; \ + b='test-iszero'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-minmax.log: test-minmax$(EXEEXT) + @p='test-minmax$(EXEEXT)'; \ + b='test-minmax'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-nextnonzero.log: test-nextnonzero$(EXEEXT) + @p='test-nextnonzero$(EXEEXT)'; \ + b='test-nextnonzero'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-random.log: test-random$(EXEEXT) + @p='test-random$(EXEEXT)'; \ + b='test-random'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-tvdiff.log: test-tvdiff$(EXEEXT) + @p='test-tvdiff$(EXEEXT)'; \ + b='test-tvdiff'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +.test.log: + @p='$<'; \ + $(am__set_b); \ + $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +@am__EXEEXT_TRUE@.test$(EXEEXT).log: +@am__EXEEXT_TRUE@ @p='$<'; \ +@am__EXEEXT_TRUE@ $(am__set_b); \ +@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ +@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ +@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ +@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile +installdirs: +install: 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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) + -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) + -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/test_array_size-test-array-size.Po + -rm -f ./$(DEPDIR)/test_ascii_ctype-test-ascii-ctype.Po + -rm -f ./$(DEPDIR)/test_ascii_string-test-ascii-string.Po + -rm -f ./$(DEPDIR)/test_byte_swapping-test-byte-swapping.Po + -rm -f ./$(DEPDIR)/test_checked_overflow-test-checked-overflow.Po + -rm -f ./$(DEPDIR)/test_human_size-test-human-size.Po + -rm -f ./$(DEPDIR)/test_isaligned-test-isaligned.Po + -rm -f ./$(DEPDIR)/test_ispowerof2-test-ispowerof2.Po + -rm -f ./$(DEPDIR)/test_iszero-test-iszero.Po + -rm -f ./$(DEPDIR)/test_minmax-test-minmax.Po + -rm -f ./$(DEPDIR)/test_nextnonzero-test-nextnonzero.Po + -rm -f ./$(DEPDIR)/test_random-test-random.Po + -rm -f ./$(DEPDIR)/test_tvdiff-test-tvdiff.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/test_array_size-test-array-size.Po + -rm -f ./$(DEPDIR)/test_ascii_ctype-test-ascii-ctype.Po + -rm -f ./$(DEPDIR)/test_ascii_string-test-ascii-string.Po + -rm -f ./$(DEPDIR)/test_byte_swapping-test-byte-swapping.Po + -rm -f ./$(DEPDIR)/test_checked_overflow-test-checked-overflow.Po + -rm -f ./$(DEPDIR)/test_human_size-test-human-size.Po + -rm -f ./$(DEPDIR)/test_isaligned-test-isaligned.Po + -rm -f ./$(DEPDIR)/test_ispowerof2-test-ispowerof2.Po + -rm -f ./$(DEPDIR)/test_iszero-test-iszero.Po + -rm -f ./$(DEPDIR)/test_minmax-test-minmax.Po + -rm -f ./$(DEPDIR)/test_nextnonzero-test-nextnonzero.Po + -rm -f ./$(DEPDIR)/test_random-test-random.Po + -rm -f ./$(DEPDIR)/test_tvdiff-test-tvdiff.Po + -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: + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \ + check-am clean clean-checkPROGRAMS clean-generic clean-libtool \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am 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 \ + recheck tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# 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/common/include/ansi-colours.h b/common/include/ansi-colours.h new file mode 100644 index 0000000..82a5160 --- /dev/null +++ b/common/include/ansi-colours.h @@ -0,0 +1,98 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_ANSI_COLOURS_H +#define NBDKIT_ANSI_COLOURS_H + +#include + +/* For the ansi_* functions, the main program should declare this + * variable, and initialize it in main() / option parsing. See + * libnbd.git/dump/dump.c for an example of how to initialize it. + */ +extern bool colour; + +/* Restore the terminal colours to the default. + * + * As well as doing this before normal exit, you should also set a + * signal handler which calls this and fflush(fp). See + * libnbd.git/dump/dump.c for an example. + */ +static inline void +ansi_restore (FILE *fp) +{ + if (colour) + fputs ("\033[0m", fp); +} + +/* Set the terminal colour. */ +static inline void +ansi_colour (const char *c, FILE *fp) +{ + if (colour) + fprintf (fp, "\033[%sm", c); +} + +#define ANSI_FG_BOLD_BLACK "1;30" +#define ANSI_FG_BLUE "22;34" +#define ANSI_FG_BRIGHT_BLUE "1;34" +#define ANSI_FG_BRIGHT_CYAN "1;36" +#define ANSI_FG_BRIGHT_GREEN "1;32" +#define ANSI_FG_BRIGHT_MAGENTA "1;35" +#define ANSI_FG_BRIGHT_RED "1;31" +#define ANSI_FG_BRIGHT_WHITE "1;37" +#define ANSI_FG_BRIGHT_YELLOW "1;33" +#define ANSI_FG_CYAN "22;36" +#define ANSI_FG_GREEN "22;32" +#define ANSI_FG_GREY "22;90" +#define ANSI_FG_MAGENTA "22;35" +#define ANSI_FG_RED "22;31" +#define ANSI_FG_YELLOW "22;33" + +#define ANSI_BG_BLACK "40" +#define ANSI_BG_LIGHT_GREY "47" +#define ANSI_BG_GREY "100" + +/* Unconditional versions of above (don't depend on global ‘colour’). */ +static inline void +ansi_force_restore (FILE *fp) +{ + fputs ("\033[0m", fp); +} + +static inline void +ansi_force_colour (const char *c, FILE *fp) +{ + fprintf (fp, "\033[%sm", c); +} + +#endif /* NBDKIT_ANSI_COLOURS_H */ diff --git a/common/include/array-size.h b/common/include/array-size.h new file mode 100644 index 0000000..d915aad --- /dev/null +++ b/common/include/array-size.h @@ -0,0 +1,41 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_ARRAY_SIZE_H +#define NBDKIT_ARRAY_SIZE_H + +#include "compiler-macros.h" + +#define ARRAY_SIZE(a) \ + ((sizeof (a) / sizeof ((a)[0])) + BUILD_BUG_UNLESS_TRUE (TYPE_IS_ARRAY (a))) + +#endif /* NBDKIT_ARRAY_SIZE_H */ diff --git a/common/include/ascii-ctype.h b/common/include/ascii-ctype.h new file mode 100644 index 0000000..191a0f2 --- /dev/null +++ b/common/include/ascii-ctype.h @@ -0,0 +1,75 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +/* Normal ctype functions are affected by the current locale. For + * example isupper() might recognize Ä in some but not all locales. + * These functions match only 7 bit ASCII characters. + */ + +#ifndef NBDKIT_ASCII_CTYPE_H +#define NBDKIT_ASCII_CTYPE_H + +#define ascii_isalnum(c) (ascii_isalpha (c) || ascii_isdigit (c)) + +#define ascii_isalpha(c) \ + (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z')) + +#define ascii_isdigit(c) \ + ((c) >= '0' && (c) <= '9') + +#define ascii_isspace(c) \ + ((c) == '\t' || (c) == '\n' || (c) == '\f' || (c) == '\r' || (c) == ' ') + +#define ascii_isupper(c) \ + ((c) >= 'A' && (c) <= 'Z') + +#define ascii_islower(c) \ + ((c) >= 'a' && (c) <= 'z') + +/* See also hexdigit.h */ +#define ascii_isxdigit(c) \ + ((c) == '0' || (c) == '1' || (c) == '2' || (c) == '3' || (c) == '4' || \ + (c) == '5' || (c) == '6' || (c) == '7' || (c) == '8' || (c) == '9' || \ + (c) == 'a' || (c) == 'b' || (c) == 'c' || \ + (c) == 'd' || (c) == 'e' || (c) == 'f' || \ + (c) == 'A' || (c) == 'B' || (c) == 'C' || \ + (c) == 'D' || (c) == 'E' || (c) == 'F') + +#define ascii_tolower(c) \ + (ascii_isupper ((c)) ? (c) + 32 : (c)) + +#define ascii_toupper(c) \ + (ascii_islower ((c)) ? (c) - 32 : (c)) + +#define ascii_isprint(c) ((c) >= 32 && (c) <= 126) + +#endif /* NBDKIT_ASCII_CTYPE_H */ diff --git a/common/include/ascii-string.h b/common/include/ascii-string.h new file mode 100644 index 0000000..b0df8c7 --- /dev/null +++ b/common/include/ascii-string.h @@ -0,0 +1,77 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +/* Case insensitive string comparison functions (like strcasecmp, + * strncasecmp) which work correctly in any locale. They can only be + * used for comparison when one or both strings is 7 bit ASCII. + */ + +#ifndef NBDKIT_ASCII_STRING_H +#define NBDKIT_ASCII_STRING_H + +#include "ascii-ctype.h" + +static inline int +ascii_strcasecmp (const char *s1, const char *s2) +{ + const unsigned char *us1 = (const unsigned char *)s1; + const unsigned char *us2 = (const unsigned char *)s2; + + while (ascii_tolower (*us1) == ascii_tolower (*us2)) { + if (*us1++ == '\0') + return 0; + us2++; + } + + return ascii_tolower (*us1) - ascii_tolower (*us2); +} + +static inline int +ascii_strncasecmp (const char *s1, const char *s2, size_t n) +{ + if (n != 0) { + const unsigned char *us1 = (const unsigned char *)s1; + const unsigned char *us2 = (const unsigned char *)s2; + + do { + if (ascii_tolower (*us1) != ascii_tolower (*us2)) + return ascii_tolower (*us1) - ascii_tolower (*us2); + if (*us1++ == '\0') + break; + us2++; + } while (--n != 0); + } + + return 0; +} + +#endif /* NBDKIT_ASCII_STRING_H */ diff --git a/common/include/byte-swapping.h b/common/include/byte-swapping.h new file mode 100644 index 0000000..085ba47 --- /dev/null +++ b/common/include/byte-swapping.h @@ -0,0 +1,130 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +/* The job of this header is to define macros (or functions) called + * things like 'htobe32' and 'le64toh' which byte swap N-bit integers + * between host representation, and little and big endian. Also + * bswap_16, bswap_32 and bswap_64 which simply swap endianness. + * + * The core code and plugins in nbdkit uses these names and relies on + * this header to provide the platform-specific implementation. On + * GNU/Linux these are defined in and but + * other platforms have other requirements. + */ + +#ifndef NBDKIT_BYTE_SWAPPING_H +#define NBDKIT_BYTE_SWAPPING_H + +#ifdef HAVE_BYTESWAP_H +#include +#endif + +#ifdef HAVE_ENDIAN_H +#include +#endif + +#ifdef HAVE_SYS_ENDIAN_H +#include +#endif + +#ifdef __HAIKU__ +#include +#define htobe16(x) B_HOST_TO_BENDIAN_INT16 (x) +#define htole16(x) B_HOST_TO_LENDIAN_INT16 (x) +#define be16toh(x) B_BENDIAN_TO_HOST_INT16 (x) +#define le16toh(x) B_LENDIAN_TO_HOST_INT16 (x) + +#define htobe32(x) B_HOST_TO_BENDIAN_INT32 (x) +#define htole32(x) B_HOST_TO_LENDIAN_INT32 (x) +#define be32toh(x) B_BENDIAN_TO_HOST_INT32 (x) +#define le32toh(x) B_LENDIAN_TO_HOST_INT32 (x) + +#define htobe64(x) B_HOST_TO_BENDIAN_INT64 (x) +#define htole64(x) B_HOST_TO_LENDIAN_INT64 (x) +#define be64toh(x) B_BENDIAN_TO_HOST_INT64 (x) +#define le64toh(x) B_LENDIAN_TO_HOST_INT64 (x) +#endif + +/* If we didn't define bswap_16, bswap_32 and bswap_64 already above, + * create macros. GCC >= 4.8 and Clang have builtins. + */ +#ifndef bswap_16 +#define bswap_16 __builtin_bswap16 +#endif + +#ifndef bswap_32 +#define bswap_32 __builtin_bswap32 +#endif + +#ifndef bswap_64 +#define bswap_64 __builtin_bswap64 +#endif + +/* If we didn't define htobe* above then define them in terms of + * bswap_* macros. + */ +#ifndef htobe32 +# ifndef WORDS_BIGENDIAN /* little endian */ +# define htobe16(x) bswap_16 (x) +# define htole16(x) (x) +# define be16toh(x) bswap_16 (x) +# define le16toh(x) (x) + +# define htobe32(x) bswap_32 (x) +# define htole32(x) (x) +# define be32toh(x) bswap_32 (x) +# define le32toh(x) (x) + +# define htobe64(x) bswap_64 (x) +# define htole64(x) (x) +# define be64toh(x) bswap_64 (x) +# define le64toh(x) (x) + +# else /* big endian */ +# define htobe16(x) (x) +# define htole16(x) bswap_16 (x) +# define be16toh(x) (x) +# define le16toh(x) bswap_16 (x) + +# define htobe32(x) (x) +# define htole32(x) bswap_32 (x) +# define be32toh(x) (x) +# define le32toh(x) bswap_32 (x) + +# define htobe64(x) (x) +# define htole64(x) bswap_64 (x) +# define be64toh(x) (x) +# define le64toh(x) bswap_64 (x) +# endif +#endif + +#endif /* NBDKIT_BYTE_SWAPPING_H */ diff --git a/common/include/checked-overflow.h b/common/include/checked-overflow.h new file mode 100644 index 0000000..47a0c6f --- /dev/null +++ b/common/include/checked-overflow.h @@ -0,0 +1,208 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +/* This header file defines macros and functions for checking overflow in + * common integer arithmetic operations. + * + * The macros use: + * - the "statement expression" GCC extension, + * - the "typeof" GCC extension, + * - the __builtin_add_overflow() and __builtin_mul_overflow() GCC/Clang + * built-ins. + * + * If either built-in is unavailable, the corresponding macro replaces it with + * a call to an inline C function. + */ + +#ifndef NBDKIT_CHECKED_OVERFLOW_H +#define NBDKIT_CHECKED_OVERFLOW_H + +#if !defined (__GNUC__) && !defined (__clang__) +#error "this file may need to be ported to your compiler" +#endif + +#include +#include + +#include "static-assert.h" +#include "unique-name.h" + +/* Add "a" and "b", both of (possibly different) unsigned integer types, and + * store the sum in "*r", which must also have some unsigned integer type. + * + * Each macro argument is evaluated exactly once, as long as it does not have + * variably modified type. + * + * The macro evaluates to "false" if "*r" can represent the mathematical sum. + * Otherwise, the macro evaluates to "true", and the low order bits of the + * mathematical sum are stored to "*r". + */ +#if HAVE_DECL___BUILTIN_ADD_OVERFLOW +#define ADD_OVERFLOW(a, b, r) ADD_OVERFLOW_BUILTIN ((a), (b), (r)) +#else +#define ADD_OVERFLOW(a, b, r) ADD_OVERFLOW_FALLBACK ((a), (b), (r)) +#endif + +/* Multiply "a" and "b", both of (possibly different) unsigned integer types, + * and store the product in "*r", which must also have some unsigned integer + * type. + * + * Each macro argument is evaluated exactly once, as long as it does not have + * variably modified type. + * + * The macro evaluates to "false" if "*r" can represent the mathematical + * product. Otherwise, the macro evaluates to "true", and the low order bits of + * the mathematical product are stored to "*r". + */ +#if HAVE_DECL___BUILTIN_MUL_OVERFLOW +#define MUL_OVERFLOW(a, b, r) MUL_OVERFLOW_BUILTIN ((a), (b), (r)) +#else +#define MUL_OVERFLOW(a, b, r) MUL_OVERFLOW_FALLBACK ((a), (b), (r)) +#endif + +/* The ADD_OVERFLOW_BUILTIN and MUL_OVERFLOW_BUILTIN function-like macros + * enforce the unsignedness of all their operands even though the underlying + * compiler built-ins, __builtin_add_overflow() and __builtin_mul_overflow(), + * don't depend on that. The explanation is that the fallback implementation + * does depend on the unsignedness of all operands, and the codebase should + * seamlessly build regardless of the built-in vs. fallback choice. + * + * Each macro argument is evaluated exactly once, as long as it does not have + * variably modified type. + */ +#if HAVE_DECL___BUILTIN_ADD_OVERFLOW +#define ADD_OVERFLOW_BUILTIN(a, b, r) \ + ({ \ + STATIC_ASSERT_UNSIGNED_INT (a); \ + STATIC_ASSERT_UNSIGNED_INT (b); \ + STATIC_ASSERT_UNSIGNED_INT (*(r)); \ + __builtin_add_overflow ((a), (b), (r)); \ + }) +#endif + +#if HAVE_DECL___BUILTIN_MUL_OVERFLOW +#define MUL_OVERFLOW_BUILTIN(a, b, r) \ + ({ \ + STATIC_ASSERT_UNSIGNED_INT (a); \ + STATIC_ASSERT_UNSIGNED_INT (b); \ + STATIC_ASSERT_UNSIGNED_INT (*(r)); \ + __builtin_mul_overflow ((a), (b), (r)); \ + }) +#endif + +/* The fallback macros call inline C functions. The unsignedness of all + * operands is enforced in order to keep the conversion to uintmax_t + * value-preserving, and to keep the conversion back from uintmax_t independent + * of the C language implementation. + * + * Each macro argument is evaluated exactly once, as long as it does not have + * variably modified type. + * + * The fallback macros and the inline C functions are defined regardless of + * HAVE_DECL___BUILTIN_ADD_OVERFLOW and HAVE_DECL___BUILTIN_MUL_OVERFLOW so + * that the test suite can always test the fallback. + */ +#define ADD_OVERFLOW_FALLBACK(a, b, r) \ + ADD_OVERFLOW_FALLBACK_1 ((a), (b), (r), \ + NBDKIT_UNIQUE_NAME (_overflow), \ + NBDKIT_UNIQUE_NAME (_tmp)) +#define ADD_OVERFLOW_FALLBACK_1(a, b, r, overflow, tmp) \ + ({ \ + bool overflow; \ + uintmax_t tmp; \ + \ + STATIC_ASSERT_UNSIGNED_INT (a); \ + STATIC_ASSERT_UNSIGNED_INT (b); \ + STATIC_ASSERT_UNSIGNED_INT (*(r)); \ + overflow = check_add_overflow ((a), (b), \ + (typeof (*(r)))-1, \ + &tmp); \ + *(r) = tmp; \ + overflow; \ + }) + +#define MUL_OVERFLOW_FALLBACK(a, b, r) \ + MUL_OVERFLOW_FALLBACK_1 ((a), (b), (r), \ + NBDKIT_UNIQUE_NAME (_overflow), \ + NBDKIT_UNIQUE_NAME (_tmp)) +#define MUL_OVERFLOW_FALLBACK_1(a, b, r, overflow, tmp) \ + ({ \ + bool overflow; \ + uintmax_t tmp; \ + \ + STATIC_ASSERT_UNSIGNED_INT (a); \ + STATIC_ASSERT_UNSIGNED_INT (b); \ + STATIC_ASSERT_UNSIGNED_INT (*(r)); \ + overflow = check_mul_overflow ((a), (b), \ + (typeof (*(r)))-1, \ + &tmp); \ + *(r) = tmp; \ + overflow; \ + }) + +/* Assert, at compile time, that the expression "x" has some unsigned integer + * type. + * + * The expression "x" is not evaluated, unless it has variably modified type. + */ +#define STATIC_ASSERT_UNSIGNED_INT(x) \ + STATIC_ASSERT ((typeof (x))-1 > 0, _x_has_uint_type) + +/* Assign the sum "a + b" to "*r", using uintmax_t modular arithmetic. + * + * Return true iff the addition overflows or the result exceeds "max". + */ +static inline bool +check_add_overflow (uintmax_t a, uintmax_t b, uintmax_t max, uintmax_t *r) +{ + bool in_range; + + *r = a + b; + in_range = a <= UINTMAX_MAX - b && *r <= max; + return !in_range; +} + +/* Assign the product "a * b" to "*r", using uintmax_t modular arithmetic. + * + * Return true iff the multiplication overflows or the result exceeds "max". + */ +static inline bool +check_mul_overflow (uintmax_t a, uintmax_t b, uintmax_t max, uintmax_t *r) +{ + bool in_range; + + *r = a * b; + in_range = b == 0 || (a <= UINTMAX_MAX / b && *r <= max); + return !in_range; +} + +#endif /* NBDKIT_CHECKED_OVERFLOW_H */ diff --git a/common/include/compiler-macros.h b/common/include/compiler-macros.h new file mode 100644 index 0000000..36c435e --- /dev/null +++ b/common/include/compiler-macros.h @@ -0,0 +1,90 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_COMPILER_MACROS_H +#define NBDKIT_COMPILER_MACROS_H + +#ifndef __cplusplus + +/* BUILD_BUG_UNLESS_TRUE(1) => 0 + * BUILD_BUG_UNLESS_TRUE(0) => compile-time failure + * + * It works by constructing a struct which has an impossible + * (negative-sized) bitfield in the false case. Anonymous bitfields + * are permitted in C99 and above. + * + * The Linux kernel calls this BUILD_BUG_ON_ZERO(!cond) which is a + * confusing name. It has the same semantics except cond is negated. + */ +#define BUILD_BUG_STRUCT_SIZE(cond) \ + (sizeof (struct { int: (cond) ? 1 : -1; })) +#define BUILD_BUG_UNLESS_TRUE(cond) \ + (BUILD_BUG_STRUCT_SIZE (cond) - BUILD_BUG_STRUCT_SIZE (cond)) + +/* Each of TYPE_IS_POINTER() and TYPE_IS_ARRAY() produces a build failure if it + * is invoked with an object that has neither pointer-to-object type nor array + * type. + * + * C99 6.5.2.1 constrains one of the operands of the subscript operator to have + * pointer-to-object type, and the other operand to have integer type. In the + * replacement text of TYPE_IS_POINTER(), we use [0] as subscript (providing the + * integer operand), therefore the macro argument (p) is constrained to have + * pointer-to-object type. + * + * If TYPE_IS_POINTER() is invoked with a pointer that has pointer-to-object + * type, the constraint is directly satisfied, and TYPE_IS_POINTER() evaluates, + * at compile time, to 1. + * + * If TYPE_IS_POINTER() is invoked with an array, the constraint of the + * subscript operator is satisfied again -- because the array argument "decays" + * to a pointer to the array's initial element (C99 6.3.2p3) --, and + * TYPE_IS_POINTER() evaluates, at compile time, to 0. + * + * If TYPE_IS_POINTER() is invoked with an argument having any other type, then + * the subscript operator constraint is not satisfied, and C99 5.1.1.3p1 + * requires the emission of a diagnostic message -- the build breaks. Therefore, + * TYPE_IS_ARRAY() can be defined simply as the logical negation of + * TYPE_IS_POINTER(). + */ +#define TYPE_IS_POINTER(p) \ + (__builtin_types_compatible_p (typeof (p), typeof (&(p)[0]))) +#define TYPE_IS_ARRAY(a) (!TYPE_IS_POINTER (a)) + +#else /* __cplusplus */ + +#define BUILD_BUG_UNLESS_TRUE(cond) 0 +#define TYPE_IS_POINTER(p) 1 +#define TYPE_IS_ARRAY(a) 1 + +#endif /* __cplusplus */ + +#endif /* NBDKIT_COMPILER_MACROS_H */ diff --git a/common/include/hexdigit.h b/common/include/hexdigit.h new file mode 100644 index 0000000..96af33a --- /dev/null +++ b/common/include/hexdigit.h @@ -0,0 +1,73 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_HEXDIGIT_H +#define NBDKIT_HEXDIGIT_H + +/* Convert a hex character ('0'-'9', 'a'-'f', 'A'-'F') to the + * corresponding numeric value. + * + * Note this does *not* check that the input is a hex character. To + * check that, see ascii_isxdigit() in ascii-ctype.h + */ +static inline unsigned char +hexdigit (const char 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; +} + +/* Convert a pair of hex digits x0, x1 to a byte, eg. '5', 'A' -> 0x5A */ +static inline unsigned char +hexbyte (const char x0, const char x1) +{ + unsigned char c0, c1; + + c0 = hexdigit (x0); + c1 = hexdigit (x1); + return c0 << 4 | c1; +} + +/* Convert a number mod 16 to the corresponding hex character. */ +static inline const char +hexchar (size_t i) +{ + static const char hex[] = "0123456789abcdef"; + + return hex[i & 0xf]; +} + +#endif /* NBDKIT_HEXDIGIT_H */ diff --git a/common/include/human-size-test-cases.h b/common/include/human-size-test-cases.h new file mode 100644 index 0000000..f351f7c --- /dev/null +++ b/common/include/human-size-test-cases.h @@ -0,0 +1,106 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_HUMAN_SIZE_TEST_CASES_H +#define NBDKIT_HUMAN_SIZE_TEST_CASES_H + +#include + +/* Just some common test cases shared (in nbdkit) between + * common/include/test-human-size.c and server/test-public.c + */ +static struct pair { + const char *str; + int64_t res; +} pairs[] = { + /* Bogus strings */ + { "", -1 }, + { "0x0", -1 }, + { "garbage", -1 }, + { "0garbage", -1 }, + { "8E", -1 }, + { "8192P", -1 }, + + /* Strings leading to overflow */ + { "9223372036854775808", -1 }, /* INT_MAX + 1 */ + { "18446744073709551614", -1 }, /* UINT64_MAX - 1 */ + { "18446744073709551615", -1 }, /* UINT64_MAX */ + { "18446744073709551616", -1 }, /* UINT64_MAX + 1 */ + { "999999999999999999999999", -1 }, + + /* Strings representing negative values */ + { "-1", -1 }, + { "-2", -1 }, + { "-9223372036854775809", -1 }, /* INT64_MIN - 1 */ + { "-9223372036854775808", -1 }, /* INT64_MIN */ + { "-9223372036854775807", -1 }, /* INT64_MIN + 1 */ + { "-18446744073709551616", -1 }, /* -UINT64_MAX - 1 */ + { "-18446744073709551615", -1 }, /* -UINT64_MAX */ + { "-18446744073709551614", -1 }, /* -UINT64_MAX + 1 */ + + /* Strings we may want to support in the future */ + { "M", -1 }, + { "1MB", -1 }, + { "1MiB", -1 }, + { "1.5M", -1 }, + + /* Valid strings */ + { "-0", 0 }, + { "0", 0 }, + { "+0", 0 }, + { " 08", 8 }, + { "1", 1 }, + { "+1", 1 }, + { "1234567890", 1234567890 }, + { "+1234567890", 1234567890 }, + { "9223372036854775807", INT64_MAX }, + { "1s", 512 }, + { "2S", 1024 }, + { "1b", 1 }, + { "1B", 1 }, + { "1k", 1024 }, + { "1K", 1024 }, + { "1m", 1024 * 1024 }, + { "1M", 1024 * 1024 }, + { "+1M", 1024 * 1024 }, + { "1g", 1024 * 1024 * 1024 }, + { "1G", 1024 * 1024 * 1024 }, + { "1t", 1024LL * 1024 * 1024 * 1024 }, + { "1T", 1024LL * 1024 * 1024 * 1024 }, + { "1p", 1024LL * 1024 * 1024 * 1024 * 1024 }, + { "1P", 1024LL * 1024 * 1024 * 1024 * 1024 }, + { "8191p", 1024LL * 1024 * 1024 * 1024 * 1024 * 8191 }, + { "1e", 1024LL * 1024 * 1024 * 1024 * 1024 * 1024 }, + { "1E", 1024LL * 1024 * 1024 * 1024 * 1024 * 1024 }, +}; + +#endif /* NBDKIT_HUMAN_SIZE_TEST_CASES_H */ diff --git a/common/include/human-size.h b/common/include/human-size.h new file mode 100644 index 0000000..788dbd7 --- /dev/null +++ b/common/include/human-size.h @@ -0,0 +1,137 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_HUMAN_SIZE_H +#define NBDKIT_HUMAN_SIZE_H + +#include +#include +#include + +/* Attempt to parse a string with a possible scaling suffix, such as + * "2M". Disk sizes cannot usefully exceed off_t (which is signed) + * and cannot be negative. + * + * On error, returns -1 and sets *error and *pstr. You can form a + * final error message by appending ": ". + */ +static inline int64_t +human_size_parse (const char *str, + const char **error, const char **pstr) +{ + int64_t size; + char *end; + uint64_t scale = 1; + + /* XXX Should we also parse things like '1.5M'? */ + /* XXX Should we allow hex? If so, hex cannot use scaling suffixes, + * because some of them are valid hex digits. + */ + errno = 0; + size = strtoimax (str, &end, 10); + if (str == end) { + *error = "could not parse size string"; + *pstr = str; + return -1; + } + if (size < 0) { + *error = "size cannot be negative"; + *pstr = str; + return -1; + } + if (errno) { + *error = "size exceeds maximum value"; + *pstr = str; + return -1; + } + + switch (*end) { + /* No suffix */ + case '\0': + end--; /* Safe, since we already filtered out empty string */ + break; + + /* Powers of 1024 */ + case 'e': case 'E': + scale *= 1024; + /* fallthru */ + case 'p': case 'P': + scale *= 1024; + /* fallthru */ + case 't': case 'T': + scale *= 1024; + /* fallthru */ + case 'g': case 'G': + scale *= 1024; + /* fallthru */ + case 'm': case 'M': + scale *= 1024; + /* fallthru */ + case 'k': case 'K': + scale *= 1024; + /* fallthru */ + case 'b': case 'B': + break; + + /* "sectors", ie. units of 512 bytes, even if that's not the real + * sector size + */ + case 's': case 'S': + scale = 512; + break; + + default: + *error = "could not parse size: unknown suffix"; + *pstr = end; + return -1; + } + + /* XXX Maybe we should support 'MiB' as a synonym for 'M'; and 'MB' + * for powers of 1000, for similarity to GNU tools. But for now, + * anything beyond 'M' is dropped. + */ + if (end[1]) { + *error = "could not parse size: unknown suffix"; + *pstr = end; + return -1; + } + + if (INT64_MAX / scale < size) { + *error = "could not parse size: size * scale overflows"; + *pstr = str; + return -1; + } + + return size * scale; +} + +#endif /* NBDKIT_HUMAN_SIZE_H */ diff --git a/common/include/isaligned.h b/common/include/isaligned.h new file mode 100644 index 0000000..60b60df --- /dev/null +++ b/common/include/isaligned.h @@ -0,0 +1,47 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_ISALIGNED_H +#define NBDKIT_ISALIGNED_H + +#include + +#include "ispowerof2.h" + +/* Return true if size is a multiple of align. align must be power of 2. + */ +#define IS_ALIGNED(size, align) ({ \ + assert (is_power_of_2 ((align))); \ + !((size) & ((align) - 1)); \ +}) + +#endif /* NBDKIT_ISALIGNED_H */ diff --git a/common/include/ispowerof2.h b/common/include/ispowerof2.h new file mode 100644 index 0000000..05f48b5 --- /dev/null +++ b/common/include/ispowerof2.h @@ -0,0 +1,84 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_ISPOWEROF2_H +#define NBDKIT_ISPOWEROF2_H + +#include + +/* Returns true if v is a power of 2. + * + * Uses the algorithm described at + * http://graphics.stanford.edu/~seander/bithacks.html#DetermineIfPowerOf2 + */ +static inline bool +is_power_of_2 (unsigned long v) +{ + return v && ((v & (v - 1)) == 0); +} + +/* Calculate log2(v) which is the size of the equivalent bit shift + * for a power of 2. For example log_2_bits (512) == 9. + * + * Note: + * - the input must be a power of 2 + * - this is undefined for v == 0 + * + * __builtin_clzl is available in GCC and clang. + */ +static inline int +log_2_bits (uint64_t v) +{ + return 64 - __builtin_clzll (v) - 1; +} + +/* Round up to next power of 2. + * https://jameshfisher.com/2018/03/30/round-up-power-2/ + * + * Note: + * 0x8000000000000000ULL => returns itself + * >= 0x8000000000000001ULL (negative) => returns ((uint64_t)-1) (error) + */ +static inline uint64_t +next_power_of_2 (int64_t x) +{ + if ((uint64_t) x == UINT64_C (0x8000000000000000)) + return UINT64_C (0x8000000000000000); + else if (x < 0) + return (uint64_t) -1; + else if (x <= 1) + return 1; + else + return UINT64_C (1) << (64 - __builtin_clzll (x-1)); +} + +#endif /* NBDKIT_ISPOWEROF2_H */ diff --git a/common/include/iszero.h b/common/include/iszero.h new file mode 100644 index 0000000..120bf15 --- /dev/null +++ b/common/include/iszero.h @@ -0,0 +1,63 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_ISZERO_H +#define NBDKIT_ISZERO_H + +#include +#include + +/* Return true iff the buffer is all zero bytes. + * + * The clever approach here was suggested by Eric Blake. See: + * https://www.redhat.com/archives/libguestfs/2017-April/msg00171.html + * https://rusty.ozlabs.org/?p=560 + * + * See also: + * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69908 + */ +static inline bool __attribute__ ((__nonnull__ (1))) +is_zero (const char *buffer, size_t size) +{ + size_t i; + const size_t limit = size < 16 ? size : 16; + + for (i = 0; i < limit; ++i) + if (buffer[i]) + return false; + if (size != limit) + return ! memcmp (buffer, buffer + 16, size - 16); + + return true; +} + +#endif /* NBDKIT_ISZERO_H */ diff --git a/common/include/minmax.h b/common/include/minmax.h new file mode 100644 index 0000000..782e348 --- /dev/null +++ b/common/include/minmax.h @@ -0,0 +1,84 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_MINMAX_H +#define NBDKIT_MINMAX_H + +#include + +/* Safe MIN and MAX macros. These evaluate each parameter once. They + * work for any comparable type. + * + * __auto_type is a GCC extension, added in GCC 4.9 in 2014, and to + * Clang in 2015. The fallback uses typeof which was added a very + * long time ago. Note that OpenBSD lacks __auto_type so the fallback + * is required. + */ + +#include "unique-name.h" + +#undef MIN +#define MIN(x, y) \ + MIN_1 ((x), (y), NBDKIT_UNIQUE_NAME (_x), NBDKIT_UNIQUE_NAME (_y)) +#undef MAX +#define MAX(x, y) \ + MAX_1 ((x), (y), NBDKIT_UNIQUE_NAME (_x), NBDKIT_UNIQUE_NAME (_y)) + +#ifdef HAVE_AUTO_TYPE + +#define MIN_1(x, y, _x, _y) ({ \ + __auto_type _x = (x); \ + __auto_type _y = (y); \ + _x < _y ? _x : _y; \ + }) +#define MAX_1(x, y, _x, _y) ({ \ + __auto_type _x = (x); \ + __auto_type _y = (y); \ + _x > _y ? _x : _y; \ + }) + +#else + +#define MIN_1(x, y, _x, _y) ({ \ + typeof (x) _x = (x); \ + typeof (y) _y = (y); \ + _x < _y ? _x : _y; \ + }) +#define MAX_1(x, y, _x, _y) ({ \ + typeof (x) _x = (x); \ + typeof (y) _y = (y); \ + _x > _y ? _x : _y; \ + }) + +#endif + +#endif /* NBDKIT_MINMAX_H */ diff --git a/common/include/nextnonzero.h b/common/include/nextnonzero.h new file mode 100644 index 0000000..f2ee393 --- /dev/null +++ b/common/include/nextnonzero.h @@ -0,0 +1,58 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_NEXTNONZERO_H +#define NBDKIT_NEXTNONZERO_H + +/* Given a byte buffer, return a pointer to the first non-zero byte, + * or return NULL if we reach the end of the buffer. + * + * XXX: Even with -O3 -mavx2, gcc 8.2.1 does a terrible job with this + * loop, compiling it completely naively. QEMU has an AVX2 + * implementation of a similar loop. + * + * See also: + * https://sourceware.org/bugzilla/show_bug.cgi?id=19920 + * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69908 + */ +static inline const char * __attribute__ ((__nonnull__ (1))) +next_non_zero (const char *buffer, size_t size) +{ + size_t i; + + for (i = 0; i < size; ++i) + if (buffer[i] != 0) + return &buffer[i]; + return NULL; +} + +#endif /* NBDKIT_NEXTNONZERO_H */ diff --git a/common/include/random.h b/common/include/random.h new file mode 100644 index 0000000..86b2588 --- /dev/null +++ b/common/include/random.h @@ -0,0 +1,106 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_RANDOM_H +#define NBDKIT_RANDOM_H + +#include + +/* Generate pseudo-random numbers, quickly, with explicit state. + * + * This is based on the xoshiro/xoroshiro generators by David Blackman + * and Sebastiano Vigna (http://xoshiro.di.unimi.it/). Specifically + * the main PRNG is ‘xoshiro256** 1.0’, and the seed generator is + * ‘splitmix64’. + * + * This does _NOT_ generate cryptographically secure random numbers + * (CSPRNG) and so should not be used when cryptography or security is + * required - use gcrypt if you need those. + */ + +/* You can seed ‘struct random_state’ by setting the s[] elements + * directly - but you must NOT set them all to zero. Alternately if + * you have a 64 bit seed, you can call xsrandom to initialize the + * state. + */ +struct random_state { + uint64_t s[4]; +}; + +static inline uint64_t +snext (uint64_t *seed) +{ + uint64_t z = (*seed += 0x9e3779b97f4a7c15); + z = (z ^ (z >> 30)) * 0xbf58476d1ce4e5b9; + z = (z ^ (z >> 27)) * 0x94d049bb133111eb; + return z ^ (z >> 31); +} + +/* Seed the random state from a 64 bit seed. */ +static inline void __attribute__ ((__nonnull__ (2))) +xsrandom (uint64_t seed, struct random_state *state) +{ + state->s[0] = snext (&seed); + state->s[1] = snext (&seed); + state->s[2] = snext (&seed); + state->s[3] = snext (&seed); +} + +static inline uint64_t +rotl (const uint64_t x, int k) +{ + /* RWMJ: I checked and GCC 10 emits either ‘rol’ or ‘ror’ correctly + * for this code. + */ + return (x << k) | (x >> (64 - k)); +} + +/* Returns 64 random bits. Updates the state. */ +static inline uint64_t __attribute__ ((__nonnull__ (1))) +xrandom (struct random_state *state) +{ + const uint64_t result_starstar = rotl (state->s[1] * 5, 7) * 9; + const uint64_t t = state->s[1] << 17; + + state->s[2] ^= state->s[0]; + state->s[3] ^= state->s[1]; + state->s[1] ^= state->s[2]; + state->s[0] ^= state->s[3]; + + state->s[2] ^= t; + + state->s[3] = rotl (state->s[3], 45); + + return result_starstar; +} + +#endif /* NBDKIT_RANDOM_H */ diff --git a/common/include/rounding.h b/common/include/rounding.h new file mode 100644 index 0000000..d0ec7aa --- /dev/null +++ b/common/include/rounding.h @@ -0,0 +1,57 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_ROUNDING_H +#define NBDKIT_ROUNDING_H + +#include + +#include "ispowerof2.h" + +/* Round up i to next multiple of n (n must be a power of 2). + */ +#define ROUND_UP(i, n) ({ \ + assert (is_power_of_2 (n)); \ + ((i) + (n) - 1) & -((typeof (i))(n)); \ +}) + +/* Round down i to next multiple of n (n must be a power of 2). + */ +#define ROUND_DOWN(i, n) ({ \ + assert (is_power_of_2 (n)); \ + (i) & -((typeof (i))(n)); \ +}) + +/* Return n / d, rounding the result up to the next integer. */ +#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) + +#endif /* NBDKIT_ROUNDING_H */ diff --git a/common/include/static-assert.h b/common/include/static-assert.h new file mode 100644 index 0000000..6ab1777 --- /dev/null +++ b/common/include/static-assert.h @@ -0,0 +1,48 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_STATIC_ASSERT_H +#define NBDKIT_STATIC_ASSERT_H + +#include "unique-name.h" + +/* Assert "expression" at compile time. If "expression" evaluates to zero (at + * compile time), produce a compiler error message that includes + * "expectation_id". + */ +#define STATIC_ASSERT(expression, expectation_id) \ + do { \ + typedef char NBDKIT_UNIQUE_NAME (expectation_id)[(expression) ? 1 : -1] \ + __attribute__ ((__unused__)); \ + } while (0) + +#endif /* NBDKIT_STATIC_ASSERT_H */ diff --git a/common/include/test-array-size.c b/common/include/test-array-size.c new file mode 100644 index 0000000..4882d3a --- /dev/null +++ b/common/include/test-array-size.c @@ -0,0 +1,87 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#undef NDEBUG /* Keep test strong even for nbdkit built without assertions */ +#include + +#include "array-size.h" +#include "static-assert.h" + +struct st { const char *s; int i; }; + +static const char *s0[] __attribute__ ((__unused__)) = { }; +static const char *s1[] __attribute__ ((__unused__)) = { "a" }; +static const char *s3[] __attribute__ ((__unused__)) = { "a", "b", "c" }; +static const char *s4[4] __attribute__ ((__unused__)) = { "a", "b", "c", "d" }; +static int i0[] __attribute__ ((__unused__)) = { }; +static int i1[] __attribute__ ((__unused__)) = { 1 }; +static int i3[] __attribute__ ((__unused__)) = { 1, 2, 3 }; +static int i4[4] __attribute__ ((__unused__)) = { 1, 2, 3, 4 }; +static struct st st0[] __attribute__ ((__unused__)) = { }; +static struct st st1[] __attribute__ ((__unused__)) = { { "a", 1 } }; +static struct st st3[] __attribute__ ((__unused__)) = + { { "a", 1 }, { "b", 2 }, { "c", 3 } }; +static struct st st4[4] __attribute__ ((__unused__)) = + { { "a", 1 }, { "b", 2 }, { "c", 3 }, { "d", 4 } }; +static struct st st4_0[4] __attribute__ ((__unused__)); + +int +main (void) +{ + STATIC_ASSERT (ARRAY_SIZE (s0) == 0, _array_size_macro_works); + STATIC_ASSERT (ARRAY_SIZE (s1) == 1, _array_size_macro_works); + STATIC_ASSERT (ARRAY_SIZE (s3) == 3, _array_size_macro_works); + STATIC_ASSERT (ARRAY_SIZE (s4) == 4, _array_size_macro_works); + STATIC_ASSERT (ARRAY_SIZE (i0) == 0, _array_size_macro_works); + STATIC_ASSERT (ARRAY_SIZE (i1) == 1, _array_size_macro_works); + STATIC_ASSERT (ARRAY_SIZE (i3) == 3, _array_size_macro_works); + STATIC_ASSERT (ARRAY_SIZE (i4) == 4, _array_size_macro_works); + STATIC_ASSERT (ARRAY_SIZE (st0) == 0, _array_size_macro_works); + STATIC_ASSERT (ARRAY_SIZE (st1) == 1, _array_size_macro_works); + STATIC_ASSERT (ARRAY_SIZE (st3) == 3, _array_size_macro_works); + STATIC_ASSERT (ARRAY_SIZE (st4) == 4, _array_size_macro_works); + STATIC_ASSERT (ARRAY_SIZE (st4_0) == 4, _array_size_macro_works); + + /* You can uncomment this to test the negative case. Unfortunately + * it's difficult to automate this test. + */ +#if 0 + int *p = i4; + STATIC_ASSERT (ARRAY_SIZE (p) == 4, _array_size_macro_is_applied_to_array); +#endif + + exit (EXIT_SUCCESS); +} diff --git a/common/include/test-ascii-ctype.c b/common/include/test-ascii-ctype.c new file mode 100644 index 0000000..aefe1cc --- /dev/null +++ b/common/include/test-ascii-ctype.c @@ -0,0 +1,88 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#undef NDEBUG /* Keep test strong even for nbdkit built without assertions */ +#include + +#include "ascii-ctype.h" + +int +main (void) +{ + assert (ascii_isspace (' ')); + assert (ascii_isspace ('\t')); + assert (ascii_isspace ('\n')); + assert (! ascii_isspace ('a')); + + assert (ascii_isalpha ('a')); + assert (ascii_isalpha ('Z')); + assert (ascii_isalpha ('z')); + assert (! ascii_isalpha (' ')); + assert (! ascii_isalpha ('0')); + { const char *s = "Ä"; assert (! ascii_isalpha (s[0])); } + { const char *s = "®"; assert (! ascii_isalpha (s[0])); } + + assert (ascii_isdigit ('0')); + assert (ascii_isdigit ('9')); + { const char *s = "Ø"; assert (! ascii_isdigit (s[0])); } /* U+00D8 */ + { const char *s = "9"; assert (! ascii_isdigit (s[0])); } /* U+FF19 */ + + assert (ascii_islower ('a')); + assert (ascii_islower ('z')); + assert (! ascii_islower ('Z')); + { const char *s = "Ä"; assert (! ascii_islower (s[0])); } + + assert (ascii_isupper ('A')); + assert (ascii_isupper ('Z')); + assert (! ascii_isupper ('z')); + { const char *s = "Ä"; assert (! ascii_isupper (s[0])); } + + assert (ascii_tolower ('A') == 'a'); + assert (ascii_tolower ('Z') == 'z'); + assert (ascii_tolower ('a') == 'a'); + assert (ascii_tolower ('z') == 'z'); + assert (ascii_tolower ('0') == '0'); + { const char *s = "Ä"; assert (ascii_tolower (s[0]) == s[0]); } + + assert (ascii_toupper ('a') == 'A'); + assert (ascii_toupper ('z') == 'Z'); + assert (ascii_toupper ('A') == 'A'); + assert (ascii_toupper ('Z') == 'Z'); + assert (ascii_toupper ('0') == '0'); + { const char *s = "à"; assert (ascii_toupper (s[0]) == s[0]); } + + exit (EXIT_SUCCESS); +} diff --git a/common/include/test-ascii-string.c b/common/include/test-ascii-string.c new file mode 100644 index 0000000..821ee19 --- /dev/null +++ b/common/include/test-ascii-string.c @@ -0,0 +1,80 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#undef NDEBUG /* Keep test strong even for nbdkit built without assertions */ +#include + +#include "ascii-string.h" + +int +main (void) +{ + assert (ascii_strcasecmp ("", "") == 0); + assert (ascii_strcasecmp ("a", "a") == 0); + assert (ascii_strcasecmp ("abc", "abc") == 0); + assert (ascii_strcasecmp ("a", "b") < 0); + assert (ascii_strcasecmp ("b", "a") > 0); + assert (ascii_strcasecmp ("aa", "a") > 0); + + /* Second string contains Turkish dotless lowercase letter ı. */ + assert (ascii_strcasecmp ("hi", "hı") != 0); + + /* Check that we got our rounding behaviour correct. */ + assert (ascii_strcasecmp ("\x1", "\x7f") < 0); + assert (ascii_strcasecmp ("\x1", "\x80") < 0); + assert (ascii_strcasecmp ("\x1", "\x81") < 0); + assert (ascii_strcasecmp ("\x1", "\xff") < 0); + + assert (ascii_strncasecmp ("", "", 0) == 0); + assert (ascii_strncasecmp ("a", "a", 1) == 0); + assert (ascii_strncasecmp ("abc", "abc", 3) == 0); + assert (ascii_strncasecmp ("abc", "def", 0) == 0); + assert (ascii_strncasecmp ("abc", "abd", 2) == 0); + assert (ascii_strncasecmp ("a", "b", 1) < 0); + assert (ascii_strncasecmp ("b", "a", 1) > 0); + assert (ascii_strncasecmp ("aa", "a", 2) > 0); + assert (ascii_strncasecmp ("aa", "a", 100) > 0); + + assert (ascii_strncasecmp ("hi", "hı", 1) == 0); + assert (ascii_strncasecmp ("hi", "hı", 2) != 0); + + assert (ascii_strncasecmp ("\x1", "\x7f", 1) < 0); + assert (ascii_strncasecmp ("\x1", "\x80", 1) < 0); + assert (ascii_strncasecmp ("\x1", "\x81", 1) < 0); + assert (ascii_strncasecmp ("\x1", "\xff", 1) < 0); + + exit (EXIT_SUCCESS); +} diff --git a/common/include/test-byte-swapping.c b/common/include/test-byte-swapping.c new file mode 100644 index 0000000..417293b --- /dev/null +++ b/common/include/test-byte-swapping.c @@ -0,0 +1,108 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include +#include +#undef NDEBUG /* Keep test strong even for nbdkit built without assertions */ +#include + +#include "byte-swapping.h" + +/* Little-endian test strings. */ +static uint8_t le16[] = { 0x34, 0x12 }; +static uint8_t le32[] = { 0x78, 0x56, 0x34, 0x12 }; +static uint8_t le64[] = { 0xf0, 0xde, 0xbc, 0x9a, 0x78, 0x56, 0x34, 0x12 }; + +/* Big-endian test strings. */ +static uint8_t be16[] = { 0x12, 0x34 }; +static uint8_t be32[] = { 0x12, 0x34, 0x56, 0x78 }; +static uint8_t be64[] = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 }; + +int +main (void) +{ + uint16_t i16; + uint32_t i32; + uint64_t i64; + + memcpy (&i16, le16, 2); + assert (le16toh (i16) == 0x1234); + memcpy (&i32, le32, 4); + assert (le32toh (i32) == 0x12345678); + memcpy (&i64, le64, 8); + assert (le64toh (i64) == 0x123456789abcdef0); + + memcpy (&i16, be16, 2); + assert (be16toh (i16) == 0x1234); + memcpy (&i32, be32, 4); + assert (be32toh (i32) == 0x12345678); + memcpy (&i64, be64, 8); + assert (be64toh (i64) == 0x123456789abcdef0); + + i16 = htole16 (0x1234); + assert (memcmp (&i16, le16, 2) == 0); + i32 = htole32 (0x12345678); + assert (memcmp (&i32, le32, 4) == 0); + i64 = htole64 (0x123456789abcdef0); + assert (memcmp (&i64, le64, 8) == 0); + + i16 = htobe16 (0x1234); + assert (memcmp (&i16, be16, 2) == 0); + i32 = htobe32 (0x12345678); + assert (memcmp (&i32, be32, 4) == 0); + i64 = htobe64 (0x123456789abcdef0); + assert (memcmp (&i64, be64, 8) == 0); + + memcpy (&i16, le16, 2); + i16 = bswap_16 (i16); + assert (memcmp (&i16, be16, 2) == 0); + i16 = bswap_16 (i16); + assert (memcmp (&i16, le16, 2) == 0); + + memcpy (&i32, le32, 4); + i32 = bswap_32 (i32); + assert (memcmp (&i32, be32, 4) == 0); + i32 = bswap_32 (i32); + assert (memcmp (&i32, le32, 4) == 0); + + memcpy (&i64, le64, 8); + i64 = bswap_64 (i64); + assert (memcmp (&i64, be64, 8) == 0); + i64 = bswap_64 (i64); + assert (memcmp (&i64, le64, 8) == 0); + + exit (EXIT_SUCCESS); +} diff --git a/common/include/test-checked-overflow.c b/common/include/test-checked-overflow.c new file mode 100644 index 0000000..208c3b6 --- /dev/null +++ b/common/include/test-checked-overflow.c @@ -0,0 +1,177 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 +#include +#undef NDEBUG /* Keep test strong even for nbdkit built without assertions */ +#include + +#include "checked-overflow.h" + +#define TEST_ADD(a, b, result, expected_overflow, expected_result) \ + do { \ + bool actual_overflow; \ + \ + actual_overflow = ADD_OVERFLOW_FALLBACK ((a), (b), (result)); \ + assert (actual_overflow == (expected_overflow)); \ + assert (*(result) == (expected_result)); \ + actual_overflow = ADD_OVERFLOW_FALLBACK ((b), (a), (result)); \ + assert (actual_overflow == (expected_overflow)); \ + assert (*(result) == (expected_result)); \ + } while (0) + +#define TEST_MUL(a, b, result, expected_overflow, expected_result) \ + do { \ + bool actual_overflow; \ + \ + actual_overflow = MUL_OVERFLOW_FALLBACK ((a), (b), (result)); \ + assert (actual_overflow == (expected_overflow)); \ + assert (*(result) == (expected_result)); \ + actual_overflow = MUL_OVERFLOW_FALLBACK ((b), (a), (result)); \ + assert (actual_overflow == (expected_overflow)); \ + assert (*(result) == (expected_result)); \ + } while (0) + +/* Define these const-qualified objects because the UINTN_MAX object-like + * macros in have "post integer promotion" types. Therefore, + * UINT16_MAX and UINT8_MAX most commonly have type "int". And that trips the + * signedness check in ADD_OVERFLOW_FALLBACK(). + */ +static const uintmax_t umax_max = UINTMAX_MAX; +static const uint64_t u64_max = UINT64_MAX; +static const uint32_t u32_max = UINT32_MAX; +static const uint16_t u16_max = UINT16_MAX; +static const uint8_t u8_max = UINT8_MAX; +static const size_t size_max = SIZE_MAX; + +int +main (void) +{ + union { + uintmax_t umax; + uint64_t u64; + uint32_t u32; + uint16_t u16; + uint8_t u8; + size_t sz; + } result; + bool overflow; + + /* "max + 0" and "0 + max" evaluate to "max", without overflow. */ + TEST_ADD (umax_max, 0u, &result.umax, false, umax_max); + TEST_ADD (u64_max, 0u, &result.u64, false, u64_max); + TEST_ADD (u32_max, 0u, &result.u32, false, u32_max); + TEST_ADD (u16_max, 0u, &result.u16, false, u16_max); + TEST_ADD (u8_max, 0u, &result.u8, false, u8_max); + TEST_ADD (size_max, 0u, &result.sz, false, size_max); + + /* "max + 1" and "1 + max" overflow to zero. */ + TEST_ADD (umax_max, 1u, &result.umax, true, 0); + TEST_ADD (u64_max, 1u, &result.u64, true, 0); + TEST_ADD (u32_max, 1u, &result.u32, true, 0); + TEST_ADD (u16_max, 1u, &result.u16, true, 0); + TEST_ADD (u8_max, 1u, &result.u8, true, 0); + TEST_ADD (size_max, 1u, &result.sz, true, 0); + + /* Adding umax_max (i.e., all-bits-one) amounts (with overflow) to + * subtracting one. + */ + TEST_ADD (umax_max, umax_max, &result.umax, true, umax_max - 1); + TEST_ADD (u64_max, umax_max, &result.u64, true, u64_max - 1); + TEST_ADD (u32_max, umax_max, &result.u32, true, u32_max - 1); + TEST_ADD (u16_max, umax_max, &result.u16, true, u16_max - 1); + TEST_ADD (u8_max, umax_max, &result.u8, true, u8_max - 1); + TEST_ADD (size_max, umax_max, &result.sz, true, size_max - 1); + + /* "max * 0" and "0 * max" evaluate to 0, without overflow. */ + TEST_MUL (umax_max, 0u, &result.umax, false, 0); + TEST_MUL (u64_max, 0u, &result.u64, false, 0); + TEST_MUL (u32_max, 0u, &result.u32, false, 0); + TEST_MUL (u16_max, 0u, &result.u16, false, 0); + TEST_MUL (u8_max, 0u, &result.u8, false, 0); + TEST_MUL (size_max, 0u, &result.sz, false, 0); + + /* "max * 1" and "1 * max" evaluate to "max", without overflow. */ + TEST_MUL (umax_max, 1u, &result.umax, false, umax_max); + TEST_MUL (u64_max, 1u, &result.u64, false, u64_max); + TEST_MUL (u32_max, 1u, &result.u32, false, u32_max); + TEST_MUL (u16_max, 1u, &result.u16, false, u16_max); + TEST_MUL (u8_max, 1u, &result.u8, false, u8_max); + TEST_MUL (size_max, 1u, &result.sz, false, size_max); + + /* "max * 2" and "2 * max" evaluate (with overflow) to "max - 1". */ + TEST_MUL (umax_max, 2u, &result.umax, true, umax_max - 1); + TEST_MUL (u64_max, 2u, &result.u64, true, u64_max - 1); + TEST_MUL (u32_max, 2u, &result.u32, true, u32_max - 1); + TEST_MUL (u16_max, 2u, &result.u16, true, u16_max - 1); + TEST_MUL (u8_max, 2u, &result.u8, true, u8_max - 1); + TEST_MUL (size_max, 2u, &result.sz, true, size_max - 1); + + /* factor 255 -> 3 5 17 + * factor 65535 -> 3 5 17 257 + * factor 4294967295 -> 3 5 17 257 65537 + * factor 18446744073709551615 -> 3 5 17 257 641 65537 6700417 + * + * Note: every time we double the width, we multiply the previous maximum + * 0xF...F with 0x10...01: + * + * 0xF (= 3 * 5) * 0x11 (= 17) = 0xFF + * 0xFF * 0x101 (= 257) = 0xFFFF + * 0xFFFF * 0x10001 (= 65537) = 0xFFFFFFFF + * 0xFFFFFFFF * 0x100000001 (= 641 * 6700417) = 0xFFFFFFFFFFFFFFFF + * + * Perform the above multiplications, advacing with prime factors. + */ + overflow = MUL_OVERFLOW_FALLBACK (3u, 5u, &result.u8); + assert (!overflow); + assert (result.u8 == 0xF); + + overflow = MUL_OVERFLOW_FALLBACK (result.u8, 17u, &result.u8); + assert (!overflow); + assert (result.u8 == UINT8_MAX); + + overflow = MUL_OVERFLOW_FALLBACK (result.u8, 257u, &result.u16); + assert (!overflow); + assert (result.u16 == UINT16_MAX); + + overflow = MUL_OVERFLOW_FALLBACK (result.u16, 65537ul, &result.u32); + assert (!overflow); + assert (result.u32 == UINT32_MAX); + + overflow = MUL_OVERFLOW_FALLBACK (result.u32, 641u, &result.u64); + assert (!overflow); + overflow = MUL_OVERFLOW_FALLBACK (result.u64, 6700417ul, &result.u64); + assert (!overflow); + assert (result.u64 == UINT64_MAX); + + return 0; +} diff --git a/common/include/test-human-size.c b/common/include/test-human-size.c new file mode 100644 index 0000000..7f75bb4 --- /dev/null +++ b/common/include/test-human-size.c @@ -0,0 +1,70 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include +#include + +#include "array-size.h" +#include "human-size.h" +#include "human-size-test-cases.h" /* defines 'pairs' below */ + +int +main (void) +{ + size_t i; + bool pass = true; + + for (i = 0; i < ARRAY_SIZE (pairs); i++) { + const char *error = NULL, *pstr = NULL; + int64_t r; + + r = human_size_parse (pairs[i].str, &error, &pstr); + if (r != pairs[i].res) { + fprintf (stderr, + "Wrong parse for %s, got %" PRId64 ", expected %" PRId64 "\n", + pairs[i].str, r, pairs[i].res); + pass = false; + } + if (r == -1) { + if (error == NULL || pstr == NULL) { + fprintf (stderr, "Wrong error message handling for %s\n", pairs[i].str); + pass = false; + } + } + } + + exit (pass ? EXIT_SUCCESS : EXIT_FAILURE); +} diff --git a/common/include/test-isaligned.c b/common/include/test-isaligned.c new file mode 100644 index 0000000..13a6b56 --- /dev/null +++ b/common/include/test-isaligned.c @@ -0,0 +1,62 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include +#include +#undef NDEBUG /* Keep test strong even for nbdkit built without assertions */ +#include + +#include "isaligned.h" + +int +main (void) +{ + uint64_t i; + + for (i = 1; i <= 0x80000000; i <<= 1) { + assert (IS_ALIGNED (0, i)); + assert (IS_ALIGNED (i, i)); + assert (IS_ALIGNED (i*2, i)); + assert (IS_ALIGNED (i*3, i)); + assert (IS_ALIGNED (i*4, i)); + if (i > 1) { + assert (! IS_ALIGNED (i-1, i)); + assert (! IS_ALIGNED (i/2, i)); + } + } + + exit (EXIT_SUCCESS); +} diff --git a/common/include/test-ispowerof2.c b/common/include/test-ispowerof2.c new file mode 100644 index 0000000..a18edbe --- /dev/null +++ b/common/include/test-ispowerof2.c @@ -0,0 +1,88 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include +#include +#undef NDEBUG /* Keep test strong even for nbdkit built without assertions */ +#include + +#include "ispowerof2.h" + +int +main (void) +{ + uint64_t i; + + assert (! is_power_of_2 (0)); + + /* is_power_of_2 is only defined for unsigned long type, which is + * 32 bit on 32 bit platforms. We need to store i in a 64 bit type + * so the loops don't wrap around. + */ + for (i = 1; i <= 0x80000000; i <<= 1) + assert (is_power_of_2 (i)); + + for (i = 4; i <= 0x80000000; i <<= 1) + assert (! is_power_of_2 (i-1)); + + /* Check log_2_bits on some known values. */ + assert (log_2_bits (1) == 0); + assert (log_2_bits (512) == 9); + assert (log_2_bits (4096) == 12); + assert (log_2_bits (0x80000000) == 31); + assert (log_2_bits (UINT64_C (0x100000000)) == 32); + assert (log_2_bits (UINT64_C (0x8000000000000000)) == 63); + + /* Test next power of 2. */ + assert (next_power_of_2 (0) == 1); + assert (next_power_of_2 (1) == 1); + assert (next_power_of_2 (3) == 4); + assert (next_power_of_2 (8) == 8); + assert (next_power_of_2 (9) == 16); + assert (next_power_of_2 (0xffff) == 0x10000); + assert (next_power_of_2 (0x10000) == 0x10000); + assert (next_power_of_2 (INT64_C ( 0xffffffff)) == 0x100000000); + assert (next_power_of_2 (INT64_C (0x100000000)) == 0x100000000); + assert (next_power_of_2 (INT64_C (0x200000001)) == 0x400000000); + assert (next_power_of_2 (INT64_C (0x6ffffffff)) == 0x800000000); + assert (next_power_of_2 (INT64_C (0x700000001)) == 0x800000000); + assert (next_power_of_2 (INT64_C (0x800000000)) == 0x800000000); + assert (next_power_of_2 (UINT64_C (0x8000000000000000)) == + UINT64_C (0x8000000000000000)); + assert (next_power_of_2 (-1) == (uint64_t)-1); + + exit (EXIT_SUCCESS); +} diff --git a/common/include/test-iszero.c b/common/include/test-iszero.c new file mode 100644 index 0000000..3ec85da --- /dev/null +++ b/common/include/test-iszero.c @@ -0,0 +1,66 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include +#include +#undef NDEBUG /* Keep test strong even for nbdkit built without assertions */ +#include + +#include "iszero.h" + +int +main (void) +{ + char *buf; + size_t i, j; + + buf = malloc (256); + if (buf == NULL) { + perror ("malloc"); + exit (EXIT_FAILURE); + } + memset (buf, 0, 256); + + for (j = 0; j <= 16; ++j) { + for (i = 0; i <= 16; ++i) + assert (is_zero (&buf[j], i)); + for (i = 0; i <= 16; ++i) + assert (is_zero (&buf[j], 256-j-i)); + } + + free (buf); + exit (EXIT_SUCCESS); +} diff --git a/common/include/test-minmax.c b/common/include/test-minmax.c new file mode 100644 index 0000000..dcbc87d --- /dev/null +++ b/common/include/test-minmax.c @@ -0,0 +1,172 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include +#include +#undef NDEBUG /* Keep test strong even for nbdkit built without assertions */ +#include +#include + +#include "minmax.h" + +#define SIGNED_TEST(var, min, max) \ + MIN_SIGNED_TEST (var, min, max) \ + MAX_SIGNED_TEST (var, min, max) + +#define MIN_SIGNED_TEST(var, min, max) \ + var = 0; \ + assert (MIN (0, var) == 0); \ + var = 1; \ + assert (MIN (0, var) == 0); \ + var = -1; \ + assert (MIN (0, var) == -1); \ + var = 1; \ + assert (MIN (var, 0) == 0); \ + var = 1; \ + assert (MIN (var, 1) == 1); \ + var = -1; \ + assert (MIN (var, 0) == -1); \ + var = min; \ + assert (MIN (var, min) == min); \ + var = max; \ + assert (MIN (var, max) == max); \ + var = min; \ + assert (MIN (var, max) == min); \ + assert (MIN (0, min) == min); + +#define MAX_SIGNED_TEST(var, min, max) \ + var = 0; \ + assert (MAX (0, var) == 0); \ + var = 1; \ + assert (MAX (0, var) == 1); \ + var = -1; \ + assert (MAX (0, var) == 0); \ + var = 1; \ + assert (MAX (var, 0) == 1); \ + var = 1; \ + assert (MAX (var, 1) == 1); \ + var = -1; \ + assert (MAX (var, 0) == 0); \ + var = min; \ + assert (MAX (var, min) == min); \ + var = max; \ + assert (MAX (var, max) == max); \ + var = min; \ + assert (MAX (var, max) == max); \ + assert (MAX (0, min) == 0); + +#define UNSIGNED_TEST(var, max) \ + MIN_UNSIGNED_TEST (var, max) \ + MAX_UNSIGNED_TEST (var, max) + +#define MIN_UNSIGNED_TEST(var, max) \ + var = 0; \ + assert (MIN (0, var) == 0); \ + var = 1; \ + assert (MIN (0, var) == 0); \ + var = 1; \ + assert (MIN (var, 0) == 0); \ + var = 1; \ + assert (MIN (var, 1) == 1); \ + var = max; \ + assert (MIN (var, max) == max); + +#define MAX_UNSIGNED_TEST(var, max) \ + var = 0; \ + assert (MAX (0, var) == 0); \ + var = 1; \ + assert (MAX (0, var) == 1); \ + var = 1; \ + assert (MAX (var, 0) == 1); \ + var = 1; \ + assert (MAX (var, 1) == 1); \ + var = max; \ + assert (MAX (var, max) == max); + +int +main (void) +{ + signed char sc; + int i; + int8_t i8; + int16_t i16; + int32_t i32; + int64_t i64; + unsigned char uc; + unsigned u; + uint8_t u8; + uint16_t u16; + uint32_t u32; + uint64_t u64; + float f; + double d; + + SIGNED_TEST (sc, SCHAR_MIN, SCHAR_MAX); + SIGNED_TEST (i, INT_MIN, INT_MAX); + SIGNED_TEST (i8, INT8_MIN, INT8_MAX); + SIGNED_TEST (i16, INT16_MIN, INT16_MAX); + SIGNED_TEST (i32, INT32_MIN, INT32_MAX); + SIGNED_TEST (i64, INT64_MIN, INT64_MAX); + + UNSIGNED_TEST (uc, UCHAR_MAX); + UNSIGNED_TEST (u, UINT_MAX); + UNSIGNED_TEST (u8, UINT8_MAX); + UNSIGNED_TEST (u16, UINT16_MAX); + UNSIGNED_TEST (u32, UINT32_MAX); + UNSIGNED_TEST (u64, UINT64_MAX); + + /* Note that FLT_MIN and DBL_MIN are the closest positive normalized + * numbers to 0.0, not the min. + */ + SIGNED_TEST (f, -FLT_MAX, FLT_MAX); + SIGNED_TEST (d, -DBL_MAX, DBL_MAX); + + /* Test that MIN and MAX can be nested. This is really a compile + * test, but we do check the answer. + */ + assert (MIN (MIN (1, 2), 3) == 1); + assert (MAX (MIN (1, 2), 3) == 3); + assert (MIN (MAX (1, 2), 3) == 2); + assert (MAX (MAX (1, 4), 3) == 4); + assert (MIN (3, MIN (1, 2)) == 1); + assert (MAX (3, MIN (1, 2)) == 3); + assert (MIN (3, MAX (1, 2)) == 2); + assert (MAX (3, MAX (1, 4)) == 4); + assert (MIN (MIN (1, MIN (2, 3)), 4) == 1); + assert (MAX (MAX (1, MAX (2, 3)), 4) == 4); + + exit (EXIT_SUCCESS); +} diff --git a/common/include/test-nextnonzero.c b/common/include/test-nextnonzero.c new file mode 100644 index 0000000..6dd47a4 --- /dev/null +++ b/common/include/test-nextnonzero.c @@ -0,0 +1,63 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include +#include +#undef NDEBUG /* Keep test strong even for nbdkit built without assertions */ +#include + +#include "nextnonzero.h" + +char buf[256]; + +int +main (void) +{ + size_t i, j; + char *p; + + for (j = 0; j <= 64; ++j) { + for (i = 0; i <= 64; ++i) { + memset (buf, 0, sizeof buf); + + p = &buf[sizeof buf - j - 1]; + *p = i+1; + assert (next_non_zero (&buf[i], sizeof buf - i) == p); + } + } + + exit (EXIT_SUCCESS); +} diff --git a/common/include/test-random.c b/common/include/test-random.c new file mode 100644 index 0000000..b111e0a --- /dev/null +++ b/common/include/test-random.c @@ -0,0 +1,193 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include +#include + +#include "array-size.h" +#include "random.h" + +/* This works by comparing the result to some known test vectors. It + * should produce the same result on all architectures, platforms and + * compilers. + */ + +#define LEN 16 + +struct { + uint64_t seed; + uint64_t vector[LEN]; +} tests[] = { + { 0, { +UINT64_C (0x99ec5f36cb75f2b4), +UINT64_C (0xbf6e1f784956452a), +UINT64_C (0x1a5f849d4933e6e0), +UINT64_C (0x6aa594f1262d2d2c), +UINT64_C (0xbba5ad4a1f842e59), +UINT64_C (0xffef8375d9ebcaca), +UINT64_C (0x6c160deed2f54c98), +UINT64_C (0x8920ad648fc30a3f), +UINT64_C (0xdb032c0ba7539731), +UINT64_C (0xeb3a475a3e749a3d), +UINT64_C (0x1d42993fa43f2a54), +UINT64_C (0x11361bf526a14bb5), +UINT64_C (0x1b4f07a5ab3d8e9c), +UINT64_C (0xa7a3257f6986db7f), +UINT64_C (0x7efdaa95605dfc9c), +UINT64_C (0x4bde97c0a78eaab8), + } }, + { 1, { +UINT64_C (0xb3f2af6d0fc710c5), +UINT64_C (0x853b559647364cea), +UINT64_C (0x92f89756082a4514), +UINT64_C (0x642e1c7bc266a3a7), +UINT64_C (0xb27a48e29a233673), +UINT64_C (0x24c123126ffda722), +UINT64_C (0x123004ef8df510e6), +UINT64_C (0x61954dcc47b1e89d), +UINT64_C (0xddfdb48ab9ed4a21), +UINT64_C (0x8d3cdb8c3aa5b1d0), +UINT64_C (0xeebd114bd87226d1), +UINT64_C (0xf50c3ff1e7d7e8a6), +UINT64_C (0xeeca3115e23bc8f1), +UINT64_C (0xab49ed3db4c66435), +UINT64_C (0x99953c6c57808dd7), +UINT64_C (0xe3fa941b05219325), +} }, + { 2, { +UINT64_C (0x1a28690da8a8d057), +UINT64_C (0xb9bb8042daedd58a), +UINT64_C (0x2f1829af001ef205), +UINT64_C (0xbf733e63d139683d), +UINT64_C (0xafa78247c6a82034), +UINT64_C (0x3c69a1b6d15cf0d0), +UINT64_C (0xa5a9fdd18948c400), +UINT64_C (0x3813d2654a981e91), +UINT64_C (0x9be35597c9c97bfa), +UINT64_C (0xbfc5e80fd0b75f32), +UINT64_C (0xbee02daaac716557), +UINT64_C (0x5afed6f12b594dbe), +UINT64_C (0xae346b9196e12cc7), +UINT64_C (0xf5f45afc1af068ed), +UINT64_C (0xff75eccacfb37519), +UINT64_C (0x1adca5a0b2e766c5), +} }, + { 3, { +UINT64_C (0xb0cdabdae5668cc0), +UINT64_C (0xa3fd1dea5e1864ee), +UINT64_C (0x37e00afb3229fd51), +UINT64_C (0x88b1b58b236f3bea), +UINT64_C (0x6cb24c8fb224980a), +UINT64_C (0x6646287ee2a98083), +UINT64_C (0x35cd8bb5e1fa7256), +UINT64_C (0xb72fe6e16b6fb4e6), +UINT64_C (0xf1397a9f1db4f5d9), +UINT64_C (0x31f25047faa8e5d4), +UINT64_C (0xec616a6e46e96dec), +UINT64_C (0xae0c5e0f7b5d1449), +UINT64_C (0xa517e799c5c6e32f), +UINT64_C (0xc1276908f843b688), +UINT64_C (0xaf7e924d738d87ec), +UINT64_C (0x1c3f3ba863d5c7d1), +} }, + { 4, { +UINT64_C (0x437057a4eb7c3a13), +UINT64_C (0xe95a0d7fd8c1832c), +UINT64_C (0x71807ff81a0c627e), +UINT64_C (0xfa40f34634632cd2), +UINT64_C (0x39cf61fc694b95b7), +UINT64_C (0x9ca3d6e037621a02), +UINT64_C (0x7be965236729c7d3), +UINT64_C (0xb95fba07afa980ac), +UINT64_C (0x91424978ab94232), +UINT64_C (0x565eb8170fdae341), +UINT64_C (0x0744508beb95a6bb), +UINT64_C (0xf2426b33aa0a601d), +UINT64_C (0x7ddc1fcd0bfec893), +UINT64_C (0x9e09fedd4af1ff3d), +UINT64_C (0xbe77c1bed02132e7), +UINT64_C (0x61e4f6e3e88d34d4), +} }, + { UINT64_MAX, { +UINT64_C (0x8f5520d52a7ead08), +UINT64_C (0xc476a018caa1802d), +UINT64_C (0x81de31c0d260469e), +UINT64_C (0xbf658d7e065f3c2f), +UINT64_C (0x913593fda1bca32a), +UINT64_C (0xbb535e93941ba525), +UINT64_C (0x5ecda415c3c6dfde), +UINT64_C (0xc487398fc9de9ae2), +UINT64_C (0xa06746dbb57c4d62), +UINT64_C (0x9d414196fdf05c8a), +UINT64_C (0x41cf1af9a178c669), +UINT64_C (0x0b3b3a95e78839f9), +UINT64_C (0x7aaab30444aefc7e), +UINT64_C (0x7b251ec961f341b1), +UINT64_C (0x30ed32acf367205f), +UINT64_C (0xc6ca62fc772728b0), +} }, +}; + +int +main (void) +{ + size_t i, j; + uint64_t r; + unsigned errors = 0; + + for (i = 0; i < ARRAY_SIZE (tests); ++i) { + struct random_state state; + + printf ("seed: %" PRIu64 "\n", tests[i].seed); + xsrandom (tests[i].seed, &state); + for (j = 0; j < LEN; ++j) { + r = xrandom (&state); + if (tests[i].vector[j] != r) { + printf ("\texpected: 0x%" PRIx64 "\tactual: 0x%" PRIx64 "\n", + tests[i].vector[j], r); + errors++; + } + } + } + + if (errors > 0) { + fprintf (stderr, "random vector does not match expected\n"); + exit (EXIT_FAILURE); + } + + printf ("test successful\n"); + exit (EXIT_SUCCESS); +} diff --git a/common/include/test-tvdiff.c b/common/include/test-tvdiff.c new file mode 100644 index 0000000..6693db3 --- /dev/null +++ b/common/include/test-tvdiff.c @@ -0,0 +1,130 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include +#include +#include + +#include "tvdiff.h" + +/* This is mainly a test of the compiler and platform rather than our + * implementation. + */ + +#define TEST_TVDIFF(tv1, tv2, expected) \ + do { \ + int64_t actual = tvdiff_usec (&(tv1), &(tv2)); \ + \ + if (actual != (expected)) { \ + fprintf (stderr, \ + "%s: unexpected result %" PRIi64 ", expecting %" PRIi64 "\n", \ + argv[0], actual, (int64_t) (expected)); \ + errors++; \ + } \ + } while (0) + +#define TEST_SUBTRACT(tv1, tv2, exp_sec, exp_usec) \ + do { \ + struct timeval z; \ + \ + subtract_timeval (&tv1, &tv2, &z); \ + if (z.tv_sec != (exp_sec) || z.tv_usec != (exp_usec)) { \ + fprintf (stderr, \ + "%s: unexpected (%ld, %d), expecting (%ld, %d)\n", \ + argv[0], \ + (long) z.tv_sec, (int) z.tv_usec, \ + (long) (exp_sec), (int) (exp_usec)); \ + errors++; \ + } \ + } while (0) + +int +main (int argc, char *argv[]) +{ + struct timeval tv1, tv2; + unsigned errors = 0; + + tv1.tv_sec = 1000; + tv1.tv_usec = 1; + TEST_TVDIFF (tv1, tv1, 0); + TEST_SUBTRACT (tv1, tv1, 0, 0); + + tv2.tv_sec = 1000; + tv2.tv_usec = 2; + TEST_TVDIFF (tv1, tv2, 1); + TEST_SUBTRACT (tv1, tv2, 0, 1); + TEST_TVDIFF (tv2, tv1, -1); + TEST_SUBTRACT (tv2, tv1, 0, -1); + + tv2.tv_sec = 1000; + tv2.tv_usec = 3; + TEST_TVDIFF (tv1, tv2, 2); + TEST_SUBTRACT (tv1, tv2, 0, 2); + TEST_TVDIFF (tv2, tv1, -2); + TEST_SUBTRACT (tv2, tv1, 0, -2); + + tv2.tv_sec = 1001; + tv2.tv_usec = 0; + TEST_TVDIFF (tv1, tv2, 999999); + TEST_SUBTRACT (tv1, tv2, 0, 999999); + TEST_TVDIFF (tv2, tv1, -999999); + TEST_SUBTRACT (tv2, tv1, 0, -999999); + + tv1.tv_sec = 1000; + tv1.tv_usec = 999999; + tv2.tv_sec = 1001; + tv2.tv_usec = 1; + TEST_TVDIFF (tv1, tv2, 2); + TEST_SUBTRACT (tv1, tv2, 0, 2); + TEST_TVDIFF (tv2, tv1, -2); + TEST_SUBTRACT (tv2, tv1, 0, -2); + + tv1.tv_sec = 1000; + tv1.tv_usec = 1; + tv2.tv_sec = 1001; + tv2.tv_usec = 2; + TEST_TVDIFF (tv1, tv2, 1000001); + TEST_SUBTRACT (tv1, tv2, 1, 1); + TEST_TVDIFF (tv2, tv1, -1000001); + TEST_SUBTRACT (tv2, tv1, -1, -1); + + /* Test that an arbitrary tv is equal to itself. */ + gettimeofday (&tv1, NULL); + TEST_TVDIFF (tv1, tv1, 0); + TEST_SUBTRACT (tv1, tv1, 0, 0); + + exit (errors == 0 ? EXIT_SUCCESS : EXIT_FAILURE); +} diff --git a/common/include/tvdiff.h b/common/include/tvdiff.h new file mode 100644 index 0000000..6da5341 --- /dev/null +++ b/common/include/tvdiff.h @@ -0,0 +1,64 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_TVDIFF_H +#define NBDKIT_TVDIFF_H + +/* Compute struct timeval differences. */ + +#include + +#include + +/* Return the number of µs (microseconds) in y - x. */ +static inline int64_t +tvdiff_usec (const struct timeval *x, const struct timeval *y) +{ + int64_t usec; + + usec = (y->tv_sec - x->tv_sec) * 1000000; + usec += y->tv_usec - x->tv_usec; + return usec; +} + +/* Return timeval difference as another struct timeval. z = y - x. */ +static inline void +subtract_timeval (const struct timeval *x, const struct timeval *y, + struct timeval *z) +{ + int64_t usec = tvdiff_usec (x, y); + + z->tv_sec = usec / 1000000; + z->tv_usec = usec % 1000000; +} + +#endif /* NBDKIT_TVDIFF_H */ diff --git a/common/include/unique-name.h b/common/include/unique-name.h new file mode 100644 index 0000000..c5830b4 --- /dev/null +++ b/common/include/unique-name.h @@ -0,0 +1,43 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_UNIQUE_NAME_H +#define NBDKIT_UNIQUE_NAME_H + +/* https://stackoverflow.com/a/1597129 + * https://stackoverflow.com/a/12711226 + */ +#define XXUNIQUE_NAME(name, counter) name ## counter +#define XUNIQUE_NAME(name, counter) XXUNIQUE_NAME (name, counter) +#define NBDKIT_UNIQUE_NAME(name) XUNIQUE_NAME (name, __COUNTER__) + +#endif /* NBDKIT_UNIQUE_NAME_H */ diff --git a/common/include/unix-path-max.h b/common/include/unix-path-max.h new file mode 100644 index 0000000..71d03cf --- /dev/null +++ b/common/include/unix-path-max.h @@ -0,0 +1,42 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_UNIX_PATH_MAX_H +#define NBDKIT_UNIX_PATH_MAX_H + +#ifdef __APPLE__ +#define UNIX_PATH_MAX 104 +#else +#define UNIX_PATH_MAX 108 +#endif + +#endif /* NBDKIT_UNIX_PATH_MAX_H */ diff --git a/common/protocol/Makefile.am b/common/protocol/Makefile.am new file mode 100644 index 0000000..48a16a9 --- /dev/null +++ b/common/protocol/Makefile.am @@ -0,0 +1,60 @@ +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 $(top_srcdir)/common-rules.mk + +EXTRA_DIST = \ + nbd-protocol.h \ + protostrings.c \ + $(NULL) + +include_HEADERS = nbd-protocol.h + +noinst_LTLIBRARIES = libprotocol.la + +libprotocol_la_SOURCES = \ + protostrings.c \ + protostrings.h \ + nbd-protocol.h \ + $(NULL) +libprotocol_la_CFLAGS = $(WARNINGS_CFLAGS) + +# protostrings.c is generated from the nbd-protocol.h header file +# where it is used to map NBD protocol flags to strings. + +BUILT_SOURCES = protostrings.c +CLEANFILES += protostrings.c + +protostrings.c: nbd-protocol.h generate-protostrings.sh Makefile + rm -f $@ $@-t + $(builddir)/generate-protostrings.sh > $@-t + mv $@-t $@ + chmod 0444 $@ diff --git a/common/protocol/Makefile.in b/common/protocol/Makefile.in new file mode 100644 index 0000000..1b89a2d --- /dev/null +++ b/common/protocol/Makefile.in @@ -0,0 +1,880 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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@ +subdir = common/protocol +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ocaml.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(include_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = generate-protostrings.sh +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libprotocol_la_LIBADD = +am__objects_1 = +am_libprotocol_la_OBJECTS = libprotocol_la-protostrings.lo \ + $(am__objects_1) +libprotocol_la_OBJECTS = $(am_libprotocol_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libprotocol_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libprotocol_la_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o \ + $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/libprotocol_la-protostrings.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libprotocol_la_SOURCES) +DIST_SOURCES = $(libprotocol_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +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 = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(includedir)" +HEADERS = $(include_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in \ + $(srcdir)/generate-protostrings.sh.in \ + $(top_srcdir)/common-rules.mk $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ +BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ +CARGO = @CARGO@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_PLUGIN_CC = @CC_PLUGIN_CC@ +CC_PLUGIN_CFLAGS = @CC_PLUGIN_CFLAGS@ +CERTTOOL = @CERTTOOL@ +CFLAGS = @CFLAGS@ +COM_ERR_CFLAGS = @COM_ERR_CFLAGS@ +COM_ERR_LIBS = @COM_ERR_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CUT = @CUT@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LDFLAGS = @DL_LDFLAGS@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXT2FS_CFLAGS = @EXT2FS_CFLAGS@ +EXT2FS_LIBS = @EXT2FS_LIBS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GENISOIMAGE = @GENISOIMAGE@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GOARCH = @GOARCH@ +GOLANG = @GOLANG@ +GOOS = @GOOS@ +GOROOT = @GOROOT@ +GREP = @GREP@ +IMPORT_LIBRARY_ON_WINDOWS = @IMPORT_LIBRARY_ON_WINDOWS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +ISOPROG = @ISOPROG@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBLKIO_CFLAGS = @LIBBLKIO_CFLAGS@ +LIBBLKIO_LIBS = @LIBBLKIO_LIBS@ +LIBGUESTFS_CFLAGS = @LIBGUESTFS_CFLAGS@ +LIBGUESTFS_LIBS = @LIBGUESTFS_LIBS@ +LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ +LIBLZMA_LIBS = @LIBLZMA_LIBS@ +LIBNBD_CFLAGS = @LIBNBD_CFLAGS@ +LIBNBD_LIBS = @LIBNBD_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSELINUX_CFLAGS = @LIBSELINUX_CFLAGS@ +LIBSELINUX_LIBS = @LIBSELINUX_LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTORRENT_CFLAGS = @LIBTORRENT_CFLAGS@ +LIBTORRENT_LIBS = @LIBTORRENT_LIBS@ +LIBVIRT_CFLAGS = @LIBVIRT_CFLAGS@ +LIBVIRT_LIBS = @LIBVIRT_LIBS@ +LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ +LIBZSTD_LIBS = @LIBZSTD_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LUA_CFLAGS = @LUA_CFLAGS@ +LUA_LIBS = @LUA_LIBS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MC = @MC@ +MKDIR_P = @MKDIR_P@ +MKISOFS = @MKISOFS@ +NBDKIT_VERSION_MAJOR = @NBDKIT_VERSION_MAJOR@ +NBDKIT_VERSION_MICRO = @NBDKIT_VERSION_MICRO@ +NBDKIT_VERSION_MINOR = @NBDKIT_VERSION_MINOR@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_ON_WINDOWS = @NO_UNDEFINED_ON_WINDOWS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OCAML = @OCAML@ +OCAMLBEST = @OCAMLBEST@ +OCAMLBUILD = @OCAMLBUILD@ +OCAMLC = @OCAMLC@ +OCAMLCDOTOPT = @OCAMLCDOTOPT@ +OCAMLDEP = @OCAMLDEP@ +OCAMLDOC = @OCAMLDOC@ +OCAMLLIB = @OCAMLLIB@ +OCAMLMKLIB = @OCAMLMKLIB@ +OCAMLMKTOP = @OCAMLMKTOP@ +OCAMLOPT = @OCAMLOPT@ +OCAMLOPTDOTOPT = @OCAMLOPTDOTOPT@ +OCAMLOPTFLAGS = @OCAMLOPTFLAGS@ +OCAMLVERSION = @OCAMLVERSION@ +OCAML_MAJOR = @OCAML_MAJOR@ +OCAML_PLUGIN_LIBRARIES = @OCAML_PLUGIN_LIBRARIES@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PERL_ARCHLIB = @PERL_ARCHLIB@ +PERL_CFLAGS = @PERL_CFLAGS@ +PERL_LDOPTS = @PERL_LDOPTS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PODWRAPPER = @PODWRAPPER@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_CXX = @PTHREAD_CXX@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CFLAGS = @PYTHON_CFLAGS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +RUBY_CFLAGS = @RUBY_CFLAGS@ +RUBY_LIBS = @RUBY_LIBS@ +RUSTC = @RUSTC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOEXT = @SOEXT@ +SSH_CFLAGS = @SSH_CFLAGS@ +SSH_LIBS = @SSH_LIBS@ +STAT = @STAT@ +STRIP = @STRIP@ +TCL_CFLAGS = @TCL_CFLAGS@ +TCL_LIBS = @TCL_LIBS@ +TRUNCATE = @TRUNCATE@ +VALGRIND = @VALGRIND@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VERSION = @VERSION@ +WARNINGS_CFLAGS = @WARNINGS_CFLAGS@ +XORRISO = @XORRISO@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +ZLIB_NG_CFLAGS = @ZLIB_NG_CFLAGS@ +ZLIB_NG_LIBS = @ZLIB_NG_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DLLTOOL = @ac_ct_DLLTOOL@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_MC = @ac_ct_MC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bashcompdir = @bashcompdir@ +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@ +filters = @filters@ +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@ +lang_plugins = @lang_plugins@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +non_lang_plugins = @non_lang_plugins@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugins = @plugins@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +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@ + +# Convenient list terminator +NULL = +plugindir = $(libdir)/nbdkit/plugins +filterdir = $(libdir)/nbdkit/filters +CLEANFILES = *~ *.cmi *.cmx *.cmxa *.so *.dll protostrings.c +EXTRA_DIST = \ + nbd-protocol.h \ + protostrings.c \ + $(NULL) + +include_HEADERS = nbd-protocol.h +noinst_LTLIBRARIES = libprotocol.la +libprotocol_la_SOURCES = \ + protostrings.c \ + protostrings.h \ + nbd-protocol.h \ + $(NULL) + +libprotocol_la_CFLAGS = $(WARNINGS_CFLAGS) + +# protostrings.c is generated from the nbd-protocol.h header file +# where it is used to map NBD protocol flags to strings. +BUILT_SOURCES = protostrings.c +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common-rules.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign common/protocol/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign common/protocol/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; +$(top_srcdir)/common-rules.mk $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +generate-protostrings.sh: $(top_builddir)/config.status $(srcdir)/generate-protostrings.sh.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libprotocol.la: $(libprotocol_la_OBJECTS) $(libprotocol_la_DEPENDENCIES) $(EXTRA_libprotocol_la_DEPENDENCIES) + $(AM_V_CCLD)$(libprotocol_la_LINK) $(libprotocol_la_OBJECTS) $(libprotocol_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libprotocol_la-protostrings.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libprotocol_la-protostrings.lo: protostrings.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprotocol_la_CFLAGS) $(CFLAGS) -MT libprotocol_la-protostrings.lo -MD -MP -MF $(DEPDIR)/libprotocol_la-protostrings.Tpo -c -o libprotocol_la-protostrings.lo `test -f 'protostrings.c' || echo '$(srcdir)/'`protostrings.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libprotocol_la-protostrings.Tpo $(DEPDIR)/libprotocol_la-protostrings.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='protostrings.c' object='libprotocol_la-protostrings.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprotocol_la_CFLAGS) $(CFLAGS) -c -o libprotocol_la-protostrings.lo `test -f 'protostrings.c' || echo '$(srcdir)/'`protostrings.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-includeHEADERS: $(include_HEADERS) + @$(NORMAL_INSTALL) + @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ + done + +uninstall-includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(includedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-am +install-exec: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) 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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +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-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/libprotocol_la-protostrings.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-includeHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/libprotocol_la-protostrings.Plo + -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-includeHEADERS + +.MAKE: all check install install-am install-exec install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + 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-man install-pdf install-pdf-am 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 tags-am uninstall \ + uninstall-am uninstall-includeHEADERS + +.PRECIOUS: Makefile + + +protostrings.c: nbd-protocol.h generate-protostrings.sh Makefile + rm -f $@ $@-t + $(builddir)/generate-protostrings.sh > $@-t + mv $@-t $@ + chmod 0444 $@ + +# 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/common/protocol/generate-protostrings.sh.in b/common/protocol/generate-protostrings.sh.in new file mode 100755 index 0000000..4a372e8 --- /dev/null +++ b/common/protocol/generate-protostrings.sh.in @@ -0,0 +1,79 @@ +#!/usr/bin/env bash +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +# The header. +cat <<'EOF' +/* Generated from nbd-protocol.h by generate-protostrings.sh. + * License of this file is BSD, the same as the rest of nbdkit. + */ + +#include +#include "nbd-protocol.h" + +EOF + +declare -A functions=( + [global_flag]=NBD_FLAG_FIXED_NEWSTYLE + [flag]=NBD_FLAG_HAS_FLAGS + [opt]=NBD_OPT_EXPORT_NAME + [rep]=NBD_REP_ACK + [info]=NBD_INFO_EXPORT + [reply]=NBD_REPLY_FLAG_DONE + [reply_type]=NBD_REPLY_TYPE_NONE + [cmd]=NBD_CMD_READ + [cmd_flag]=NBD_CMD_FLAG_FUA + [error]=NBD_SUCCESS +) + +# Generate each 'const char *name_of_nbd_' +keys=$( printf '%s\n' ${!functions[@]} | sort ) +for fn in $keys; do + echo 'extern const char *' + echo "name_of_nbd_$fn (unsigned int fl)" + echo '{' + echo ' static char buf[] = "unknown (0x00000000)";' + echo ' switch (fl) {' + + # We look for the first #define and rewrite every + # line up to the next blank line. + symbol="${functions[$fn]}" + @SED@ -n "/^#define $symbol/,/^$/p" nbd-protocol.h | + @SED@ 's/^#define \([_A-Z]*\).*/ case \1:\ + return "\1\";/' + + echo ' default:' + echo ' snprintf (buf, sizeof buf, "unknown (0x%x)", fl);' + echo ' return buf;' + echo ' }' + echo '}' + echo +done diff --git a/common/protocol/nbd-protocol.h b/common/protocol/nbd-protocol.h new file mode 100644 index 0000000..b5a28ae --- /dev/null +++ b/common/protocol/nbd-protocol.h @@ -0,0 +1,319 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBD_PROTOCOL_H +#define NBD_PROTOCOL_H + +#include + +/* Note that all NBD fields are sent on the wire in network byte + * order, so you must use beXXtoh or htobeXX when reading or writing + * these structures. + */ + +#if defined (__GNUC__) || defined (__clang__) +#define NBD_ATTRIBUTE_PACKED __attribute__ ((__packed__)) +#else +#error "Please port to your compiler's notion of a packed struct" +#endif + +#define NBD_MAX_STRING 4096 /* Maximum length of a string field */ + +/* Old-style handshake. */ +struct nbd_old_handshake { + uint64_t nbdmagic; /* NBD_MAGIC */ + uint64_t version; /* NBD_OLD_VERSION */ + uint64_t exportsize; + uint16_t gflags; /* global flags */ + uint16_t eflags; /* per-export flags */ + char zeroes[124]; /* must be sent as zero bytes */ +} NBD_ATTRIBUTE_PACKED; + +#define NBD_MAGIC UINT64_C (0x4e42444d41474943) /* ASCII "NBDMAGIC" */ +#define NBD_OLD_VERSION UINT64_C (0x0000420281861253) + +/* New-style handshake. */ +struct nbd_new_handshake { + uint64_t nbdmagic; /* NBD_MAGIC */ + uint64_t version; /* NBD_NEW_VERSION */ + uint16_t gflags; /* global flags */ +} NBD_ATTRIBUTE_PACKED; + +#define NBD_NEW_VERSION UINT64_C (0x49484156454F5054) /* ASCII "IHAVEOPT" */ + +/* New-style handshake option (sent by the client to us). */ +struct nbd_new_option { + uint64_t version; /* NBD_NEW_VERSION */ + uint32_t option; /* NBD_OPT_* */ + uint32_t optlen; /* option data length */ + /* option data follows */ +} NBD_ATTRIBUTE_PACKED; + +/* Newstyle handshake OPT_EXPORT_NAME reply message. + * Modern clients use NBD_OPT_GO instead of this. + */ +struct nbd_export_name_option_reply { + uint64_t exportsize; /* size of export */ + uint16_t eflags; /* per-export flags */ + char zeroes[124]; /* optional zeroes, unless NBD_FLAG_NO_ZEROES */ +} NBD_ATTRIBUTE_PACKED; + +/* Fixed newstyle handshake reply message. */ +struct nbd_fixed_new_option_reply { + uint64_t magic; /* NBD_REP_MAGIC */ + uint32_t option; /* option we are replying to */ + uint32_t reply; /* NBD_REP_* */ + uint32_t replylen; +} NBD_ATTRIBUTE_PACKED; + +#define NBD_REP_MAGIC UINT64_C (0x3e889045565a9) + +/* Global flags. */ +#define NBD_FLAG_FIXED_NEWSTYLE (1U << 0) +#define NBD_FLAG_NO_ZEROES (1U << 1) + +/* Per-export flags. */ +#define NBD_FLAG_HAS_FLAGS (1U << 0) +#define NBD_FLAG_READ_ONLY (1U << 1) +#define NBD_FLAG_SEND_FLUSH (1U << 2) +#define NBD_FLAG_SEND_FUA (1U << 3) +#define NBD_FLAG_ROTATIONAL (1U << 4) +#define NBD_FLAG_SEND_TRIM (1U << 5) +#define NBD_FLAG_SEND_WRITE_ZEROES (1U << 6) +#define NBD_FLAG_SEND_DF (1U << 7) +#define NBD_FLAG_CAN_MULTI_CONN (1U << 8) +#define NBD_FLAG_SEND_CACHE (1U << 10) +#define NBD_FLAG_SEND_FAST_ZERO (1U << 11) + +/* NBD options (new style handshake only). */ +#define NBD_OPT_EXPORT_NAME 1 +#define NBD_OPT_ABORT 2 +#define NBD_OPT_LIST 3 +#define NBD_OPT_STARTTLS 5 +#define NBD_OPT_INFO 6 +#define NBD_OPT_GO 7 +#define NBD_OPT_STRUCTURED_REPLY 8 +#define NBD_OPT_LIST_META_CONTEXT 9 +#define NBD_OPT_SET_META_CONTEXT 10 +#define NBD_OPT_EXTENDED_HEADERS 11 + +#define NBD_REP_ERR(val) (0x80000000 | (val)) +#define NBD_REP_IS_ERR(val) (!!((val) & 0x80000000)) + +#define NBD_REP_ACK 1 +#define NBD_REP_SERVER 2 +#define NBD_REP_INFO 3 +#define NBD_REP_META_CONTEXT 4 +#define NBD_REP_ERR_UNSUP NBD_REP_ERR (1) +#define NBD_REP_ERR_POLICY NBD_REP_ERR (2) +#define NBD_REP_ERR_INVALID NBD_REP_ERR (3) +#define NBD_REP_ERR_PLATFORM NBD_REP_ERR (4) +#define NBD_REP_ERR_TLS_REQD NBD_REP_ERR (5) +#define NBD_REP_ERR_UNKNOWN NBD_REP_ERR (6) +#define NBD_REP_ERR_SHUTDOWN NBD_REP_ERR (7) +#define NBD_REP_ERR_BLOCK_SIZE_REQD NBD_REP_ERR (8) +#define NBD_REP_ERR_TOO_BIG NBD_REP_ERR (9) +#define NBD_REP_ERR_EXT_HEADER_REQD NBD_REP_ERR (10) + +#define NBD_INFO_EXPORT 0 +#define NBD_INFO_NAME 1 +#define NBD_INFO_DESCRIPTION 2 +#define NBD_INFO_BLOCK_SIZE 3 + +/* NBD_INFO_EXPORT reply (follows fixed_new_option_reply). */ +struct nbd_fixed_new_option_reply_info_export { + uint16_t info; /* NBD_INFO_EXPORT */ + uint64_t exportsize; /* size of export */ + uint16_t eflags; /* per-export flags */ +} NBD_ATTRIBUTE_PACKED; + +/* NBD_INFO_NAME or NBD_INFO_DESCRIPTION reply (follows + * fixed_new_option_reply). + */ +struct nbd_fixed_new_option_reply_info_name_or_desc { + uint16_t info; /* NBD_INFO_NAME, NBD_INFO_DESCRIPTION */ + /* followed by a string name or description */ +} NBD_ATTRIBUTE_PACKED; + +/* NBD_INFO_BLOCK_SIZE reply (follows fixed_new_option_reply). */ +struct nbd_fixed_new_option_reply_info_block_size { + uint16_t info; /* NBD_INFO_BLOCK_SIZE */ + uint32_t minimum; /* minimum block size */ + uint32_t preferred; /* preferred block size */ + uint32_t maximum; /* maximum block size */ +} NBD_ATTRIBUTE_PACKED; + +/* NBD_REP_SERVER reply (follows fixed_new_option_reply). */ +struct nbd_fixed_new_option_reply_server { + uint32_t export_name_len; /* length of export name */ + /* followed by a string export name and description */ +} NBD_ATTRIBUTE_PACKED; + +/* NBD_REP_META_CONTEXT reply (follows fixed_new_option_reply). */ +struct nbd_fixed_new_option_reply_meta_context { + uint32_t context_id; /* metadata context ID */ + /* followed by a string */ +} NBD_ATTRIBUTE_PACKED; + +/* Compact request (client -> server). */ +struct nbd_request { + uint32_t magic; /* NBD_REQUEST_MAGIC. */ + uint16_t flags; /* Request flags: NBD_CMD_FLAG_*. */ + uint16_t type; /* Request type: NBD_CMD_*. */ + uint64_t cookie; /* Opaque handle. */ + uint64_t offset; /* Request offset. */ + uint32_t count; /* Request length. */ +} NBD_ATTRIBUTE_PACKED; + +/* Extended request (client -> server). */ +struct nbd_request_ext { + uint32_t magic; /* NBD_EXTENDED_REQUEST_MAGIC. */ + uint16_t flags; /* Request flags: NBD_CMD_FLAG_*. */ + uint16_t type; /* Request type: NBD_CMD_*. */ + uint64_t cookie; /* Opaque handle. */ + uint64_t offset; /* Request offset. */ + uint64_t count; /* Request effect or payload length. */ +} NBD_ATTRIBUTE_PACKED; + +/* Simple reply (server -> client). */ +struct nbd_simple_reply { + uint32_t magic; /* NBD_SIMPLE_REPLY_MAGIC. */ + uint32_t error; /* NBD_SUCCESS or one of NBD_E*. */ + uint64_t cookie; /* Opaque handle. */ +} NBD_ATTRIBUTE_PACKED; + +/* Structured reply (server -> client). */ +struct nbd_structured_reply { + uint32_t magic; /* NBD_STRUCTURED_REPLY_MAGIC. */ + uint16_t flags; /* NBD_REPLY_FLAG_* */ + uint16_t type; /* NBD_REPLY_TYPE_* */ + uint64_t cookie; /* Opaque handle. */ + uint32_t length; /* Length of following nbd_chunk_* payload. */ +} NBD_ATTRIBUTE_PACKED; + +/* Extended reply (server -> client). */ +struct nbd_extended_reply { + uint32_t magic; /* NBD_EXTENDED_REPLY_MAGIC. */ + uint16_t flags; /* NBD_REPLY_FLAG_* */ + uint16_t type; /* NBD_REPLY_TYPE_* */ + uint64_t cookie; /* Opaque handle. */ + uint64_t offset; /* Client's offset. */ + uint64_t length; /* Length of following nbd_chunk_* payload. */ +} NBD_ATTRIBUTE_PACKED; + +struct nbd_chunk_offset_data { + uint64_t offset; /* offset */ + /* Followed by data. */ +} NBD_ATTRIBUTE_PACKED; + +struct nbd_chunk_offset_hole { + uint64_t offset; + uint32_t length; /* Length of hole. */ +} NBD_ATTRIBUTE_PACKED; + +struct nbd_chunk_block_status_32 { + uint32_t context_id; /* metadata context ID */ + /* followed by array of nbd_block_descriptor_32 extents */ +} NBD_ATTRIBUTE_PACKED; + +struct nbd_block_descriptor_32 { + uint32_t length; /* length of block */ + uint32_t status_flags; /* block type (hole etc) */ +} NBD_ATTRIBUTE_PACKED; + +struct nbd_chunk_block_status_64 { + uint32_t context_id; /* metadata context ID */ + uint32_t count; /* non-zero descriptor count */ + /* followed by nbd_block_descriptor_64[count] extents */ +} NBD_ATTRIBUTE_PACKED; + +struct nbd_block_descriptor_64 { + uint64_t length; /* length of block */ + uint64_t status_flags; /* block type (hole etc) */ +} NBD_ATTRIBUTE_PACKED; + +struct nbd_chunk_error { + uint32_t error; /* NBD_E* error number */ + uint16_t len; /* Length of human readable error. */ + /* Followed by human readable error string, and possibly more structure. */ +} NBD_ATTRIBUTE_PACKED; + +#define NBD_REQUEST_MAGIC 0x25609513 +#define NBD_EXTENDED_REQUEST_MAGIC 0x21e41c71 +#define NBD_SIMPLE_REPLY_MAGIC 0x67446698 +#define NBD_STRUCTURED_REPLY_MAGIC 0x668e33ef +#define NBD_EXTENDED_REPLY_MAGIC 0x6e8a278c + +/* Structured reply flags. */ +#define NBD_REPLY_FLAG_DONE (1U << 0) + +#define NBD_REPLY_TYPE_ERR(val) ((1U<<15) | (val)) +#define NBD_REPLY_TYPE_IS_ERR(val) (!!((val) & (1U<<15))) + +/* Structured reply types. */ +#define NBD_REPLY_TYPE_NONE 0 +#define NBD_REPLY_TYPE_OFFSET_DATA 1 +#define NBD_REPLY_TYPE_OFFSET_HOLE 2 +#define NBD_REPLY_TYPE_BLOCK_STATUS 5 +#define NBD_REPLY_TYPE_BLOCK_STATUS_EXT 6 +#define NBD_REPLY_TYPE_ERROR NBD_REPLY_TYPE_ERR (1) +#define NBD_REPLY_TYPE_ERROR_OFFSET NBD_REPLY_TYPE_ERR (2) + +/* NBD commands. */ +#define NBD_CMD_READ 0 +#define NBD_CMD_WRITE 1 +#define NBD_CMD_DISC 2 /* Disconnect. */ +#define NBD_CMD_FLUSH 3 +#define NBD_CMD_TRIM 4 +#define NBD_CMD_CACHE 5 +#define NBD_CMD_WRITE_ZEROES 6 +#define NBD_CMD_BLOCK_STATUS 7 + +#define NBD_CMD_FLAG_FUA (1U << 0) +#define NBD_CMD_FLAG_NO_HOLE (1U << 1) +#define NBD_CMD_FLAG_DF (1U << 2) +#define NBD_CMD_FLAG_REQ_ONE (1U << 3) +#define NBD_CMD_FLAG_FAST_ZERO (1U << 4) +#define NBD_CMD_FLAG_PAYLOAD_LEN (1U << 5) + +/* NBD error codes. */ +#define NBD_SUCCESS 0 +#define NBD_EPERM 1 +#define NBD_EIO 5 +#define NBD_ENOMEM 12 +#define NBD_EINVAL 22 +#define NBD_ENOSPC 28 +#define NBD_EOVERFLOW 75 +#define NBD_ENOTSUP 95 +#define NBD_ESHUTDOWN 108 + +#endif /* NBD_PROTOCOL_H */ diff --git a/common/protocol/protostrings.c b/common/protocol/protostrings.c new file mode 100644 index 0000000..5f61ee7 --- /dev/null +++ b/common/protocol/protostrings.c @@ -0,0 +1,271 @@ +/* Generated from nbd-protocol.h by generate-protostrings.sh. + * License of this file is BSD, the same as the rest of nbdkit. + */ + +#include +#include "nbd-protocol.h" + +extern const char * +name_of_nbd_cmd (unsigned int fl) +{ + static char buf[] = "unknown (0x00000000)"; + switch (fl) { + case NBD_CMD_READ: + return "NBD_CMD_READ"; + case NBD_CMD_WRITE: + return "NBD_CMD_WRITE"; + case NBD_CMD_DISC: + return "NBD_CMD_DISC"; + case NBD_CMD_FLUSH: + return "NBD_CMD_FLUSH"; + case NBD_CMD_TRIM: + return "NBD_CMD_TRIM"; + case NBD_CMD_CACHE: + return "NBD_CMD_CACHE"; + case NBD_CMD_WRITE_ZEROES: + return "NBD_CMD_WRITE_ZEROES"; + case NBD_CMD_BLOCK_STATUS: + return "NBD_CMD_BLOCK_STATUS"; + + default: + snprintf (buf, sizeof buf, "unknown (0x%x)", fl); + return buf; + } +} + +extern const char * +name_of_nbd_cmd_flag (unsigned int fl) +{ + static char buf[] = "unknown (0x00000000)"; + switch (fl) { + case NBD_CMD_FLAG_FUA: + return "NBD_CMD_FLAG_FUA"; + case NBD_CMD_FLAG_NO_HOLE: + return "NBD_CMD_FLAG_NO_HOLE"; + case NBD_CMD_FLAG_DF: + return "NBD_CMD_FLAG_DF"; + case NBD_CMD_FLAG_REQ_ONE: + return "NBD_CMD_FLAG_REQ_ONE"; + case NBD_CMD_FLAG_FAST_ZERO: + return "NBD_CMD_FLAG_FAST_ZERO"; + case NBD_CMD_FLAG_PAYLOAD_LEN: + return "NBD_CMD_FLAG_PAYLOAD_LEN"; + + default: + snprintf (buf, sizeof buf, "unknown (0x%x)", fl); + return buf; + } +} + +extern const char * +name_of_nbd_error (unsigned int fl) +{ + static char buf[] = "unknown (0x00000000)"; + switch (fl) { + case NBD_SUCCESS: + return "NBD_SUCCESS"; + case NBD_EPERM: + return "NBD_EPERM"; + case NBD_EIO: + return "NBD_EIO"; + case NBD_ENOMEM: + return "NBD_ENOMEM"; + case NBD_EINVAL: + return "NBD_EINVAL"; + case NBD_ENOSPC: + return "NBD_ENOSPC"; + case NBD_EOVERFLOW: + return "NBD_EOVERFLOW"; + case NBD_ENOTSUP: + return "NBD_ENOTSUP"; + case NBD_ESHUTDOWN: + return "NBD_ESHUTDOWN"; + + default: + snprintf (buf, sizeof buf, "unknown (0x%x)", fl); + return buf; + } +} + +extern const char * +name_of_nbd_flag (unsigned int fl) +{ + static char buf[] = "unknown (0x00000000)"; + switch (fl) { + case NBD_FLAG_HAS_FLAGS: + return "NBD_FLAG_HAS_FLAGS"; + case NBD_FLAG_READ_ONLY: + return "NBD_FLAG_READ_ONLY"; + case NBD_FLAG_SEND_FLUSH: + return "NBD_FLAG_SEND_FLUSH"; + case NBD_FLAG_SEND_FUA: + return "NBD_FLAG_SEND_FUA"; + case NBD_FLAG_ROTATIONAL: + return "NBD_FLAG_ROTATIONAL"; + case NBD_FLAG_SEND_TRIM: + return "NBD_FLAG_SEND_TRIM"; + case NBD_FLAG_SEND_WRITE_ZEROES: + return "NBD_FLAG_SEND_WRITE_ZEROES"; + case NBD_FLAG_SEND_DF: + return "NBD_FLAG_SEND_DF"; + case NBD_FLAG_CAN_MULTI_CONN: + return "NBD_FLAG_CAN_MULTI_CONN"; + case NBD_FLAG_SEND_CACHE: + return "NBD_FLAG_SEND_CACHE"; + case NBD_FLAG_SEND_FAST_ZERO: + return "NBD_FLAG_SEND_FAST_ZERO"; + + default: + snprintf (buf, sizeof buf, "unknown (0x%x)", fl); + return buf; + } +} + +extern const char * +name_of_nbd_global_flag (unsigned int fl) +{ + static char buf[] = "unknown (0x00000000)"; + switch (fl) { + case NBD_FLAG_FIXED_NEWSTYLE: + return "NBD_FLAG_FIXED_NEWSTYLE"; + case NBD_FLAG_NO_ZEROES: + return "NBD_FLAG_NO_ZEROES"; + + default: + snprintf (buf, sizeof buf, "unknown (0x%x)", fl); + return buf; + } +} + +extern const char * +name_of_nbd_info (unsigned int fl) +{ + static char buf[] = "unknown (0x00000000)"; + switch (fl) { + case NBD_INFO_EXPORT: + return "NBD_INFO_EXPORT"; + case NBD_INFO_NAME: + return "NBD_INFO_NAME"; + case NBD_INFO_DESCRIPTION: + return "NBD_INFO_DESCRIPTION"; + case NBD_INFO_BLOCK_SIZE: + return "NBD_INFO_BLOCK_SIZE"; + + default: + snprintf (buf, sizeof buf, "unknown (0x%x)", fl); + return buf; + } +} + +extern const char * +name_of_nbd_opt (unsigned int fl) +{ + static char buf[] = "unknown (0x00000000)"; + switch (fl) { + case NBD_OPT_EXPORT_NAME: + return "NBD_OPT_EXPORT_NAME"; + case NBD_OPT_ABORT: + return "NBD_OPT_ABORT"; + case NBD_OPT_LIST: + return "NBD_OPT_LIST"; + case NBD_OPT_STARTTLS: + return "NBD_OPT_STARTTLS"; + case NBD_OPT_INFO: + return "NBD_OPT_INFO"; + case NBD_OPT_GO: + return "NBD_OPT_GO"; + case NBD_OPT_STRUCTURED_REPLY: + return "NBD_OPT_STRUCTURED_REPLY"; + case NBD_OPT_LIST_META_CONTEXT: + return "NBD_OPT_LIST_META_CONTEXT"; + case NBD_OPT_SET_META_CONTEXT: + return "NBD_OPT_SET_META_CONTEXT"; + case NBD_OPT_EXTENDED_HEADERS: + return "NBD_OPT_EXTENDED_HEADERS"; + + default: + snprintf (buf, sizeof buf, "unknown (0x%x)", fl); + return buf; + } +} + +extern const char * +name_of_nbd_rep (unsigned int fl) +{ + static char buf[] = "unknown (0x00000000)"; + switch (fl) { + case NBD_REP_ACK: + return "NBD_REP_ACK"; + case NBD_REP_SERVER: + return "NBD_REP_SERVER"; + case NBD_REP_INFO: + return "NBD_REP_INFO"; + case NBD_REP_META_CONTEXT: + return "NBD_REP_META_CONTEXT"; + case NBD_REP_ERR_UNSUP: + return "NBD_REP_ERR_UNSUP"; + case NBD_REP_ERR_POLICY: + return "NBD_REP_ERR_POLICY"; + case NBD_REP_ERR_INVALID: + return "NBD_REP_ERR_INVALID"; + case NBD_REP_ERR_PLATFORM: + return "NBD_REP_ERR_PLATFORM"; + case NBD_REP_ERR_TLS_REQD: + return "NBD_REP_ERR_TLS_REQD"; + case NBD_REP_ERR_UNKNOWN: + return "NBD_REP_ERR_UNKNOWN"; + case NBD_REP_ERR_SHUTDOWN: + return "NBD_REP_ERR_SHUTDOWN"; + case NBD_REP_ERR_BLOCK_SIZE_REQD: + return "NBD_REP_ERR_BLOCK_SIZE_REQD"; + case NBD_REP_ERR_TOO_BIG: + return "NBD_REP_ERR_TOO_BIG"; + case NBD_REP_ERR_EXT_HEADER_REQD: + return "NBD_REP_ERR_EXT_HEADER_REQD"; + + default: + snprintf (buf, sizeof buf, "unknown (0x%x)", fl); + return buf; + } +} + +extern const char * +name_of_nbd_reply (unsigned int fl) +{ + static char buf[] = "unknown (0x00000000)"; + switch (fl) { + case NBD_REPLY_FLAG_DONE: + return "NBD_REPLY_FLAG_DONE"; + + default: + snprintf (buf, sizeof buf, "unknown (0x%x)", fl); + return buf; + } +} + +extern const char * +name_of_nbd_reply_type (unsigned int fl) +{ + static char buf[] = "unknown (0x00000000)"; + switch (fl) { + case NBD_REPLY_TYPE_NONE: + return "NBD_REPLY_TYPE_NONE"; + case NBD_REPLY_TYPE_OFFSET_DATA: + return "NBD_REPLY_TYPE_OFFSET_DATA"; + case NBD_REPLY_TYPE_OFFSET_HOLE: + return "NBD_REPLY_TYPE_OFFSET_HOLE"; + case NBD_REPLY_TYPE_BLOCK_STATUS: + return "NBD_REPLY_TYPE_BLOCK_STATUS"; + case NBD_REPLY_TYPE_BLOCK_STATUS_EXT: + return "NBD_REPLY_TYPE_BLOCK_STATUS_EXT"; + case NBD_REPLY_TYPE_ERROR: + return "NBD_REPLY_TYPE_ERROR"; + case NBD_REPLY_TYPE_ERROR_OFFSET: + return "NBD_REPLY_TYPE_ERROR_OFFSET"; + + default: + snprintf (buf, sizeof buf, "unknown (0x%x)", fl); + return buf; + } +} + diff --git a/common/protocol/protostrings.h b/common/protocol/protostrings.h new file mode 100644 index 0000000..94e418e --- /dev/null +++ b/common/protocol/protostrings.h @@ -0,0 +1,51 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_PROTOSTRINGS_H +#define NBDKIT_PROTOSTRINGS_H + +/* The corresponding functions are generated by + * generate-protostrings.sh from the nbd-protocol.h header file. + */ + +extern const char *name_of_nbd_global_flag (unsigned int); +extern const char *name_of_nbd_flag (unsigned int); +extern const char *name_of_nbd_opt (unsigned int); +extern const char *name_of_nbd_rep (unsigned int); +extern const char *name_of_nbd_info (unsigned int); +extern const char *name_of_nbd_reply_flag (unsigned int); +extern const char *name_of_nbd_reply_type (unsigned int); +extern const char *name_of_nbd_cmd (unsigned int); +extern const char *name_of_nbd_cmd_flag (unsigned int); +extern const char *name_of_nbd_error (unsigned int); + +#endif /* NBDKIT_PROTOSTRINGS_H */ diff --git a/common/regions/Makefile.am b/common/regions/Makefile.am new file mode 100644 index 0000000..30a9199 --- /dev/null +++ b/common/regions/Makefile.am @@ -0,0 +1,46 @@ +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 $(top_srcdir)/common-rules.mk + +noinst_LTLIBRARIES = libregions.la + +libregions_la_SOURCES = \ + regions.c \ + regions.h \ + $(NULL) +libregions_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/common/include \ + -I$(top_srcdir)/common/utils \ + $(NULL) +libregions_la_CFLAGS = $(WARNINGS_CFLAGS) diff --git a/common/regions/Makefile.in b/common/regions/Makefile.in new file mode 100644 index 0000000..0c05c26 --- /dev/null +++ b/common/regions/Makefile.in @@ -0,0 +1,804 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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@ +subdir = common/regions +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ocaml.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libregions_la_LIBADD = +am__objects_1 = +am_libregions_la_OBJECTS = libregions_la-regions.lo $(am__objects_1) +libregions_la_OBJECTS = $(am_libregions_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libregions_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libregions_la_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/libregions_la-regions.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libregions_la_SOURCES) +DIST_SOURCES = $(libregions_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/common-rules.mk \ + $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ +BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ +CARGO = @CARGO@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_PLUGIN_CC = @CC_PLUGIN_CC@ +CC_PLUGIN_CFLAGS = @CC_PLUGIN_CFLAGS@ +CERTTOOL = @CERTTOOL@ +CFLAGS = @CFLAGS@ +COM_ERR_CFLAGS = @COM_ERR_CFLAGS@ +COM_ERR_LIBS = @COM_ERR_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CUT = @CUT@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LDFLAGS = @DL_LDFLAGS@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXT2FS_CFLAGS = @EXT2FS_CFLAGS@ +EXT2FS_LIBS = @EXT2FS_LIBS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GENISOIMAGE = @GENISOIMAGE@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GOARCH = @GOARCH@ +GOLANG = @GOLANG@ +GOOS = @GOOS@ +GOROOT = @GOROOT@ +GREP = @GREP@ +IMPORT_LIBRARY_ON_WINDOWS = @IMPORT_LIBRARY_ON_WINDOWS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +ISOPROG = @ISOPROG@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBLKIO_CFLAGS = @LIBBLKIO_CFLAGS@ +LIBBLKIO_LIBS = @LIBBLKIO_LIBS@ +LIBGUESTFS_CFLAGS = @LIBGUESTFS_CFLAGS@ +LIBGUESTFS_LIBS = @LIBGUESTFS_LIBS@ +LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ +LIBLZMA_LIBS = @LIBLZMA_LIBS@ +LIBNBD_CFLAGS = @LIBNBD_CFLAGS@ +LIBNBD_LIBS = @LIBNBD_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSELINUX_CFLAGS = @LIBSELINUX_CFLAGS@ +LIBSELINUX_LIBS = @LIBSELINUX_LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTORRENT_CFLAGS = @LIBTORRENT_CFLAGS@ +LIBTORRENT_LIBS = @LIBTORRENT_LIBS@ +LIBVIRT_CFLAGS = @LIBVIRT_CFLAGS@ +LIBVIRT_LIBS = @LIBVIRT_LIBS@ +LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ +LIBZSTD_LIBS = @LIBZSTD_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LUA_CFLAGS = @LUA_CFLAGS@ +LUA_LIBS = @LUA_LIBS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MC = @MC@ +MKDIR_P = @MKDIR_P@ +MKISOFS = @MKISOFS@ +NBDKIT_VERSION_MAJOR = @NBDKIT_VERSION_MAJOR@ +NBDKIT_VERSION_MICRO = @NBDKIT_VERSION_MICRO@ +NBDKIT_VERSION_MINOR = @NBDKIT_VERSION_MINOR@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_ON_WINDOWS = @NO_UNDEFINED_ON_WINDOWS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OCAML = @OCAML@ +OCAMLBEST = @OCAMLBEST@ +OCAMLBUILD = @OCAMLBUILD@ +OCAMLC = @OCAMLC@ +OCAMLCDOTOPT = @OCAMLCDOTOPT@ +OCAMLDEP = @OCAMLDEP@ +OCAMLDOC = @OCAMLDOC@ +OCAMLLIB = @OCAMLLIB@ +OCAMLMKLIB = @OCAMLMKLIB@ +OCAMLMKTOP = @OCAMLMKTOP@ +OCAMLOPT = @OCAMLOPT@ +OCAMLOPTDOTOPT = @OCAMLOPTDOTOPT@ +OCAMLOPTFLAGS = @OCAMLOPTFLAGS@ +OCAMLVERSION = @OCAMLVERSION@ +OCAML_MAJOR = @OCAML_MAJOR@ +OCAML_PLUGIN_LIBRARIES = @OCAML_PLUGIN_LIBRARIES@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PERL_ARCHLIB = @PERL_ARCHLIB@ +PERL_CFLAGS = @PERL_CFLAGS@ +PERL_LDOPTS = @PERL_LDOPTS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PODWRAPPER = @PODWRAPPER@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_CXX = @PTHREAD_CXX@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CFLAGS = @PYTHON_CFLAGS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +RUBY_CFLAGS = @RUBY_CFLAGS@ +RUBY_LIBS = @RUBY_LIBS@ +RUSTC = @RUSTC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOEXT = @SOEXT@ +SSH_CFLAGS = @SSH_CFLAGS@ +SSH_LIBS = @SSH_LIBS@ +STAT = @STAT@ +STRIP = @STRIP@ +TCL_CFLAGS = @TCL_CFLAGS@ +TCL_LIBS = @TCL_LIBS@ +TRUNCATE = @TRUNCATE@ +VALGRIND = @VALGRIND@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VERSION = @VERSION@ +WARNINGS_CFLAGS = @WARNINGS_CFLAGS@ +XORRISO = @XORRISO@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +ZLIB_NG_CFLAGS = @ZLIB_NG_CFLAGS@ +ZLIB_NG_LIBS = @ZLIB_NG_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DLLTOOL = @ac_ct_DLLTOOL@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_MC = @ac_ct_MC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bashcompdir = @bashcompdir@ +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@ +filters = @filters@ +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@ +lang_plugins = @lang_plugins@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +non_lang_plugins = @non_lang_plugins@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugins = @plugins@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +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@ + +# Convenient list terminator +NULL = +plugindir = $(libdir)/nbdkit/plugins +filterdir = $(libdir)/nbdkit/filters +CLEANFILES = *~ *.cmi *.cmx *.cmxa *.so *.dll +noinst_LTLIBRARIES = libregions.la +libregions_la_SOURCES = \ + regions.c \ + regions.h \ + $(NULL) + +libregions_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/common/include \ + -I$(top_srcdir)/common/utils \ + $(NULL) + +libregions_la_CFLAGS = $(WARNINGS_CFLAGS) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common-rules.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign common/regions/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign common/regions/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; +$(top_srcdir)/common-rules.mk $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libregions.la: $(libregions_la_OBJECTS) $(libregions_la_DEPENDENCIES) $(EXTRA_libregions_la_DEPENDENCIES) + $(AM_V_CCLD)$(libregions_la_LINK) $(libregions_la_OBJECTS) $(libregions_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libregions_la-regions.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libregions_la-regions.lo: regions.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libregions_la_CPPFLAGS) $(CPPFLAGS) $(libregions_la_CFLAGS) $(CFLAGS) -MT libregions_la-regions.lo -MD -MP -MF $(DEPDIR)/libregions_la-regions.Tpo -c -o libregions_la-regions.lo `test -f 'regions.c' || echo '$(srcdir)/'`regions.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libregions_la-regions.Tpo $(DEPDIR)/libregions_la-regions.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='regions.c' object='libregions_la-regions.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libregions_la_CPPFLAGS) $(CPPFLAGS) $(libregions_la_CFLAGS) $(CFLAGS) -c -o libregions_la-regions.lo `test -f 'regions.c' || echo '$(srcdir)/'`regions.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: 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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/libregions_la-regions.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/libregions_la-regions.Plo + -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: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am 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 tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# 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/common/regions/regions.c b/common/regions/regions.c new file mode 100644 index 0000000..2eb0ad6 --- /dev/null +++ b/common/regions/regions.c @@ -0,0 +1,191 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include +#include + +#include + +#include "isaligned.h" +#include "regions.h" + +void +init_regions (regions *rs) +{ + *rs = (regions) empty_vector; +} + +void +free_regions (struct regions *rs) +{ + /* We don't need to free the data since that is not owned by the + * regions structure. + */ + free (rs->ptr); +} + +/* Find the region corresponding to the given offset. Use region->end + * to find the end of the region. + */ +static int +compare_offset (const void *offsetp, const struct region *region) +{ + const uint64_t offset = *(uint64_t *)offsetp; + + if (offset < region->start) return -1; + if (offset > region->end) return 1; + return 0; +} + +const struct region * +find_region (const regions *rs, uint64_t offset) +{ + return regions_search (rs, &offset, compare_offset); +} + +/* This is the low level function for constructing the list of + * regions. It appends one region to the list, checking that the + * invariants described above (about the regions being non-overlapping + * and contiguous) is maintained. Note it is not possible to + * construct regions out of order using this function. + */ +static int __attribute__ ((__nonnull__ (1))) +append_one_region (regions *rs, struct region region) +{ + /* The assertions in this function are meant to maintain the + * invariant about the array as described at the top of this file. + */ + assert (region.start == virtual_size (rs)); + assert (region.len > 0); + assert (region.end >= region.start); + assert (region.len == region.end - region.start + 1); + + if (regions_append (rs, region) == -1) { + nbdkit_error ("realloc: %m"); + return -1; + } + + return 0; +} + +static int +append_padding (regions *rs, uint64_t alignment) +{ + struct region region; + + assert (is_power_of_2 (alignment)); + + region.start = virtual_size (rs); + if (IS_ALIGNED (region.start, alignment)) + return 0; /* nothing to do */ + region.end = (region.start & ~(alignment-1)) + alignment - 1; + region.len = region.end - region.start + 1; + region.type = region_zero; + region.description = "padding"; + return append_one_region (rs, region); +} + +int +append_region_va (regions *rs, + const char *description, uint64_t len, + uint64_t pre_aligment, uint64_t post_alignment, + enum region_type type, va_list ap) +{ + struct region region; + + /* Pre-alignment. */ + if (pre_aligment != 0) { + if (append_padding (rs, pre_aligment) == -1) + return -1; + assert (IS_ALIGNED (virtual_size (rs), pre_aligment)); + } + + /* Main region. */ + region.description = description; + region.start = virtual_size (rs); + region.len = len; + region.end = region.start + region.len - 1; + region.type = type; + if (type == region_file) + region.u.i = va_arg (ap, size_t); + else if (type == region_data) + region.u.data = va_arg (ap, const unsigned char *); + if (append_one_region (rs, region) == -1) + return -1; + + /* Post-alignment. */ + if (post_alignment != 0) { + if (append_padding (rs, post_alignment) == -1) + return -1; + assert (IS_ALIGNED (virtual_size (rs), post_alignment)); + } + + return 0; +} + +int +append_region_len (regions *rs, + const char *description, uint64_t len, + uint64_t pre_aligment, uint64_t post_alignment, + enum region_type type, ...) +{ + va_list ap; + int r; + + va_start (ap, type); + r = append_region_va (rs, description, len, + pre_aligment, post_alignment, type, ap); + va_end (ap); + return r; +} + +int +append_region_end (regions *rs, + const char *description, uint64_t end, + uint64_t pre_aligment, uint64_t post_alignment, + enum region_type type, ...) +{ + va_list ap; + int r; + uint64_t len; + + va_start (ap, type); + len = end - virtual_size (rs) + 1; + r = append_region_va (rs, description, len, + pre_aligment, post_alignment, type, ap); + va_end (ap); + return r; +} diff --git a/common/regions/regions.h b/common/regions/regions.h new file mode 100644 index 0000000..141565c --- /dev/null +++ b/common/regions/regions.h @@ -0,0 +1,135 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_REGIONS_H +#define NBDKIT_REGIONS_H + +#include +#include +#include + +#include "vector.h" + +/* This defines a very simple structure used to define the virtual + * disk in the partitioning and floppy plugins. + * + * We split the virtual disk into non-overlapping, contiguous regions. + * These are stored in an array, ordered by address. + * + * Each region can be one of several types, referring to a backing + * file, some data stored in memory, or zero padding. + */ + +/* Region type. */ +enum region_type { + region_file, /* contents of the i'th file */ + region_data, /* pointer to in-memory data */ + region_zero, /* padding */ +}; + +/* Region. */ +struct region { + uint64_t start, len, end; /* byte offsets; end = start + len - 1 */ + enum region_type type; + union { + size_t i; /* region_file: i'th file */ + const unsigned char *data; /* region_data: data */ + } u; + + /* Optional name or description of this region. This is not used by + * the regions code but can be added to regions to make debugging + * easier. + */ + const char *description; +}; + +/* Vector of struct region. */ +DEFINE_VECTOR_TYPE (regions, struct region); + +extern void init_regions (regions *regions) + __attribute__ ((__nonnull__ (1))); +extern void free_regions (regions *regions) + __attribute__ ((__nonnull__ (1))); + +/* Return the number of regions. */ +static inline size_t __attribute__ ((__nonnull__ (1))) +nr_regions (regions *rs) +{ + return rs->len; +} + +/* Return the virtual size of the disk. */ +static inline int64_t __attribute__ ((__nonnull__ (1))) +virtual_size (regions *rs) +{ + if (rs->len == 0) + return 0; + else + return rs->ptr[rs->len-1].end + 1; +} + +/* Look up the region corresponding to the given offset. If the + * offset is inside the disk image then this cannot return NULL. + */ +extern const struct region *find_region (const regions *regions, + uint64_t offset) + __attribute__ ((__nonnull__ (1))); + +/* Append one region of a given length, plus up to two optional + * padding regions. + * + * pre_aligment (if != 0) describes the required alignment of this + * region. A padding region of type region_zero is inserted before + * the main region if required. + * + * post_alignment (if != 0) describes the required alignment after + * this region. A padding region of type region_zero is inserted + * after the main region if required. + * + * If type == region_file, it must be followed by u.i parameter. + * If type == region_data, it must be followed by u.data parameter. + */ +extern int append_region_len (regions *regions, + const char *description, uint64_t len, + uint64_t pre_aligment, uint64_t post_alignment, + enum region_type type, ...); + +/* Same as append_region_len (above) but instead of specifying the + * size of the main region, specify the end byte as an offset. Note + * the end byte is included in the region, it's is NOT the end+1 byte. + */ +extern int append_region_end (regions *regions, + const char *description, uint64_t end, + uint64_t pre_aligment, uint64_t post_alignment, + enum region_type type, ...); + +#endif /* NBDKIT_REGIONS_H */ diff --git a/common/replacements/Makefile.am b/common/replacements/Makefile.am new file mode 100644 index 0000000..5531d6e --- /dev/null +++ b/common/replacements/Makefile.am @@ -0,0 +1,88 @@ +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 $(top_srcdir)/common-rules.mk + +SUBDIRS = win32 + +AM_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/common/include \ + -I$(top_builddir)/include \ + $(NULL) + +noinst_LTLIBRARIES = libcompat.la +# sources should be empty +libcompat_la_SOURCES = +libcompat_la_LIBADD = $(LTLIBOBJS) + +EXTRA_DIST = \ + fdatasync.c \ + fdatasync.h \ + fsync.c \ + fsync.h \ + get_current_dir_name.c \ + get_current_dir_name.h \ + getdelim.c \ + getline.c \ + getline.h \ + openlog.c \ + open_memstream.c \ + open_memstream.h \ + poll.c \ + poll.h \ + posix_memalign.c \ + posix_memalign.h \ + pread.c \ + pread.h \ + pwrite.c \ + pwrite.h \ + realpath.c \ + realpath.h \ + strndup.c \ + strndup.h \ + sysconf.c \ + sysconf.h \ + syslog.c \ + syslog.h \ + vsyslog.c + +TESTS = \ + test-current-dir-name +check_PROGRAMS = $(TESTS) + +test_current_dir_name_SOURCES = \ + test-current-dir-name.c \ + get_current_dir_name.c \ + get_current_dir_name.h \ + $(NULL) +test_current_dir_name_CPPFLAGS = -I$(srcdir) +test_current_dir_name_CFLAGS = $(WARNINGS_CFLAGS) diff --git a/common/replacements/Makefile.in b/common/replacements/Makefile.in new file mode 100644 index 0000000..f004206 --- /dev/null +++ b/common/replacements/Makefile.in @@ -0,0 +1,1437 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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@ +TESTS = test-current-dir-name$(EXEEXT) +check_PROGRAMS = $(am__EXEEXT_1) +subdir = common/replacements +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ocaml.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__EXEEXT_1 = test-current-dir-name$(EXEEXT) +LTLIBRARIES = $(noinst_LTLIBRARIES) +libcompat_la_DEPENDENCIES = $(LTLIBOBJS) +am_libcompat_la_OBJECTS = +libcompat_la_OBJECTS = $(am_libcompat_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +am__objects_1 = +am_test_current_dir_name_OBJECTS = \ + test_current_dir_name-test-current-dir-name.$(OBJEXT) \ + test_current_dir_name-get_current_dir_name.$(OBJEXT) \ + $(am__objects_1) +test_current_dir_name_OBJECTS = $(am_test_current_dir_name_OBJECTS) +test_current_dir_name_LDADD = $(LDADD) +test_current_dir_name_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_current_dir_name_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = $(DEPDIR)/fdatasync.Plo $(DEPDIR)/fsync.Plo \ + $(DEPDIR)/get_current_dir_name.Plo $(DEPDIR)/getdelim.Plo \ + $(DEPDIR)/getline.Plo $(DEPDIR)/open_memstream.Plo \ + $(DEPDIR)/openlog.Plo $(DEPDIR)/poll.Plo \ + $(DEPDIR)/posix_memalign.Plo $(DEPDIR)/pread.Plo \ + $(DEPDIR)/pwrite.Plo $(DEPDIR)/realpath.Plo \ + $(DEPDIR)/strndup.Plo $(DEPDIR)/sysconf.Plo \ + $(DEPDIR)/syslog.Plo $(DEPDIR)/vsyslog.Plo \ + ./$(DEPDIR)/test_current_dir_name-get_current_dir_name.Po \ + ./$(DEPDIR)/test_current_dir_name-test-current-dir-name.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libcompat_la_SOURCES) $(test_current_dir_name_SOURCES) +DIST_SOURCES = $(libcompat_la_SOURCES) \ + $(test_current_dir_name_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + check recheck distdir distdir-am +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = { \ + $(am__tty_colors_dummy); \ + if test "X$(AM_COLOR_TESTS)" = Xno; then \ + am__color_tests=no; \ + elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ + am__color_tests=yes; \ + elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ + am__color_tests=yes; \ + fi; \ + if test $$am__color_tests = yes; then \ + red=''; \ + grn=''; \ + lgn=''; \ + blu=''; \ + mgn=''; \ + brg=''; \ + std=''; \ + fi; \ +} +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 = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__recheck_rx = ^[ ]*:recheck:[ ]* +am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* +am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* +# A command that, given a newline-separated list of test names on the +# standard input, print the name of the tests that are to be re-run +# upon "make recheck". +am__list_recheck_tests = $(AWK) '{ \ + recheck = 1; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + { \ + if ((getline line2 < ($$0 ".log")) < 0) \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ + { \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ + { \ + break; \ + } \ + }; \ + if (recheck) \ + print $$0; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# A command that, given a newline-separated list of test names on the +# standard input, create the global log from their .trs and .log files. +am__create_global_log = $(AWK) ' \ +function fatal(msg) \ +{ \ + print "fatal: making $@: " msg | "cat >&2"; \ + exit 1; \ +} \ +function rst_section(header) \ +{ \ + print header; \ + len = length(header); \ + for (i = 1; i <= len; i = i + 1) \ + printf "="; \ + printf "\n\n"; \ +} \ +{ \ + copy_in_global_log = 1; \ + global_test_result = "RUN"; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".trs"); \ + if (line ~ /$(am__global_test_result_rx)/) \ + { \ + sub("$(am__global_test_result_rx)", "", line); \ + sub("[ ]*$$", "", line); \ + global_test_result = line; \ + } \ + else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ + copy_in_global_log = 0; \ + }; \ + if (copy_in_global_log) \ + { \ + rst_section(global_test_result ": " $$0); \ + while ((rc = (getline line < ($$0 ".log"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".log"); \ + print line; \ + }; \ + printf "\n"; \ + }; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# Restructured Text title. +am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } +# Solaris 10 'make', and several other traditional 'make' implementations, +# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it +# by disabling -e (using the XSI extension "set +e") if it's set. +am__sh_e_setup = case $$- in *e*) set +e;; esac +# Default flags passed to test drivers. +am__common_driver_flags = \ + --color-tests "$$am__color_tests" \ + --enable-hard-errors "$$am__enable_hard_errors" \ + --expect-failure "$$am__expect_failure" +# To be inserted before the command running the test. Creates the +# directory for the log if needed. Stores in $dir the directory +# containing $f, in $tst the test, in $log the log. Executes the +# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and +# passes TESTS_ENVIRONMENT. Set up options for the wrapper that +# will run the test scripts (or their associated LOG_COMPILER, if +# thy have one). +am__check_pre = \ +$(am__sh_e_setup); \ +$(am__vpath_adj_setup) $(am__vpath_adj) \ +$(am__tty_colors); \ +srcdir=$(srcdir); export srcdir; \ +case "$@" in \ + */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ + *) am__odir=.;; \ +esac; \ +test "x$$am__odir" = x"." || test -d "$$am__odir" \ + || $(MKDIR_P) "$$am__odir" || exit $$?; \ +if test -f "./$$f"; then dir=./; \ +elif test -f "$$f"; then dir=; \ +else dir="$(srcdir)/"; fi; \ +tst=$$dir$$f; log='$@'; \ +if test -n '$(DISABLE_HARD_ERRORS)'; then \ + am__enable_hard_errors=no; \ +else \ + am__enable_hard_errors=yes; \ +fi; \ +case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ + am__expect_failure=yes;; \ + *) \ + am__expect_failure=no;; \ +esac; \ +$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) +# A shell command to get the names of the tests scripts with any registered +# extension removed (i.e., equivalently, the names of the test logs, with +# the '.log' extension removed). The result is saved in the shell variable +# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, +# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", +# since that might cause problem with VPATH rewrites for suffix-less tests. +# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. +am__set_TESTS_bases = \ + bases='$(TEST_LOGS)'; \ + bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ + bases=`echo $$bases` +AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)' +RECHECK_LOGS = $(TEST_LOGS) +TEST_SUITE_LOG = test-suite.log +TEST_EXTENSIONS = @EXEEXT@ .test +LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) +am__set_b = \ + case '$@' in \ + */*) \ + case '$*' in \ + */*) b='$*';; \ + *) b=`echo '$@' | sed 's/\.log$$//'`; \ + esac;; \ + *) \ + b='$*';; \ + esac +am__test_logs1 = $(TESTS:=.log) +am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) +TEST_LOGS = $(am__test_logs2:.test.log=.log) +TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ + $(TEST_LOG_FLAGS) +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/common-rules.mk \ + $(top_srcdir)/depcomp $(top_srcdir)/test-driver fdatasync.c \ + fsync.c get_current_dir_name.c getdelim.c getline.c \ + open_memstream.c openlog.c poll.c posix_memalign.c pread.c \ + pwrite.c realpath.c strndup.c sysconf.c syslog.c vsyslog.c +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ +BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ +CARGO = @CARGO@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_PLUGIN_CC = @CC_PLUGIN_CC@ +CC_PLUGIN_CFLAGS = @CC_PLUGIN_CFLAGS@ +CERTTOOL = @CERTTOOL@ +CFLAGS = @CFLAGS@ +COM_ERR_CFLAGS = @COM_ERR_CFLAGS@ +COM_ERR_LIBS = @COM_ERR_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CUT = @CUT@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LDFLAGS = @DL_LDFLAGS@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXT2FS_CFLAGS = @EXT2FS_CFLAGS@ +EXT2FS_LIBS = @EXT2FS_LIBS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GENISOIMAGE = @GENISOIMAGE@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GOARCH = @GOARCH@ +GOLANG = @GOLANG@ +GOOS = @GOOS@ +GOROOT = @GOROOT@ +GREP = @GREP@ +IMPORT_LIBRARY_ON_WINDOWS = @IMPORT_LIBRARY_ON_WINDOWS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +ISOPROG = @ISOPROG@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBLKIO_CFLAGS = @LIBBLKIO_CFLAGS@ +LIBBLKIO_LIBS = @LIBBLKIO_LIBS@ +LIBGUESTFS_CFLAGS = @LIBGUESTFS_CFLAGS@ +LIBGUESTFS_LIBS = @LIBGUESTFS_LIBS@ +LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ +LIBLZMA_LIBS = @LIBLZMA_LIBS@ +LIBNBD_CFLAGS = @LIBNBD_CFLAGS@ +LIBNBD_LIBS = @LIBNBD_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSELINUX_CFLAGS = @LIBSELINUX_CFLAGS@ +LIBSELINUX_LIBS = @LIBSELINUX_LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTORRENT_CFLAGS = @LIBTORRENT_CFLAGS@ +LIBTORRENT_LIBS = @LIBTORRENT_LIBS@ +LIBVIRT_CFLAGS = @LIBVIRT_CFLAGS@ +LIBVIRT_LIBS = @LIBVIRT_LIBS@ +LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ +LIBZSTD_LIBS = @LIBZSTD_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LUA_CFLAGS = @LUA_CFLAGS@ +LUA_LIBS = @LUA_LIBS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MC = @MC@ +MKDIR_P = @MKDIR_P@ +MKISOFS = @MKISOFS@ +NBDKIT_VERSION_MAJOR = @NBDKIT_VERSION_MAJOR@ +NBDKIT_VERSION_MICRO = @NBDKIT_VERSION_MICRO@ +NBDKIT_VERSION_MINOR = @NBDKIT_VERSION_MINOR@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_ON_WINDOWS = @NO_UNDEFINED_ON_WINDOWS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OCAML = @OCAML@ +OCAMLBEST = @OCAMLBEST@ +OCAMLBUILD = @OCAMLBUILD@ +OCAMLC = @OCAMLC@ +OCAMLCDOTOPT = @OCAMLCDOTOPT@ +OCAMLDEP = @OCAMLDEP@ +OCAMLDOC = @OCAMLDOC@ +OCAMLLIB = @OCAMLLIB@ +OCAMLMKLIB = @OCAMLMKLIB@ +OCAMLMKTOP = @OCAMLMKTOP@ +OCAMLOPT = @OCAMLOPT@ +OCAMLOPTDOTOPT = @OCAMLOPTDOTOPT@ +OCAMLOPTFLAGS = @OCAMLOPTFLAGS@ +OCAMLVERSION = @OCAMLVERSION@ +OCAML_MAJOR = @OCAML_MAJOR@ +OCAML_PLUGIN_LIBRARIES = @OCAML_PLUGIN_LIBRARIES@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PERL_ARCHLIB = @PERL_ARCHLIB@ +PERL_CFLAGS = @PERL_CFLAGS@ +PERL_LDOPTS = @PERL_LDOPTS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PODWRAPPER = @PODWRAPPER@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_CXX = @PTHREAD_CXX@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CFLAGS = @PYTHON_CFLAGS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +RUBY_CFLAGS = @RUBY_CFLAGS@ +RUBY_LIBS = @RUBY_LIBS@ +RUSTC = @RUSTC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOEXT = @SOEXT@ +SSH_CFLAGS = @SSH_CFLAGS@ +SSH_LIBS = @SSH_LIBS@ +STAT = @STAT@ +STRIP = @STRIP@ +TCL_CFLAGS = @TCL_CFLAGS@ +TCL_LIBS = @TCL_LIBS@ +TRUNCATE = @TRUNCATE@ +VALGRIND = @VALGRIND@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VERSION = @VERSION@ +WARNINGS_CFLAGS = @WARNINGS_CFLAGS@ +XORRISO = @XORRISO@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +ZLIB_NG_CFLAGS = @ZLIB_NG_CFLAGS@ +ZLIB_NG_LIBS = @ZLIB_NG_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DLLTOOL = @ac_ct_DLLTOOL@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_MC = @ac_ct_MC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bashcompdir = @bashcompdir@ +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@ +filters = @filters@ +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@ +lang_plugins = @lang_plugins@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +non_lang_plugins = @non_lang_plugins@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugins = @plugins@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +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@ + +# Convenient list terminator +NULL = +plugindir = $(libdir)/nbdkit/plugins +filterdir = $(libdir)/nbdkit/filters +CLEANFILES = *~ *.cmi *.cmx *.cmxa *.so *.dll +SUBDIRS = win32 +AM_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/common/include \ + -I$(top_builddir)/include \ + $(NULL) + +noinst_LTLIBRARIES = libcompat.la +# sources should be empty +libcompat_la_SOURCES = +libcompat_la_LIBADD = $(LTLIBOBJS) +EXTRA_DIST = \ + fdatasync.c \ + fdatasync.h \ + fsync.c \ + fsync.h \ + get_current_dir_name.c \ + get_current_dir_name.h \ + getdelim.c \ + getline.c \ + getline.h \ + openlog.c \ + open_memstream.c \ + open_memstream.h \ + poll.c \ + poll.h \ + posix_memalign.c \ + posix_memalign.h \ + pread.c \ + pread.h \ + pwrite.c \ + pwrite.h \ + realpath.c \ + realpath.h \ + strndup.c \ + strndup.h \ + sysconf.c \ + sysconf.h \ + syslog.c \ + syslog.h \ + vsyslog.c + +test_current_dir_name_SOURCES = \ + test-current-dir-name.c \ + get_current_dir_name.c \ + get_current_dir_name.h \ + $(NULL) + +test_current_dir_name_CPPFLAGS = -I$(srcdir) +test_current_dir_name_CFLAGS = $(WARNINGS_CFLAGS) +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common-rules.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign common/replacements/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign common/replacements/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; +$(top_srcdir)/common-rules.mk $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libcompat.la: $(libcompat_la_OBJECTS) $(libcompat_la_DEPENDENCIES) $(EXTRA_libcompat_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libcompat_la_OBJECTS) $(libcompat_la_LIBADD) $(LIBS) + +test-current-dir-name$(EXEEXT): $(test_current_dir_name_OBJECTS) $(test_current_dir_name_DEPENDENCIES) $(EXTRA_test_current_dir_name_DEPENDENCIES) + @rm -f test-current-dir-name$(EXEEXT) + $(AM_V_CCLD)$(test_current_dir_name_LINK) $(test_current_dir_name_OBJECTS) $(test_current_dir_name_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/fdatasync.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/fsync.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/get_current_dir_name.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getdelim.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getline.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/open_memstream.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/openlog.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/poll.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/posix_memalign.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pread.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pwrite.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/realpath.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strndup.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/sysconf.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/syslog.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/vsyslog.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_current_dir_name-get_current_dir_name.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_current_dir_name-test-current-dir-name.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +test_current_dir_name-test-current-dir-name.o: test-current-dir-name.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_current_dir_name_CPPFLAGS) $(CPPFLAGS) $(test_current_dir_name_CFLAGS) $(CFLAGS) -MT test_current_dir_name-test-current-dir-name.o -MD -MP -MF $(DEPDIR)/test_current_dir_name-test-current-dir-name.Tpo -c -o test_current_dir_name-test-current-dir-name.o `test -f 'test-current-dir-name.c' || echo '$(srcdir)/'`test-current-dir-name.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_current_dir_name-test-current-dir-name.Tpo $(DEPDIR)/test_current_dir_name-test-current-dir-name.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-current-dir-name.c' object='test_current_dir_name-test-current-dir-name.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_current_dir_name_CPPFLAGS) $(CPPFLAGS) $(test_current_dir_name_CFLAGS) $(CFLAGS) -c -o test_current_dir_name-test-current-dir-name.o `test -f 'test-current-dir-name.c' || echo '$(srcdir)/'`test-current-dir-name.c + +test_current_dir_name-test-current-dir-name.obj: test-current-dir-name.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_current_dir_name_CPPFLAGS) $(CPPFLAGS) $(test_current_dir_name_CFLAGS) $(CFLAGS) -MT test_current_dir_name-test-current-dir-name.obj -MD -MP -MF $(DEPDIR)/test_current_dir_name-test-current-dir-name.Tpo -c -o test_current_dir_name-test-current-dir-name.obj `if test -f 'test-current-dir-name.c'; then $(CYGPATH_W) 'test-current-dir-name.c'; else $(CYGPATH_W) '$(srcdir)/test-current-dir-name.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_current_dir_name-test-current-dir-name.Tpo $(DEPDIR)/test_current_dir_name-test-current-dir-name.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-current-dir-name.c' object='test_current_dir_name-test-current-dir-name.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_current_dir_name_CPPFLAGS) $(CPPFLAGS) $(test_current_dir_name_CFLAGS) $(CFLAGS) -c -o test_current_dir_name-test-current-dir-name.obj `if test -f 'test-current-dir-name.c'; then $(CYGPATH_W) 'test-current-dir-name.c'; else $(CYGPATH_W) '$(srcdir)/test-current-dir-name.c'; fi` + +test_current_dir_name-get_current_dir_name.o: get_current_dir_name.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_current_dir_name_CPPFLAGS) $(CPPFLAGS) $(test_current_dir_name_CFLAGS) $(CFLAGS) -MT test_current_dir_name-get_current_dir_name.o -MD -MP -MF $(DEPDIR)/test_current_dir_name-get_current_dir_name.Tpo -c -o test_current_dir_name-get_current_dir_name.o `test -f 'get_current_dir_name.c' || echo '$(srcdir)/'`get_current_dir_name.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_current_dir_name-get_current_dir_name.Tpo $(DEPDIR)/test_current_dir_name-get_current_dir_name.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='get_current_dir_name.c' object='test_current_dir_name-get_current_dir_name.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_current_dir_name_CPPFLAGS) $(CPPFLAGS) $(test_current_dir_name_CFLAGS) $(CFLAGS) -c -o test_current_dir_name-get_current_dir_name.o `test -f 'get_current_dir_name.c' || echo '$(srcdir)/'`get_current_dir_name.c + +test_current_dir_name-get_current_dir_name.obj: get_current_dir_name.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_current_dir_name_CPPFLAGS) $(CPPFLAGS) $(test_current_dir_name_CFLAGS) $(CFLAGS) -MT test_current_dir_name-get_current_dir_name.obj -MD -MP -MF $(DEPDIR)/test_current_dir_name-get_current_dir_name.Tpo -c -o test_current_dir_name-get_current_dir_name.obj `if test -f 'get_current_dir_name.c'; then $(CYGPATH_W) 'get_current_dir_name.c'; else $(CYGPATH_W) '$(srcdir)/get_current_dir_name.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_current_dir_name-get_current_dir_name.Tpo $(DEPDIR)/test_current_dir_name-get_current_dir_name.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='get_current_dir_name.c' object='test_current_dir_name-get_current_dir_name.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_current_dir_name_CPPFLAGS) $(CPPFLAGS) $(test_current_dir_name_CFLAGS) $(CFLAGS) -c -o test_current_dir_name-get_current_dir_name.obj `if test -f 'get_current_dir_name.c'; then $(CYGPATH_W) 'get_current_dir_name.c'; else $(CYGPATH_W) '$(srcdir)/get_current_dir_name.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +# Recover from deleted '.trs' file; this should ensure that +# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create +# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells +# to avoid problems with "make -n". +.log.trs: + rm -f $< $@ + $(MAKE) $(AM_MAKEFLAGS) $< + +# Leading 'am--fnord' is there to ensure the list of targets does not +# expand to empty, as could happen e.g. with make check TESTS=''. +am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) +am--force-recheck: + @: + +$(TEST_SUITE_LOG): $(TEST_LOGS) + @$(am__set_TESTS_bases); \ + am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ + redo_bases=`for i in $$bases; do \ + am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ + done`; \ + if test -n "$$redo_bases"; then \ + redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ + redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ + if $(am__make_dryrun); then :; else \ + rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ + fi; \ + fi; \ + if test -n "$$am__remaking_logs"; then \ + echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ + "recursion detected" >&2; \ + elif test -n "$$redo_logs"; then \ + am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ + fi; \ + if $(am__make_dryrun); then :; else \ + st=0; \ + errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ + for i in $$redo_bases; do \ + test -f $$i.trs && test -r $$i.trs \ + || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ + test -f $$i.log && test -r $$i.log \ + || { echo "$$errmsg $$i.log" >&2; st=1; }; \ + done; \ + test $$st -eq 0 || exit 1; \ + fi + @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ + ws='[ ]'; \ + results=`for b in $$bases; do echo $$b.trs; done`; \ + test -n "$$results" || results=/dev/null; \ + all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ + pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ + fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ + skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ + xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ + xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ + error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ + if test `expr $$fail + $$xpass + $$error` -eq 0; then \ + success=true; \ + else \ + success=false; \ + fi; \ + br='==================='; br=$$br$$br$$br$$br; \ + result_count () \ + { \ + if test x"$$1" = x"--maybe-color"; then \ + maybe_colorize=yes; \ + elif test x"$$1" = x"--no-color"; then \ + maybe_colorize=no; \ + else \ + echo "$@: invalid 'result_count' usage" >&2; exit 4; \ + fi; \ + shift; \ + desc=$$1 count=$$2; \ + if test $$maybe_colorize = yes && test $$count -gt 0; then \ + color_start=$$3 color_end=$$std; \ + else \ + color_start= color_end=; \ + fi; \ + echo "$${color_start}# $$desc $$count$${color_end}"; \ + }; \ + create_testsuite_report () \ + { \ + result_count $$1 "TOTAL:" $$all "$$brg"; \ + result_count $$1 "PASS: " $$pass "$$grn"; \ + result_count $$1 "SKIP: " $$skip "$$blu"; \ + result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ + result_count $$1 "FAIL: " $$fail "$$red"; \ + result_count $$1 "XPASS:" $$xpass "$$red"; \ + result_count $$1 "ERROR:" $$error "$$mgn"; \ + }; \ + { \ + echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ + $(am__rst_title); \ + create_testsuite_report --no-color; \ + echo; \ + echo ".. contents:: :depth: 2"; \ + echo; \ + for b in $$bases; do echo $$b; done \ + | $(am__create_global_log); \ + } >$(TEST_SUITE_LOG).tmp || exit 1; \ + mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ + if $$success; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ + fi; \ + echo "$${col}$$br$${std}"; \ + echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \ + echo "$${col}$$br$${std}"; \ + create_testsuite_report --maybe-color; \ + echo "$$col$$br$$std"; \ + if $$success; then :; else \ + echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ + if test -n "$(PACKAGE_BUGREPORT)"; then \ + echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ + fi; \ + echo "$$col$$br$$std"; \ + fi; \ + $$success || exit 1 + +check-TESTS: $(check_PROGRAMS) + @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list + @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + trs_list=`for i in $$bases; do echo $$i.trs; done`; \ + log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ + exit $$?; +recheck: all $(check_PROGRAMS) + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + bases=`for i in $$bases; do echo $$i; done \ + | $(am__list_recheck_tests)` || exit 1; \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + log_list=`echo $$log_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ + am__force_recheck=am--force-recheck \ + TEST_LOGS="$$log_list"; \ + exit $$? +test-current-dir-name.log: test-current-dir-name$(EXEEXT) + @p='test-current-dir-name$(EXEEXT)'; \ + b='test-current-dir-name'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +.test.log: + @p='$<'; \ + $(am__set_b); \ + $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +@am__EXEEXT_TRUE@.test$(EXEEXT).log: +@am__EXEEXT_TRUE@ @p='$<'; \ +@am__EXEEXT_TRUE@ $(am__set_b); \ +@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ +@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ +@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ +@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-recursive +all-am: Makefile $(LTLIBRARIES) +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) + -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) + -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ + clean-noinstLTLIBRARIES mostlyclean-am + +distclean: distclean-recursive + -rm -f $(DEPDIR)/fdatasync.Plo + -rm -f $(DEPDIR)/fsync.Plo + -rm -f $(DEPDIR)/get_current_dir_name.Plo + -rm -f $(DEPDIR)/getdelim.Plo + -rm -f $(DEPDIR)/getline.Plo + -rm -f $(DEPDIR)/open_memstream.Plo + -rm -f $(DEPDIR)/openlog.Plo + -rm -f $(DEPDIR)/poll.Plo + -rm -f $(DEPDIR)/posix_memalign.Plo + -rm -f $(DEPDIR)/pread.Plo + -rm -f $(DEPDIR)/pwrite.Plo + -rm -f $(DEPDIR)/realpath.Plo + -rm -f $(DEPDIR)/strndup.Plo + -rm -f $(DEPDIR)/sysconf.Plo + -rm -f $(DEPDIR)/syslog.Plo + -rm -f $(DEPDIR)/vsyslog.Plo + -rm -f ./$(DEPDIR)/test_current_dir_name-get_current_dir_name.Po + -rm -f ./$(DEPDIR)/test_current_dir_name-test-current-dir-name.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(DEPDIR)/fdatasync.Plo + -rm -f $(DEPDIR)/fsync.Plo + -rm -f $(DEPDIR)/get_current_dir_name.Plo + -rm -f $(DEPDIR)/getdelim.Plo + -rm -f $(DEPDIR)/getline.Plo + -rm -f $(DEPDIR)/open_memstream.Plo + -rm -f $(DEPDIR)/openlog.Plo + -rm -f $(DEPDIR)/poll.Plo + -rm -f $(DEPDIR)/posix_memalign.Plo + -rm -f $(DEPDIR)/pread.Plo + -rm -f $(DEPDIR)/pwrite.Plo + -rm -f $(DEPDIR)/realpath.Plo + -rm -f $(DEPDIR)/strndup.Plo + -rm -f $(DEPDIR)/sysconf.Plo + -rm -f $(DEPDIR)/syslog.Plo + -rm -f $(DEPDIR)/vsyslog.Plo + -rm -f ./$(DEPDIR)/test_current_dir_name-get_current_dir_name.Po + -rm -f ./$(DEPDIR)/test_current_dir_name-test-current-dir-name.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) check-am install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--depfiles check check-TESTS check-am clean \ + clean-checkPROGRAMS clean-generic clean-libtool \ + clean-noinstLTLIBRARIES cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am recheck tags tags-am \ + uninstall uninstall-am + +.PRECIOUS: Makefile + + +# 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/common/replacements/fdatasync.c b/common/replacements/fdatasync.c new file mode 100644 index 0000000..17e46b7 --- /dev/null +++ b/common/replacements/fdatasync.c @@ -0,0 +1,51 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +/* Replacement for fdatasync for platforms which lack this function. */ + +#include + +#include +#include + +#ifndef HAVE_FDATASYNC + +#include "fsync.h" +#include "fdatasync.h" + +int +fdatasync (int fd) +{ + return fsync (fd); +} + +#endif /* !HAVE_FDATASYNC */ diff --git a/common/replacements/fdatasync.h b/common/replacements/fdatasync.h new file mode 100644 index 0000000..e3ee265 --- /dev/null +++ b/common/replacements/fdatasync.h @@ -0,0 +1,44 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_FDATASYNC_H +#define NBDKIT_FDATASYNC_H + +#include + +#include + +#ifndef HAVE_FDATASYNC +extern int fdatasync (int fd); +#endif + +#endif /* NBDKIT_FDATASYNC_H */ diff --git a/common/replacements/fsync.c b/common/replacements/fsync.c new file mode 100644 index 0000000..1328008 --- /dev/null +++ b/common/replacements/fsync.c @@ -0,0 +1,76 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +/* Replacement for fsync for platforms which lack this function. */ + +#include + +#include +#include +#include + +#ifndef HAVE_FSYNC + +#include "fsync.h" + +#ifdef WIN32 + +/* Replacement fsync for Win32. */ + +#include "nbdkit-plugin.h" +#include + +int +fsync (int fd) +{ + HANDLE h; + + h = (HANDLE) _get_osfhandle (fd); + if (h == INVALID_HANDLE_VALUE) { + nbdkit_debug ("ReadFile: bad handle"); + errno = EIO; + return -1; + } + + if (!FlushFileBuffers (h)) { + nbdkit_debug ("FlushFileBuffers: error %d", GetLastError ()); + errno = EIO; + return -1; + } + return 0; +} + +#else /* !WIN32 */ +#error "no replacement fsync is available on this platform" +#endif + +#endif /* !HAVE_FSYNC */ diff --git a/common/replacements/fsync.h b/common/replacements/fsync.h new file mode 100644 index 0000000..5442bd7 --- /dev/null +++ b/common/replacements/fsync.h @@ -0,0 +1,44 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_FSYNC_H +#define NBDKIT_FSYNC_H + +#include + +#include + +#ifndef HAVE_FSYNC +extern int fsync (int fd); +#endif + +#endif /* NBDKIT_FSYNC_H */ diff --git a/common/replacements/get_current_dir_name.c b/common/replacements/get_current_dir_name.c new file mode 100644 index 0000000..ed03383 --- /dev/null +++ b/common/replacements/get_current_dir_name.c @@ -0,0 +1,60 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +/* Implement get_current_dir_name(3) on platforms which don't have it. */ + +#include + +#ifndef HAVE_GET_CURRENT_DIR_NAME + +#include +#include +#include +#include + +#include "get_current_dir_name.h" + +char * +get_current_dir_name (void) +{ + char *ret; + + ret = malloc (PATH_MAX); + if (ret == NULL) + return NULL; + ret = getcwd (ret, PATH_MAX); + if (ret == NULL) + return NULL; + return realloc (ret, strlen (ret) + 1); +} + +#endif /* !HAVE_GET_CURRENT_DIR_NAME */ diff --git a/common/replacements/get_current_dir_name.h b/common/replacements/get_current_dir_name.h new file mode 100644 index 0000000..064f51b --- /dev/null +++ b/common/replacements/get_current_dir_name.h @@ -0,0 +1,48 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_GET_CURRENT_DIR_NAME_H +#define NBDKIT_GET_CURRENT_DIR_NAME_H + +#include + +#ifdef HAVE_GET_CURRENT_DIR_NAME + +#include + +#else + +extern char *get_current_dir_name (void); + +#endif + +#endif /* NBDKIT_GET_CURRENT_DIR_NAME_H */ diff --git a/common/replacements/getdelim.c b/common/replacements/getdelim.c new file mode 100644 index 0000000..97421cb --- /dev/null +++ b/common/replacements/getdelim.c @@ -0,0 +1,84 @@ +/* $NetBSD: getdelim.c,v 1.2 2015/12/25 20:12:46 joerg Exp $ */ +/* NetBSD-src: getline.c,v 1.2 2014/09/16 17:23:50 christos Exp */ + +/*- + * Copyright (c) 2011 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 + +#include +#include + +#ifndef HAVE_GETDELIM + +#include "getline.h" + +ssize_t +getdelim (char **buf, size_t *bufsiz, int delimiter, FILE *fp) +{ + char *ptr, *eptr; + + if (*buf == NULL || *bufsiz == 0) { + *bufsiz = BUFSIZ; + if ((*buf = malloc (*bufsiz)) == NULL) + return -1; + } + + for (ptr = *buf, eptr = *buf + *bufsiz;;) { + int c = fgetc (fp); + if (c == -1) { + if (feof (fp)) { + ssize_t diff = (ssize_t)(ptr - *buf); + if (diff != 0) { + *ptr = '\0'; + return diff; + } + } + return -1; + } + *ptr++ = c; + if (c == delimiter) { + *ptr = '\0'; + return ptr - *buf; + } + if (ptr + 2 >= eptr) { + char *nbuf; + size_t nbufsiz = *bufsiz * 2; + ssize_t d = ptr - *buf; + if ((nbuf = realloc (*buf, nbufsiz)) == NULL) + return -1; + *buf = nbuf; + *bufsiz = nbufsiz; + eptr = nbuf + nbufsiz; + ptr = nbuf + d; + } + } +} + +#endif diff --git a/common/replacements/getline.c b/common/replacements/getline.c new file mode 100644 index 0000000..e9caf49 --- /dev/null +++ b/common/replacements/getline.c @@ -0,0 +1,46 @@ +/* $NetBSD: getline.c,v 1.2 2015/12/25 20:12:46 joerg Exp $ */ +/* NetBSD-src: getline.c,v 1.2 2014/09/16 17:23:50 christos Exp */ + +/*- + * Copyright (c) 2011 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 +#include + +#ifndef HAVE_GETLINE + +#include "getline.h" + +ssize_t +getline (char **buf, size_t *bufsiz, FILE *fp) +{ + return getdelim (buf, bufsiz, '\n', fp); +} + +#endif diff --git a/common/replacements/getline.h b/common/replacements/getline.h new file mode 100644 index 0000000..8ee6f87 --- /dev/null +++ b/common/replacements/getline.h @@ -0,0 +1,48 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_GETLINE_H +#define NBDKIT_GETLINE_H + +#include + +#include +#include + +#ifndef HAVE_GETLINE + +ssize_t getline (char **lineptr, size_t *n, FILE *stream); +ssize_t getdelim (char **lineptr, size_t *n, int delim, FILE *stream); + +#endif + +#endif /* NBDKIT_GETLINE_H */ diff --git a/common/replacements/open_memstream.c b/common/replacements/open_memstream.c new file mode 100644 index 0000000..2185ef8 --- /dev/null +++ b/common/replacements/open_memstream.c @@ -0,0 +1,150 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +/* Replacement for open_memstream for platforms which lack this function. */ + +#include + +#include + +#include "open_memstream.h" + +#ifndef HAVE_OPEN_MEMSTREAM + +#ifdef WIN32 + +/* Replacement open_memstream for Win32. */ + +#include + +#include + +/* This is provided by common/utils which hasn't been compiled yet. + * Programs using this replacement will need to link to + * libutils.la. XXX + */ +#include "../utils/vector.h" +#include "../utils/nbdkit-string.h" + +/* Map FILE* that we return to the user buffer. */ +struct file_to_memstream { + FILE *fp; + char tmpname[MAX_PATH]; + char **ptr; + size_t *size; +}; +DEFINE_VECTOR_TYPE (file_vector, struct file_to_memstream); +static file_vector files = empty_vector; + +FILE * +open_memstream (char **ptr, size_t *size) +{ + struct file_to_memstream f2m; + char tmppath[MAX_PATH]; + DWORD ret; + FILE *fp; + + ret = GetTempPath (MAX_PATH, tmppath); + if (ret > MAX_PATH || ret == 0) + return NULL; + + ret = GetTempFileName (tmppath, TEXT ("nbdkit"), 0, f2m.tmpname); + if (!ret) + return NULL; + + fp = fopen (f2m.tmpname, "w+"); + if (fp == NULL) + return NULL; + + f2m.fp = fp; + f2m.ptr = ptr; + f2m.size = size; + if (file_vector_append (&files, f2m) == -1) { + fclose (fp); + return NULL; + } + + return fp; +} + +int +close_memstream (FILE *fp) +{ + size_t i; + int c, r; + string content = empty_vector; + struct file_to_memstream *f2m; + + for (i = 0; i < files.len; ++i) { + if (files.ptr[i].fp == fp) + break; + } + assert (i < files.len); + f2m = &files.ptr[i]; + + /* Read the file back into memory. */ + rewind (fp); + while ((c = getc (fp)) != EOF) { + if (string_append (&content, c) == -1) { + append_failed: + fclose (fp); + unlink (f2m->tmpname); + free (content.ptr); + file_vector_remove (&files, i); + return -1; + } + } + /* Make sure the buffer is \0-terminated but don't include this + * in the buffer size returned below. + */ + if (string_append (&content, 0) == -1) goto append_failed; + + r = fclose (fp); + unlink (f2m->tmpname); + if (r == EOF) { + free (content.ptr); + file_vector_remove (&files, i); + return -1; + } + + /* Pass the buffer to the user. User will free it. */ + *(files.ptr[i].ptr) = content.ptr; + *(files.ptr[i].size) = content.len - 1; + file_vector_remove (&files, i); + return 0; +} + +#else /* !WIN32 */ +#error "no replacement open_memstream is available on this platform" +#endif + +#endif /* !HAVE_OPEN_MEMSTREAM */ diff --git a/common/replacements/open_memstream.h b/common/replacements/open_memstream.h new file mode 100644 index 0000000..f7d61fa --- /dev/null +++ b/common/replacements/open_memstream.h @@ -0,0 +1,54 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_OPEN_MEMSTREAM_H +#define NBDKIT_OPEN_MEMSTREAM_H + +#include + +#include + +#ifndef HAVE_OPEN_MEMSTREAM +extern FILE *open_memstream (char **ptr, size_t *size); + +/* This function is not a straight replacement for open_memstream + * because if you use it you must replace fclose with close_memstream. + * + * Also you cannot access the buffer until you close it, which is fine + * for all uses in nbdkit, but it is not a general replacement. + */ +extern int close_memstream (FILE *memstream); +#else +#define close_memstream fclose +#endif + +#endif /* NBDKIT_OPEN_MEMSTREAM_H */ diff --git a/common/replacements/openlog.c b/common/replacements/openlog.c new file mode 100644 index 0000000..a1e5e6d --- /dev/null +++ b/common/replacements/openlog.c @@ -0,0 +1,61 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include + +#ifndef HAVE_OPENLOG_H + +#include "syslog.h" + +#ifdef WIN32 + +/* Replacement openlog for Win32. */ + +#include + +HANDLE event_source = INVALID_HANDLE_VALUE; + +void +openlog (const char *ident, int option, int facility) +{ + event_source = RegisterEventSource (NULL, ident); +} + +#else /* !WIN32 */ +#error "no replacement openlog is available on this platform" +#endif + +#endif /* !HAVE_SYSLOG_H */ diff --git a/common/replacements/poll.c b/common/replacements/poll.c new file mode 100644 index 0000000..a11e2ee --- /dev/null +++ b/common/replacements/poll.c @@ -0,0 +1,120 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +/* Replacement for poll for platforms which lack this function. */ + +#include + +#include +#include + +#ifndef HAVE_POLL + +#include "poll.h" + +#ifdef WIN32 + +#include +#include +#include +#include + +/* This is provided by common/utils which hasn't been compiled yet. + * Programs using the poll replacement will need to link to + * libutils.la. XXX + */ +extern int translate_winsock_error (const char *fn, int err); + +/* Windows doesn't have poll. It has something called WSAPoll in + * Winsock, but even Microsoft admit it is broken. Gnulib contains an + * elaborate emulation of poll written by Paolo Bonzini, but it's + * distributed under an incompatible license. However Winsock has + * select so we can write a simple (but slow) emulation of poll using + * select. + */ +int +poll (struct pollfd *fds, int n, int timeout) +{ + int i, r; + fd_set readfds, writefds; + struct timeval tv, *tvp; + + /* https://docs.microsoft.com/en-us/windows/win32/winsock/maximum-number-of-sockets-supported-2 */ + if (n >= 64) { + errno = EINVAL; + return -1; + } + + FD_ZERO (&readfds); + FD_ZERO (&writefds); + + for (i = 0; i < n; ++i) { + if (fds[i].events & POLLIN) + FD_SET (fds[i].fd, &readfds); + if (fds[i].events & POLLOUT) + FD_SET (fds[i].fd, &writefds); + fds[i].revents = 0; + } + + if (timeout >= 0) { + tv.tv_sec = timeout / 1000; + tv.tv_usec = timeout % 1000; + tvp = &tv; + } + else + tvp = NULL; + + /* Windows ignores the nfds parameter of select. */ + r = select (0, &readfds, &writefds, NULL, tvp); + if (r == -1) { + errno = translate_winsock_error ("select", WSAGetLastError ()); + return -1; + } + + r = 0; + for (i = 0; i < n; ++i) { + if (FD_ISSET (fds[i].fd, &readfds)) + fds[i].revents |= POLLIN; + if (FD_ISSET (fds[i].fd, &writefds)) + fds[i].revents |= POLLOUT; + if (fds[i].revents != 0) + r++; + } + + return r; +} + +#else /* !WIN32 */ +#error "no replacement poll is available on this platform" +#endif + +#endif /* !HAVE_POLL */ diff --git a/common/replacements/poll.h b/common/replacements/poll.h new file mode 100644 index 0000000..01b5105 --- /dev/null +++ b/common/replacements/poll.h @@ -0,0 +1,73 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_POLL_H +#define NBDKIT_POLL_H + +#include + +#ifdef HAVE_POLL + +#include_next + +#else + +#ifdef HAVE_WINSOCK2_H +#include +#endif + +#ifdef HAVE_WINSOCK2_H +#undef POLLIN +#undef POLLOUT +#undef POLLERR +#undef POLLHUP +#undef POLLRDHUP +#define pollfd rpl_pollfd +#endif + +struct pollfd { + int fd; + short events; + short revents; +}; + +#define POLLIN 0x0001 +#define POLLOUT 0x0002 +#define POLLERR 0x0008 +#define POLLHUP 0x0010 +#define POLLRDHUP 0x2000 + +extern int poll (struct pollfd *fds, int n, int timeout); + +#endif + +#endif /* NBDKIT_POLL_H */ diff --git a/common/replacements/posix_memalign.c b/common/replacements/posix_memalign.c new file mode 100644 index 0000000..10a36ac --- /dev/null +++ b/common/replacements/posix_memalign.c @@ -0,0 +1,75 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include + +#ifndef HAVE_POSIX_MEMALIGN + +#include "posix_memalign.h" + +#ifdef HAVE_VALLOC + +int +posix_memalign (void **ptr, size_t alignment, size_t size) +{ + *ptr = valloc (size); + if (*ptr == NULL) + return errno; + return 0; +} + +#else /* !HAVE_VALLOC */ + +#ifdef WIN32 + +#include + +int +posix_memalign (void **ptr, size_t alignment, size_t size) +{ + *ptr = VirtualAlloc (NULL, size, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE); + if (*ptr == NULL) + return ENOMEM; + return 0; +} + +#else /* !WIN32 */ +#error "no replacement posix_memalign() is available on this platform" +#endif + +#endif /* !HAVE_VALLOC */ + +#endif /* !HAVE_POSIX_MEMALIGN */ diff --git a/common/replacements/posix_memalign.h b/common/replacements/posix_memalign.h new file mode 100644 index 0000000..4c07891 --- /dev/null +++ b/common/replacements/posix_memalign.h @@ -0,0 +1,54 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +/* Replacement for posix_memalign for platforms which lack it. + * + * NB: This only works for page aligned allocations. The alignment + * parameter is ignored in our replacement functions. + */ + +#ifndef NBDKIT_POSIX_MEMALIGN_H +#define NBDKIT_POSIX_MEMALIGN_H + +#include + +#ifdef HAVE_POSIX_MEMALIGN + +#include + +#else + +extern int posix_memalign (void **ptr, size_t alignment, size_t size); + +#endif /* !HAVE_POSIX_MEMALIGN */ + +#endif /* NBDKIT_POSIX_MEMALIGN_H */ diff --git a/common/replacements/pread.c b/common/replacements/pread.c new file mode 100644 index 0000000..12f2930 --- /dev/null +++ b/common/replacements/pread.c @@ -0,0 +1,88 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +/* Replacement for pread for platforms which lack this function. */ + +#include + +#include +#include +#include +#include + +#ifndef HAVE_PREAD + +#include "pread.h" + +#ifdef WIN32 + +/* Replacement pread for Win32. */ + +#include "nbdkit-plugin.h" +#include + +ssize_t +pread (int fd, void *buf, size_t count, off_t offset) +{ + DWORD r; + OVERLAPPED ovl; + HANDLE h; + + memset (&ovl, 0, sizeof ovl); + /* Seriously WTF Windows? */ + ovl.Offset = offset & 0xffffffff; + ovl.OffsetHigh = offset >> 32; + + h = (HANDLE) _get_osfhandle (fd); + if (h == INVALID_HANDLE_VALUE) { + nbdkit_debug ("ReadFile: bad handle"); + errno = EIO; + return -1; + } + + /* XXX Will fail weirdly if count is larger than 32 bits. */ + if (!ReadFile (h, buf, count, &r, &ovl)) { + if (GetLastError () == ERROR_HANDLE_EOF) + return 0; + nbdkit_debug ("ReadFile: error %d", GetLastError ()); + errno = EIO; + return -1; + } + + return r; +} + +#else /* !WIN32 */ +#error "no replacement pread is available on this platform" +#endif + +#endif /* !HAVE_PREAD */ diff --git a/common/replacements/pread.h b/common/replacements/pread.h new file mode 100644 index 0000000..1e439f8 --- /dev/null +++ b/common/replacements/pread.h @@ -0,0 +1,44 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_PREAD_H +#define NBDKIT_PREAD_H + +#include + +#include + +#ifndef HAVE_PREAD +extern ssize_t pread (int fd, void *buf, size_t count, off_t offset); +#endif + +#endif /* NBDKIT_PREAD_H */ diff --git a/common/replacements/pwrite.c b/common/replacements/pwrite.c new file mode 100644 index 0000000..f1068f5 --- /dev/null +++ b/common/replacements/pwrite.c @@ -0,0 +1,86 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +/* Replacement for pwrite for platforms which lack this function. */ + +#include + +#include +#include +#include +#include + +#ifndef HAVE_PWRITE + +#include "pwrite.h" + +#ifdef WIN32 + +/* Replacement pwrite for Win32. */ + +#include "nbdkit-plugin.h" +#include + +ssize_t +pwrite (int fd, const void *buf, size_t count, off_t offset) +{ + DWORD r; + OVERLAPPED ovl; + HANDLE h; + + memset (&ovl, 0, sizeof ovl); + /* Seriously WTF Windows? */ + ovl.Offset = offset & 0xffffffff; + ovl.OffsetHigh = offset >> 32; + + h = (HANDLE) _get_osfhandle (fd); + if (h == INVALID_HANDLE_VALUE) { + nbdkit_debug ("ReadFile: bad handle"); + errno = EIO; + return -1; + } + + /* XXX Will fail weirdly if count is larger than 32 bits. */ + if (!WriteFile (h, buf, count, &r, &ovl)) { + nbdkit_debug ("WriteFile: error %d", GetLastError ()); + errno = EIO; + return -1; + } + + return r; +} + +#else /* !WIN32 */ +#error "no replacement pwrite is available on this platform" +#endif + +#endif /* !HAVE_PWRITE */ diff --git a/common/replacements/pwrite.h b/common/replacements/pwrite.h new file mode 100644 index 0000000..1b2cfeb --- /dev/null +++ b/common/replacements/pwrite.h @@ -0,0 +1,44 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_PWRITE_H +#define NBDKIT_PWRITE_H + +#include + +#include + +#ifndef HAVE_PWRITE +extern ssize_t pwrite (int fd, const void *buf, size_t count, off_t offset); +#endif + +#endif /* NBDKIT_PWRITE_H */ diff --git a/common/replacements/realpath.c b/common/replacements/realpath.c new file mode 100644 index 0000000..437f635 --- /dev/null +++ b/common/replacements/realpath.c @@ -0,0 +1,80 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +/* Replacement for realpath for platforms which lack this function. */ + +#include + +#include +#include +#include + +#ifndef HAVE_REALPATH + +#include "realpath.h" + +#ifdef WIN32 + +/* Replacement realpath for Win32. + * + * Note this is not thread-safe, but should be fine for all the + * uses in the server and ordinary plugins. + */ + +#include + +char * +realpath (const char *path, char *out) +{ + TCHAR buf[MAX_PATH]; + int r; + + r = GetFullPathNameA (path, MAX_PATH, buf, NULL); + if (r == 0) { + errno = GetLastError (); + return NULL; + } + + out = malloc (r + 1); + if (out == NULL) + return NULL; + memcpy (out, buf, r); + out[r] = '\0'; + + return out; +} + +#else /* !WIN32 */ +#error "no replacement realpath is available on this platform" +#endif + +#endif /* !HAVE_REALPATH */ diff --git a/common/replacements/realpath.h b/common/replacements/realpath.h new file mode 100644 index 0000000..5e3a76b --- /dev/null +++ b/common/replacements/realpath.h @@ -0,0 +1,47 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_REALPATH_H +#define NBDKIT_REALPATH_H + +#include + +#include +#include + +#ifndef HAVE_REALPATH + +char *realpath (const char *path, char *out); + +#endif + +#endif /* NBDKIT_REALPATH_H */ diff --git a/common/replacements/strndup.c b/common/replacements/strndup.c new file mode 100644 index 0000000..c6b59b5 --- /dev/null +++ b/common/replacements/strndup.c @@ -0,0 +1,58 @@ +/* $NetBSD: strndup.c,v 1.4 2007/07/03 12:11:09 nakayama Exp $ */ + +/* + * Copyright (c) 1988, 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. + * 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. + */ + +/* $NetBSD: strndup.c,v 1.4 2007/07/03 12:11:09 nakayama Exp $ */ + +#include + +#include +#include +#include + +#ifndef HAVE_STRNDUP + +char * +strndup (const char *str, size_t n) +{ + size_t len; + char *copy; + + for (len = 0; len < n && str[len]; len++) + continue; + + if (!(copy = malloc (len + 1))) + return NULL; + memcpy (copy, str, len); + copy[len] = '\0'; + return copy; +} + +#endif /* !HAVE_STRNDUP */ diff --git a/common/replacements/strndup.h b/common/replacements/strndup.h new file mode 100644 index 0000000..b0429ee --- /dev/null +++ b/common/replacements/strndup.h @@ -0,0 +1,47 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_STRNDUP_H +#define NBDKIT_STRNDUP_H + +#include + +#include +#include + +#ifndef HAVE_STRNDUP + +char *strndup (const char *s, size_t n); + +#endif + +#endif /* NBDKIT_STRNDUP_H */ diff --git a/common/replacements/sysconf.c b/common/replacements/sysconf.c new file mode 100644 index 0000000..f43cf54 --- /dev/null +++ b/common/replacements/sysconf.c @@ -0,0 +1,68 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include + +#ifndef HAVE_SYSCONF + +#include "sysconf.h" + +#ifdef WIN32 + +#include + +/* Replacement sysconf for Win32. */ + +long +sysconf (int name) +{ + SYSTEM_INFO sysinfo; + + if (name == _SC_PAGESIZE) { + GetSystemInfo (&sysinfo); + return sysinfo.dwPageSize; + } + else { + errno = EINVAL; + return -1; + } +} + +#else /* !WIN32 */ +#error "no replacement sysconf() is available on this platform" +#endif + +#endif /* !HAVE_SYSCONF */ diff --git a/common/replacements/sysconf.h b/common/replacements/sysconf.h new file mode 100644 index 0000000..9d9c1a8 --- /dev/null +++ b/common/replacements/sysconf.h @@ -0,0 +1,56 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +/* Replacement for sysconf for platforms which lack it. Just enough + * to get the system page size. + */ + +#ifndef NBDKIT_SYSCONF_H +#define NBDKIT_SYSCONF_H + +#include + +#ifdef HAVE_SYSCONF + +#include + +#else + +#ifndef _SC_PAGESIZE +#define _SC_PAGESIZE 1 +#endif + +extern long sysconf (int name); + +#endif /* !HAVE_SYSCONF */ + +#endif /* NBDKIT_SYSCONF_H */ diff --git a/common/replacements/syslog.c b/common/replacements/syslog.c new file mode 100644 index 0000000..fb7a957 --- /dev/null +++ b/common/replacements/syslog.c @@ -0,0 +1,61 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include + +#ifndef HAVE_SYSLOG_H + +#include "syslog.h" + +#ifdef WIN32 + +/* Replacement syslog for Win32. */ + +void +syslog (int pri, const char *fmt, ...) +{ + va_list args; + + va_start (args, fmt); + vsyslog (pri, fmt, args); + va_end (args); +} + +#else /* !WIN32 */ +#error "no replacement syslog is available on this platform" +#endif + +#endif /* !HAVE_SYSLOG_H */ diff --git a/common/replacements/syslog.h b/common/replacements/syslog.h new file mode 100644 index 0000000..e5111d5 --- /dev/null +++ b/common/replacements/syslog.h @@ -0,0 +1,66 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +/* Replacement for syslog for platforms which lack it. Note this only + * implements "just enough syslog" for nbdkit. It's not a general + * replacement. + */ + +#ifndef NBDKIT_SYSLOG_H +#define NBDKIT_SYSLOG_H + +#include + +#ifdef HAVE_SYSLOG_H + +#include_next + +#else + +#include + +/* Since the replacement function ignores the priority field, we only + * need to define these to any integer. + */ +#define LOG_PID 0 +#define LOG_ERR 0 +#define LOG_DAEMON 0 + +extern void openlog (const char *ident, int option, int facility); +extern void syslog (int pri, const char *fmt, ...) + __attribute__ ((format (printf, 2, 3))); +extern void vsyslog (int pri, const char *fmt, va_list args) + __attribute__ ((format (printf, 2, 0))); + +#endif /* !HAVE_SYSLOG_H */ + +#endif /* NBDKIT_SYSLOG_H */ diff --git a/common/replacements/test-current-dir-name.c b/common/replacements/test-current-dir-name.c new file mode 100644 index 0000000..5c6038b --- /dev/null +++ b/common/replacements/test-current-dir-name.c @@ -0,0 +1,54 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include +#include +#include +#undef NDEBUG /* Keep test strong even for nbdkit built without assertions */ +#include + +#include "get_current_dir_name.h" + +int +main (void) +{ + char *pwd; + + pwd = get_current_dir_name (); + printf ("pwd = %s\n", pwd); + free (pwd); + exit (EXIT_SUCCESS); +} diff --git a/common/replacements/vsyslog.c b/common/replacements/vsyslog.c new file mode 100644 index 0000000..9ac5789 --- /dev/null +++ b/common/replacements/vsyslog.c @@ -0,0 +1,73 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include + +#ifndef HAVE_SYSLOG_H + +#include "syslog.h" + +#ifdef WIN32 + +/* Replacement vsyslog for Win32. */ + +#include + +#include "win32/nbdkit-cat.h" + +extern HANDLE event_source; + +void +vsyslog (int pri, const char *fmt, va_list args) +{ + char *str; + const char *strs[1]; + + if (vasprintf (&str, fmt, args) == -1) + return; + strs[0] = str; + + ReportEventA (event_source, EVENTLOG_ERROR_TYPE, 0, + NBDKIT_SYSLOG_ERROR, NULL, 1, 0, strs, NULL); + + free (str); +} + +#else /* !WIN32 */ +#error "no replacement vsyslog is available on this platform" +#endif + +#endif /* !HAVE_SYSLOG_H */ diff --git a/common/replacements/win32/Makefile.am b/common/replacements/win32/Makefile.am new file mode 100644 index 0000000..9b5a68d --- /dev/null +++ b/common/replacements/win32/Makefile.am @@ -0,0 +1,45 @@ +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 $(top_srcdir)/common-rules.mk + +EXTRA_DIST = nbdkit-cat.mc + +if IS_WINDOWS + +# Build the message catalog. +noinst_DATA = MSG00001.bin nbdkit-cat.h nbdkit-cat.rc + +$(noinst_DATA): nbdkit-cat.mc + rm -f $@ + $(MC) $< + +endif diff --git a/common/replacements/win32/Makefile.in b/common/replacements/win32/Makefile.in new file mode 100644 index 0000000..934617f --- /dev/null +++ b/common/replacements/win32/Makefile.in @@ -0,0 +1,637 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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@ +subdir = common/replacements/win32 +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ocaml.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(noinst_DATA) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/common-rules.mk +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ +BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ +CARGO = @CARGO@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_PLUGIN_CC = @CC_PLUGIN_CC@ +CC_PLUGIN_CFLAGS = @CC_PLUGIN_CFLAGS@ +CERTTOOL = @CERTTOOL@ +CFLAGS = @CFLAGS@ +COM_ERR_CFLAGS = @COM_ERR_CFLAGS@ +COM_ERR_LIBS = @COM_ERR_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CUT = @CUT@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LDFLAGS = @DL_LDFLAGS@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXT2FS_CFLAGS = @EXT2FS_CFLAGS@ +EXT2FS_LIBS = @EXT2FS_LIBS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GENISOIMAGE = @GENISOIMAGE@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GOARCH = @GOARCH@ +GOLANG = @GOLANG@ +GOOS = @GOOS@ +GOROOT = @GOROOT@ +GREP = @GREP@ +IMPORT_LIBRARY_ON_WINDOWS = @IMPORT_LIBRARY_ON_WINDOWS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +ISOPROG = @ISOPROG@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBLKIO_CFLAGS = @LIBBLKIO_CFLAGS@ +LIBBLKIO_LIBS = @LIBBLKIO_LIBS@ +LIBGUESTFS_CFLAGS = @LIBGUESTFS_CFLAGS@ +LIBGUESTFS_LIBS = @LIBGUESTFS_LIBS@ +LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ +LIBLZMA_LIBS = @LIBLZMA_LIBS@ +LIBNBD_CFLAGS = @LIBNBD_CFLAGS@ +LIBNBD_LIBS = @LIBNBD_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSELINUX_CFLAGS = @LIBSELINUX_CFLAGS@ +LIBSELINUX_LIBS = @LIBSELINUX_LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTORRENT_CFLAGS = @LIBTORRENT_CFLAGS@ +LIBTORRENT_LIBS = @LIBTORRENT_LIBS@ +LIBVIRT_CFLAGS = @LIBVIRT_CFLAGS@ +LIBVIRT_LIBS = @LIBVIRT_LIBS@ +LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ +LIBZSTD_LIBS = @LIBZSTD_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LUA_CFLAGS = @LUA_CFLAGS@ +LUA_LIBS = @LUA_LIBS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MC = @MC@ +MKDIR_P = @MKDIR_P@ +MKISOFS = @MKISOFS@ +NBDKIT_VERSION_MAJOR = @NBDKIT_VERSION_MAJOR@ +NBDKIT_VERSION_MICRO = @NBDKIT_VERSION_MICRO@ +NBDKIT_VERSION_MINOR = @NBDKIT_VERSION_MINOR@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_ON_WINDOWS = @NO_UNDEFINED_ON_WINDOWS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OCAML = @OCAML@ +OCAMLBEST = @OCAMLBEST@ +OCAMLBUILD = @OCAMLBUILD@ +OCAMLC = @OCAMLC@ +OCAMLCDOTOPT = @OCAMLCDOTOPT@ +OCAMLDEP = @OCAMLDEP@ +OCAMLDOC = @OCAMLDOC@ +OCAMLLIB = @OCAMLLIB@ +OCAMLMKLIB = @OCAMLMKLIB@ +OCAMLMKTOP = @OCAMLMKTOP@ +OCAMLOPT = @OCAMLOPT@ +OCAMLOPTDOTOPT = @OCAMLOPTDOTOPT@ +OCAMLOPTFLAGS = @OCAMLOPTFLAGS@ +OCAMLVERSION = @OCAMLVERSION@ +OCAML_MAJOR = @OCAML_MAJOR@ +OCAML_PLUGIN_LIBRARIES = @OCAML_PLUGIN_LIBRARIES@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PERL_ARCHLIB = @PERL_ARCHLIB@ +PERL_CFLAGS = @PERL_CFLAGS@ +PERL_LDOPTS = @PERL_LDOPTS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PODWRAPPER = @PODWRAPPER@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_CXX = @PTHREAD_CXX@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CFLAGS = @PYTHON_CFLAGS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +RUBY_CFLAGS = @RUBY_CFLAGS@ +RUBY_LIBS = @RUBY_LIBS@ +RUSTC = @RUSTC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOEXT = @SOEXT@ +SSH_CFLAGS = @SSH_CFLAGS@ +SSH_LIBS = @SSH_LIBS@ +STAT = @STAT@ +STRIP = @STRIP@ +TCL_CFLAGS = @TCL_CFLAGS@ +TCL_LIBS = @TCL_LIBS@ +TRUNCATE = @TRUNCATE@ +VALGRIND = @VALGRIND@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VERSION = @VERSION@ +WARNINGS_CFLAGS = @WARNINGS_CFLAGS@ +XORRISO = @XORRISO@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +ZLIB_NG_CFLAGS = @ZLIB_NG_CFLAGS@ +ZLIB_NG_LIBS = @ZLIB_NG_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DLLTOOL = @ac_ct_DLLTOOL@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_MC = @ac_ct_MC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bashcompdir = @bashcompdir@ +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@ +filters = @filters@ +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@ +lang_plugins = @lang_plugins@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +non_lang_plugins = @non_lang_plugins@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugins = @plugins@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +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@ + +# Convenient list terminator +NULL = +plugindir = $(libdir)/nbdkit/plugins +filterdir = $(libdir)/nbdkit/filters +CLEANFILES = *~ *.cmi *.cmx *.cmxa *.so *.dll +EXTRA_DIST = nbdkit-cat.mc + +# Build the message catalog. +@IS_WINDOWS_TRUE@noinst_DATA = MSG00001.bin nbdkit-cat.h nbdkit-cat.rc +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common-rules.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign common/replacements/win32/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign common/replacements/win32/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; +$(top_srcdir)/common-rules.mk $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(DATA) +installdirs: +install: 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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +@IS_WINDOWS_TRUE@$(noinst_DATA): nbdkit-cat.mc +@IS_WINDOWS_TRUE@ rm -f $@ +@IS_WINDOWS_TRUE@ $(MC) $< + +# 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/common/replacements/win32/nbdkit-cat.mc b/common/replacements/win32/nbdkit-cat.mc new file mode 100644 index 0000000..9bf1b0a --- /dev/null +++ b/common/replacements/win32/nbdkit-cat.mc @@ -0,0 +1,37 @@ +;// nbdkit +;// Copyright Red Hat +;// +;// Redistribution and use in source and binary forms, with or without +;// modification, are permitted provided that the following conditions are +;// met: +;// +;// * Redistributions of source code must retain the above copyright +;// notice, this list of conditions and the following disclaimer. +;// +;// * Redistributions in binary form must reproduce the above copyright +;// notice, this list of conditions and the following disclaimer in the +;// documentation and/or other materials provided with the distribution. +;// +;// * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +MessageId=1 +Severity=Error +SymbolicName=NBDKIT_SYSLOG_ERROR +Language=English +%1 +. diff --git a/common/utils/Makefile.am b/common/utils/Makefile.am new file mode 100644 index 0000000..f28c8d2 --- /dev/null +++ b/common/utils/Makefile.am @@ -0,0 +1,130 @@ +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 $(top_srcdir)/common-rules.mk + +EXTRA_DIST = windows-errors.txt + +noinst_LTLIBRARIES = libutils.la + +libutils_la_SOURCES = \ + cleanup.c \ + cleanup-nbdkit.c \ + cleanup.h \ + const-string-vector.h \ + environ.c \ + exit-with-parent.c \ + exit-with-parent.h \ + full-rw.c \ + quote.c \ + nbdkit-string.h \ + string-vector.h \ + utils.c \ + utils.h \ + vector.c \ + vector.h \ + windows-compat.h \ + windows-compat.c \ + windows-errors.c \ + $(NULL) +libutils_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/common/include \ + -I$(top_srcdir)/common/replacements \ + $(NULL) +libutils_la_CFLAGS = \ + $(WARNINGS_CFLAGS) \ + $(PTHREAD_CFLAGS) \ + $(NULL) +libutils_la_LIBADD = \ + $(PTHREAD_LIBS) \ + $(NULL) + +# Generate the code to map Winsock errors to errno codes. +BUILT_SOURCES = windows-errors.c +windows-errors.c: windows-errors.txt + @rm -f $@ $@-t + @echo '/* Generated from windows-errors.txt */' > $@-t + @echo '#include ' >> $@-t + @echo '#ifdef WIN32' >> $@-t + @echo '#include ' >> $@-t + @echo '#include ' >> $@-t + @echo '#include ' >> $@-t + @echo '#include ' >> $@-t + @echo 'int' >> $@-t + @echo 'translate_winsock_error (const char *fn, int err) {' >> $@-t +# Always log the original error. + @echo ' nbdkit_debug ("%s: winsock error %d", fn, err);' >> $@-t + @echo ' switch (err) {' >> $@-t + @$(SED) -e '/^#/d' \ + -e '/^$$/d' \ + -e 's/\(.*\)[[:space:]][[:space:]]*\(.*\)/#if defined(\1) \&\& defined(\2)\n\ + case \1: return \2;\n\ +\#endif/' \ + < $< >> $@-t + @echo ' default:' >> $@-t + @echo ' return err > 10000 && err < 10025 ? err - 10000 : EINVAL;' >> $@-t + @echo ' }' >> $@-t + @echo '}' >> $@-t + @echo '#endif /* WIN32 */' >> $@-t + mv $@-t $@ + chmod -w $@ + +# Unit tests. + +TESTS = test-quotes test-vector +check_PROGRAMS = test-quotes test-vector + +test_quotes_SOURCES = test-quotes.c quote.c utils.h +test_quotes_CPPFLAGS = \ + -I$(srcdir) \ + -I$(top_srcdir)/common/replacements \ + -I$(top_srcdir)/common/include \ + $(NULL) +test_quotes_CFLAGS = $(WARNINGS_CFLAGS) +test_quotes_LDADD = \ + $(top_builddir)/common/replacements/libcompat.la \ + $(NULL) + +test_vector_SOURCES = test-vector.c vector.c vector.h bench.h +test_vector_CPPFLAGS = \ + -I$(srcdir) \ + -I$(top_srcdir)/common/replacements \ + -I$(top_srcdir)/common/include \ + $(NULL) +test_vector_CFLAGS = $(WARNINGS_CFLAGS) +test_vector_LDADD = \ + $(top_builddir)/common/replacements/libcompat.la \ + $(NULL) + +bench: test-vector + NBDKIT_BENCH=1 ./test-vector diff --git a/common/utils/Makefile.in b/common/utils/Makefile.in new file mode 100644 index 0000000..db70e83 --- /dev/null +++ b/common/utils/Makefile.in @@ -0,0 +1,1489 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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@ +TESTS = test-quotes$(EXEEXT) test-vector$(EXEEXT) +check_PROGRAMS = test-quotes$(EXEEXT) test-vector$(EXEEXT) +subdir = common/utils +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ocaml.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +am__DEPENDENCIES_1 = +libutils_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am__objects_1 = +am_libutils_la_OBJECTS = libutils_la-cleanup.lo \ + libutils_la-cleanup-nbdkit.lo libutils_la-environ.lo \ + libutils_la-exit-with-parent.lo libutils_la-full-rw.lo \ + libutils_la-quote.lo libutils_la-utils.lo \ + libutils_la-vector.lo libutils_la-windows-compat.lo \ + libutils_la-windows-errors.lo $(am__objects_1) +libutils_la_OBJECTS = $(am_libutils_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libutils_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libutils_la_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_test_quotes_OBJECTS = test_quotes-test-quotes.$(OBJEXT) \ + test_quotes-quote.$(OBJEXT) +test_quotes_OBJECTS = $(am_test_quotes_OBJECTS) +test_quotes_DEPENDENCIES = \ + $(top_builddir)/common/replacements/libcompat.la \ + $(am__DEPENDENCIES_1) +test_quotes_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(test_quotes_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_test_vector_OBJECTS = test_vector-test-vector.$(OBJEXT) \ + test_vector-vector.$(OBJEXT) +test_vector_OBJECTS = $(am_test_vector_OBJECTS) +test_vector_DEPENDENCIES = \ + $(top_builddir)/common/replacements/libcompat.la \ + $(am__DEPENDENCIES_1) +test_vector_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(test_vector_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/libutils_la-cleanup-nbdkit.Plo \ + ./$(DEPDIR)/libutils_la-cleanup.Plo \ + ./$(DEPDIR)/libutils_la-environ.Plo \ + ./$(DEPDIR)/libutils_la-exit-with-parent.Plo \ + ./$(DEPDIR)/libutils_la-full-rw.Plo \ + ./$(DEPDIR)/libutils_la-quote.Plo \ + ./$(DEPDIR)/libutils_la-utils.Plo \ + ./$(DEPDIR)/libutils_la-vector.Plo \ + ./$(DEPDIR)/libutils_la-windows-compat.Plo \ + ./$(DEPDIR)/libutils_la-windows-errors.Plo \ + ./$(DEPDIR)/test_quotes-quote.Po \ + ./$(DEPDIR)/test_quotes-test-quotes.Po \ + ./$(DEPDIR)/test_vector-test-vector.Po \ + ./$(DEPDIR)/test_vector-vector.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libutils_la_SOURCES) $(test_quotes_SOURCES) \ + $(test_vector_SOURCES) +DIST_SOURCES = $(libutils_la_SOURCES) $(test_quotes_SOURCES) \ + $(test_vector_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = { \ + $(am__tty_colors_dummy); \ + if test "X$(AM_COLOR_TESTS)" = Xno; then \ + am__color_tests=no; \ + elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ + am__color_tests=yes; \ + elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ + am__color_tests=yes; \ + fi; \ + if test $$am__color_tests = yes; then \ + red=''; \ + grn=''; \ + lgn=''; \ + blu=''; \ + mgn=''; \ + brg=''; \ + std=''; \ + fi; \ +} +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 = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__recheck_rx = ^[ ]*:recheck:[ ]* +am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* +am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* +# A command that, given a newline-separated list of test names on the +# standard input, print the name of the tests that are to be re-run +# upon "make recheck". +am__list_recheck_tests = $(AWK) '{ \ + recheck = 1; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + { \ + if ((getline line2 < ($$0 ".log")) < 0) \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ + { \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ + { \ + break; \ + } \ + }; \ + if (recheck) \ + print $$0; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# A command that, given a newline-separated list of test names on the +# standard input, create the global log from their .trs and .log files. +am__create_global_log = $(AWK) ' \ +function fatal(msg) \ +{ \ + print "fatal: making $@: " msg | "cat >&2"; \ + exit 1; \ +} \ +function rst_section(header) \ +{ \ + print header; \ + len = length(header); \ + for (i = 1; i <= len; i = i + 1) \ + printf "="; \ + printf "\n\n"; \ +} \ +{ \ + copy_in_global_log = 1; \ + global_test_result = "RUN"; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".trs"); \ + if (line ~ /$(am__global_test_result_rx)/) \ + { \ + sub("$(am__global_test_result_rx)", "", line); \ + sub("[ ]*$$", "", line); \ + global_test_result = line; \ + } \ + else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ + copy_in_global_log = 0; \ + }; \ + if (copy_in_global_log) \ + { \ + rst_section(global_test_result ": " $$0); \ + while ((rc = (getline line < ($$0 ".log"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".log"); \ + print line; \ + }; \ + printf "\n"; \ + }; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# Restructured Text title. +am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } +# Solaris 10 'make', and several other traditional 'make' implementations, +# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it +# by disabling -e (using the XSI extension "set +e") if it's set. +am__sh_e_setup = case $$- in *e*) set +e;; esac +# Default flags passed to test drivers. +am__common_driver_flags = \ + --color-tests "$$am__color_tests" \ + --enable-hard-errors "$$am__enable_hard_errors" \ + --expect-failure "$$am__expect_failure" +# To be inserted before the command running the test. Creates the +# directory for the log if needed. Stores in $dir the directory +# containing $f, in $tst the test, in $log the log. Executes the +# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and +# passes TESTS_ENVIRONMENT. Set up options for the wrapper that +# will run the test scripts (or their associated LOG_COMPILER, if +# thy have one). +am__check_pre = \ +$(am__sh_e_setup); \ +$(am__vpath_adj_setup) $(am__vpath_adj) \ +$(am__tty_colors); \ +srcdir=$(srcdir); export srcdir; \ +case "$@" in \ + */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ + *) am__odir=.;; \ +esac; \ +test "x$$am__odir" = x"." || test -d "$$am__odir" \ + || $(MKDIR_P) "$$am__odir" || exit $$?; \ +if test -f "./$$f"; then dir=./; \ +elif test -f "$$f"; then dir=; \ +else dir="$(srcdir)/"; fi; \ +tst=$$dir$$f; log='$@'; \ +if test -n '$(DISABLE_HARD_ERRORS)'; then \ + am__enable_hard_errors=no; \ +else \ + am__enable_hard_errors=yes; \ +fi; \ +case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ + am__expect_failure=yes;; \ + *) \ + am__expect_failure=no;; \ +esac; \ +$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) +# A shell command to get the names of the tests scripts with any registered +# extension removed (i.e., equivalently, the names of the test logs, with +# the '.log' extension removed). The result is saved in the shell variable +# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, +# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", +# since that might cause problem with VPATH rewrites for suffix-less tests. +# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. +am__set_TESTS_bases = \ + bases='$(TEST_LOGS)'; \ + bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ + bases=`echo $$bases` +AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)' +RECHECK_LOGS = $(TEST_LOGS) +AM_RECURSIVE_TARGETS = check recheck +TEST_SUITE_LOG = test-suite.log +TEST_EXTENSIONS = @EXEEXT@ .test +LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) +am__set_b = \ + case '$@' in \ + */*) \ + case '$*' in \ + */*) b='$*';; \ + *) b=`echo '$@' | sed 's/\.log$$//'`; \ + esac;; \ + *) \ + b='$*';; \ + esac +am__test_logs1 = $(TESTS:=.log) +am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) +TEST_LOGS = $(am__test_logs2:.test.log=.log) +TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ + $(TEST_LOG_FLAGS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/common-rules.mk \ + $(top_srcdir)/depcomp $(top_srcdir)/test-driver +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ +BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ +CARGO = @CARGO@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_PLUGIN_CC = @CC_PLUGIN_CC@ +CC_PLUGIN_CFLAGS = @CC_PLUGIN_CFLAGS@ +CERTTOOL = @CERTTOOL@ +CFLAGS = @CFLAGS@ +COM_ERR_CFLAGS = @COM_ERR_CFLAGS@ +COM_ERR_LIBS = @COM_ERR_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CUT = @CUT@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LDFLAGS = @DL_LDFLAGS@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXT2FS_CFLAGS = @EXT2FS_CFLAGS@ +EXT2FS_LIBS = @EXT2FS_LIBS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GENISOIMAGE = @GENISOIMAGE@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GOARCH = @GOARCH@ +GOLANG = @GOLANG@ +GOOS = @GOOS@ +GOROOT = @GOROOT@ +GREP = @GREP@ +IMPORT_LIBRARY_ON_WINDOWS = @IMPORT_LIBRARY_ON_WINDOWS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +ISOPROG = @ISOPROG@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBLKIO_CFLAGS = @LIBBLKIO_CFLAGS@ +LIBBLKIO_LIBS = @LIBBLKIO_LIBS@ +LIBGUESTFS_CFLAGS = @LIBGUESTFS_CFLAGS@ +LIBGUESTFS_LIBS = @LIBGUESTFS_LIBS@ +LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ +LIBLZMA_LIBS = @LIBLZMA_LIBS@ +LIBNBD_CFLAGS = @LIBNBD_CFLAGS@ +LIBNBD_LIBS = @LIBNBD_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSELINUX_CFLAGS = @LIBSELINUX_CFLAGS@ +LIBSELINUX_LIBS = @LIBSELINUX_LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTORRENT_CFLAGS = @LIBTORRENT_CFLAGS@ +LIBTORRENT_LIBS = @LIBTORRENT_LIBS@ +LIBVIRT_CFLAGS = @LIBVIRT_CFLAGS@ +LIBVIRT_LIBS = @LIBVIRT_LIBS@ +LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ +LIBZSTD_LIBS = @LIBZSTD_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LUA_CFLAGS = @LUA_CFLAGS@ +LUA_LIBS = @LUA_LIBS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MC = @MC@ +MKDIR_P = @MKDIR_P@ +MKISOFS = @MKISOFS@ +NBDKIT_VERSION_MAJOR = @NBDKIT_VERSION_MAJOR@ +NBDKIT_VERSION_MICRO = @NBDKIT_VERSION_MICRO@ +NBDKIT_VERSION_MINOR = @NBDKIT_VERSION_MINOR@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_ON_WINDOWS = @NO_UNDEFINED_ON_WINDOWS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OCAML = @OCAML@ +OCAMLBEST = @OCAMLBEST@ +OCAMLBUILD = @OCAMLBUILD@ +OCAMLC = @OCAMLC@ +OCAMLCDOTOPT = @OCAMLCDOTOPT@ +OCAMLDEP = @OCAMLDEP@ +OCAMLDOC = @OCAMLDOC@ +OCAMLLIB = @OCAMLLIB@ +OCAMLMKLIB = @OCAMLMKLIB@ +OCAMLMKTOP = @OCAMLMKTOP@ +OCAMLOPT = @OCAMLOPT@ +OCAMLOPTDOTOPT = @OCAMLOPTDOTOPT@ +OCAMLOPTFLAGS = @OCAMLOPTFLAGS@ +OCAMLVERSION = @OCAMLVERSION@ +OCAML_MAJOR = @OCAML_MAJOR@ +OCAML_PLUGIN_LIBRARIES = @OCAML_PLUGIN_LIBRARIES@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PERL_ARCHLIB = @PERL_ARCHLIB@ +PERL_CFLAGS = @PERL_CFLAGS@ +PERL_LDOPTS = @PERL_LDOPTS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PODWRAPPER = @PODWRAPPER@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_CXX = @PTHREAD_CXX@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CFLAGS = @PYTHON_CFLAGS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +RUBY_CFLAGS = @RUBY_CFLAGS@ +RUBY_LIBS = @RUBY_LIBS@ +RUSTC = @RUSTC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOEXT = @SOEXT@ +SSH_CFLAGS = @SSH_CFLAGS@ +SSH_LIBS = @SSH_LIBS@ +STAT = @STAT@ +STRIP = @STRIP@ +TCL_CFLAGS = @TCL_CFLAGS@ +TCL_LIBS = @TCL_LIBS@ +TRUNCATE = @TRUNCATE@ +VALGRIND = @VALGRIND@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VERSION = @VERSION@ +WARNINGS_CFLAGS = @WARNINGS_CFLAGS@ +XORRISO = @XORRISO@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +ZLIB_NG_CFLAGS = @ZLIB_NG_CFLAGS@ +ZLIB_NG_LIBS = @ZLIB_NG_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DLLTOOL = @ac_ct_DLLTOOL@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_MC = @ac_ct_MC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bashcompdir = @bashcompdir@ +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@ +filters = @filters@ +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@ +lang_plugins = @lang_plugins@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +non_lang_plugins = @non_lang_plugins@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugins = @plugins@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +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@ + +# Convenient list terminator +NULL = +plugindir = $(libdir)/nbdkit/plugins +filterdir = $(libdir)/nbdkit/filters +CLEANFILES = *~ *.cmi *.cmx *.cmxa *.so *.dll +EXTRA_DIST = windows-errors.txt +noinst_LTLIBRARIES = libutils.la +libutils_la_SOURCES = \ + cleanup.c \ + cleanup-nbdkit.c \ + cleanup.h \ + const-string-vector.h \ + environ.c \ + exit-with-parent.c \ + exit-with-parent.h \ + full-rw.c \ + quote.c \ + nbdkit-string.h \ + string-vector.h \ + utils.c \ + utils.h \ + vector.c \ + vector.h \ + windows-compat.h \ + windows-compat.c \ + windows-errors.c \ + $(NULL) + +libutils_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/common/include \ + -I$(top_srcdir)/common/replacements \ + $(NULL) + +libutils_la_CFLAGS = \ + $(WARNINGS_CFLAGS) \ + $(PTHREAD_CFLAGS) \ + $(NULL) + +libutils_la_LIBADD = \ + $(PTHREAD_LIBS) \ + $(NULL) + + +# Generate the code to map Winsock errors to errno codes. +BUILT_SOURCES = windows-errors.c +test_quotes_SOURCES = test-quotes.c quote.c utils.h +test_quotes_CPPFLAGS = \ + -I$(srcdir) \ + -I$(top_srcdir)/common/replacements \ + -I$(top_srcdir)/common/include \ + $(NULL) + +test_quotes_CFLAGS = $(WARNINGS_CFLAGS) +test_quotes_LDADD = \ + $(top_builddir)/common/replacements/libcompat.la \ + $(NULL) + +test_vector_SOURCES = test-vector.c vector.c vector.h bench.h +test_vector_CPPFLAGS = \ + -I$(srcdir) \ + -I$(top_srcdir)/common/replacements \ + -I$(top_srcdir)/common/include \ + $(NULL) + +test_vector_CFLAGS = $(WARNINGS_CFLAGS) +test_vector_LDADD = \ + $(top_builddir)/common/replacements/libcompat.la \ + $(NULL) + +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common-rules.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign common/utils/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign common/utils/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; +$(top_srcdir)/common-rules.mk $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libutils.la: $(libutils_la_OBJECTS) $(libutils_la_DEPENDENCIES) $(EXTRA_libutils_la_DEPENDENCIES) + $(AM_V_CCLD)$(libutils_la_LINK) $(libutils_la_OBJECTS) $(libutils_la_LIBADD) $(LIBS) + +test-quotes$(EXEEXT): $(test_quotes_OBJECTS) $(test_quotes_DEPENDENCIES) $(EXTRA_test_quotes_DEPENDENCIES) + @rm -f test-quotes$(EXEEXT) + $(AM_V_CCLD)$(test_quotes_LINK) $(test_quotes_OBJECTS) $(test_quotes_LDADD) $(LIBS) + +test-vector$(EXEEXT): $(test_vector_OBJECTS) $(test_vector_DEPENDENCIES) $(EXTRA_test_vector_DEPENDENCIES) + @rm -f test-vector$(EXEEXT) + $(AM_V_CCLD)$(test_vector_LINK) $(test_vector_OBJECTS) $(test_vector_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libutils_la-cleanup-nbdkit.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libutils_la-cleanup.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libutils_la-environ.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libutils_la-exit-with-parent.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libutils_la-full-rw.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libutils_la-quote.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libutils_la-utils.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libutils_la-vector.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libutils_la-windows-compat.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libutils_la-windows-errors.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_quotes-quote.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_quotes-test-quotes.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_vector-test-vector.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_vector-vector.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libutils_la-cleanup.lo: cleanup.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutils_la_CPPFLAGS) $(CPPFLAGS) $(libutils_la_CFLAGS) $(CFLAGS) -MT libutils_la-cleanup.lo -MD -MP -MF $(DEPDIR)/libutils_la-cleanup.Tpo -c -o libutils_la-cleanup.lo `test -f 'cleanup.c' || echo '$(srcdir)/'`cleanup.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libutils_la-cleanup.Tpo $(DEPDIR)/libutils_la-cleanup.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cleanup.c' object='libutils_la-cleanup.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutils_la_CPPFLAGS) $(CPPFLAGS) $(libutils_la_CFLAGS) $(CFLAGS) -c -o libutils_la-cleanup.lo `test -f 'cleanup.c' || echo '$(srcdir)/'`cleanup.c + +libutils_la-cleanup-nbdkit.lo: cleanup-nbdkit.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutils_la_CPPFLAGS) $(CPPFLAGS) $(libutils_la_CFLAGS) $(CFLAGS) -MT libutils_la-cleanup-nbdkit.lo -MD -MP -MF $(DEPDIR)/libutils_la-cleanup-nbdkit.Tpo -c -o libutils_la-cleanup-nbdkit.lo `test -f 'cleanup-nbdkit.c' || echo '$(srcdir)/'`cleanup-nbdkit.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libutils_la-cleanup-nbdkit.Tpo $(DEPDIR)/libutils_la-cleanup-nbdkit.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cleanup-nbdkit.c' object='libutils_la-cleanup-nbdkit.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutils_la_CPPFLAGS) $(CPPFLAGS) $(libutils_la_CFLAGS) $(CFLAGS) -c -o libutils_la-cleanup-nbdkit.lo `test -f 'cleanup-nbdkit.c' || echo '$(srcdir)/'`cleanup-nbdkit.c + +libutils_la-environ.lo: environ.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutils_la_CPPFLAGS) $(CPPFLAGS) $(libutils_la_CFLAGS) $(CFLAGS) -MT libutils_la-environ.lo -MD -MP -MF $(DEPDIR)/libutils_la-environ.Tpo -c -o libutils_la-environ.lo `test -f 'environ.c' || echo '$(srcdir)/'`environ.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libutils_la-environ.Tpo $(DEPDIR)/libutils_la-environ.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='environ.c' object='libutils_la-environ.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutils_la_CPPFLAGS) $(CPPFLAGS) $(libutils_la_CFLAGS) $(CFLAGS) -c -o libutils_la-environ.lo `test -f 'environ.c' || echo '$(srcdir)/'`environ.c + +libutils_la-exit-with-parent.lo: exit-with-parent.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutils_la_CPPFLAGS) $(CPPFLAGS) $(libutils_la_CFLAGS) $(CFLAGS) -MT libutils_la-exit-with-parent.lo -MD -MP -MF $(DEPDIR)/libutils_la-exit-with-parent.Tpo -c -o libutils_la-exit-with-parent.lo `test -f 'exit-with-parent.c' || echo '$(srcdir)/'`exit-with-parent.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libutils_la-exit-with-parent.Tpo $(DEPDIR)/libutils_la-exit-with-parent.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='exit-with-parent.c' object='libutils_la-exit-with-parent.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutils_la_CPPFLAGS) $(CPPFLAGS) $(libutils_la_CFLAGS) $(CFLAGS) -c -o libutils_la-exit-with-parent.lo `test -f 'exit-with-parent.c' || echo '$(srcdir)/'`exit-with-parent.c + +libutils_la-full-rw.lo: full-rw.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutils_la_CPPFLAGS) $(CPPFLAGS) $(libutils_la_CFLAGS) $(CFLAGS) -MT libutils_la-full-rw.lo -MD -MP -MF $(DEPDIR)/libutils_la-full-rw.Tpo -c -o libutils_la-full-rw.lo `test -f 'full-rw.c' || echo '$(srcdir)/'`full-rw.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libutils_la-full-rw.Tpo $(DEPDIR)/libutils_la-full-rw.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='full-rw.c' object='libutils_la-full-rw.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutils_la_CPPFLAGS) $(CPPFLAGS) $(libutils_la_CFLAGS) $(CFLAGS) -c -o libutils_la-full-rw.lo `test -f 'full-rw.c' || echo '$(srcdir)/'`full-rw.c + +libutils_la-quote.lo: quote.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutils_la_CPPFLAGS) $(CPPFLAGS) $(libutils_la_CFLAGS) $(CFLAGS) -MT libutils_la-quote.lo -MD -MP -MF $(DEPDIR)/libutils_la-quote.Tpo -c -o libutils_la-quote.lo `test -f 'quote.c' || echo '$(srcdir)/'`quote.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libutils_la-quote.Tpo $(DEPDIR)/libutils_la-quote.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='quote.c' object='libutils_la-quote.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutils_la_CPPFLAGS) $(CPPFLAGS) $(libutils_la_CFLAGS) $(CFLAGS) -c -o libutils_la-quote.lo `test -f 'quote.c' || echo '$(srcdir)/'`quote.c + +libutils_la-utils.lo: utils.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutils_la_CPPFLAGS) $(CPPFLAGS) $(libutils_la_CFLAGS) $(CFLAGS) -MT libutils_la-utils.lo -MD -MP -MF $(DEPDIR)/libutils_la-utils.Tpo -c -o libutils_la-utils.lo `test -f 'utils.c' || echo '$(srcdir)/'`utils.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libutils_la-utils.Tpo $(DEPDIR)/libutils_la-utils.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='utils.c' object='libutils_la-utils.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutils_la_CPPFLAGS) $(CPPFLAGS) $(libutils_la_CFLAGS) $(CFLAGS) -c -o libutils_la-utils.lo `test -f 'utils.c' || echo '$(srcdir)/'`utils.c + +libutils_la-vector.lo: vector.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutils_la_CPPFLAGS) $(CPPFLAGS) $(libutils_la_CFLAGS) $(CFLAGS) -MT libutils_la-vector.lo -MD -MP -MF $(DEPDIR)/libutils_la-vector.Tpo -c -o libutils_la-vector.lo `test -f 'vector.c' || echo '$(srcdir)/'`vector.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libutils_la-vector.Tpo $(DEPDIR)/libutils_la-vector.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vector.c' object='libutils_la-vector.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutils_la_CPPFLAGS) $(CPPFLAGS) $(libutils_la_CFLAGS) $(CFLAGS) -c -o libutils_la-vector.lo `test -f 'vector.c' || echo '$(srcdir)/'`vector.c + +libutils_la-windows-compat.lo: windows-compat.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutils_la_CPPFLAGS) $(CPPFLAGS) $(libutils_la_CFLAGS) $(CFLAGS) -MT libutils_la-windows-compat.lo -MD -MP -MF $(DEPDIR)/libutils_la-windows-compat.Tpo -c -o libutils_la-windows-compat.lo `test -f 'windows-compat.c' || echo '$(srcdir)/'`windows-compat.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libutils_la-windows-compat.Tpo $(DEPDIR)/libutils_la-windows-compat.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='windows-compat.c' object='libutils_la-windows-compat.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutils_la_CPPFLAGS) $(CPPFLAGS) $(libutils_la_CFLAGS) $(CFLAGS) -c -o libutils_la-windows-compat.lo `test -f 'windows-compat.c' || echo '$(srcdir)/'`windows-compat.c + +libutils_la-windows-errors.lo: windows-errors.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutils_la_CPPFLAGS) $(CPPFLAGS) $(libutils_la_CFLAGS) $(CFLAGS) -MT libutils_la-windows-errors.lo -MD -MP -MF $(DEPDIR)/libutils_la-windows-errors.Tpo -c -o libutils_la-windows-errors.lo `test -f 'windows-errors.c' || echo '$(srcdir)/'`windows-errors.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libutils_la-windows-errors.Tpo $(DEPDIR)/libutils_la-windows-errors.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='windows-errors.c' object='libutils_la-windows-errors.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutils_la_CPPFLAGS) $(CPPFLAGS) $(libutils_la_CFLAGS) $(CFLAGS) -c -o libutils_la-windows-errors.lo `test -f 'windows-errors.c' || echo '$(srcdir)/'`windows-errors.c + +test_quotes-test-quotes.o: test-quotes.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_quotes_CPPFLAGS) $(CPPFLAGS) $(test_quotes_CFLAGS) $(CFLAGS) -MT test_quotes-test-quotes.o -MD -MP -MF $(DEPDIR)/test_quotes-test-quotes.Tpo -c -o test_quotes-test-quotes.o `test -f 'test-quotes.c' || echo '$(srcdir)/'`test-quotes.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_quotes-test-quotes.Tpo $(DEPDIR)/test_quotes-test-quotes.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-quotes.c' object='test_quotes-test-quotes.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_quotes_CPPFLAGS) $(CPPFLAGS) $(test_quotes_CFLAGS) $(CFLAGS) -c -o test_quotes-test-quotes.o `test -f 'test-quotes.c' || echo '$(srcdir)/'`test-quotes.c + +test_quotes-test-quotes.obj: test-quotes.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_quotes_CPPFLAGS) $(CPPFLAGS) $(test_quotes_CFLAGS) $(CFLAGS) -MT test_quotes-test-quotes.obj -MD -MP -MF $(DEPDIR)/test_quotes-test-quotes.Tpo -c -o test_quotes-test-quotes.obj `if test -f 'test-quotes.c'; then $(CYGPATH_W) 'test-quotes.c'; else $(CYGPATH_W) '$(srcdir)/test-quotes.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_quotes-test-quotes.Tpo $(DEPDIR)/test_quotes-test-quotes.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-quotes.c' object='test_quotes-test-quotes.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_quotes_CPPFLAGS) $(CPPFLAGS) $(test_quotes_CFLAGS) $(CFLAGS) -c -o test_quotes-test-quotes.obj `if test -f 'test-quotes.c'; then $(CYGPATH_W) 'test-quotes.c'; else $(CYGPATH_W) '$(srcdir)/test-quotes.c'; fi` + +test_quotes-quote.o: quote.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_quotes_CPPFLAGS) $(CPPFLAGS) $(test_quotes_CFLAGS) $(CFLAGS) -MT test_quotes-quote.o -MD -MP -MF $(DEPDIR)/test_quotes-quote.Tpo -c -o test_quotes-quote.o `test -f 'quote.c' || echo '$(srcdir)/'`quote.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_quotes-quote.Tpo $(DEPDIR)/test_quotes-quote.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='quote.c' object='test_quotes-quote.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_quotes_CPPFLAGS) $(CPPFLAGS) $(test_quotes_CFLAGS) $(CFLAGS) -c -o test_quotes-quote.o `test -f 'quote.c' || echo '$(srcdir)/'`quote.c + +test_quotes-quote.obj: quote.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_quotes_CPPFLAGS) $(CPPFLAGS) $(test_quotes_CFLAGS) $(CFLAGS) -MT test_quotes-quote.obj -MD -MP -MF $(DEPDIR)/test_quotes-quote.Tpo -c -o test_quotes-quote.obj `if test -f 'quote.c'; then $(CYGPATH_W) 'quote.c'; else $(CYGPATH_W) '$(srcdir)/quote.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_quotes-quote.Tpo $(DEPDIR)/test_quotes-quote.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='quote.c' object='test_quotes-quote.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_quotes_CPPFLAGS) $(CPPFLAGS) $(test_quotes_CFLAGS) $(CFLAGS) -c -o test_quotes-quote.obj `if test -f 'quote.c'; then $(CYGPATH_W) 'quote.c'; else $(CYGPATH_W) '$(srcdir)/quote.c'; fi` + +test_vector-test-vector.o: test-vector.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_vector_CPPFLAGS) $(CPPFLAGS) $(test_vector_CFLAGS) $(CFLAGS) -MT test_vector-test-vector.o -MD -MP -MF $(DEPDIR)/test_vector-test-vector.Tpo -c -o test_vector-test-vector.o `test -f 'test-vector.c' || echo '$(srcdir)/'`test-vector.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_vector-test-vector.Tpo $(DEPDIR)/test_vector-test-vector.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-vector.c' object='test_vector-test-vector.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_vector_CPPFLAGS) $(CPPFLAGS) $(test_vector_CFLAGS) $(CFLAGS) -c -o test_vector-test-vector.o `test -f 'test-vector.c' || echo '$(srcdir)/'`test-vector.c + +test_vector-test-vector.obj: test-vector.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_vector_CPPFLAGS) $(CPPFLAGS) $(test_vector_CFLAGS) $(CFLAGS) -MT test_vector-test-vector.obj -MD -MP -MF $(DEPDIR)/test_vector-test-vector.Tpo -c -o test_vector-test-vector.obj `if test -f 'test-vector.c'; then $(CYGPATH_W) 'test-vector.c'; else $(CYGPATH_W) '$(srcdir)/test-vector.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_vector-test-vector.Tpo $(DEPDIR)/test_vector-test-vector.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-vector.c' object='test_vector-test-vector.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_vector_CPPFLAGS) $(CPPFLAGS) $(test_vector_CFLAGS) $(CFLAGS) -c -o test_vector-test-vector.obj `if test -f 'test-vector.c'; then $(CYGPATH_W) 'test-vector.c'; else $(CYGPATH_W) '$(srcdir)/test-vector.c'; fi` + +test_vector-vector.o: vector.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_vector_CPPFLAGS) $(CPPFLAGS) $(test_vector_CFLAGS) $(CFLAGS) -MT test_vector-vector.o -MD -MP -MF $(DEPDIR)/test_vector-vector.Tpo -c -o test_vector-vector.o `test -f 'vector.c' || echo '$(srcdir)/'`vector.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_vector-vector.Tpo $(DEPDIR)/test_vector-vector.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vector.c' object='test_vector-vector.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_vector_CPPFLAGS) $(CPPFLAGS) $(test_vector_CFLAGS) $(CFLAGS) -c -o test_vector-vector.o `test -f 'vector.c' || echo '$(srcdir)/'`vector.c + +test_vector-vector.obj: vector.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_vector_CPPFLAGS) $(CPPFLAGS) $(test_vector_CFLAGS) $(CFLAGS) -MT test_vector-vector.obj -MD -MP -MF $(DEPDIR)/test_vector-vector.Tpo -c -o test_vector-vector.obj `if test -f 'vector.c'; then $(CYGPATH_W) 'vector.c'; else $(CYGPATH_W) '$(srcdir)/vector.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_vector-vector.Tpo $(DEPDIR)/test_vector-vector.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vector.c' object='test_vector-vector.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_vector_CPPFLAGS) $(CPPFLAGS) $(test_vector_CFLAGS) $(CFLAGS) -c -o test_vector-vector.obj `if test -f 'vector.c'; then $(CYGPATH_W) 'vector.c'; else $(CYGPATH_W) '$(srcdir)/vector.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +# Recover from deleted '.trs' file; this should ensure that +# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create +# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells +# to avoid problems with "make -n". +.log.trs: + rm -f $< $@ + $(MAKE) $(AM_MAKEFLAGS) $< + +# Leading 'am--fnord' is there to ensure the list of targets does not +# expand to empty, as could happen e.g. with make check TESTS=''. +am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) +am--force-recheck: + @: + +$(TEST_SUITE_LOG): $(TEST_LOGS) + @$(am__set_TESTS_bases); \ + am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ + redo_bases=`for i in $$bases; do \ + am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ + done`; \ + if test -n "$$redo_bases"; then \ + redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ + redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ + if $(am__make_dryrun); then :; else \ + rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ + fi; \ + fi; \ + if test -n "$$am__remaking_logs"; then \ + echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ + "recursion detected" >&2; \ + elif test -n "$$redo_logs"; then \ + am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ + fi; \ + if $(am__make_dryrun); then :; else \ + st=0; \ + errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ + for i in $$redo_bases; do \ + test -f $$i.trs && test -r $$i.trs \ + || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ + test -f $$i.log && test -r $$i.log \ + || { echo "$$errmsg $$i.log" >&2; st=1; }; \ + done; \ + test $$st -eq 0 || exit 1; \ + fi + @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ + ws='[ ]'; \ + results=`for b in $$bases; do echo $$b.trs; done`; \ + test -n "$$results" || results=/dev/null; \ + all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ + pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ + fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ + skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ + xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ + xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ + error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ + if test `expr $$fail + $$xpass + $$error` -eq 0; then \ + success=true; \ + else \ + success=false; \ + fi; \ + br='==================='; br=$$br$$br$$br$$br; \ + result_count () \ + { \ + if test x"$$1" = x"--maybe-color"; then \ + maybe_colorize=yes; \ + elif test x"$$1" = x"--no-color"; then \ + maybe_colorize=no; \ + else \ + echo "$@: invalid 'result_count' usage" >&2; exit 4; \ + fi; \ + shift; \ + desc=$$1 count=$$2; \ + if test $$maybe_colorize = yes && test $$count -gt 0; then \ + color_start=$$3 color_end=$$std; \ + else \ + color_start= color_end=; \ + fi; \ + echo "$${color_start}# $$desc $$count$${color_end}"; \ + }; \ + create_testsuite_report () \ + { \ + result_count $$1 "TOTAL:" $$all "$$brg"; \ + result_count $$1 "PASS: " $$pass "$$grn"; \ + result_count $$1 "SKIP: " $$skip "$$blu"; \ + result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ + result_count $$1 "FAIL: " $$fail "$$red"; \ + result_count $$1 "XPASS:" $$xpass "$$red"; \ + result_count $$1 "ERROR:" $$error "$$mgn"; \ + }; \ + { \ + echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ + $(am__rst_title); \ + create_testsuite_report --no-color; \ + echo; \ + echo ".. contents:: :depth: 2"; \ + echo; \ + for b in $$bases; do echo $$b; done \ + | $(am__create_global_log); \ + } >$(TEST_SUITE_LOG).tmp || exit 1; \ + mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ + if $$success; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ + fi; \ + echo "$${col}$$br$${std}"; \ + echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \ + echo "$${col}$$br$${std}"; \ + create_testsuite_report --maybe-color; \ + echo "$$col$$br$$std"; \ + if $$success; then :; else \ + echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ + if test -n "$(PACKAGE_BUGREPORT)"; then \ + echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ + fi; \ + echo "$$col$$br$$std"; \ + fi; \ + $$success || exit 1 + +check-TESTS: $(check_PROGRAMS) + @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list + @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + trs_list=`for i in $$bases; do echo $$i.trs; done`; \ + log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ + exit $$?; +recheck: all $(check_PROGRAMS) + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + bases=`for i in $$bases; do echo $$i; done \ + | $(am__list_recheck_tests)` || exit 1; \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + log_list=`echo $$log_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ + am__force_recheck=am--force-recheck \ + TEST_LOGS="$$log_list"; \ + exit $$? +test-quotes.log: test-quotes$(EXEEXT) + @p='test-quotes$(EXEEXT)'; \ + b='test-quotes'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-vector.log: test-vector$(EXEEXT) + @p='test-vector$(EXEEXT)'; \ + b='test-vector'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +.test.log: + @p='$<'; \ + $(am__set_b); \ + $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +@am__EXEEXT_TRUE@.test$(EXEEXT).log: +@am__EXEEXT_TRUE@ @p='$<'; \ +@am__EXEEXT_TRUE@ $(am__set_b); \ +@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ +@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ +@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ +@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +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) +installdirs: +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-am +install-exec: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) 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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) + -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) + -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +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-checkPROGRAMS clean-generic clean-libtool \ + clean-noinstLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/libutils_la-cleanup-nbdkit.Plo + -rm -f ./$(DEPDIR)/libutils_la-cleanup.Plo + -rm -f ./$(DEPDIR)/libutils_la-environ.Plo + -rm -f ./$(DEPDIR)/libutils_la-exit-with-parent.Plo + -rm -f ./$(DEPDIR)/libutils_la-full-rw.Plo + -rm -f ./$(DEPDIR)/libutils_la-quote.Plo + -rm -f ./$(DEPDIR)/libutils_la-utils.Plo + -rm -f ./$(DEPDIR)/libutils_la-vector.Plo + -rm -f ./$(DEPDIR)/libutils_la-windows-compat.Plo + -rm -f ./$(DEPDIR)/libutils_la-windows-errors.Plo + -rm -f ./$(DEPDIR)/test_quotes-quote.Po + -rm -f ./$(DEPDIR)/test_quotes-test-quotes.Po + -rm -f ./$(DEPDIR)/test_vector-test-vector.Po + -rm -f ./$(DEPDIR)/test_vector-vector.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/libutils_la-cleanup-nbdkit.Plo + -rm -f ./$(DEPDIR)/libutils_la-cleanup.Plo + -rm -f ./$(DEPDIR)/libutils_la-environ.Plo + -rm -f ./$(DEPDIR)/libutils_la-exit-with-parent.Plo + -rm -f ./$(DEPDIR)/libutils_la-full-rw.Plo + -rm -f ./$(DEPDIR)/libutils_la-quote.Plo + -rm -f ./$(DEPDIR)/libutils_la-utils.Plo + -rm -f ./$(DEPDIR)/libutils_la-vector.Plo + -rm -f ./$(DEPDIR)/libutils_la-windows-compat.Plo + -rm -f ./$(DEPDIR)/libutils_la-windows-errors.Plo + -rm -f ./$(DEPDIR)/test_quotes-quote.Po + -rm -f ./$(DEPDIR)/test_quotes-test-quotes.Po + -rm -f ./$(DEPDIR)/test_vector-test-vector.Po + -rm -f ./$(DEPDIR)/test_vector-vector.Po + -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: + +.MAKE: all check check-am install install-am install-exec \ + install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \ + check-am clean clean-checkPROGRAMS clean-generic clean-libtool \ + clean-noinstLTLIBRARIES cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am 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 recheck tags tags-am uninstall \ + uninstall-am + +.PRECIOUS: Makefile + +windows-errors.c: windows-errors.txt + @rm -f $@ $@-t + @echo '/* Generated from windows-errors.txt */' > $@-t + @echo '#include ' >> $@-t + @echo '#ifdef WIN32' >> $@-t + @echo '#include ' >> $@-t + @echo '#include ' >> $@-t + @echo '#include ' >> $@-t + @echo '#include ' >> $@-t + @echo 'int' >> $@-t + @echo 'translate_winsock_error (const char *fn, int err) {' >> $@-t +# Always log the original error. + @echo ' nbdkit_debug ("%s: winsock error %d", fn, err);' >> $@-t + @echo ' switch (err) {' >> $@-t + @$(SED) -e '/^#/d' \ + -e '/^$$/d' \ + -e 's/\(.*\)[[:space:]][[:space:]]*\(.*\)/#if defined(\1) \&\& defined(\2)\n\ + case \1: return \2;\n\ +\#endif/' \ + < $< >> $@-t + @echo ' default:' >> $@-t + @echo ' return err > 10000 && err < 10025 ? err - 10000 : EINVAL;' >> $@-t + @echo ' }' >> $@-t + @echo '}' >> $@-t + @echo '#endif /* WIN32 */' >> $@-t + mv $@-t $@ + chmod -w $@ + +bench: test-vector + NBDKIT_BENCH=1 ./test-vector + +# 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/common/utils/bench.h b/common/utils/bench.h new file mode 100644 index 0000000..f1dc0fb --- /dev/null +++ b/common/utils/bench.h @@ -0,0 +1,72 @@ +/* libnbd + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef LIBNBD_BENCH_H +#define LIBNBD_BENCH_H + +#include + +#define MICROSECONDS 1000000 + +struct bench { + struct timeval start, stop; +}; + +static inline void +bench_start (struct bench *b) +{ + gettimeofday (&b->start, NULL); +} + +static inline void +bench_stop (struct bench *b) +{ + gettimeofday (&b->stop, NULL); +} + +static inline double +bench_sec (struct bench *b) +{ + struct timeval dt; + + dt.tv_sec = b->stop.tv_sec - b->start.tv_sec; + dt.tv_usec = b->stop.tv_usec - b->start.tv_usec; + + if (dt.tv_usec < 0) { + dt.tv_sec -= 1; + dt.tv_usec += MICROSECONDS; + } + + return ((double)dt.tv_sec * MICROSECONDS + dt.tv_usec) / MICROSECONDS; +} + +#endif /* LIBNBD_BENCH_H */ diff --git a/common/utils/cleanup-nbdkit.c b/common/utils/cleanup-nbdkit.c new file mode 100644 index 0000000..ec1ebe4 --- /dev/null +++ b/common/utils/cleanup-nbdkit.c @@ -0,0 +1,51 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include + +#include "cleanup.h" +#include "nbdkit-filter.h" + +void +cleanup_extents_free (struct nbdkit_extents **ptr) +{ + nbdkit_extents_free (*ptr); +} + +void +cleanup_exports_free (struct nbdkit_exports **ptr) +{ + nbdkit_exports_free (*ptr); +} diff --git a/common/utils/cleanup.c b/common/utils/cleanup.c new file mode 100644 index 0000000..2308549 --- /dev/null +++ b/common/utils/cleanup.c @@ -0,0 +1,59 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include + +#include "cleanup.h" + +void +cleanup_free (void *ptr) +{ + free (* (void **) ptr); +} + +void +cleanup_mutex_unlock (pthread_mutex_t **ptr) +{ + int r = pthread_mutex_unlock (*ptr); + assert (!r); +} + +void +cleanup_rwlock_unlock (pthread_rwlock_t **ptr) +{ + int r = pthread_rwlock_unlock (*ptr); + assert (!r); +} diff --git a/common/utils/cleanup.h b/common/utils/cleanup.h new file mode 100644 index 0000000..dd0c271 --- /dev/null +++ b/common/utils/cleanup.h @@ -0,0 +1,101 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_CLEANUP_H +#define NBDKIT_CLEANUP_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#include "unique-name.h" + +/* Work around clang bug: https://bugs.llvm.org/show_bug.cgi?id=43482 */ +#ifdef __clang__ +#define CLANG_UNUSED_VARIABLE_WORKAROUND __attribute__ ((__unused__)) +#else +#define CLANG_UNUSED_VARIABLE_WORKAROUND +#endif + +/* cleanup.c */ +extern void cleanup_free (void *ptr); +#define CLEANUP_FREE __attribute__ ((cleanup (cleanup_free))) + +extern void cleanup_mutex_unlock (pthread_mutex_t **ptr); +#define CLEANUP_MUTEX_UNLOCK __attribute__ ((cleanup (cleanup_mutex_unlock))) + +#define ACQUIRE_LOCK_FOR_CURRENT_SCOPE(mutex) \ + ACQUIRE_LOCK_FOR_CURRENT_SCOPE_1 ((mutex), NBDKIT_UNIQUE_NAME (_lock)) +#define ACQUIRE_LOCK_FOR_CURRENT_SCOPE_1(mutex, lock) \ + CLEANUP_MUTEX_UNLOCK pthread_mutex_t *lock = mutex; \ + do { \ + int _r = pthread_mutex_lock (lock); \ + assert (!_r); \ + } while (0) + +extern void cleanup_rwlock_unlock (pthread_rwlock_t **ptr); +#define CLEANUP_RWLOCK_UNLOCK __attribute__ ((cleanup (cleanup_rwlock_unlock))) + +#define ACQUIRE_WRLOCK_FOR_CURRENT_SCOPE(rwlock) \ + ACQUIRE_WRLOCK_FOR_CURRENT_SCOPE_1 ((rwlock), NBDKIT_UNIQUE_NAME (_lock)) +#define ACQUIRE_WRLOCK_FOR_CURRENT_SCOPE_1(rwlock, lock) \ + CLEANUP_RWLOCK_UNLOCK pthread_rwlock_t *lock = rwlock; \ + do { \ + int _r = pthread_rwlock_wrlock (lock); \ + assert (!_r); \ + } while (0) + +#define ACQUIRE_RDLOCK_FOR_CURRENT_SCOPE(rwlock) \ + ACQUIRE_RDLOCK_FOR_CURRENT_SCOPE_1 ((rwlock), NBDKIT_UNIQUE_NAME (_lock)) +#define ACQUIRE_RDLOCK_FOR_CURRENT_SCOPE_1(rwlock, lock) \ + CLEANUP_RWLOCK_UNLOCK pthread_rwlock_t *lock = rwlock; \ + do { \ + int _r = pthread_rwlock_rdlock (lock); \ + assert (!_r); \ + } while (0) + +/* cleanup-nbdkit.c */ +struct nbdkit_extents; +extern void cleanup_extents_free (struct nbdkit_extents **ptr); +#define CLEANUP_EXTENTS_FREE __attribute__ ((cleanup (cleanup_extents_free))) +struct nbdkit_exports; +extern void cleanup_exports_free (struct nbdkit_exports **ptr); +#define CLEANUP_EXPORTS_FREE __attribute__ ((cleanup (cleanup_exports_free))) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* NBDKIT_CLEANUP_H */ diff --git a/common/utils/const-string-vector.h b/common/utils/const-string-vector.h new file mode 100644 index 0000000..621e543 --- /dev/null +++ b/common/utils/const-string-vector.h @@ -0,0 +1,46 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +/* Extensible list of const strings. The implementation uses vector.h. */ + +#ifndef CONST_STRING_VECTOR_H +#define CONST_STRING_VECTOR_H + +#include "vector.h" + +DEFINE_VECTOR_TYPE (const_string_vector, const char *); + +/* This frees only the array. */ +#define CLEANUP_FREE_CONST_STRING_VECTOR \ + __attribute__ ((cleanup (const_string_vector_reset))) + +#endif /* CONST_STRING_VECTOR_H */ diff --git a/common/utils/environ.c b/common/utils/environ.c new file mode 100644 index 0000000..4fa9d2c --- /dev/null +++ b/common/utils/environ.c @@ -0,0 +1,116 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include +#include + +#include + +#include "utils.h" +#include "string-vector.h" + +/* Copy an environ. Also this allows you to add (key, value) pairs to + * the environ through the varargs NULL-terminated list. Returns NULL + * if the copy or allocation failed. + */ +char ** +copy_environ (char **env, ...) +{ + string_vector ret = empty_vector; + size_t i, len; + char *s; + va_list argp; + const char *key, *value; + + /* Copy the existing keys into the new vector. */ + for (i = 0; env[i] != NULL; ++i) { + s = strdup (env[i]); + if (s == NULL) { + nbdkit_error ("strdup: %m"); + goto error; + } + if (string_vector_append (&ret, s) == -1) { + nbdkit_error ("realloc: %m"); + goto error; + } + } + + /* Add the new keys. */ + va_start (argp, env); + while ((key = va_arg (argp, const char *)) != NULL) { + value = va_arg (argp, const char *); + if (asprintf (&s, "%s=%s", key, value) == -1) { + nbdkit_error ("asprintf: %m"); + va_end (argp); + goto error; + } + + /* Search for key in the existing environment. It's O(n^2) ... */ + len = strlen (key); + for (i = 0; i < ret.len; ++i) { + if (strncmp (key, ret.ptr[i], len) == 0 && ret.ptr[i][len] == '=') { + /* Replace the existing key. */ + free (ret.ptr[i]); + ret.ptr[i] = s; + goto found; + } + } + + /* Else, append a new key. */ + if (string_vector_append (&ret, s) == -1) { + nbdkit_error ("realloc: %m"); + va_end (argp); + free (s); + goto error; + } + + found: ; + } + va_end (argp); + + /* Append a NULL pointer. */ + if (string_vector_append (&ret, NULL) == -1) { + nbdkit_error ("realloc: %m"); + goto error; + } + + /* Return the list of strings. */ + return ret.ptr; + + error: + string_vector_empty (&ret); + return NULL; +} diff --git a/common/utils/exit-with-parent.c b/common/utils/exit-with-parent.c new file mode 100644 index 0000000..b57c40b --- /dev/null +++ b/common/utils/exit-with-parent.c @@ -0,0 +1,174 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +/* Implement the --exit-with-parent feature on operating systems which + * support it. + */ + +#include + +#include +#include +#include + +#ifdef HAVE_SYS_PRCTL_H +#include +#endif + +#ifdef HAVE_SYS_PROCCTL_H +#include +#endif + +#if defined (HAVE_SYS_PRCTL_H) && defined (PR_SET_PDEATHSIG) + +/* For Linux >= 2.1.57. */ + +int +set_exit_with_parent (void) +{ + return prctl (PR_SET_PDEATHSIG, SIGTERM); +} + +bool +can_exit_with_parent (void) +{ + return true; +} + +#elif defined (HAVE_SYS_PROCCTL_H) && defined (PROC_PDEATHSIG_CTL) + +/* For FreeBSD >= 11.2 */ + +int +set_exit_with_parent (void) +{ + const int sig = SIGTERM; + return procctl (P_PID, 0, PROC_PDEATHSIG_CTL, (void*) &sig); +} + +bool +can_exit_with_parent (void) +{ + return true; +} + +#elif defined (__APPLE__) + +/* For macOS. */ + +#include +#include +#include +#include + +#include "nbdkit-plugin.h" + +static void * +exit_with_parent_loop (void *vp) +{ + const pid_t ppid = getppid (); + int fd; + struct kevent kev, res[1]; + int r; + + nbdkit_debug ("macOS: --exit-with-parent: " + "registering exit with parent for ppid %d", + (int) ppid); + + /* Register the kevent to wait for ppid to exit. */ + fd = kqueue (); + if (fd == -1) { + nbdkit_error ("exit_with_parent_loop: kqueue: %m"); + return NULL; + } + EV_SET (&kev, ppid, EVFILT_PROC, EV_ADD|EV_ENABLE, NOTE_EXIT, 0, NULL); + if (kevent (fd, &kev, 1, NULL, 0, NULL) == -1) { + nbdkit_error ("exit_with_parent_loop: kevent: %m"); + close (fd); + return NULL; + } + + /* Wait for the kevent to happen. */ + r = kevent (fd, 0, 0, res, 1, NULL); + if (r == 1 && res[0].ident == ppid) { + /* Shut down the whole process when the parent dies. */ + nbdkit_debug ("macOS: --exit-with-parent: " + "exit because parent process died"); + nbdkit_shutdown (); + } + + return NULL; +} + +int +set_exit_with_parent (void) +{ + int r; + pthread_attr_t attrs; + pthread_t exit_with_parent_thread; + + /* We have to block waiting for kevent, so that requires that we + * start a background thread. + */ + pthread_attr_init (&attrs); + pthread_attr_setdetachstate (&attrs, PTHREAD_CREATE_DETACHED); + r = pthread_create (&exit_with_parent_thread, NULL, + exit_with_parent_loop, NULL); + if (r != 0) { + errno = r; + return -1; + } + + return 0; +} + +bool +can_exit_with_parent (void) +{ + return true; +} + +#else /* any platform that doesn't support this function */ + +int +set_exit_with_parent (void) +{ + abort (); +} + +bool +can_exit_with_parent (void) +{ + return false; +} + +#endif diff --git a/common/utils/exit-with-parent.h b/common/utils/exit-with-parent.h new file mode 100644 index 0000000..a390633 --- /dev/null +++ b/common/utils/exit-with-parent.h @@ -0,0 +1,46 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_EXIT_WITH_PARENT_H +#define NBDKIT_EXIT_WITH_PARENT_H + +#include + +/* Test if the feature is available on the platform. */ +extern bool can_exit_with_parent (void); + +/* --exit-with-parent: kill the current process if the parent exits. + * This may return -1 on error. + */ +extern int set_exit_with_parent (void); + +#endif /* NBDKIT_EXIT_WITH_PARENT_H */ diff --git a/common/utils/full-rw.c b/common/utils/full-rw.c new file mode 100644 index 0000000..1160717 --- /dev/null +++ b/common/utils/full-rw.c @@ -0,0 +1,84 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +/* These functions are like pread(2)/pwrite(2) but they always read or + * write the full amount, or fail. + */ + +#include + +#include +#include +#include +#include + +#include "pread.h" +#include "pwrite.h" + +ssize_t +full_pread (int fd, void *buf, size_t count, off_t offset) +{ + ssize_t ret = 0, r; + + while (count > 0) { + r = pread (fd, buf, count, offset); + if (r == -1) return -1; + if (r == 0) { + /* Presumably the caller wasn't expecting end-of-file here, so + * return an error. + */ + errno = EIO; + return -1; + } + ret += r; + offset += r; + count -= r; + } + + return ret; +} + +ssize_t +full_pwrite (int fd, const void *buf, size_t count, off_t offset) +{ + ssize_t ret = 0, r; + + while (count > 0) { + r = pwrite (fd, buf, count, offset); + if (r == -1) return -1; + ret += r; + offset += r; + count -= r; + } + + return ret; +} diff --git a/common/utils/nbdkit-string.h b/common/utils/nbdkit-string.h new file mode 100644 index 0000000..b09a836 --- /dev/null +++ b/common/utils/nbdkit-string.h @@ -0,0 +1,43 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +/* Extensible string. The implementation uses vector.h. */ + +#ifndef NBDKIT_STRING_H +#define NBDKIT_STRING_H + +#include "vector.h" + +DEFINE_VECTOR_TYPE (string, char); +#define CLEANUP_FREE_STRING __attribute__ ((cleanup (string_reset))) + +#endif /* NBDKIT_STRING_H */ diff --git a/common/utils/quote.c b/common/utils/quote.c new file mode 100644 index 0000000..19f4d62 --- /dev/null +++ b/common/utils/quote.c @@ -0,0 +1,138 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include +#include + +#include "ascii-ctype.h" +#include "hexdigit.h" + +/* Print str to fp, shell quoting if necessary. This comes from + * libguestfs, but was written by me so I'm relicensing it to a BSD + * license for nbdkit. + */ +void +shell_quote (const char *str, FILE *fp) +{ + /* Note possible bug in this list (XXX): + * https://www.redhat.com/archives/libguestfs/2019-February/msg00036.html + */ + const char *safe_chars = + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_=,:/"; + size_t i, len; + + /* If the string consists only of safe characters, output it as-is. */ + len = strlen (str); + if (len > 0 && len == strspn (str, safe_chars)) { + fputs (str, fp); + return; + } + + /* Double-quote the string. */ + fputc ('"', fp); + for (i = 0; i < len; ++i) { + switch (str[i]) { + case '$': case '`': case '\\': case '"': + fputc ('\\', fp); + /*FALLTHROUGH*/ + default: + fputc (str[i], fp); + } + } + fputc ('"', fp); +} + +/* Print str to fp, URI quoting if necessary. + * The resulting string is safe for use in a URI path or query component, + * and can be passed through the shell without further quoting. + */ +void +uri_quote (const char *str, FILE *fp) +{ + /* safe_chars contains the RFC 3986 unreserved characters plus '/'. */ + const char *safe_chars = + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_~/"; + size_t i, len; + + /* If the string consists only of safe characters, output it as-is. */ + len = strlen (str); + if (len == strspn (str, safe_chars)) { + fputs (str, fp); + return; + } + + for (i = 0; i < len; ++i) { + if (strchr (safe_chars, str[i])) + fputc (str[i], fp); + else + fprintf (fp, "%%%02X", str[i] & 0xff); + } +} + +/* Print str to fp, quoting in a way similar to C strings, for example + * '\n' -> "\n". + * + * Note that we do not emit quotes around the string, and double + * quotes within the string are not escaped. + */ +void +c_string_quote (const char *str, FILE *fp) +{ + size_t i; + char c; + + for (i = 0; c = str[i], c != '\0'; ++i) { + switch (c) { + case '\\': fputc ('\\', fp); fputc ('\\', fp); break; + case '\a': fputc ('\\', fp); fputc ('a', fp); break; + case '\b': fputc ('\\', fp); fputc ('b', fp); break; + case '\f': fputc ('\\', fp); fputc ('f', fp); break; + case '\n': fputc ('\\', fp); fputc ('n', fp); break; + case '\r': fputc ('\\', fp); fputc ('r', fp); break; + case '\t': fputc ('\\', fp); fputc ('t', fp); break; + case '\v': fputc ('\\', fp); fputc ('v', fp); break; + default: + if (ascii_isprint (c)) + fputc (c, fp); + else { + fputc ('\\', fp); + fputc ('x', fp); + fputc (hexchar (c >> 4), fp); + fputc (hexchar (c), fp); + } + } + } +} diff --git a/common/utils/string-vector.h b/common/utils/string-vector.h new file mode 100644 index 0000000..f30e1e1 --- /dev/null +++ b/common/utils/string-vector.h @@ -0,0 +1,46 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +/* Extensible list of strings. The implementation uses vector.h. */ + +#ifndef STRING_VECTOR_H +#define STRING_VECTOR_H + +#include "vector.h" + +DEFINE_POINTER_VECTOR_TYPE (string_vector, char *); + +/* This frees both the array and the strings. */ +#define CLEANUP_FREE_STRING_VECTOR \ + __attribute__ ((cleanup (string_vector_empty))) + +#endif /* STRING_VECTOR_H */ diff --git a/common/utils/test-quotes.c b/common/utils/test-quotes.c new file mode 100644 index 0000000..2a8409d --- /dev/null +++ b/common/utils/test-quotes.c @@ -0,0 +1,114 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +/* Unit tests of utils quoting code. */ + +#include + +#include +#include +#include +#undef NDEBUG /* Keep test strong even for nbdkit built without assertions */ +#include +#include + +#include "array-size.h" +#include "utils.h" + +#ifdef HAVE_OPEN_MEMSTREAM + +static bool +test (const char *orig, const char *fnname, void (*fn) (const char *, FILE *), + const char *exp) +{ + char *str = NULL; + size_t str_len = 0; + FILE *fp; + + fp = open_memstream (&str, &str_len); + assert (fp); + fn (orig, fp); + if (fclose (fp) == EOF) + assert (false); + if (str_len == 0 && !str) + str = strdup (""); + assert (str); + + if (strcmp (str, exp)) { + fprintf (stderr, "%s failed, got '%s' expected '%s'\n", + fnname, str, exp); + free (str); + return true; + } + free (str); + return false; +} + +int +main (void) +{ + struct { + const char *orig; + const char *shell; + const char *uri; + } tests[] = { + { "a-b_c.0", "a-b_c.0", "a-b_c.0" }, + { "/Safe/Path", "/Safe/Path", "/Safe/Path" }, + { "a~b", "\"a~b\"", "a~b" }, + { "", "\"\"", "" }, + { "a=b", "a=b", "a%3Db" }, /* XXX shell wrong if used as argv[0] */ + { "a;b", "\"a;b\"", "a%3Bb" }, + { "a b", "\"a b\"", "a%20b" }, + { "a%b", "\"a%b\"", "a%25b" }, + { "a'b\"c$d`e\\f", "\"a'b\\\"c\\$d\\`e\\\\f\"", "a%27b%22c%24d%60e%5Cf" }, + }; + size_t i; + bool fail = false; + + for (i = 0; i < ARRAY_SIZE (tests); i++) { + fail |= test (tests[i].orig, "shell_quote", shell_quote, tests[i].shell); + fail |= test (tests[i].orig, "uri_quote", uri_quote, tests[i].uri); + } + return fail ? EXIT_FAILURE : EXIT_SUCCESS; +} + +#else /* !OPEN_MEMSTREAM */ + +int +main (int argc, char *argv[]) +{ + fprintf (stderr, "%s: test skipped because no support for open_memstream\n", + argv[0]); + exit (77); +} + +#endif /* !OPEN_MEMSTREAM */ diff --git a/common/utils/test-vector.c b/common/utils/test-vector.c new file mode 100644 index 0000000..27ae1ea --- /dev/null +++ b/common/utils/test-vector.c @@ -0,0 +1,263 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include +#include +#include +#include + +#undef NDEBUG /* Keep test strong even for nbdkit built without assertions */ +#include + +#include "bench.h" +#include "const-string-vector.h" +#include "nbdkit-string.h" +#include "string-vector.h" +#include "vector.h" + +#define APPENDS 1000000 + +DEFINE_VECTOR_TYPE (int64_vector, int64_t); +DEFINE_VECTOR_TYPE (uint32_vector, uint32_t); + +static int +compare (const int64_t *a, const int64_t *b) +{ + return (*a > *b) - (*a < *b); +} + +static void +test_int64_vector (void) +{ + int64_vector v = empty_vector; + size_t i; + int64_t tmp, *p; + + for (i = 0; i < 10; ++i) { + int r = int64_vector_insert (&v, i, 0); + assert (r == 0); + } + + for (i = 0; i < 10; ++i) + assert (v.ptr[i] == 9 - i); + int64_vector_sort (&v, compare); + for (i = 0; i < 10; ++i) + assert (v.ptr[i] == i); + + int64_vector_remove (&v, 1); + assert (v.len == 9); + assert (v.ptr[1] == 2); + + tmp = 10; + p = int64_vector_search (&v, &tmp, (void*) compare); + assert (p == NULL); + tmp = 8; + p = int64_vector_search (&v, &tmp, (void*) compare); + assert (p == &v.ptr[7]); + + free (v.ptr); +} + +static void +test_string_concat (string *s, const char *append) +{ + const size_t len = strlen (append); + size_t i; + int r; + + r = string_reserve (s, len); + assert (r == 0); + + /* The contract is that after calling string_reserve with 'n', we + * can append up to 'n' items to the vector without failing. + */ + for (i = 0; i < len; ++i) { + r = string_append (s, append[i]); + assert (r == 0); + } +} + +static void +test_string (void) +{ + string s = empty_vector; + int r; + char nul = 0; + + test_string_concat (&s, "hello"); + test_string_concat (&s, " world"); + r = string_append (&s, nul); + assert (r == 0); + + assert (strcmp (s.ptr, "hello world") == 0); + assert (s.len == 12); /* hello + space + world + \0 */ + free (s.ptr); +} + +static void +test_string_vector (void) +{ + CLEANUP_FREE_STRING_VECTOR string_vector v = empty_vector; + size_t i; + int r; + + for (i = 0; i < 10; ++i) { + char *s; + + r = asprintf (&s, "number %zu", i); + assert (r >= 0); + r = string_vector_append (&v, s); + assert (r == 0); + } + /* NULL-terminate the strings. */ + r = string_vector_append (&v, NULL); + assert (r == 0); + + /* Now print them. */ + for (i = 0; v.ptr[i] != NULL; ++i) + printf ("%s\n", v.ptr[i]); + assert (i == 10); +} + +static void +test_const_string_vector (void) +{ + CLEANUP_FREE_CONST_STRING_VECTOR const_string_vector v = empty_vector; + size_t i; + int r; + + r = const_string_vector_append (&v, "abc"); + assert (r >= 0); + r = const_string_vector_append (&v, "def"); + assert (r >= 0); + r = const_string_vector_append (&v, "ghi"); + assert (r >= 0); + r = const_string_vector_append (&v, "jkl"); + assert (r >= 0); + + /* NULL-terminate the strings. */ + r = const_string_vector_append (&v, NULL); + assert (r == 0); + + /* Now print them. */ + for (i = 0; v.ptr[i] != NULL; ++i) + printf ("%s\n", v.ptr[i]); + assert (i == 4); +} + +/* Test size_t overflow. */ +static void +test_overflow (void) +{ + string s = empty_vector; + int r; + + /* It should be impossible to reserve SIZE_MAX - epsilon. */ + r = string_reserve (&s, SIZE_MAX - 10000); + assert (r == -1); + assert (errno == ENOMEM); +} + +static void +bench_reserve (void) +{ + uint32_vector v = empty_vector; + struct bench b; + uint32_t i; + + bench_start (&b); + + uint32_vector_reserve (&v, APPENDS); + + for (i = 0; i < APPENDS; i++) { + uint32_vector_append (&v, i); + } + + bench_stop (&b); + + assert (v.ptr[APPENDS-1] == APPENDS-1); + free (v.ptr); + + printf ("bench_reserve: %d appends in %.6f s\n", APPENDS, bench_sec (&b)); +} + +static void +bench_append (void) +{ + uint32_vector v = empty_vector; + struct bench b; + uint32_t i; + + bench_start (&b); + + for (i = 0; i < APPENDS; i++) { + uint32_vector_append (&v, i); + } + + bench_stop (&b); + + assert (v.ptr[APPENDS - 1] == APPENDS - 1); + free (v.ptr); + + printf ("bench_append: %d appends in %.6f s\n", APPENDS, bench_sec (&b)); +} + +int +main (int argc, char *argv[]) +{ + const char *s; + bool bench; + + s = getenv ("NBDKIT_BENCH"); + bench = s && strcmp (s, "1") == 0; + + if (!bench) { + /* Do normal tests. */ + test_int64_vector (); + test_string (); + test_string_vector (); + test_const_string_vector (); + test_overflow (); + } + + else { + /* Do benchmarks. */ + bench_reserve (); + bench_append (); + } + + return 0; +} diff --git a/common/utils/utils.c b/common/utils/utils.c new file mode 100644 index 0000000..0e46ade --- /dev/null +++ b/common/utils/utils.c @@ -0,0 +1,234 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +#ifdef HAVE_SYS_WAIT_H +#include +#endif + +#include + +#include "windows-compat.h" + +#ifndef WIN32 + +/* Convert exit status to nbd_error. If the exit status was nonzero + * or another failure then -1 is returned. + */ +int +exit_status_to_nbd_error (int status, const char *cmd) +{ + if (WIFEXITED (status) && WEXITSTATUS (status) != 0) { + nbdkit_error ("%s: command failed with exit code %d", + cmd, WEXITSTATUS (status)); + return -1; + } + else if (WIFSIGNALED (status)) { + nbdkit_error ("%s: command was killed by signal %d", + cmd, WTERMSIG (status)); + return -1; + } + else if (WIFSTOPPED (status)) { + nbdkit_error ("%s: command was stopped by signal %d", + cmd, WSTOPSIG (status)); + return -1; + } + + return 0; +} + +#else /* WIN32 */ + +/* This assumes we're using Win32 system(). See: + * https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/system-wsystem?view=vs-2019 + */ +int +exit_status_to_nbd_error (int status, const char *cmd) +{ + if (status == 0) + return 0; + + nbdkit_error ("%s: command failed: errno = %d", cmd, errno); + return -1; +} + +#endif /* WIN32 */ + +#ifndef WIN32 + +/* Set the FD_CLOEXEC flag on the given fd, if it is non-negative. + * On failure, close fd and return -1; on success, return fd. + * + * Note that this function should ONLY be used on platforms that lack + * atomic CLOEXEC support during fd creation (such as Haiku in 2019); + * when using it as a fallback path, you must also consider how to + * prevent fd leaks to plugins that want to fork(). + */ +int +set_cloexec (int fd) +{ +#if (defined SOCK_CLOEXEC && defined HAVE_MKOSTEMP && defined HAVE_PIPE2 && \ + defined HAVE_ACCEPT4) + nbdkit_error ("prefer creating fds with CLOEXEC atomically set"); + close (fd); + errno = EBADF; + return -1; +#else +# if !defined __APPLE__ && \ + (defined SOCK_CLOEXEC || defined HAVE_MKOSTEMP || defined HAVE_PIPE2 || \ + defined HAVE_ACCEPT4) +# error "Unexpected: your system has incomplete atomic CLOEXEC support" +# endif + int f; + int err; + + if (fd == -1) + return -1; + + f = fcntl (fd, F_GETFD); + if (f == -1 || fcntl (fd, F_SETFD, f | FD_CLOEXEC) == -1) { + err = errno; + nbdkit_error ("fcntl: %m"); + close (fd); + errno = err; + return -1; + } + return fd; +#endif +} + +#else /* WIN32 */ + +int +set_cloexec (int fd) +{ + return fd; +} + +#endif /* WIN32 */ + +#ifndef WIN32 + +/* Set the O_NONBLOCK flag on the given fd, if it is non-negative. + * On failure, close fd and return -1; on success, return fd. + */ +int +set_nonblock (int fd) +{ + int f; + int err; + + if (fd == -1) + return -1; + + f = fcntl (fd, F_GETFL); + if (f == -1 || fcntl (fd, F_SETFL, f | O_NONBLOCK) == -1) { + err = errno; + nbdkit_error ("fcntl: %m"); + close (fd); + errno = err; + return -1; + } + return fd; +} + +#else /* WIN32 */ + +int +set_nonblock (int fd) +{ + return fd; +} + +#endif /* WIN32 */ + +#ifndef WIN32 + +char * +make_temporary_directory (void) +{ + char template[] = "/tmp/nbdkitXXXXXX"; + + if (mkdtemp (template) == NULL) + return NULL; + + return strdup (template); +} + +#else /* WIN32 */ + +char * +make_temporary_directory (void) +{ + char tmppath[MAX_PATH]; + char tmpname[MAX_PATH]; + DWORD ret; + + ret = GetTempPath (MAX_PATH, tmppath); + if (ret > MAX_PATH || ret == 0) { + fprintf (stderr, "mkdtemp: GetTempPath: %lu\n", GetLastError ()); + return NULL; + } + + ret = GetTempFileName (tmppath, TEXT ("nbdkit"), 0, tmpname); + if (!ret) { + fprintf (stderr, "mkdtemp: GetTempFileName: %lu\n", GetLastError ()); + return NULL; + } + + /* The above function actually creates the file, so we must remove + * it before creating the directory. Not ideal because it leaves a + * small window for exploitation (XXX). + */ + unlink (tmpname); + + if (mkdir (tmpname) == -1) { + fprintf (stderr, "mkdtemp: mkdir: %s: %lu\n", tmpname, GetLastError ()); + return NULL; + } + + return strdup (tmpname); +} + +#endif /* WIN32 */ diff --git a/common/utils/utils.h b/common/utils/utils.h new file mode 100644 index 0000000..1e6d897 --- /dev/null +++ b/common/utils/utils.h @@ -0,0 +1,48 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_UTILS_H +#define NBDKIT_UTILS_H + +extern void shell_quote (const char *str, FILE *fp); +extern void uri_quote (const char *str, FILE *fp); +extern void c_string_quote (const char *str, FILE *fp); +extern int exit_status_to_nbd_error (int status, const char *cmd); +extern int set_cloexec (int fd); +extern int set_nonblock (int fd); +extern char **copy_environ (char **env, ...) __attribute__ ((__sentinel__)); +extern char *make_temporary_directory (void); +extern ssize_t full_pread (int fd, void *buf, size_t count, off_t offset); +extern ssize_t full_pwrite (int fd, const void *buf, size_t count, + off_t offset); + +#endif /* NBDKIT_UTILS_H */ diff --git a/common/utils/vector.c b/common/utils/vector.c new file mode 100644 index 0000000..8dcb466 --- /dev/null +++ b/common/utils/vector.c @@ -0,0 +1,159 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include +#include +#include + +#include "checked-overflow.h" +#include "posix_memalign.h" +#include "sysconf.h" +#include "vector.h" + +static int +calculate_capacity (struct generic_vector *v, size_t n, size_t itemsize, + size_t *newcap_r, size_t *newbytes_r) +{ + size_t reqcap, reqbytes, newcap, newbytes, t; + + /* New capacity requested. We must allocate this minimum (or fail). + * reqcap = v->cap + n + * reqbytes = reqcap * itemsize + */ + if (ADD_OVERFLOW (v->cap, n, &reqcap) || + MUL_OVERFLOW (reqcap, itemsize, &reqbytes)) { + errno = ENOMEM; + return -1; + } + + /* However for the sake of optimization, scale buffer by 3/2 so that + * repeated reservations don't call realloc often. + * newcap = v->cap + (v->cap + 1) / 2 + * newbytes = newcap * itemsize + */ + if (ADD_OVERFLOW (v->cap, 1u, &t) || + ADD_OVERFLOW (v->cap, t/2, &newcap) || + MUL_OVERFLOW (newcap, itemsize, &newbytes) || + newbytes < reqbytes) { + /* If that either overflows or is less than the minimum requested, + * fall back to the requested capacity. + */ + newcap = reqcap; + newbytes = reqbytes; + } + + *newcap_r = newcap; + *newbytes_r = newbytes; + return 0; +} + +int +generic_vector_reserve (struct generic_vector *v, size_t n, size_t itemsize) +{ + void *newptr; + size_t newcap, newbytes; + + if (calculate_capacity (v, n, itemsize, &newcap, &newbytes) == -1) + return -1; + + newptr = realloc (v->ptr, newbytes); + if (newptr == NULL) + return -1; + + v->ptr = newptr; + v->cap = newcap; + return 0; +} + +/* Always allocates a buffer which is page aligned (both base and size). */ +int +generic_vector_reserve_page_aligned (struct generic_vector *v, + size_t n, size_t itemsize) +{ + int r; + void *newptr; + size_t newcap, newbytes; + long pagesize; + size_t extra, extra_items; + + pagesize = sysconf (_SC_PAGESIZE); + assert (pagesize > 1); + + assert (pagesize % itemsize == 0); + + if (calculate_capacity (v, n, itemsize, &newcap, &newbytes) == -1) + return -1; + + /* If the new size (in bytes) is not a full page then we have to + * round up to the next page. + */ + extra = newbytes & (pagesize - 1); + if (extra > 0) { + extra_items = (pagesize - extra) / itemsize; + + if (ADD_OVERFLOW (newcap, extra_items, &newcap) || + ADD_OVERFLOW (newbytes, extra_items * itemsize, &newbytes)) { + errno = ENOMEM; + return -1; + } + } + + if ((r = posix_memalign (&newptr, pagesize, newbytes)) != 0) { + errno = r; + return -1; + } + + /* How much to copy here? + * + * vector_reserve always makes the buffer larger so we don't have to + * deal with the case of a shrinking buffer. + * + * Like the underlying realloc we do not have to zero the newly + * reserved elements. + * + * However (like realloc) we have to copy the existing elements even + * those that are not allocated and only reserved (between 'len' and + * 'cap'). + * + * The spec of vector is not clear on the last two points, but + * existing code depends on this undocumented behaviour. + */ + memcpy (newptr, v->ptr, v->cap * itemsize); + free (v->ptr); + v->ptr = newptr; + v->cap = newcap; + return 0; +} diff --git a/common/utils/vector.h b/common/utils/vector.h new file mode 100644 index 0000000..7337d26 --- /dev/null +++ b/common/utils/vector.h @@ -0,0 +1,256 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +/* Simple implementation of a vector. It can be cheaply appended, and + * more expensively inserted. There are two main use-cases we + * consider: lists of strings (either with a defined length, or + * NULL-terminated), and lists of numbers. It is generic so could be + * used for lists of anything (eg. structs) where being able to append + * easily is important. + */ + +#ifndef NBDKIT_VECTOR_H +#define NBDKIT_VECTOR_H + +#include +#include + +#include "compiler-macros.h" +#include "static-assert.h" + +#ifdef __clang__ +#pragma clang diagnostic ignored "-Wunused-function" +#pragma clang diagnostic ignored "-Wduplicate-decl-specifier" +#endif + +/* Use of this macro defines a new type called ‘name’ containing an + * extensible vector of ‘type’ elements. For example: + * + * DEFINE_VECTOR_TYPE (string_vector, char *); + * + * defines a new type called ‘string_vector’ as a vector of ‘char *’. + * You can create variables of this type: + * + * string_vector names = empty_vector; + * + * or + * + * string_vector names; + * names = (string_vector)empty_vector; + * + * where ‘names.ptr[]’ will be an array of strings and ‘names.len’ + * will be the number of strings. There are no get/set accessors. To + * iterate over the strings you can use the ‘.ptr’ field directly: + * + * for (size_t i = 0; i < names.len; ++i) + * printf ("%s\n", names.ptr[i]); + * + * Initializing with ‘empty_vector’, or assigning the compound literal + * ‘(string_vector)empty_vector’, sets ‘.ptr = NULL’ and ‘.len = 0’. + * + * DEFINE_VECTOR_TYPE also defines utility functions. For the full + * list see the definition below, but useful functions include: + * + * ‘name’_append (eg. ‘string_vector_append’) + * - Append a new element at the end. This operation is cheap. + * + * ‘name’_insert (eg. ‘string_vector_insert’) + * - Insert a new element at the beginning, middle or end. This + * operation is more expensive because existing elements may need + * to be copied around. + * + * Both functions extend the vector if required, and so both may fail + * (returning -1) which you must check for. + */ +#define DEFINE_VECTOR_TYPE(name, type) \ + struct name { \ + type *ptr; /* Pointer to array of items. */ \ + size_t len; /* Number of valid items in the array. */ \ + size_t cap; /* Maximum number of items. */ \ + }; \ + typedef struct name name; \ + \ + /* Reserve n elements at the end of the vector. Note space is \ + * allocated and capacity is increased, but the vector length is \ + * not increased and the new elements are not initialized. \ + */ \ + static inline int __attribute__ ((__unused__)) \ + name##_reserve (name *v, size_t n) \ + { \ + return generic_vector_reserve ((struct generic_vector *)v, n, \ + sizeof (type)); \ + } \ + \ + /* Same as _reserve, but the allocation will be page aligned. Note \ + * that the machine page size must be divisible by sizeof (type). \ + */ \ + static inline int __attribute__ ((__unused__)) \ + name##_reserve_page_aligned (name *v, size_t n) \ + { \ + return generic_vector_reserve_page_aligned ((struct generic_vector *)v, \ + n, sizeof (type)); \ + } \ + \ + /* Insert at i'th element. i=0 => beginning i=len => append */ \ + static inline int __attribute__ ((__unused__)) \ + name##_insert (name *v, type elem, size_t i) \ + { \ + assert (i <= v->len); \ + if (v->len >= v->cap) { \ + if (name##_reserve (v, 1) == -1) return -1; \ + } \ + memmove (&v->ptr[i+1], &v->ptr[i], (v->len-i) * sizeof (elem)); \ + v->ptr[i] = elem; \ + v->len++; \ + return 0; \ + } \ + \ + /* Append a new element to the end of the vector. */ \ + static inline int __attribute__ ((__unused__)) \ + name##_append (name *v, type elem) \ + { \ + return name##_insert (v, elem, v->len); \ + } \ + \ + /* Remove i'th element. i=0 => beginning i=len-1 => end */ \ + static inline void __attribute__ ((__unused__)) \ + name##_remove (name *v, size_t i) \ + { \ + assert (i < v->len); \ + memmove (&v->ptr[i], &v->ptr[i+1], (v->len-i-1) * sizeof (type)); \ + v->len--; \ + } \ + \ + /* Remove all elements and deallocate the vector. */ \ + static inline void __attribute__ ((__unused__)) \ + name##_reset (name *v) \ + { \ + free (v->ptr); \ + v->ptr = NULL; \ + v->len = v->cap = 0; \ + } \ + \ + /* Iterate over the vector, calling f() on each element. */ \ + static inline void __attribute__ ((__unused__)) \ + name##_iter (name *v, void (*f) (type elem)) \ + { \ + size_t i; \ + for (i = 0; i < v->len; ++i) \ + f (v->ptr[i]); \ + } \ + \ + /* Sort the elements of the vector. */ \ + static inline void __attribute__ ((__unused__)) \ + name##_sort (name *v, \ + int (*compare) (const type *p1, const type *p2)) \ + { \ + qsort (v->ptr, v->len, sizeof (type), (void *) compare); \ + } \ + \ + /* Search for an exactly matching element in the vector using a \ + * binary search. Returns a pointer to the element or NULL. \ + */ \ + static inline type * __attribute__ ((__unused__)) \ + name##_search (const name *v, const void *key, \ + int (*compare) (const void *key, const type *v)) \ + { \ + return bsearch (key, v->ptr, v->len, sizeof (type), \ + (void *) compare); \ + } \ + \ + /* Make a new vector with the same elements. */ \ + static inline int __attribute__ ((__unused__)) \ + name##_duplicate (name *v, name *copy) \ + { \ + /* Note it's allowed for v and copy to be the same pointer. */ \ + type *vptr = v->ptr; \ + type *newptr; \ + size_t len = v->len * sizeof (type); \ + \ + newptr = malloc (len); \ + if (newptr == NULL) return -1; \ + memcpy (newptr, vptr, len); \ + copy->ptr = newptr; \ + copy->len = copy->cap = v->len; \ + return 0; \ + } \ + \ + /* End with duplicate declaration, so callers must supply ';'. */ \ + struct name + +#define empty_vector { .ptr = NULL, .len = 0, .cap = 0 } + +/* This macro should only be used if: + * - the vector contains pointers, and + * - the pointed-to objects are: + * - neither const- nor volatile-qualified, and + * - allocated with malloc() or equivalent. + */ +#define ADD_VECTOR_EMPTY_METHOD(name) \ + /* Call free() on each element of the vector, then reset the vector. \ + */ \ + static inline void __attribute__ ((__unused__)) \ + name##_empty (name *v) \ + { \ + size_t i; \ + for (i = 0; i < v->len; ++i) { \ + STATIC_ASSERT (TYPE_IS_POINTER (v->ptr[i]), \ + _vector_contains_pointers); \ + free (v->ptr[i]); \ + } \ + name##_reset (v); \ + } \ + \ + /* Force callers to supply ';'. */ \ + struct name + +/* Convenience macro tying together DEFINE_VECTOR_TYPE() and + * ADD_VECTOR_EMPTY_METHOD(). Inherit and forward the requirement for a + * trailing semicolon from ADD_VECTOR_EMPTY_METHOD() to the caller. + */ +#define DEFINE_POINTER_VECTOR_TYPE(name, type) \ + DEFINE_VECTOR_TYPE (name, type); \ + ADD_VECTOR_EMPTY_METHOD (name) + +struct generic_vector { + void *ptr; + size_t len; + size_t cap; +}; + +extern int generic_vector_reserve (struct generic_vector *v, + size_t n, size_t itemsize); + +extern int generic_vector_reserve_page_aligned (struct generic_vector *v, + size_t n, size_t itemsize); + +#endif /* NBDKIT_VECTOR_H */ diff --git a/common/utils/windows-compat.c b/common/utils/windows-compat.c new file mode 100644 index 0000000..9b63f18 --- /dev/null +++ b/common/utils/windows-compat.c @@ -0,0 +1,221 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include + +#ifdef WIN32 + +#include +#include +#include +#include +#include + +#include "windows-compat.h" + +#undef accept +#undef bind +#undef closesocket +#undef getpeername +#undef listen +#undef getsockopt +#undef recv +#undef setsockopt +#undef socket +#undef send + +#define GET_SOCKET_FROM_FD(fd) \ + SOCKET sk = _get_osfhandle (fd); \ + if (sk == INVALID_SOCKET) { \ + errno = EBADF; \ + return -1; \ + } + +/* Sockets are non-blocking by default. Make them blocking. This + * introduces a bunch of caveats, see: + * http://www.sockets.com/winsock.htm#Overview_BlockingNonBlocking + */ +static int +set_blocking (SOCKET sk) +{ + u_long arg = 0; + + if (ioctlsocket (sk, FIONBIO, &arg) < 0) { + errno = translate_winsock_error ("ioctlsocket", WSAGetLastError ()); + return -1; + } + return 0; +} + +int +win_accept (int fd, struct sockaddr *addr, socklen_t *len) +{ + SOCKET new_sk; + GET_SOCKET_FROM_FD (fd); + + new_sk = accept (sk, addr, len); + if (new_sk == INVALID_SOCKET) { + errno = translate_winsock_error ("accept", WSAGetLastError ()); + return -1; + } + if (set_blocking (new_sk) == -1) return -1; + return _open_osfhandle ((intptr_t) new_sk, O_RDWR|O_BINARY); +} + +int +win_bind (int fd, const struct sockaddr *addr, socklen_t len) +{ + GET_SOCKET_FROM_FD (fd); + + if (bind (sk, addr, len) < 0) { + errno = translate_winsock_error ("bind", WSAGetLastError ()); + return -1; + } + + return 0; +} + +int +win_closesocket (int fd) +{ + GET_SOCKET_FROM_FD (fd); + + if (closesocket (sk) < 0) { + errno = translate_winsock_error ("closesocket", WSAGetLastError ()); + return -1; + } + + return 0; +} + +int +win_getpeername (int fd, struct sockaddr *addr, socklen_t *len) +{ + GET_SOCKET_FROM_FD (fd); + + if (getpeername (sk, addr, len) < 0) { + errno = translate_winsock_error ("getpeername", WSAGetLastError ()); + return -1; + } + + return 0; +} + +int +win_listen (int fd, int backlog) +{ + GET_SOCKET_FROM_FD (fd); + + if (listen (sk, backlog) < 0) { + errno = translate_winsock_error ("listen", WSAGetLastError ()); + return -1; + } + + return 0; +} + +int +win_getsockopt (int fd, int level, int optname, + void *optval, socklen_t *optlen) +{ + GET_SOCKET_FROM_FD (fd); + + if (getsockopt (sk, level, optname, optval, optlen) < 0) { + errno = translate_winsock_error ("getsockopt", WSAGetLastError ()); + return -1; + } + + return 0; +} + +int +win_recv (int fd, void *buf, size_t len, int flags) +{ + int r; + GET_SOCKET_FROM_FD (fd); + + r = recv (sk, buf, len, flags); + if (r < 0) { + errno = translate_winsock_error ("recv", WSAGetLastError ()); + return -1; + } + + return r; +} + +int +win_setsockopt (int fd, int level, int optname, + const void *optval, socklen_t optlen) +{ + GET_SOCKET_FROM_FD (fd); + + if (setsockopt (sk, level, optname, optval, optlen) < 0) { + errno = translate_winsock_error ("setsockopt", WSAGetLastError ()); + return -1; + } + + return 0; +} + +int +win_socket (int domain, int type, int protocol) +{ + SOCKET sk; + + sk = WSASocket (domain, type, protocol, NULL, 0, 0); + if (sk == INVALID_SOCKET) { + errno = translate_winsock_error ("socket", WSAGetLastError ()); + return -1; + } + + if (set_blocking (sk) == -1) return -1; + return _open_osfhandle ((intptr_t) sk, O_RDWR|O_BINARY); +} + +int +win_send (int fd, const void *buf, size_t len, int flags) +{ + int r; + GET_SOCKET_FROM_FD (fd); + + r = send (sk, buf, len, flags); + if (r < 0) { + errno = translate_winsock_error ("send", WSAGetLastError ()); + return -1; + } + + return r; +} + +#endif /* WIN32 */ diff --git a/common/utils/windows-compat.h b/common/utils/windows-compat.h new file mode 100644 index 0000000..1111a1b --- /dev/null +++ b/common/utils/windows-compat.h @@ -0,0 +1,157 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_WINDOWS_COMPAT_H +#define NBDKIT_WINDOWS_COMPAT_H + +#ifdef WIN32 + +#include + +#include +#include +#include + +#include + +/* Note that this is part of Windows 10, but not yet available in + * mingw-w64. + */ +#ifdef HAVE_AFUNIX_H +#include +#else + +/* This is the same as the definition in common/include/unix-path-max.h + * so we should be fine here even if the other file was included. + */ +#ifndef UNIX_PATH_MAX +#define UNIX_PATH_MAX 108 +#endif + +struct sockaddr_un +{ + ADDRESS_FAMILY sun_family; + char sun_path[UNIX_PATH_MAX]; +}; +#endif /* !HAVE_AFUNIX_H */ + +/* Windows doesn't have O_CLOEXEC, but it also doesn't have file + * descriptors that can be inherited across exec. Similarly for + * O_NOCTTY. + */ +#ifndef O_CLOEXEC +#define O_CLOEXEC 0 +#endif +#ifndef O_NOCTTY +#define O_NOCTTY 0 +#endif + +/* Windows lacks certain errnos, so replace them here as + * best we can. + */ +#ifndef EBADMSG +#define EBADMSG EPROTO +#endif +#ifndef ESHUTDOWN +#define ESHUTDOWN ECONNABORTED +#endif + +/* Windows uses non-standard names for shutdown(how). */ +#ifndef SHUT_WR +#define SHUT_WR SD_SEND +#define SHUT_RDWR SD_BOTH +#endif + +/* This generated function translates Winsock errors into errno codes. */ +extern int translate_winsock_error (const char *fn, int err); + +/* Add wrappers around the Winsock syscalls that nbdkit uses. */ +extern int win_accept (int fd, struct sockaddr *addr, socklen_t *len); +extern int win_bind (int fd, const struct sockaddr *addr, socklen_t len); +extern int win_closesocket (int fd); +extern int win_getpeername (int fd, struct sockaddr *addr, socklen_t *len); +extern int win_listen (int fd, int backlog); +extern int win_getsockopt (int fd, int level, int optname, + void *optval, socklen_t *optlen); +extern int win_recv (int fd, void *buf, size_t len, int flags); +extern int win_setsockopt (int fd, int level, int optname, + const void *optval, socklen_t optlen); +extern int win_socket (int domain, int type, int protocol); +extern int win_send (int fd, const void *buf, size_t len, int flags); + +#define accept win_accept +#define bind win_bind +#define closesocket win_closesocket +#define getpeername win_getpeername +#define listen win_listen +#define getsockopt win_getsockopt +#define recv win_recv +#define setsockopt win_setsockopt +#define socket win_socket +#define send win_send + +/* Windows has strange names for these functions. */ +#define dup _dup +#define dup2 _dup2 + +/* setenv replacement. */ +#define setenv(k, v, replace) _putenv_s ((k), (v)); + +/* Unfortunately quite commonly used at the moment. Make it a common + * macro so we can easily find places which need porting. + * + * Note: Don't use this for things which can never work on Windows + * (eg. Unix socket support). Those should just give regular errors. + */ +#define NOT_IMPLEMENTED_ON_WINDOWS(feature) \ + do { \ + fprintf (stderr, "nbdkit: %s is not implemented for Windows.\n", feature); \ + fprintf (stderr, "You can help by contributing to the Windows port,\n"); \ + fprintf (stderr, "see nbdkit README in the source for how to\n"); \ + fprintf (stderr, "contribute.\n"); \ + exit (EXIT_FAILURE); \ + } while (0) + +#else /* !WIN32 */ + +/* Windows doesn't have a generic function for closing anything, + * instead you have to call closesocket on a SOCKET object. We would + * like to #define close to point to the Windows alternative above, + * but that's not possible because it breaks things like + * backend->close. So instead the server code must call closesocket() + * on anything that might be a socket. + */ +#define closesocket close + +#endif /* !WIN32 */ + +#endif /* NBDKIT_WINDOWS_COMPAT_H */ diff --git a/common/utils/windows-errors.c b/common/utils/windows-errors.c new file mode 100644 index 0000000..98f0cc8 --- /dev/null +++ b/common/utils/windows-errors.c @@ -0,0 +1,291 @@ +/* Generated from windows-errors.txt */ +#include +#ifdef WIN32 +#include +#include +#include +#include +int +translate_winsock_error (const char *fn, int err) { + nbdkit_debug ("%s: winsock error %d", fn, err); + switch (err) { +#if defined(WSA_INVALID_HANDLE) && defined(EBADF) + + case WSA_INVALID_HANDLE: return EBADF; + +#endif +#if defined(WSA_NOT_ENOUGH_MEMORY) && defined(ENOMEM) + + case WSA_NOT_ENOUGH_MEMORY: return ENOMEM; + +#endif +#if defined(WSA_INVALID_PARAMETER) && defined(EINVAL) + + case WSA_INVALID_PARAMETER: return EINVAL; + +#endif +#if defined(WSA_OPERATION_ABORTED) && defined(ECONNABORTED) + + case WSA_OPERATION_ABORTED: return ECONNABORTED; + +#endif +#if defined(WSA_IO_INCOMPLETE) && defined(EWOULDBLOCK) + + case WSA_IO_INCOMPLETE: return EWOULDBLOCK; + +#endif +#if defined(WSA_IO_PENDING ) && defined(EWOULDBLOCK) + + case WSA_IO_PENDING : return EWOULDBLOCK; + +#endif +#if defined(WSAEINTR ) && defined(EINTR) + + case WSAEINTR : return EINTR; + +#endif +#if defined(WSAEBADF ) && defined(EBADF) + + case WSAEBADF : return EBADF; + +#endif +#if defined(WSAEACCES ) && defined(EACCES) + + case WSAEACCES : return EACCES; + +#endif +#if defined(WSAEFAULT ) && defined(EFAULT) + + case WSAEFAULT : return EFAULT; + +#endif +#if defined(WSAEINVAL ) && defined(EINVAL) + + case WSAEINVAL : return EINVAL; + +#endif +#if defined(WSAEMFILE ) && defined(EMFILE) + + case WSAEMFILE : return EMFILE; + +#endif +#if defined(WSAEWOULDBLOCK ) && defined(EWOULDBLOCK) + + case WSAEWOULDBLOCK : return EWOULDBLOCK; + +#endif +#if defined(WSAEINPROGRESS ) && defined(EINPROGRESS) + + case WSAEINPROGRESS : return EINPROGRESS; + +#endif +#if defined(WSAEALREADY ) && defined(EALREADY) + + case WSAEALREADY : return EALREADY; + +#endif +#if defined(WSAENOTSOCK ) && defined(ENOTSOCK) + + case WSAENOTSOCK : return ENOTSOCK; + +#endif +#if defined(WSAEDESTADDRREQ ) && defined(EDESTADDRREQ) + + case WSAEDESTADDRREQ : return EDESTADDRREQ; + +#endif +#if defined(WSAEMSGSIZE ) && defined(EMSGSIZE) + + case WSAEMSGSIZE : return EMSGSIZE; + +#endif +#if defined(WSAEPROTOTYPE ) && defined(EPROTOTYPE) + + case WSAEPROTOTYPE : return EPROTOTYPE; + +#endif +#if defined(WSAENOPROTOOPT ) && defined(ENOPROTOOPT) + + case WSAENOPROTOOPT : return ENOPROTOOPT; + +#endif +#if defined(WSAEPROTONOSUPPORT) && defined(EPROTONOSUPPORT) + + case WSAEPROTONOSUPPORT: return EPROTONOSUPPORT; + +#endif +#if defined(WSAESOCKTNOSUPPORT) && defined(ESOCKTNOSUPPORT) + + case WSAESOCKTNOSUPPORT: return ESOCKTNOSUPPORT; + +#endif +#if defined(WSAEOPNOTSUPP ) && defined(EOPNOTSUPP) + + case WSAEOPNOTSUPP : return EOPNOTSUPP; + +#endif +#if defined(WSAEPFNOSUPPORT ) && defined(EPFNOSUPPORT) + + case WSAEPFNOSUPPORT : return EPFNOSUPPORT; + +#endif +#if defined(WSAEAFNOSUPPORT ) && defined(EAFNOSUPPORT) + + case WSAEAFNOSUPPORT : return EAFNOSUPPORT; + +#endif +#if defined(WSAEADDRINUSE ) && defined(EADDRINUSE) + + case WSAEADDRINUSE : return EADDRINUSE; + +#endif +#if defined(WSAEADDRNOTAVAIL) && defined(EADDRNOTAVAIL) + + case WSAEADDRNOTAVAIL: return EADDRNOTAVAIL; + +#endif +#if defined(WSAENETDOWN ) && defined(ENETDOWN) + + case WSAENETDOWN : return ENETDOWN; + +#endif +#if defined(WSAENETUNREACH ) && defined(ENETUNREACH) + + case WSAENETUNREACH : return ENETUNREACH; + +#endif +#if defined(WSAENETRESET ) && defined(ENETRESET) + + case WSAENETRESET : return ENETRESET; + +#endif +#if defined(WSAECONNABORTED ) && defined(ECONNABORTED) + + case WSAECONNABORTED : return ECONNABORTED; + +#endif +#if defined(WSAECONNRESET ) && defined(ECONNRESET) + + case WSAECONNRESET : return ECONNRESET; + +#endif +#if defined(WSAENOBUFS ) && defined(ENOBUFS) + + case WSAENOBUFS : return ENOBUFS; + +#endif +#if defined(WSAEISCONN ) && defined(EISCONN) + + case WSAEISCONN : return EISCONN; + +#endif +#if defined(WSAENOTCONN ) && defined(ENOTCONN) + + case WSAENOTCONN : return ENOTCONN; + +#endif +#if defined(WSAESHUTDOWN ) && defined(ESHUTDOWN) + + case WSAESHUTDOWN : return ESHUTDOWN; + +#endif +#if defined(WSAETOOMANYREFS ) && defined(ETOOMANYREFS) + + case WSAETOOMANYREFS : return ETOOMANYREFS; + +#endif +#if defined(WSAETIMEDOUT ) && defined(ETIMEDOUT) + + case WSAETIMEDOUT : return ETIMEDOUT; + +#endif +#if defined(WSAECONNREFUSED ) && defined(ECONNREFUSED) + + case WSAECONNREFUSED : return ECONNREFUSED; + +#endif +#if defined(WSAELOOP ) && defined(ELOOP) + + case WSAELOOP : return ELOOP; + +#endif +#if defined(WSAENAMETOOLONG ) && defined(ENAMETOOLONG) + + case WSAENAMETOOLONG : return ENAMETOOLONG; + +#endif +#if defined(WSAEHOSTDOWN ) && defined(EHOSTDOWN) + + case WSAEHOSTDOWN : return EHOSTDOWN; + +#endif +#if defined(WSAEHOSTUNREACH ) && defined(EHOSTUNREACH) + + case WSAEHOSTUNREACH : return EHOSTUNREACH; + +#endif +#if defined(WSAENOTEMPTY ) && defined(ENOTEMPTY) + + case WSAENOTEMPTY : return ENOTEMPTY; + +#endif +#if defined(WSAEPROCLIM ) && defined(EMFILE) + + case WSAEPROCLIM : return EMFILE; + +#endif +#if defined(WSAEUSERS ) && defined(EUSERS) + + case WSAEUSERS : return EUSERS; + +#endif +#if defined(WSAEDQUOT ) && defined(EDQUOT) + + case WSAEDQUOT : return EDQUOT; + +#endif +#if defined(WSAESTALE ) && defined(ESTALE) + + case WSAESTALE : return ESTALE; + +#endif +#if defined(WSAEREMOTE ) && defined(EREMOTE) + + case WSAEREMOTE : return EREMOTE; + +#endif +#if defined(WSASYSNOTREADY ) && defined(EINVAL) + + case WSASYSNOTREADY : return EINVAL; + +#endif +#if defined(WSAVERNOTSUPPORTED) && defined(EINVAL) + + case WSAVERNOTSUPPORTED: return EINVAL; + +#endif +#if defined(WSANOTINITIALISED) && defined(EINVAL) + + case WSANOTINITIALISED: return EINVAL; + +#endif +#if defined(WSAEDISCON ) && defined(ESHUTDOWN) + + case WSAEDISCON : return ESHUTDOWN; + +#endif +#if defined(WSAENOMORE ) && defined(ESHUTDOWN) + + case WSAENOMORE : return ESHUTDOWN; + +#endif +#if defined(WSAECANCELLED ) && defined(ECANCELED) + + case WSAECANCELLED : return ECANCELED; + +#endif + default: + return err > 10000 && err < 10025 ? err - 10000 : EINVAL; + } +} +#endif /* WIN32 */ diff --git a/common/utils/windows-errors.txt b/common/utils/windows-errors.txt new file mode 100644 index 0000000..f802cab --- /dev/null +++ b/common/utils/windows-errors.txt @@ -0,0 +1,105 @@ +# Winsock error to errno code mapping. +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +# The main reference is: +# https://docs.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2 +# This was originally written by hand, but I also referenced libvirt's +# and Gnulib's choices of mappings. + +WSA_INVALID_HANDLE EBADF +WSA_NOT_ENOUGH_MEMORY ENOMEM +WSA_INVALID_PARAMETER EINVAL +WSA_OPERATION_ABORTED ECONNABORTED + +# These two are only kind of correct. +WSA_IO_INCOMPLETE EWOULDBLOCK +WSA_IO_PENDING EWOULDBLOCK + +WSAEINTR EINTR +WSAEBADF EBADF +WSAEACCES EACCES +WSAEFAULT EFAULT +WSAEINVAL EINVAL +WSAEMFILE EMFILE +WSAEWOULDBLOCK EWOULDBLOCK +WSAEINPROGRESS EINPROGRESS +WSAEALREADY EALREADY +WSAENOTSOCK ENOTSOCK +WSAEDESTADDRREQ EDESTADDRREQ +WSAEMSGSIZE EMSGSIZE +WSAEPROTOTYPE EPROTOTYPE +WSAENOPROTOOPT ENOPROTOOPT +WSAEPROTONOSUPPORT EPROTONOSUPPORT +WSAESOCKTNOSUPPORT ESOCKTNOSUPPORT +WSAEOPNOTSUPP EOPNOTSUPP +WSAEPFNOSUPPORT EPFNOSUPPORT +WSAEAFNOSUPPORT EAFNOSUPPORT +WSAEADDRINUSE EADDRINUSE +WSAEADDRNOTAVAIL EADDRNOTAVAIL +WSAENETDOWN ENETDOWN +WSAENETUNREACH ENETUNREACH +WSAENETRESET ENETRESET +WSAECONNABORTED ECONNABORTED +WSAECONNRESET ECONNRESET +WSAENOBUFS ENOBUFS +WSAEISCONN EISCONN +WSAENOTCONN ENOTCONN +WSAESHUTDOWN ESHUTDOWN +WSAETOOMANYREFS ETOOMANYREFS +WSAETIMEDOUT ETIMEDOUT +WSAECONNREFUSED ECONNREFUSED +WSAELOOP ELOOP +WSAENAMETOOLONG ENAMETOOLONG +WSAEHOSTDOWN EHOSTDOWN +WSAEHOSTUNREACH EHOSTUNREACH +WSAENOTEMPTY ENOTEMPTY + +# This really means "too many processes" but this is the closest I could find. +WSAEPROCLIM EMFILE + +WSAEUSERS EUSERS +WSAEDQUOT EDQUOT +WSAESTALE ESTALE +WSAEREMOTE EREMOTE + +# The next three are respectively: Didn't call WSAStartup, Winsock +# version is unsupported, and WSAStartup failed. +WSASYSNOTREADY EINVAL +WSAVERNOTSUPPORTED EINVAL +WSANOTINITIALISED EINVAL + +WSAEDISCON ESHUTDOWN +WSAENOMORE ESHUTDOWN +WSAECANCELLED ECANCELED + +# There are a bunch more after this but they all seem pretty obscure. +# Unknown errors are mapped to EIO and a debug message is printed so +# we have the original error. diff --git a/compile b/compile new file mode 100755 index 0000000..df363c8 --- /dev/null +++ b/compile @@ -0,0 +1,348 @@ +#! /bin/sh +# Wrapper for compilers which do not understand '-c -o'. + +scriptversion=2018-03-07.03; # UTC + +# Copyright (C) 1999-2021 Free Software Foundation, Inc. +# Written by Tom Tromey . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +nl=' +' + +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent tools from complaining about whitespace usage. +IFS=" "" $nl" + +file_conv= + +# func_file_conv build_file lazy +# Convert a $build file to $host form and store it in $file +# Currently only supports Windows hosts. If the determined conversion +# type is listed in (the comma separated) LAZY, no conversion will +# take place. +func_file_conv () +{ + file=$1 + case $file in + / | /[!/]*) # absolute file, and not a UNC file + if test -z "$file_conv"; then + # lazily determine how to convert abs files + case `uname -s` in + MINGW*) + file_conv=mingw + ;; + CYGWIN* | MSYS*) + file_conv=cygwin + ;; + *) + file_conv=wine + ;; + esac + fi + case $file_conv/,$2, in + *,$file_conv,*) + ;; + mingw/*) + file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` + ;; + cygwin/* | msys/*) + file=`cygpath -m "$file" || echo "$file"` + ;; + wine/*) + file=`winepath -w "$file" || echo "$file"` + ;; + esac + ;; + esac +} + +# func_cl_dashL linkdir +# Make cl look for libraries in LINKDIR +func_cl_dashL () +{ + func_file_conv "$1" + if test -z "$lib_path"; then + lib_path=$file + else + lib_path="$lib_path;$file" + fi + linker_opts="$linker_opts -LIBPATH:$file" +} + +# func_cl_dashl library +# Do a library search-path lookup for cl +func_cl_dashl () +{ + lib=$1 + found=no + save_IFS=$IFS + IFS=';' + for dir in $lib_path $LIB + do + IFS=$save_IFS + if $shared && test -f "$dir/$lib.dll.lib"; then + found=yes + lib=$dir/$lib.dll.lib + break + fi + if test -f "$dir/$lib.lib"; then + found=yes + lib=$dir/$lib.lib + break + fi + if test -f "$dir/lib$lib.a"; then + found=yes + lib=$dir/lib$lib.a + break + fi + done + IFS=$save_IFS + + if test "$found" != yes; then + lib=$lib.lib + fi +} + +# func_cl_wrapper cl arg... +# Adjust compile command to suit cl +func_cl_wrapper () +{ + # Assume a capable shell + lib_path= + shared=: + linker_opts= + for arg + do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + eat=1 + case $2 in + *.o | *.[oO][bB][jJ]) + func_file_conv "$2" + set x "$@" -Fo"$file" + shift + ;; + *) + func_file_conv "$2" + set x "$@" -Fe"$file" + shift + ;; + esac + ;; + -I) + eat=1 + func_file_conv "$2" mingw + set x "$@" -I"$file" + shift + ;; + -I*) + func_file_conv "${1#-I}" mingw + set x "$@" -I"$file" + shift + ;; + -l) + eat=1 + func_cl_dashl "$2" + set x "$@" "$lib" + shift + ;; + -l*) + func_cl_dashl "${1#-l}" + set x "$@" "$lib" + shift + ;; + -L) + eat=1 + func_cl_dashL "$2" + ;; + -L*) + func_cl_dashL "${1#-L}" + ;; + -static) + shared=false + ;; + -Wl,*) + arg=${1#-Wl,} + save_ifs="$IFS"; IFS=',' + for flag in $arg; do + IFS="$save_ifs" + linker_opts="$linker_opts $flag" + done + IFS="$save_ifs" + ;; + -Xlinker) + eat=1 + linker_opts="$linker_opts $2" + ;; + -*) + set x "$@" "$1" + shift + ;; + *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) + func_file_conv "$1" + set x "$@" -Tp"$file" + shift + ;; + *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) + func_file_conv "$1" mingw + set x "$@" "$file" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift + done + if test -n "$linker_opts"; then + linker_opts="-link$linker_opts" + fi + exec "$@" $linker_opts + exit 1 +} + +eat= + +case $1 in + '') + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: compile [--help] [--version] PROGRAM [ARGS] + +Wrapper for compilers which do not understand '-c -o'. +Remove '-o dest.o' from ARGS, run PROGRAM with the remaining +arguments, and rename the output as expected. + +If you are trying to build a whole package this is not the +right script to run: please start by reading the file 'INSTALL'. + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "compile $scriptversion" + exit $? + ;; + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ + icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) + func_cl_wrapper "$@" # Doesn't return... + ;; +esac + +ofile= +cfile= + +for arg +do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + # So we strip '-o arg' only if arg is an object. + eat=1 + case $2 in + *.o | *.obj) + ofile=$2 + ;; + *) + set x "$@" -o "$2" + shift + ;; + esac + ;; + *.c) + cfile=$1 + set x "$@" "$1" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift +done + +if test -z "$ofile" || test -z "$cfile"; then + # If no '-o' option was seen then we might have been invoked from a + # pattern rule where we don't need one. That is ok -- this is a + # normal compilation that the losing compiler can handle. If no + # '.c' file was seen then we are probably linking. That is also + # ok. + exec "$@" +fi + +# Name of file we expect compiler to create. +cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` + +# Create the lock directory. +# Note: use '[/\\:.-]' here to ensure that we don't use the same name +# that we are using for the .o file. Also, base the name on the expected +# object file name, since that is what matters with a parallel build. +lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d +while true; do + if mkdir "$lockdir" >/dev/null 2>&1; then + break + fi + sleep 1 +done +# FIXME: race condition here if user kills between mkdir and trap. +trap "rmdir '$lockdir'; exit 1" 1 2 15 + +# Run the compile. +"$@" +ret=$? + +if test -f "$cofile"; then + test "$cofile" = "$ofile" || mv "$cofile" "$ofile" +elif test -f "${cofile}bj"; then + test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" +fi + +rmdir "$lockdir" +exit $ret + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/config.guess b/config.guess new file mode 100755 index 0000000..c7f17e8 --- /dev/null +++ b/config.guess @@ -0,0 +1,1768 @@ +#!/usr/bin/sh +# Attempt to guess a canonical system name. +# Copyright 1992-2022 Free Software Foundation, Inc. + +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2022-05-25' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). +# +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. +# +# You can get the latest version of this script from: +# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess +# +# Please send patches to . + + +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Options: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright 1992-2022 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +# Just in case it came from the environment. +GUESS= + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +tmp= +# shellcheck disable=SC2172 +trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 + +set_cc_for_build() { + # prevent multiple calls if $tmp is already set + test "$tmp" && return 0 + : "${TMPDIR=/tmp}" + # shellcheck disable=SC2039,SC3028 + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } + dummy=$tmp/dummy + case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in + ,,) echo "int x;" > "$dummy.c" + for driver in cc gcc c89 c99 ; do + if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then + CC_FOR_BUILD=$driver + break + fi + done + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; + esac +} + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if test -f /.attbin/uname ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +case $UNAME_SYSTEM in +Linux|GNU|GNU/*) + LIBC=unknown + + set_cc_for_build + cat <<-EOF > "$dummy.c" + #include + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #elif defined(__GLIBC__) + LIBC=gnu + #else + #include + /* First heuristic to detect musl libc. */ + #ifdef __DEFINED_va_list + LIBC=musl + #endif + #endif + EOF + cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + eval "$cc_set_libc" + + # Second heuristic to detect musl libc. + if [ "$LIBC" = unknown ] && + command -v ldd >/dev/null && + ldd --version 2>&1 | grep -q ^musl; then + LIBC=musl + fi + + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + if [ "$LIBC" = unknown ]; then + LIBC=gnu + fi + ;; +esac + +# Note: order is significant - the case branches are not exclusive. + +case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + echo unknown)` + case $UNAME_MACHINE_ARCH in + aarch64eb) machine=aarch64_be-unknown ;; + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + earmv*) + arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` + machine=${arch}${endian}-unknown + ;; + *) machine=$UNAME_MACHINE_ARCH-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently (or will in the future) and ABI. + case $UNAME_MACHINE_ARCH in + earm*) + os=netbsdelf + ;; + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # Determine ABI tags. + case $UNAME_MACHINE_ARCH in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case $UNAME_VERSION in + Debian*) + release='-gnu' + ;; + *) + release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + GUESS=$machine-${os}${release}${abi-} + ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE + ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE + ;; + *:SecBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE + ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE + ;; + *:MidnightBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE + ;; + *:ekkoBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE + ;; + *:SolidBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE + ;; + *:OS108:*:*) + GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE + ;; + macppc:MirBSD:*:*) + GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE + ;; + *:MirBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE + ;; + *:Sortix:*:*) + GUESS=$UNAME_MACHINE-unknown-sortix + ;; + *:Twizzler:*:*) + GUESS=$UNAME_MACHINE-unknown-twizzler + ;; + *:Redox:*:*) + GUESS=$UNAME_MACHINE-unknown-redox + ;; + mips:OSF1:*.*) + GUESS=mips-dec-osf1 + ;; + alpha:OSF1:*:*) + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + trap '' 0 + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case $ALPHA_CPU_TYPE in + "EV4 (21064)") + UNAME_MACHINE=alpha ;; + "EV4.5 (21064)") + UNAME_MACHINE=alpha ;; + "LCA4 (21066/21068)") + UNAME_MACHINE=alpha ;; + "EV5 (21164)") + UNAME_MACHINE=alphaev5 ;; + "EV5.6 (21164A)") + UNAME_MACHINE=alphaev56 ;; + "EV5.6 (21164PC)") + UNAME_MACHINE=alphapca56 ;; + "EV5.7 (21164PC)") + UNAME_MACHINE=alphapca57 ;; + "EV6 (21264)") + UNAME_MACHINE=alphaev6 ;; + "EV6.7 (21264A)") + UNAME_MACHINE=alphaev67 ;; + "EV6.8CB (21264C)") + UNAME_MACHINE=alphaev68 ;; + "EV6.8AL (21264B)") + UNAME_MACHINE=alphaev68 ;; + "EV6.8CX (21264D)") + UNAME_MACHINE=alphaev68 ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE=alphaev69 ;; + "EV7 (21364)") + UNAME_MACHINE=alphaev7 ;; + "EV7.9 (21364A)") + UNAME_MACHINE=alphaev79 ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + GUESS=$UNAME_MACHINE-dec-osf$OSF_REL + ;; + Amiga*:UNIX_System_V:4.0:*) + GUESS=m68k-unknown-sysv4 + ;; + *:[Aa]miga[Oo][Ss]:*:*) + GUESS=$UNAME_MACHINE-unknown-amigaos + ;; + *:[Mm]orph[Oo][Ss]:*:*) + GUESS=$UNAME_MACHINE-unknown-morphos + ;; + *:OS/390:*:*) + GUESS=i370-ibm-openedition + ;; + *:z/VM:*:*) + GUESS=s390-ibm-zvmoe + ;; + *:OS400:*:*) + GUESS=powerpc-ibm-os400 + ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + GUESS=arm-acorn-riscix$UNAME_RELEASE + ;; + arm*:riscos:*:*|arm*:RISCOS:*:*) + GUESS=arm-unknown-riscos + ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + GUESS=hppa1.1-hitachi-hiuxmpp + ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + case `(/bin/universe) 2>/dev/null` in + att) GUESS=pyramid-pyramid-sysv3 ;; + *) GUESS=pyramid-pyramid-bsd ;; + esac + ;; + NILE*:*:*:dcosx) + GUESS=pyramid-pyramid-svr4 + ;; + DRS?6000:unix:4.0:6*) + GUESS=sparc-icl-nx6 + ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) GUESS=sparc-icl-nx7 ;; + esac + ;; + s390x:SunOS:*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL + ;; + sun4H:SunOS:5.*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-hal-solaris2$SUN_REL + ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris2$SUN_REL + ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + GUESS=i386-pc-auroraux$UNAME_RELEASE + ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + set_cc_for_build + SUN_ARCH=i386 + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH=x86_64 + fi + fi + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$SUN_ARCH-pc-solaris2$SUN_REL + ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris3$SUN_REL + ;; + sun4*:SunOS:*:*) + case `/usr/bin/arch -k` in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` + GUESS=sparc-sun-sunos$SUN_REL + ;; + sun3*:SunOS:*:*) + GUESS=m68k-sun-sunos$UNAME_RELEASE + ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 + case `/bin/arch` in + sun3) + GUESS=m68k-sun-sunos$UNAME_RELEASE + ;; + sun4) + GUESS=sparc-sun-sunos$UNAME_RELEASE + ;; + esac + ;; + aushp:SunOS:*:*) + GUESS=sparc-auspex-sunos$UNAME_RELEASE + ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + GUESS=m68k-milan-mint$UNAME_RELEASE + ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + GUESS=m68k-hades-mint$UNAME_RELEASE + ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + GUESS=m68k-unknown-mint$UNAME_RELEASE + ;; + m68k:machten:*:*) + GUESS=m68k-apple-machten$UNAME_RELEASE + ;; + powerpc:machten:*:*) + GUESS=powerpc-apple-machten$UNAME_RELEASE + ;; + RISC*:Mach:*:*) + GUESS=mips-dec-mach_bsd4.3 + ;; + RISC*:ULTRIX:*:*) + GUESS=mips-dec-ultrix$UNAME_RELEASE + ;; + VAX*:ULTRIX*:*:*) + GUESS=vax-dec-ultrix$UNAME_RELEASE + ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + GUESS=clipper-intergraph-clix$UNAME_RELEASE + ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && + dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`"$dummy" "$dummyarg"` && + { echo "$SYSTEM_NAME"; exit; } + GUESS=mips-mips-riscos$UNAME_RELEASE + ;; + Motorola:PowerMAX_OS:*:*) + GUESS=powerpc-motorola-powermax + ;; + Motorola:*:4.3:PL8-*) + GUESS=powerpc-harris-powermax + ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + GUESS=powerpc-harris-powermax + ;; + Night_Hawk:Power_UNIX:*:*) + GUESS=powerpc-harris-powerunix + ;; + m88k:CX/UX:7*:*) + GUESS=m88k-harris-cxux7 + ;; + m88k:*:4*:R4*) + GUESS=m88k-motorola-sysv4 + ;; + m88k:*:3*:R3*) + GUESS=m88k-motorola-sysv3 + ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 + then + if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ + test "$TARGET_BINARY_INTERFACE"x = x + then + GUESS=m88k-dg-dgux$UNAME_RELEASE + else + GUESS=m88k-dg-dguxbcs$UNAME_RELEASE + fi + else + GUESS=i586-dg-dgux$UNAME_RELEASE + fi + ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + GUESS=m88k-dolphin-sysv3 + ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + GUESS=m88k-motorola-sysv3 + ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + GUESS=m88k-tektronix-sysv3 + ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + GUESS=m68k-tektronix-bsd + ;; + *:IRIX*:*:*) + IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'` + GUESS=mips-sgi-irix$IRIX_REL + ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id + ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + GUESS=i386-ibm-aix + ;; + ia64:AIX:*:*) + if test -x /usr/bin/oslevel ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE + fi + GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV + ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` + then + GUESS=$SYSTEM_NAME + else + GUESS=rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + GUESS=rs6000-ibm-aix3.2.4 + else + GUESS=rs6000-ibm-aix3.2 + fi + ;; + *:AIX:*:[4567]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if test -x /usr/bin/lslpp ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \ + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` + else + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE + fi + GUESS=$IBM_ARCH-ibm-aix$IBM_REV + ;; + *:AIX:*:*) + GUESS=rs6000-ibm-aix + ;; + ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) + GUESS=romp-ibm-bsd4.4 + ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to + ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + GUESS=rs6000-bull-bosx + ;; + DPX/2?00:B.O.S.:*:*) + GUESS=m68k-bull-sysv3 + ;; + 9000/[34]??:4.3bsd:1.*:*) + GUESS=m68k-hp-bsd + ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + GUESS=m68k-hp-bsd4.4 + ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` + case $UNAME_MACHINE in + 9000/31?) HP_ARCH=m68000 ;; + 9000/[34]??) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if test -x /usr/bin/getconf; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case $sc_cpu_version in + 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 + 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case $sc_kernel_bits in + 32) HP_ARCH=hppa2.0n ;; + 64) HP_ARCH=hppa2.0w ;; + '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 + esac ;; + esac + fi + if test "$HP_ARCH" = ""; then + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if test "$HP_ARCH" = hppa2.0w + then + set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | + grep -q __LP64__ + then + HP_ARCH=hppa2.0w + else + HP_ARCH=hppa64 + fi + fi + GUESS=$HP_ARCH-hp-hpux$HPUX_REV + ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` + GUESS=ia64-hp-hpux$HPUX_REV + ;; + 3050*:HI-UX:*:*) + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && + { echo "$SYSTEM_NAME"; exit; } + GUESS=unknown-hitachi-hiuxwe2 + ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) + GUESS=hppa1.1-hp-bsd + ;; + 9000/8??:4.3bsd:*:*) + GUESS=hppa1.0-hp-bsd + ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + GUESS=hppa1.0-hp-mpeix + ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) + GUESS=hppa1.1-hp-osf + ;; + hp8??:OSF1:*:*) + GUESS=hppa1.0-hp-osf + ;; + i*86:OSF1:*:*) + if test -x /usr/sbin/sysversion ; then + GUESS=$UNAME_MACHINE-unknown-osf1mk + else + GUESS=$UNAME_MACHINE-unknown-osf1 + fi + ;; + parisc*:Lites*:*:*) + GUESS=hppa1.1-hp-lites + ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + GUESS=c1-convex-bsd + ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + GUESS=c34-convex-bsd + ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + GUESS=c38-convex-bsd + ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + GUESS=c4-convex-bsd + ;; + CRAY*Y-MP:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=ymp-cray-unicos$CRAY_REL + ;; + CRAY*[A-Z]90:*:*:*) + echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=t90-cray-unicos$CRAY_REL + ;; + CRAY*T3E:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=alphaev5-cray-unicosmk$CRAY_REL + ;; + CRAY*SV1:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=sv1-cray-unicos$CRAY_REL + ;; + *:UNICOS/mp:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=craynv-cray-unicosmp$CRAY_REL + ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` + GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` + GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE + ;; + sparc*:BSD/OS:*:*) + GUESS=sparc-unknown-bsdi$UNAME_RELEASE + ;; + *:BSD/OS:*:*) + GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE + ;; + arm:FreeBSD:*:*) + UNAME_PROCESSOR=`uname -p` + set_cc_for_build + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi + else + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf + fi + ;; + *:FreeBSD:*:*) + UNAME_PROCESSOR=`/usr/bin/uname -p` + case $UNAME_PROCESSOR in + amd64) + UNAME_PROCESSOR=x86_64 ;; + i386) + UNAME_PROCESSOR=i586 ;; + esac + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL + ;; + i*:CYGWIN*:*) + GUESS=$UNAME_MACHINE-pc-cygwin + ;; + *:MINGW64*:*) + GUESS=$UNAME_MACHINE-pc-mingw64 + ;; + *:MINGW*:*) + GUESS=$UNAME_MACHINE-pc-mingw32 + ;; + *:MSYS*:*) + GUESS=$UNAME_MACHINE-pc-msys + ;; + i*:PW*:*) + GUESS=$UNAME_MACHINE-pc-pw32 + ;; + *:SerenityOS:*:*) + GUESS=$UNAME_MACHINE-pc-serenity + ;; + *:Interix*:*) + case $UNAME_MACHINE in + x86) + GUESS=i586-pc-interix$UNAME_RELEASE + ;; + authenticamd | genuineintel | EM64T) + GUESS=x86_64-unknown-interix$UNAME_RELEASE + ;; + IA64) + GUESS=ia64-unknown-interix$UNAME_RELEASE + ;; + esac ;; + i*:UWIN*:*) + GUESS=$UNAME_MACHINE-pc-uwin + ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + GUESS=x86_64-pc-cygwin + ;; + prep*:SunOS:5.*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=powerpcle-unknown-solaris2$SUN_REL + ;; + *:GNU:*:*) + # the GNU system + GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` + GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL + ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC + ;; + *:Minix:*:*) + GUESS=$UNAME_MACHINE-unknown-minix + ;; + aarch64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + arm*:Linux:*:*) + set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + else + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi + else + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf + fi + fi + ;; + avr32*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + cris:Linux:*:*) + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; + crisv32:Linux:*:*) + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; + e2k:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + frv:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + hexagon:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + i*86:Linux:*:*) + GUESS=$UNAME_MACHINE-pc-linux-$LIBC + ;; + ia64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + k1om:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + m32r*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + m68*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + mips:Linux:*:* | mips64:Linux:*:*) + set_cc_for_build + IS_GLIBC=0 + test x"${LIBC}" = xgnu && IS_GLIBC=1 + sed 's/^ //' << EOF > "$dummy.c" + #undef CPU + #undef mips + #undef mipsel + #undef mips64 + #undef mips64el + #if ${IS_GLIBC} && defined(_ABI64) + LIBCABI=gnuabi64 + #else + #if ${IS_GLIBC} && defined(_ABIN32) + LIBCABI=gnuabin32 + #else + LIBCABI=${LIBC} + #endif + #endif + + #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa64r6 + #else + #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa32r6 + #else + #if defined(__mips64) + CPU=mips64 + #else + CPU=mips + #endif + #endif + #endif + + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + MIPS_ENDIAN=el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + MIPS_ENDIAN= + #else + MIPS_ENDIAN= + #endif + #endif +EOF + cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'` + eval "$cc_set_vars" + test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } + ;; + mips64el:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + openrisc*:Linux:*:*) + GUESS=or1k-unknown-linux-$LIBC + ;; + or32:Linux:*:* | or1k*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + padre:Linux:*:*) + GUESS=sparc-unknown-linux-$LIBC + ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + GUESS=hppa64-unknown-linux-$LIBC + ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;; + PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;; + *) GUESS=hppa-unknown-linux-$LIBC ;; + esac + ;; + ppc64:Linux:*:*) + GUESS=powerpc64-unknown-linux-$LIBC + ;; + ppc:Linux:*:*) + GUESS=powerpc-unknown-linux-$LIBC + ;; + ppc64le:Linux:*:*) + GUESS=powerpc64le-unknown-linux-$LIBC + ;; + ppcle:Linux:*:*) + GUESS=powerpcle-unknown-linux-$LIBC + ;; + riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + s390:Linux:*:* | s390x:Linux:*:*) + GUESS=$UNAME_MACHINE-ibm-linux-$LIBC + ;; + sh64*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + sh*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + tile*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + vax:Linux:*:*) + GUESS=$UNAME_MACHINE-dec-linux-$LIBC + ;; + x86_64:Linux:*:*) + set_cc_for_build + CPU=$UNAME_MACHINE + LIBCABI=$LIBC + if test "$CC_FOR_BUILD" != no_compiler_found; then + ABI=64 + sed 's/^ //' << EOF > "$dummy.c" + #ifdef __i386__ + ABI=x86 + #else + #ifdef __ILP32__ + ABI=x32 + #endif + #endif +EOF + cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` + eval "$cc_set_abi" + case $ABI in + x86) CPU=i686 ;; + x32) LIBCABI=${LIBC}x32 ;; + esac + fi + GUESS=$CPU-pc-linux-$LIBCABI + ;; + xtensa*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + GUESS=i386-sequent-sysv4 + ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION + ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + GUESS=$UNAME_MACHINE-pc-os2-emx + ;; + i*86:XTS-300:*:STOP) + GUESS=$UNAME_MACHINE-unknown-stop + ;; + i*86:atheos:*:*) + GUESS=$UNAME_MACHINE-unknown-atheos + ;; + i*86:syllable:*:*) + GUESS=$UNAME_MACHINE-pc-syllable + ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + GUESS=i386-unknown-lynxos$UNAME_RELEASE + ;; + i*86:*DOS:*:*) + GUESS=$UNAME_MACHINE-pc-msdosdjgpp + ;; + i*86:*:4.*:*) + UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL + else + GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL + fi + ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL + else + GUESS=$UNAME_MACHINE-pc-sysv32 + fi + ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configure will decide that + # this is a cross-build. + GUESS=i586-pc-msdosdjgpp + ;; + Intel:Mach:3*:*) + GUESS=i386-pc-mach3 + ;; + paragon:*:*:*) + GUESS=i860-intel-osf1 + ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4 + fi + ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + GUESS=m68010-convergent-sysv + ;; + mc68k:UNIX:SYSTEM5:3.51m) + GUESS=m68k-convergent-sysv + ;; + M680?0:D-NIX:5.3:*) + GUESS=m68k-diab-dnix + ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + GUESS=m68k-unknown-lynxos$UNAME_RELEASE + ;; + mc68030:UNIX_System_V:4.*:*) + GUESS=m68k-atari-sysv4 + ;; + TSUNAMI:LynxOS:2.*:*) + GUESS=sparc-unknown-lynxos$UNAME_RELEASE + ;; + rs6000:LynxOS:2.*:*) + GUESS=rs6000-unknown-lynxos$UNAME_RELEASE + ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + GUESS=powerpc-unknown-lynxos$UNAME_RELEASE + ;; + SM[BE]S:UNIX_SV:*:*) + GUESS=mips-dde-sysv$UNAME_RELEASE + ;; + RM*:ReliantUNIX-*:*:*) + GUESS=mips-sni-sysv4 + ;; + RM*:SINIX-*:*:*) + GUESS=mips-sni-sysv4 + ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + GUESS=$UNAME_MACHINE-sni-sysv4 + else + GUESS=ns32k-sni-sysv + fi + ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + GUESS=i586-unisys-sysv4 + ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + GUESS=hppa1.1-stratus-sysv4 + ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + GUESS=i860-stratus-sysv4 + ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + GUESS=$UNAME_MACHINE-stratus-vos + ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + GUESS=hppa1.1-stratus-vos + ;; + mc68*:A/UX:*:*) + GUESS=m68k-apple-aux$UNAME_RELEASE + ;; + news*:NEWS-OS:6*:*) + GUESS=mips-sony-newsos6 + ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if test -d /usr/nec; then + GUESS=mips-nec-sysv$UNAME_RELEASE + else + GUESS=mips-unknown-sysv$UNAME_RELEASE + fi + ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + GUESS=powerpc-be-beos + ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + GUESS=powerpc-apple-beos + ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + GUESS=i586-pc-beos + ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + GUESS=i586-pc-haiku + ;; + ppc:Haiku:*:*) # Haiku running on Apple PowerPC + GUESS=powerpc-apple-haiku + ;; + *:Haiku:*:*) # Haiku modern gcc (not bound by BeOS compat) + GUESS=$UNAME_MACHINE-unknown-haiku + ;; + SX-4:SUPER-UX:*:*) + GUESS=sx4-nec-superux$UNAME_RELEASE + ;; + SX-5:SUPER-UX:*:*) + GUESS=sx5-nec-superux$UNAME_RELEASE + ;; + SX-6:SUPER-UX:*:*) + GUESS=sx6-nec-superux$UNAME_RELEASE + ;; + SX-7:SUPER-UX:*:*) + GUESS=sx7-nec-superux$UNAME_RELEASE + ;; + SX-8:SUPER-UX:*:*) + GUESS=sx8-nec-superux$UNAME_RELEASE + ;; + SX-8R:SUPER-UX:*:*) + GUESS=sx8r-nec-superux$UNAME_RELEASE + ;; + SX-ACE:SUPER-UX:*:*) + GUESS=sxace-nec-superux$UNAME_RELEASE + ;; + Power*:Rhapsody:*:*) + GUESS=powerpc-apple-rhapsody$UNAME_RELEASE + ;; + *:Rhapsody:*:*) + GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE + ;; + arm64:Darwin:*:*) + GUESS=aarch64-apple-darwin$UNAME_RELEASE + ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + if command -v xcode-select > /dev/null 2> /dev/null && \ + ! xcode-select --print-path > /dev/null 2> /dev/null ; then + # Avoid executing cc if there is no toolchain installed as + # cc will be a stub that puts up a graphical alert + # prompting the user to install developer tools. + CC_FOR_BUILD=no_compiler_found + else + set_cc_for_build + fi + if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc + if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_PPC >/dev/null + then + UNAME_PROCESSOR=powerpc + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # uname -m returns i386 or x86_64 + UNAME_PROCESSOR=$UNAME_MACHINE + fi + GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE + ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = x86; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE + ;; + *:QNX:*:4*) + GUESS=i386-pc-qnx + ;; + NEO-*:NONSTOP_KERNEL:*:*) + GUESS=neo-tandem-nsk$UNAME_RELEASE + ;; + NSE-*:NONSTOP_KERNEL:*:*) + GUESS=nse-tandem-nsk$UNAME_RELEASE + ;; + NSR-*:NONSTOP_KERNEL:*:*) + GUESS=nsr-tandem-nsk$UNAME_RELEASE + ;; + NSV-*:NONSTOP_KERNEL:*:*) + GUESS=nsv-tandem-nsk$UNAME_RELEASE + ;; + NSX-*:NONSTOP_KERNEL:*:*) + GUESS=nsx-tandem-nsk$UNAME_RELEASE + ;; + *:NonStop-UX:*:*) + GUESS=mips-compaq-nonstopux + ;; + BS2000:POSIX*:*:*) + GUESS=bs2000-siemens-sysv + ;; + DS/*:UNIX_System_V:*:*) + GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE + ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "${cputype-}" = 386; then + UNAME_MACHINE=i386 + elif test "x${cputype-}" != x; then + UNAME_MACHINE=$cputype + fi + GUESS=$UNAME_MACHINE-unknown-plan9 + ;; + *:TOPS-10:*:*) + GUESS=pdp10-unknown-tops10 + ;; + *:TENEX:*:*) + GUESS=pdp10-unknown-tenex + ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + GUESS=pdp10-dec-tops20 + ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + GUESS=pdp10-xkl-tops20 + ;; + *:TOPS-20:*:*) + GUESS=pdp10-unknown-tops20 + ;; + *:ITS:*:*) + GUESS=pdp10-unknown-its + ;; + SEI:*:*:SEIUX) + GUESS=mips-sei-seiux$UNAME_RELEASE + ;; + *:DragonFly:*:*) + DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL + ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case $UNAME_MACHINE in + A*) GUESS=alpha-dec-vms ;; + I*) GUESS=ia64-dec-vms ;; + V*) GUESS=vax-dec-vms ;; + esac ;; + *:XENIX:*:SysV) + GUESS=i386-pc-xenix + ;; + i*86:skyos:*:*) + SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` + GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL + ;; + i*86:rdos:*:*) + GUESS=$UNAME_MACHINE-pc-rdos + ;; + i*86:Fiwix:*:*) + GUESS=$UNAME_MACHINE-pc-fiwix + ;; + *:AROS:*:*) + GUESS=$UNAME_MACHINE-unknown-aros + ;; + x86_64:VMkernel:*:*) + GUESS=$UNAME_MACHINE-unknown-esx + ;; + amd64:Isilon\ OneFS:*:*) + GUESS=x86_64-unknown-onefs + ;; + *:Unleashed:*:*) + GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE + ;; +esac + +# Do we have a guess based on uname results? +if test "x$GUESS" != x; then + echo "$GUESS" + exit +fi + +# No uname command or uname output not recognized. +set_cc_for_build +cat > "$dummy.c" < +#include +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#include +#if defined(_SIZE_T_) || defined(SIGLOST) +#include +#endif +#endif +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); +#endif + +#if defined (vax) +#if !defined (ultrix) +#include +#if defined (BSD) +#if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +#else +#if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +#else + printf ("vax-dec-bsd\n"); exit (0); +#endif +#endif +#else + printf ("vax-dec-bsd\n"); exit (0); +#endif +#else +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname un; + uname (&un); + printf ("vax-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("vax-dec-ultrix\n"); exit (0); +#endif +#endif +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname *un; + uname (&un); + printf ("mips-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("mips-dec-ultrix\n"); exit (0); +#endif +#endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. +test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } + +echo "$0: unable to guess system type" >&2 + +case $UNAME_MACHINE:$UNAME_SYSTEM in + mips:Linux | mips64:Linux) + # If we got here on MIPS GNU/Linux, output extra information. + cat >&2 <&2 <&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` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = "$UNAME_MACHINE" +UNAME_RELEASE = "$UNAME_RELEASE" +UNAME_SYSTEM = "$UNAME_SYSTEM" +UNAME_VERSION = "$UNAME_VERSION" +EOF +fi + +exit 1 + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..f30546d --- /dev/null +++ b/config.h.in @@ -0,0 +1,580 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define if building universal (internal helper macro) */ +#undef AC_APPLE_UNIVERSAL_BUILD + +/* String that separates path elements. */ +#undef DIR_SEPARATOR_STR + +/* Enable special libFuzzer binary */ +#undef ENABLE_LIBFUZZER + +/* Extension used for executables. */ +#undef EXEEXT + +/* Define to 1 if you have the `accept4' function. */ +#undef HAVE_ACCEPT4 + +/* Define to 1 if you have the header file. */ +#undef HAVE_AFUNIX_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ALLOCA_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ARPA_INET_H + +/* __auto_type is available */ +#undef HAVE_AUTO_TYPE + +/* Define to 1 if you have the header file. */ +#undef HAVE_BYTESWAP_H + +/* caml_alloc_initialized_string found at compile time. */ +#undef HAVE_CAML_ALLOC_INITIALIZED_STRING + +/* caml_shutdown found at compile time. */ +#undef HAVE_CAML_SHUTDOWN + +/* caml/socketaddr.h found at compile time. */ +#undef HAVE_CAML_SOCKETADDR_H + +/* caml_unix_alloc_sockaddr found at compile time. */ +#undef HAVE_CAML_UNIX_ALLOC_SOCKADDR + +/* com_err found at compile time. */ +#undef HAVE_COM_ERR + +/* curl found at compile time. */ +#undef HAVE_CURL + +/* CURLOPT_PROTOCOLS_STR found at compile time. */ +#undef HAVE_CURLOPT_PROTOCOLS_STR + +/* CURLOPT_UNIX_SOCKET_PATH found at compile time. */ +#undef HAVE_CURLOPT_UNIX_SOCKET_PATH + +/* CURL_HTTP_VERSION_2TLS found at compile time. */ +#undef HAVE_CURL_HTTP_VERSION_2TLS + +/* CURL_HTTP_VERSION_2_0 found at compile time. */ +#undef HAVE_CURL_HTTP_VERSION_2_0 + +/* CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE found at compile time. */ +#undef HAVE_CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE + +/* CURL_HTTP_VERSION_3 found at compile time. */ +#undef HAVE_CURL_HTTP_VERSION_3 + +/* CURL_HTTP_VERSION_3ONLY found at compile time. */ +#undef HAVE_CURL_HTTP_VERSION_3ONLY + +/* Define to 1 if you have the `curl_multi_get_handles' function. */ +#undef HAVE_CURL_MULTI_GET_HANDLES + +/* CURL_SSLVERSION_MAX_DEFAULT found at compile time. */ +#undef HAVE_CURL_SSLVERSION_MAX_DEFAULT + +/* CURL_SSLVERSION_MAX_TLSv1_0 found at compile time. */ +#undef HAVE_CURL_SSLVERSION_MAX_TLSv1_0 + +/* CURL_SSLVERSION_MAX_TLSv1_1 found at compile time. */ +#undef HAVE_CURL_SSLVERSION_MAX_TLSv1_1 + +/* CURL_SSLVERSION_MAX_TLSv1_2 found at compile time. */ +#undef HAVE_CURL_SSLVERSION_MAX_TLSv1_2 + +/* CURL_SSLVERSION_MAX_TLSv1_3 found at compile time. */ +#undef HAVE_CURL_SSLVERSION_MAX_TLSv1_3 + +/* Define to 1 if you have the declaration of `program_invocation_short_name', + and to 0 if you don't. */ +#undef HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME + +/* Define to 1 if you have the declaration of `__builtin_add_overflow(int, + int, int *)', and to 0 if you don't. */ +#undef HAVE_DECL___BUILTIN_ADD_OVERFLOW + +/* Define to 1 if you have the declaration of `__builtin_mul_overflow(int, + int, int *)', and to 0 if you don't. */ +#undef HAVE_DECL___BUILTIN_MUL_OVERFLOW + +/* Define to 1 if you have the `dladdr' function. */ +#undef HAVE_DLADDR + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ENDIAN_H + +/* environ is declared in headers */ +#undef HAVE_ENVIRON_DECL + +/* ext2fs found at compile time. */ +#undef HAVE_EXT2FS + +/* Define to 1 if you have the `fdatasync' function. */ +#undef HAVE_FDATASYNC + +/* Define to 1 if you have the `flockfile' function. */ +#undef HAVE_FLOCKFILE + +/* Define to 1 if you have the `fsync' function. */ +#undef HAVE_FSYNC + +/* Define to 1 if you have the `funlockfile' function. */ +#undef HAVE_FUNLOCKFILE + +/* Define to 1 if you have the `getdelim' function. */ +#undef HAVE_GETDELIM + +/* Define to 1 if you have the `getline' function. */ +#undef HAVE_GETLINE + +/* Define to 1 if you have the `get_current_dir_name' function. */ +#undef HAVE_GET_CURRENT_DIR_NAME + +/* gnutls found at compile time. */ +#undef HAVE_GNUTLS + +/* Define to 1 if you have the `gnutls_base64_decode2' function. */ +#undef HAVE_GNUTLS_BASE64_DECODE2 + +/* Define to 1 if you have the `gnutls_certificate_set_known_dh_params' + function. */ +#undef HAVE_GNUTLS_CERTIFICATE_SET_KNOWN_DH_PARAMS + +/* Define to 1 if you have the `gnutls_group_get' function. */ +#undef HAVE_GNUTLS_GROUP_GET + +/* Define to 1 if you have the `gnutls_group_get_name' function. */ +#undef HAVE_GNUTLS_GROUP_GET_NAME + +/* Define to 1 if you have the `gnutls_pbkdf2' function. */ +#undef HAVE_GNUTLS_PBKDF2 + +/* Define to 1 if you have the `gnutls_session_set_verify_cert' function. */ +#undef HAVE_GNUTLS_SESSION_SET_VERIFY_CERT + +/* Define to 1 if you have the header file. */ +#undef HAVE_GNUTLS_SOCKET_H + +/* Define to 1 if you have the `gnutls_srp_server_get_username' function. */ +#undef HAVE_GNUTLS_SRP_SERVER_GET_USERNAME + +/* Define to 1 if you have the `gnutls_transport_is_ktls_enabled' function. */ +#undef HAVE_GNUTLS_TRANSPORT_IS_KTLS_ENABLED + +/* Define to 1 if you have the header file. */ +#undef HAVE_GRP_H + +/* Define to 1 if you have the `inet_ntop' function. */ +#undef HAVE_INET_NTOP + +/* Define to 1 if you have the `inet_pton' function. */ +#undef HAVE_INET_PTON + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* libblkio found at compile time. */ +#undef HAVE_LIBBLKIO + +/* libguestfs found at compile time. */ +#undef HAVE_LIBGUESTFS + +/* liblzma found at compile time. */ +#undef HAVE_LIBLZMA + +/* libnbd found at compile time. */ +#undef HAVE_LIBNBD + +/* libselinux found at compile time. */ +#undef HAVE_LIBSELINUX + +/* libvirt found at compile time. */ +#undef HAVE_LIBVIRT + +/* libzstd found at compile time. */ +#undef HAVE_LIBZSTD + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_FS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_VM_SOCKETS_H + +/* Define to 1 if you have the `lua_isinteger' function. */ +#undef HAVE_LUA_ISINTEGER + +/* Define to 1 if you have the header file. */ +#undef HAVE_MINIX_CONFIG_H + +/* Define to 1 if you have the `mkostemp' function. */ +#undef HAVE_MKOSTEMP + +/* Define to 1 if you have the `mlock' function. */ +#undef HAVE_MLOCK + +/* Define to 1 if you have the `mlockall' function. */ +#undef HAVE_MLOCKALL + +/* Define to 1 if you have the `munlock' function. */ +#undef HAVE_MUNLOCK + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETDB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_TCP_H + +/* Define to 1 if you have the `openlog' function. */ +#undef HAVE_OPENLOG + +/* Define to 1 if you have the `open_memstream' function. */ +#undef HAVE_OPEN_MEMSTREAM + +/* Define to 1 if you have the `perl_alloc' function. */ +#undef HAVE_PERL_ALLOC + +/* Define to 1 if you have the `pipe' function. */ +#undef HAVE_PIPE + +/* Define to 1 if you have the `pipe2' function. */ +#undef HAVE_PIPE2 + +/* Define to 1 if you have the `poll' function. */ +#undef HAVE_POLL + +/* Define to 1 if you have the `posix_fadvise' function. */ +#undef HAVE_POSIX_FADVISE + +/* Define to 1 if you have the `posix_memalign' function. */ +#undef HAVE_POSIX_MEMALIGN + +/* Define to 1 if you have the `ppoll' function. */ +#undef HAVE_PPOLL + +/* Define to 1 if you have the `pread' function. */ +#undef HAVE_PREAD + +/* Define if you have POSIX threads libraries and header files. */ +#undef HAVE_PTHREAD + +/* Have PTHREAD_PRIO_INHERIT. */ +#undef HAVE_PTHREAD_PRIO_INHERIT + +/* Define to 1 if you have the header file. */ +#undef HAVE_PWD_H + +/* Define to 1 if you have the `pwrite' function. */ +#undef HAVE_PWRITE + +/* Python library found at compile time */ +#undef HAVE_PYTHON + +/* Define to 1 if you have the `realpath' function. */ +#undef HAVE_REALPATH + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDATOMIC_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `strndup' function. */ +#undef HAVE_STRNDUP + +/* Define to 1 if `d_type' is a member of `struct dirent'. */ +#undef HAVE_STRUCT_DIRENT_D_TYPE + +/* Define to 1 if `uid' is a member of `struct sockpeercred'. */ +#undef HAVE_STRUCT_SOCKPEERCRED_UID + +/* Define to 1 if `cache_readahead' is a member of `struct struct_io_manager'. + */ +#undef HAVE_STRUCT_STRUCT_IO_MANAGER_CACHE_READAHEAD + +/* Define to 1 if `zeroout' is a member of `struct struct_io_manager'. */ +#undef HAVE_STRUCT_STRUCT_IO_MANAGER_ZEROOUT + +/* Define to 1 if `uid' is a member of `struct ucred'. */ +#undef HAVE_STRUCT_UCRED_UID + +/* Define to 1 if you have the `sysconf' function. */ +#undef HAVE_SYSCONF + +/* Define to 1 if you have the `syslog' function. */ +#undef HAVE_SYSLOG + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYSLOG_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_ENDIAN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_IOCTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_MMAN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PRCTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PROCCTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STATVFS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_UCRED_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_UN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_VSOCK_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_WAIT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_TERMIOS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Valgrind headers found at compile time */ +#undef HAVE_VALGRIND + +/* Define to 1 if you have the `valloc' function. */ +#undef HAVE_VALLOC + +/* Define to 1 if vfprintf supports %m. */ +#undef HAVE_VFPRINTF_PERCENT_M + +/* Define to 1 if you have the `vsyslog' function. */ +#undef HAVE_VSYSLOG + +/* Define to 1 if you have the header file. */ +#undef HAVE_WCHAR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_WINSOCK2_H + +/* zlib found at compile time. */ +#undef HAVE_ZLIB + +/* zlib-ng found at compile time. */ +#undef HAVE_ZLIB_NG + +/* Program used by iso plugin to make ISOs. */ +#undef ISOPROG + +/* ISO program behaves like xorriso. */ +#undef ISOPROG_IS_XORRISO + +/* Temporary directory for large files */ +#undef LARGE_TMPDIR + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#undef LT_OBJDIR + +/* Extra version information (for use by packagers) */ +#undef NBDKIT_VERSION_EXTRA + +/* 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 home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if the C compiler supports function prototypes. */ +#undef PROTOTYPES + +/* Define to necessary symbol if this constant uses a non-standard name on + your system. */ +#undef PTHREAD_CREATE_JOINABLE + +/* The size of `gid_t', as computed by sizeof. */ +#undef SIZEOF_GID_T + +/* The size of `long', as computed by sizeof. */ +#undef SIZEOF_LONG + +/* The size of `pid_t', as computed by sizeof. */ +#undef SIZEOF_PID_T + +/* The size of `uid_t', as computed by sizeof. */ +#undef SIZEOF_UID_T + +/* Extension used for shared objects/DLLs. */ +#undef SOEXT + +/* Define to 1 if all of the C90 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ +#undef STDC_HEADERS + +/* Default TLS session priority string */ +#undef TLS_PRIORITY + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable general extensions on macOS. */ +#ifndef _DARWIN_C_SOURCE +# undef _DARWIN_C_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable X/Open compliant socket functions that do not require linking + with -lxnet on HP-UX 11.11. */ +#ifndef _HPUX_ALT_XOPEN_SOCKET_API +# undef _HPUX_ALT_XOPEN_SOCKET_API +#endif +/* Identify the host operating system as Minix. + This macro does not affect the system headers' behavior. + A future release of Autoconf may stop defining this macro. */ +#ifndef _MINIX +# undef _MINIX +#endif +/* Enable general extensions on NetBSD. + Enable NetBSD compatibility extensions on Minix. */ +#ifndef _NETBSD_SOURCE +# undef _NETBSD_SOURCE +#endif +/* Enable OpenBSD compatibility extensions on NetBSD. + Oddly enough, this does nothing on OpenBSD. */ +#ifndef _OPENBSD_SOURCE +# undef _OPENBSD_SOURCE +#endif +/* Define to 1 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_SOURCE +# undef _POSIX_SOURCE +#endif +/* Define to 2 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_1_SOURCE +# undef _POSIX_1_SOURCE +#endif +/* Enable POSIX-compatible threading on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ +#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ +#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ +# undef __STDC_WANT_IEC_60559_BFP_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ +#ifndef __STDC_WANT_IEC_60559_DFP_EXT__ +# undef __STDC_WANT_IEC_60559_DFP_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ +#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ +# undef __STDC_WANT_IEC_60559_FUNCS_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */ +#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ +# undef __STDC_WANT_IEC_60559_TYPES_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ +#ifndef __STDC_WANT_LIB_EXT2__ +# undef __STDC_WANT_LIB_EXT2__ +#endif +/* Enable extensions specified by ISO/IEC 24747:2009. */ +#ifndef __STDC_WANT_MATH_SPEC_FUNCS__ +# undef __STDC_WANT_MATH_SPEC_FUNCS__ +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable X/Open extensions. Define to 500 only if necessary + to make mbstate_t available. */ +#ifndef _XOPEN_SOURCE +# undef _XOPEN_SOURCE +#endif + + +/* Version number of package */ +#undef VERSION + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +# undef WORDS_BIGENDIAN +# endif +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* Define for large files, on AIX-style hosts. */ +#undef _LARGE_FILES + +/* Define like PROTOTYPES; this can be used by system headers. */ +#undef __PROTOTYPES + +/* Host architecture. */ +#undef host_cpu + +/* Host operating system. */ +#undef host_os diff --git a/config.sub b/config.sub new file mode 100755 index 0000000..b41da55 --- /dev/null +++ b/config.sub @@ -0,0 +1,1890 @@ +#!/usr/bin/sh +# Configuration validation subroutine script. +# Copyright 1992-2022 Free Software Foundation, Inc. + +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2022-01-03' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). + + +# Please send patches to . +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# You can get the latest version of this script from: +# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS + +Canonicalize a configuration name. + +Options: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright 1992-2022 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo "$1" + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Split fields of configuration type +# shellcheck disable=SC2162 +saved_IFS=$IFS +IFS="-" read field1 field2 field3 field4 <&2 + exit 1 + ;; + *-*-*-*) + basic_machine=$field1-$field2 + basic_os=$field3-$field4 + ;; + *-*-*) + # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two + # parts + maybe_os=$field2-$field3 + case $maybe_os in + nto-qnx* | linux-* | uclinux-uclibc* \ + | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ + | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ + | storm-chaos* | os2-emx* | rtmk-nova*) + basic_machine=$field1 + basic_os=$maybe_os + ;; + android-linux) + basic_machine=$field1-unknown + basic_os=linux-android + ;; + *) + basic_machine=$field1-$field2 + basic_os=$field3 + ;; + esac + ;; + *-*) + # A lone config we happen to match not fitting any pattern + case $field1-$field2 in + decstation-3100) + basic_machine=mips-dec + basic_os= + ;; + *-*) + # Second component is usually, but not always the OS + case $field2 in + # Prevent following clause from handling this valid os + sun*os*) + basic_machine=$field1 + basic_os=$field2 + ;; + zephyr*) + basic_machine=$field1-unknown + basic_os=$field2 + ;; + # Manufacturers + dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ + | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ + | unicom* | ibm* | next | hp | isi* | apollo | altos* \ + | convergent* | ncr* | news | 32* | 3600* | 3100* \ + | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ + | ultra | tti* | harris | dolphin | highlevel | gould \ + | cbm | ns | masscomp | apple | axis | knuth | cray \ + | microblaze* | sim | cisco \ + | oki | wec | wrs | winbond) + basic_machine=$field1-$field2 + basic_os= + ;; + *) + basic_machine=$field1 + basic_os=$field2 + ;; + esac + ;; + esac + ;; + *) + # Convert single-component short-hands not valid as part of + # multi-component configurations. + case $field1 in + 386bsd) + basic_machine=i386-pc + basic_os=bsd + ;; + a29khif) + basic_machine=a29k-amd + basic_os=udi + ;; + adobe68k) + basic_machine=m68010-adobe + basic_os=scout + ;; + alliant) + basic_machine=fx80-alliant + basic_os= + ;; + altos | altos3068) + basic_machine=m68k-altos + basic_os= + ;; + am29k) + basic_machine=a29k-none + basic_os=bsd + ;; + amdahl) + basic_machine=580-amdahl + basic_os=sysv + ;; + amiga) + basic_machine=m68k-unknown + basic_os= + ;; + amigaos | amigados) + basic_machine=m68k-unknown + basic_os=amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + basic_os=sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + basic_os=sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + basic_os=bsd + ;; + aros) + basic_machine=i386-pc + basic_os=aros + ;; + aux) + basic_machine=m68k-apple + basic_os=aux + ;; + balance) + basic_machine=ns32k-sequent + basic_os=dynix + ;; + blackfin) + basic_machine=bfin-unknown + basic_os=linux + ;; + cegcc) + basic_machine=arm-unknown + basic_os=cegcc + ;; + convex-c1) + basic_machine=c1-convex + basic_os=bsd + ;; + convex-c2) + basic_machine=c2-convex + basic_os=bsd + ;; + convex-c32) + basic_machine=c32-convex + basic_os=bsd + ;; + convex-c34) + basic_machine=c34-convex + basic_os=bsd + ;; + convex-c38) + basic_machine=c38-convex + basic_os=bsd + ;; + cray) + basic_machine=j90-cray + basic_os=unicos + ;; + crds | unos) + basic_machine=m68k-crds + basic_os= + ;; + da30) + basic_machine=m68k-da30 + basic_os= + ;; + decstation | pmax | pmin | dec3100 | decstatn) + basic_machine=mips-dec + basic_os= + ;; + delta88) + basic_machine=m88k-motorola + basic_os=sysv3 + ;; + dicos) + basic_machine=i686-pc + basic_os=dicos + ;; + djgpp) + basic_machine=i586-pc + basic_os=msdosdjgpp + ;; + ebmon29k) + basic_machine=a29k-amd + basic_os=ebmon + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + basic_os=ose + ;; + gmicro) + basic_machine=tron-gmicro + basic_os=sysv + ;; + go32) + basic_machine=i386-pc + basic_os=go32 + ;; + h8300hms) + basic_machine=h8300-hitachi + basic_os=hms + ;; + h8300xray) + basic_machine=h8300-hitachi + basic_os=xray + ;; + h8500hms) + basic_machine=h8500-hitachi + basic_os=hms + ;; + harris) + basic_machine=m88k-harris + basic_os=sysv3 + ;; + hp300 | hp300hpux) + basic_machine=m68k-hp + basic_os=hpux + ;; + hp300bsd) + basic_machine=m68k-hp + basic_os=bsd + ;; + hppaosf) + basic_machine=hppa1.1-hp + basic_os=osf + ;; + hppro) + basic_machine=hppa1.1-hp + basic_os=proelf + ;; + i386mach) + basic_machine=i386-mach + basic_os=mach + ;; + isi68 | isi) + basic_machine=m68k-isi + basic_os=sysv + ;; + m68knommu) + basic_machine=m68k-unknown + basic_os=linux + ;; + magnum | m3230) + basic_machine=mips-mips + basic_os=sysv + ;; + merlin) + basic_machine=ns32k-utek + basic_os=sysv + ;; + mingw64) + basic_machine=x86_64-pc + basic_os=mingw64 + ;; + mingw32) + basic_machine=i686-pc + basic_os=mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + basic_os=mingw32ce + ;; + monitor) + basic_machine=m68k-rom68k + basic_os=coff + ;; + morphos) + basic_machine=powerpc-unknown + basic_os=morphos + ;; + moxiebox) + basic_machine=moxie-unknown + basic_os=moxiebox + ;; + msdos) + basic_machine=i386-pc + basic_os=msdos + ;; + msys) + basic_machine=i686-pc + basic_os=msys + ;; + mvs) + basic_machine=i370-ibm + basic_os=mvs + ;; + nacl) + basic_machine=le32-unknown + basic_os=nacl + ;; + ncr3000) + basic_machine=i486-ncr + basic_os=sysv4 + ;; + netbsd386) + basic_machine=i386-pc + basic_os=netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + basic_os=linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + basic_os=newsos + ;; + news1000) + basic_machine=m68030-sony + basic_os=newsos + ;; + necv70) + basic_machine=v70-nec + basic_os=sysv + ;; + nh3000) + basic_machine=m68k-harris + basic_os=cxux + ;; + nh[45]000) + basic_machine=m88k-harris + basic_os=cxux + ;; + nindy960) + basic_machine=i960-intel + basic_os=nindy + ;; + mon960) + basic_machine=i960-intel + basic_os=mon960 + ;; + nonstopux) + basic_machine=mips-compaq + basic_os=nonstopux + ;; + os400) + basic_machine=powerpc-ibm + basic_os=os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + basic_os=ose + ;; + os68k) + basic_machine=m68k-none + basic_os=os68k + ;; + paragon) + basic_machine=i860-intel + basic_os=osf + ;; + parisc) + basic_machine=hppa-unknown + basic_os=linux + ;; + psp) + basic_machine=mipsallegrexel-sony + basic_os=psp + ;; + pw32) + basic_machine=i586-unknown + basic_os=pw32 + ;; + rdos | rdos64) + basic_machine=x86_64-pc + basic_os=rdos + ;; + rdos32) + basic_machine=i386-pc + basic_os=rdos + ;; + rom68k) + basic_machine=m68k-rom68k + basic_os=coff + ;; + sa29200) + basic_machine=a29k-amd + basic_os=udi + ;; + sei) + basic_machine=mips-sei + basic_os=seiux + ;; + sequent) + basic_machine=i386-sequent + basic_os= + ;; + sps7) + basic_machine=m68k-bull + basic_os=sysv2 + ;; + st2000) + basic_machine=m68k-tandem + basic_os= + ;; + stratus) + basic_machine=i860-stratus + basic_os=sysv4 + ;; + sun2) + basic_machine=m68000-sun + basic_os= + ;; + sun2os3) + basic_machine=m68000-sun + basic_os=sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + basic_os=sunos4 + ;; + sun3) + basic_machine=m68k-sun + basic_os= + ;; + sun3os3) + basic_machine=m68k-sun + basic_os=sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + basic_os=sunos4 + ;; + sun4) + basic_machine=sparc-sun + basic_os= + ;; + sun4os3) + basic_machine=sparc-sun + basic_os=sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + basic_os=sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + basic_os=solaris2 + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + basic_os= + ;; + sv1) + basic_machine=sv1-cray + basic_os=unicos + ;; + symmetry) + basic_machine=i386-sequent + basic_os=dynix + ;; + t3e) + basic_machine=alphaev5-cray + basic_os=unicos + ;; + t90) + basic_machine=t90-cray + basic_os=unicos + ;; + toad1) + basic_machine=pdp10-xkl + basic_os=tops20 + ;; + tpf) + basic_machine=s390x-ibm + basic_os=tpf + ;; + udi29k) + basic_machine=a29k-amd + basic_os=udi + ;; + ultra3) + basic_machine=a29k-nyu + basic_os=sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + basic_os=none + ;; + vaxv) + basic_machine=vax-dec + basic_os=sysv + ;; + vms) + basic_machine=vax-dec + basic_os=vms + ;; + vsta) + basic_machine=i386-pc + basic_os=vsta + ;; + vxworks960) + basic_machine=i960-wrs + basic_os=vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + basic_os=vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + basic_os=vxworks + ;; + xbox) + basic_machine=i686-pc + basic_os=mingw32 + ;; + ymp) + basic_machine=ymp-cray + basic_os=unicos + ;; + *) + basic_machine=$1 + basic_os= + ;; + esac + ;; +esac + +# Decode 1-component or ad-hoc basic machines +case $basic_machine in + # Here we handle the default manufacturer of certain CPU types. It is in + # some cases the only manufacturer, in others, it is the most popular. + w89k) + cpu=hppa1.1 + vendor=winbond + ;; + op50n) + cpu=hppa1.1 + vendor=oki + ;; + op60c) + cpu=hppa1.1 + vendor=oki + ;; + ibm*) + cpu=i370 + vendor=ibm + ;; + orion105) + cpu=clipper + vendor=highlevel + ;; + mac | mpw | mac-mpw) + cpu=m68k + vendor=apple + ;; + pmac | pmac-mpw) + cpu=powerpc + vendor=apple + ;; + + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + cpu=m68000 + vendor=att + ;; + 3b*) + cpu=we32k + vendor=att + ;; + bluegene*) + cpu=powerpc + vendor=ibm + basic_os=cnk + ;; + decsystem10* | dec10*) + cpu=pdp10 + vendor=dec + basic_os=tops10 + ;; + decsystem20* | dec20*) + cpu=pdp10 + vendor=dec + basic_os=tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + cpu=m68k + vendor=motorola + ;; + dpx2*) + cpu=m68k + vendor=bull + basic_os=sysv3 + ;; + encore | umax | mmax) + cpu=ns32k + vendor=encore + ;; + elxsi) + cpu=elxsi + vendor=elxsi + basic_os=${basic_os:-bsd} + ;; + fx2800) + cpu=i860 + vendor=alliant + ;; + genix) + cpu=ns32k + vendor=ns + ;; + h3050r* | hiux*) + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + cpu=m68000 + vendor=hp + ;; + hp9k3[2-9][0-9]) + cpu=m68k + vendor=hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + cpu=hppa1.1 + vendor=hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + i*86v32) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv32 + ;; + i*86v4*) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv4 + ;; + i*86v) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv + ;; + i*86sol2) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=solaris2 + ;; + j90 | j90-cray) + cpu=j90 + vendor=cray + basic_os=${basic_os:-unicos} + ;; + iris | iris4d) + cpu=mips + vendor=sgi + case $basic_os in + irix*) + ;; + *) + basic_os=irix4 + ;; + esac + ;; + miniframe) + cpu=m68000 + vendor=convergent + ;; + *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) + cpu=m68k + vendor=atari + basic_os=mint + ;; + news-3600 | risc-news) + cpu=mips + vendor=sony + basic_os=newsos + ;; + next | m*-next) + cpu=m68k + vendor=next + case $basic_os in + openstep*) + ;; + nextstep*) + ;; + ns2*) + basic_os=nextstep2 + ;; + *) + basic_os=nextstep3 + ;; + esac + ;; + np1) + cpu=np1 + vendor=gould + ;; + op50n-* | op60c-*) + cpu=hppa1.1 + vendor=oki + basic_os=proelf + ;; + pa-hitachi) + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 + ;; + pbd) + cpu=sparc + vendor=tti + ;; + pbb) + cpu=m68k + vendor=tti + ;; + pc532) + cpu=ns32k + vendor=pc532 + ;; + pn) + cpu=pn + vendor=gould + ;; + power) + cpu=power + vendor=ibm + ;; + ps2) + cpu=i386 + vendor=ibm + ;; + rm[46]00) + cpu=mips + vendor=siemens + ;; + rtpc | rtpc-*) + cpu=romp + vendor=ibm + ;; + sde) + cpu=mipsisa32 + vendor=sde + basic_os=${basic_os:-elf} + ;; + simso-wrs) + cpu=sparclite + vendor=wrs + basic_os=vxworks + ;; + tower | tower-32) + cpu=m68k + vendor=ncr + ;; + vpp*|vx|vx-*) + cpu=f301 + vendor=fujitsu + ;; + w65) + cpu=w65 + vendor=wdc + ;; + w89k-*) + cpu=hppa1.1 + vendor=winbond + basic_os=proelf + ;; + none) + cpu=none + vendor=none + ;; + leon|leon[3-9]) + cpu=sparc + vendor=$basic_machine + ;; + leon-*|leon[3-9]-*) + cpu=sparc + vendor=`echo "$basic_machine" | sed 's/-.*//'` + ;; + + *-*) + # shellcheck disable=SC2162 + saved_IFS=$IFS + IFS="-" read cpu vendor <&2 + exit 1 + ;; + esac + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $vendor in + digital*) + vendor=dec + ;; + commodore*) + vendor=cbm + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if test x$basic_os != x +then + +# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just +# set os. +case $basic_os in + gnu/linux*) + kernel=linux + os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` + ;; + os2-emx) + kernel=os2 + os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` + ;; + nto-qnx*) + kernel=nto + os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` + ;; + *-*) + # shellcheck disable=SC2162 + saved_IFS=$IFS + IFS="-" read kernel os <&2 + exit 1 + ;; +esac + +# As a final step for OS-related things, validate the OS-kernel combination +# (given a valid OS), if there is a kernel. +case $kernel-$os in + linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \ + | linux-musl* | linux-relibc* | linux-uclibc* ) + ;; + uclinux-uclibc* ) + ;; + -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* ) + # These are just libc implementations, not actual OSes, and thus + # require a kernel. + echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 + exit 1 + ;; + kfreebsd*-gnu* | kopensolaris*-gnu*) + ;; + vxworks-simlinux | vxworks-simwindows | vxworks-spe) + ;; + nto-qnx*) + ;; + os2-emx) + ;; + *-eabi* | *-gnueabi*) + ;; + -*) + # Blank kernel with real OS is always fine. + ;; + *-*) + echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 + exit 1 + ;; +esac + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +case $vendor in + unknown) + case $cpu-$os in + *-riscix*) + vendor=acorn + ;; + *-sunos*) + vendor=sun + ;; + *-cnk* | *-aix*) + vendor=ibm + ;; + *-beos*) + vendor=be + ;; + *-hpux*) + vendor=hp + ;; + *-mpeix*) + vendor=hp + ;; + *-hiux*) + vendor=hitachi + ;; + *-unos*) + vendor=crds + ;; + *-dgux*) + vendor=dg + ;; + *-luna*) + vendor=omron + ;; + *-genix*) + vendor=ns + ;; + *-clix*) + vendor=intergraph + ;; + *-mvs* | *-opened*) + vendor=ibm + ;; + *-os400*) + vendor=ibm + ;; + s390-* | s390x-*) + vendor=ibm + ;; + *-ptx*) + vendor=sequent + ;; + *-tpf*) + vendor=ibm + ;; + *-vxsim* | *-vxworks* | *-windiss*) + vendor=wrs + ;; + *-aux*) + vendor=apple + ;; + *-hms*) + vendor=hitachi + ;; + *-mpw* | *-macos*) + vendor=apple + ;; + *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) + vendor=atari + ;; + *-vos*) + vendor=stratus + ;; + esac + ;; +esac + +echo "$cpu-$vendor-${kernel:+$kernel-}$os" +exit + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/configure b/configure new file mode 100755 index 0000000..aa22336 --- /dev/null +++ b/configure @@ -0,0 +1,30485 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.71 for nbdkit 1.36.2. +# +# +# Copyright (C) 1992-1996, 1998-2017, 2020-2021 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 +as_nop=: +if test ${ZSH_VERSION+y} && (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 $as_nop + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. +as_nl=' +' +export as_nl +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi + +# The user is always right. +if ${PATH_SEPARATOR+false} :; 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 + + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + 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 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="as_nop=: +if test \${ZSH_VERSION+y} && (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 \$as_nop + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ) +then : + +else \$as_nop + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1 +blah=\$(echo \$(echo blah)) +test x\"\$blah\" = xblah || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 + + test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ + || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null +then : + as_have_required=yes +else $as_nop + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null +then : + +else $as_nop + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$as_shell as_have_required=yes + if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null +then : + break 2 +fi +fi + done;; + esac + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi +fi + + + if test "x$CONFIG_SHELL" != x +then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno +then : + printf "%s\n" "$0: This script requires a shell more modern than all" + printf "%s\n" "$0: the shells that I found on your system." + if test ${ZSH_VERSION+y} ; then + printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" + printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." + else + printf "%s\n" "$0: Please tell bug-autoconf@gnu.org about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`printf "%s\n" "$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 || +printf "%s\n" 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_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else $as_nop + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else $as_nop + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + printf "%s\n" "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +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 + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# 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_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # 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" || + { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # 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 +} + + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + + +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 -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +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='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# 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'" + +SHELL=${CONFIG_SHELL-/bin/sh} + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/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= + +# Identity of this package. +PACKAGE_NAME='nbdkit' +PACKAGE_TARNAME='nbdkit' +PACKAGE_VERSION='1.36.2' +PACKAGE_STRING='nbdkit 1.36.2' +PACKAGE_BUGREPORT='' +PACKAGE_URL='' + +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_STDIO_H +# include +#endif +#ifdef HAVE_STDLIB_H +# include +#endif +#ifdef HAVE_STRING_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_header_c_list= +ac_config_libobj_dir=common/replacements +with_manpages=check +ac_subst_vars='am__EXEEXT_FALSE +am__EXEEXT_TRUE +LTLIBOBJS +NBDKIT_VERSION_MICRO +NBDKIT_VERSION_MINOR +NBDKIT_VERSION_MAJOR +HAVE_VDDK_FALSE +HAVE_VDDK_TRUE +HAVE_TORRENT_FALSE +HAVE_TORRENT_TRUE +LIBTORRENT_LIBS +LIBTORRENT_CFLAGS +HAVE_EXT2_FALSE +HAVE_EXT2_TRUE +COM_ERR_LIBS +COM_ERR_CFLAGS +EXT2FS_LIBS +EXT2FS_CFLAGS +USE_LIBGUESTFS_FOR_TESTS_FALSE +USE_LIBGUESTFS_FOR_TESTS_TRUE +HAVE_LIBGUESTFS_FALSE +HAVE_LIBGUESTFS_TRUE +LIBGUESTFS_LIBS +LIBGUESTFS_CFLAGS +HAVE_LIBZSTD_FALSE +HAVE_LIBZSTD_TRUE +LIBZSTD_LIBS +LIBZSTD_CFLAGS +HAVE_LIBLZMA_FALSE +HAVE_LIBLZMA_TRUE +LIBLZMA_LIBS +LIBLZMA_CFLAGS +HAVE_LIBNBD_FALSE +HAVE_LIBNBD_TRUE +LIBNBD_LIBS +LIBNBD_CFLAGS +ZLIB_NG_LIBS +ZLIB_NG_CFLAGS +HAVE_ZLIB_FALSE +HAVE_ZLIB_TRUE +ZLIB_LIBS +ZLIB_CFLAGS +HAVE_LIBVIRT_FALSE +HAVE_LIBVIRT_TRUE +LIBVIRT_LIBS +LIBVIRT_CFLAGS +HAVE_ISO_FALSE +HAVE_ISO_TRUE +ISOPROG +MKISOFS +GENISOIMAGE +XORRISO +HAVE_SSH_FALSE +HAVE_SSH_TRUE +SSH_LIBS +SSH_CFLAGS +HAVE_CURL_FALSE +HAVE_CURL_TRUE +CURL_LIBS +CURL_CFLAGS +HAVE_LIBBLKIO_FALSE +HAVE_LIBBLKIO_TRUE +LIBBLKIO_LIBS +LIBBLKIO_CFLAGS +HAVE_GOLANG_FALSE +HAVE_GOLANG_TRUE +GOROOT +GOARCH +GOOS +GOLANG +HAVE_LUA_FALSE +HAVE_LUA_TRUE +LUA_LIBS +LUA_CFLAGS +HAVE_TCL_FALSE +HAVE_TCL_TRUE +TCL_LIBS +TCL_CFLAGS +HAVE_RUBY_FALSE +HAVE_RUBY_TRUE +RUBY_LIBS +RUBY_CFLAGS +RUBY +HAVE_RUST_FALSE +HAVE_RUST_TRUE +RUSTC +CARGO +OCAML_PLUGIN_LIBRARIES +OCAML_MAJOR +HAVE_OCAMLDOC_FALSE +HAVE_OCAMLDOC_TRUE +HAVE_OCAML_FALSE +HAVE_OCAML_TRUE +OCAMLBUILD +OCAMLDOC +OCAMLMKLIB +OCAMLMKTOP +OCAMLDEP +OCAML +OCAMLOPTDOTOPT +OCAMLCDOTOPT +OCAMLBEST +OCAMLOPT +OCAMLLIB +OCAMLVERSION +OCAMLC +OCAMLOPTFLAGS +PYTHON_LDFLAGS +HAVE_PYTHON_FALSE +HAVE_PYTHON_TRUE +PYTHON_VERSION +PYTHON_LIBS +PYTHON_CFLAGS +PYTHON +PERL_LDOPTS +PERL_CFLAGS +PERL_ARCHLIB +HAVE_PERL_FALSE +HAVE_PERL_TRUE +CC_PLUGIN_CFLAGS +CC_PLUGIN_CC +HAVE_PLUGINS_FALSE +HAVE_PLUGINS_TRUE +PODWRAPPER +HAVE_POD_FALSE +HAVE_POD_TRUE +PERL +HAVE_BASH_COMPLETION_FALSE +HAVE_BASH_COMPLETION_TRUE +bashcompdir +BASH_COMPLETION_LIBS +BASH_COMPLETION_CFLAGS +USE_LINKER_SCRIPT_FALSE +USE_LINKER_SCRIPT_TRUE +ENABLE_LIBFUZZER_FALSE +ENABLE_LIBFUZZER_TRUE +VALGRIND_LIBS +VALGRIND_CFLAGS +VALGRIND +HAVE_MKE2FS_WITH_D_FALSE +HAVE_MKE2FS_WITH_D_TRUE +TRUNCATE +STAT +CUT +HAVE_GNUTLS_PBKDF2_FALSE +HAVE_GNUTLS_PBKDF2_TRUE +CERTTOOL +HAVE_GNUTLS_FALSE +HAVE_GNUTLS_TRUE +GNUTLS_LIBS +GNUTLS_CFLAGS +LIBSELINUX_LIBS +LIBSELINUX_CFLAGS +PKG_CONFIG_LIBDIR +PKG_CONFIG_PATH +PKG_CONFIG +HAVE_GLIBC_234_FALSE +HAVE_GLIBC_234_TRUE +ac_ct_DLLTOOL +ac_ct_MC +MC +IS_WINDOWS_FALSE +IS_WINDOWS_TRUE +SOEXT +IMPORT_LIBRARY_ON_WINDOWS +NO_UNDEFINED_ON_WINDOWS +DL_LDFLAGS +HAVE_ICONV_FALSE +HAVE_ICONV_TRUE +DL_LIBS +LIBOBJS +PTHREAD_CFLAGS +PTHREAD_LIBS +PTHREAD_CXX +PTHREAD_CC +ax_pthread_config +CAN_TEST_ANSI_C_FALSE +CAN_TEST_ANSI_C_TRUE +WARNINGS_CFLAGS +HAVE_CXX_FALSE +HAVE_CXX_TRUE +CXXCPP +am__fastdepCXX_FALSE +am__fastdepCXX_TRUE +CXXDEPMODE +ac_ct_CXX +CXXFLAGS +CXX +CPP +filters +non_lang_plugins +lang_plugins +plugins +LT_SYS_LIBRARY_PATH +OTOOL64 +OTOOL +LIPO +NMEDIT +DSYMUTIL +MANIFEST_TOOL +RANLIB +ac_ct_AR +AR +FILECMD +LN_S +NM +ac_ct_DUMPBIN +DUMPBIN +LD +FGREP +EGREP +GREP +SED +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +LIBTOOL +OBJDUMP +DLLTOOL +AS +AM_BACKSLASH +AM_DEFAULT_VERBOSITY +AM_DEFAULT_V +AM_V +CSCOPE +ETAGS +CTAGS +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +am__nodep +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__include +DEPDIR +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +MKDIR_P +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +am__isrc +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +runstatedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL +am__quote' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_dependency_tracking +enable_silent_rules +enable_shared +enable_static +with_pic +enable_fast_install +with_aix_soname +with_gnu_ld +with_sysroot +enable_libtool_lock +with_extra +enable_largefile +enable_gcc_warnings +with_iconv +with_selinux +with_gnutls +with_tls_priority +enable_linuxdisk +enable_valgrind +enable_libfuzzer +enable_linker_script +with_bash_completions +with_manpages +enable_plugins +enable_perl +enable_python +enable_ocaml +enable_rust +enable_ruby +enable_tcl +enable_lua +enable_golang +with_libblkio +with_curl +with_ssh +with_iso +with_libvirt +with_zlib +with_zlib_ng +with_libnbd +enable_nbd_plugin +with_liblzma +with_libzstd +with_libguestfs +enable_libguestfs_tests +with_ext2 +enable_torrent +enable_vddk +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +LT_SYS_LIBRARY_PATH +CPP +CXX +CXXFLAGS +CCC +CXXCPP +PKG_CONFIG +PKG_CONFIG_PATH +PKG_CONFIG_LIBDIR +LIBSELINUX_CFLAGS +LIBSELINUX_LIBS +GNUTLS_CFLAGS +GNUTLS_LIBS +VALGRIND_CFLAGS +VALGRIND_LIBS +BASH_COMPLETION_CFLAGS +BASH_COMPLETION_LIBS +bashcompdir +CC_PLUGIN_CC +CC_PLUGIN_CFLAGS +PYTHON_CFLAGS +PYTHON_LIBS +RUBY_CFLAGS +RUBY_LIBS +TCL_CFLAGS +TCL_LIBS +LUA_CFLAGS +LUA_LIBS +LIBBLKIO_CFLAGS +LIBBLKIO_LIBS +CURL_CFLAGS +CURL_LIBS +SSH_CFLAGS +SSH_LIBS +LIBVIRT_CFLAGS +LIBVIRT_LIBS +ZLIB_CFLAGS +ZLIB_LIBS +ZLIB_NG_CFLAGS +ZLIB_NG_LIBS +LIBNBD_CFLAGS +LIBNBD_LIBS +LIBLZMA_CFLAGS +LIBLZMA_LIBS +LIBZSTD_CFLAGS +LIBZSTD_LIBS +LIBGUESTFS_CFLAGS +LIBGUESTFS_LIBS +EXT2FS_CFLAGS +EXT2FS_LIBS +COM_ERR_CFLAGS +COM_ERR_LIBS +LIBTORRENT_CFLAGS +LIBTORRENT_LIBS' + + +# 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' +runstatedir='${localstatedir}/run' +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= ;; + *) ac_optarg=yes ;; + esac + + 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_fn_error $? "invalid feature name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$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_fn_error $? "invalid feature name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$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 ;; + + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + + -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_fn_error $? "invalid package name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$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_fn_error $? "invalid package name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$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_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + printf "%s\n" "$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_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) printf "%s\n" "$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 runstatedir +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_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +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 + 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_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# 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 || +printf "%s\n" 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_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + 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 nbdkit 1.36.2 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] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] + --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/nbdkit] + --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 nbdkit 1.36.2:";; + 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] + --enable-dependency-tracking + do not reject slow dependency extractors + --disable-dependency-tracking + speeds up one-time build + --enable-silent-rules less verbose build output (undo: "make V=1") + --disable-silent-rules verbose build output (undo: "make V=0") + --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) + --disable-largefile omit support for large files + --enable-gcc-warnings turn on lots of GCC warnings (for developers) + --disable-linuxdisk disable linuxdisk plugin [default=check] + --disable-valgrind disable Valgrind probe + --enable-libfuzzer build libFuzzer test binary (developers only) + --disable-linker-script disable linker script for server (developers only) + --disable-plugins disable all bundled plugins and filters + --disable-perl disable Perl embed plugin + --disable-python disable Python embed plugin + --disable-ocaml disable OCaml embed plugin + --disable-rust disable Rust plugin + --disable-ruby disable Ruby plugin + --disable-tcl disable Tcl plugin + --disable-lua disable Lua plugin + --disable-golang disable Go language plugin + --disable-nbd-plugin disable nbd plugin (deprecated, use + --without-libnbd) + --disable-libguestfs-tests + disable tests which need libguestfs + --disable-torrent disable bittorrent plugin + --disable-vddk disable VMware VDDK plugin + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use + both] + --with-aix-soname=aix|svr4|both + shared library versioning (aka "SONAME") variant to + provide on AIX, [default=aix]. + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-sysroot[=DIR] Search for dependent libraries within DIR (or the + compiler's sysroot if not specified). + --with-extra=... extra version information (for use by packagers) + --without-iconv don't try to link against iconv [default=check] + --without-selinux disable SELinux support, used for socket labelling + [default=check] + --without-gnutls disable TLS support via GnuTLS [default=check] + --with-tls-priority=... default TLS session priority string [default=NORMAL] + --without-bash-completions + disable installing bash completions [default=check] + --without-manpages Do not build man pages [default=check] + --without-libblkio disable blkio plugin [default=check] + --without-curl disable curl plugin [default=check] + --without-ssh disable ssh plugin [default=check] + --without-iso disable iso plugin [default=check] + --without-libvirt disable libvirt plugin [default=check] + --without-zlib disable gzip filter [default=check] + --without-zlib-ng disable zlib-ng support [default=check] + --without-libnbd disable nbd plugin [default=check] + --without-liblzma disable xz filter [default=check] + --without-libzstd disable allocator=zstd [default=check] + --without-libguestfs disable guestfs plugin and tests [default=check] + --without-ext2 disable ext2 filter [default=check] + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + LT_SYS_LIBRARY_PATH + User-defined run-time library search path. + CPP C preprocessor + CXX C++ compiler command + CXXFLAGS C++ compiler flags + CXXCPP C++ preprocessor + PKG_CONFIG path to pkg-config utility + PKG_CONFIG_PATH + directories to add to pkg-config's search path + PKG_CONFIG_LIBDIR + path overriding pkg-config's built-in search path + LIBSELINUX_CFLAGS + C compiler flags for LIBSELINUX, overriding pkg-config + LIBSELINUX_LIBS + linker flags for LIBSELINUX, overriding pkg-config + GNUTLS_CFLAGS + C compiler flags for GNUTLS, overriding pkg-config + GNUTLS_LIBS linker flags for GNUTLS, overriding pkg-config + VALGRIND_CFLAGS + C compiler flags for VALGRIND, overriding pkg-config + VALGRIND_LIBS + linker flags for VALGRIND, overriding pkg-config + BASH_COMPLETION_CFLAGS + C compiler flags for BASH_COMPLETION, overriding pkg-config + BASH_COMPLETION_LIBS + linker flags for BASH_COMPLETION, overriding pkg-config + bashcompdir value of completionsdir for bash-completion, overriding + pkg-config + CC_PLUGIN_CC + Value to hard-code into the cc plugin's default for CC, instead + of $CC + CC_PLUGIN_CFLAGS + Value to hard-code into the cc plugin's default for CFLAGS, + instead of $CFLAGS + PYTHON_CFLAGS + C compiler flags for PYTHON, overriding pkg-config + PYTHON_LIBS linker flags for PYTHON, overriding pkg-config + RUBY_CFLAGS C compiler flags for RUBY, overriding pkg-config + RUBY_LIBS linker flags for RUBY, overriding pkg-config + TCL_CFLAGS C compiler flags for TCL, overriding pkg-config + TCL_LIBS linker flags for TCL, overriding pkg-config + LUA_CFLAGS C compiler flags for LUA, overriding pkg-config + LUA_LIBS linker flags for LUA, overriding pkg-config + LIBBLKIO_CFLAGS + C compiler flags for LIBBLKIO, overriding pkg-config + LIBBLKIO_LIBS + linker flags for LIBBLKIO, overriding pkg-config + CURL_CFLAGS C compiler flags for CURL, overriding pkg-config + CURL_LIBS linker flags for CURL, overriding pkg-config + SSH_CFLAGS C compiler flags for SSH, overriding pkg-config + SSH_LIBS linker flags for SSH, overriding pkg-config + LIBVIRT_CFLAGS + C compiler flags for LIBVIRT, overriding pkg-config + LIBVIRT_LIBS + linker flags for LIBVIRT, overriding pkg-config + ZLIB_CFLAGS C compiler flags for ZLIB, overriding pkg-config + ZLIB_LIBS linker flags for ZLIB, overriding pkg-config + ZLIB_NG_CFLAGS + C compiler flags for ZLIB_NG, overriding pkg-config + ZLIB_NG_LIBS + linker flags for ZLIB_NG, overriding pkg-config + LIBNBD_CFLAGS + C compiler flags for LIBNBD, overriding pkg-config + LIBNBD_LIBS linker flags for LIBNBD, overriding pkg-config + LIBLZMA_CFLAGS + C compiler flags for LIBLZMA, overriding pkg-config + LIBLZMA_LIBS + linker flags for LIBLZMA, overriding pkg-config + LIBZSTD_CFLAGS + C compiler flags for LIBZSTD, overriding pkg-config + LIBZSTD_LIBS + linker flags for LIBZSTD, overriding pkg-config + LIBGUESTFS_CFLAGS + C compiler flags for LIBGUESTFS, overriding pkg-config + LIBGUESTFS_LIBS + linker flags for LIBGUESTFS, overriding pkg-config + EXT2FS_CFLAGS + C compiler flags for EXT2FS, overriding pkg-config + EXT2FS_LIBS linker flags for EXT2FS, overriding pkg-config + COM_ERR_CFLAGS + C compiler flags for COM_ERR, overriding pkg-config + COM_ERR_LIBS + linker flags for COM_ERR, overriding pkg-config + LIBTORRENT_CFLAGS + C compiler flags for LIBTORRENT, overriding pkg-config + LIBTORRENT_LIBS + linker flags for LIBTORRENT, overriding pkg-config + +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 the package provider. +_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=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf "%s\n" "$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 configure.gnu first; this name is used for a wrapper for + # Metaconfig's "Configure" on case-insensitive file systems. + 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 + printf "%s\n" "$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 +nbdkit configure 1.36.2 +generated by GNU Autoconf 2.71 + +Copyright (C) 2021 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 + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam + 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:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval "$3=yes" +else $as_nop + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam 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:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. */ + +#include +#undef $2 + +/* 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 $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main (void) +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + eval "$3=yes" +else $as_nop + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + 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:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that +# executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + 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:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { 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:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: program exited with status $ac_status" >&5 + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES +# -------------------------------------------- +# Tries to find the compile-time value of EXPR in a program that includes +# INCLUDES, setting VAR accordingly. Returns whether the value could be +# computed +ac_fn_c_compute_int () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +static int test_array [1 - 2 * !(($2) >= 0)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_lo=0 ac_mid=0 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_hi=$ac_mid; break +else $as_nop + as_fn_arith $ac_mid + 1 && ac_lo=$as_val + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + done +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +static int test_array [1 - 2 * !(($2) < 0)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_hi=-1 ac_mid=-1 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +static int test_array [1 - 2 * !(($2) >= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_lo=$ac_mid; break +else $as_nop + as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + done +else $as_nop + ac_lo= ac_hi= +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_hi=$ac_mid +else $as_nop + as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +done +case $ac_lo in #(( +?*) eval "$3=\$ac_lo"; ac_retval=0 ;; +'') ac_retval=1 ;; +esac + else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +static long int longval (void) { return $2; } +static unsigned long int ulongval (void) { return $2; } +#include +#include +int +main (void) +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if (($2) < 0) + { + long int i = longval (); + if (i != ($2)) + return 1; + fprintf (f, "%ld", i); + } + else + { + unsigned long int i = ulongval (); + if (i != ($2)) + 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 +if ac_fn_c_try_run "$LINENO" +then : + echo >>conftest.val; read $3 &5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_compile + +# ac_fn_cxx_try_cpp LINENO +# ------------------------ +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + 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:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.err + } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_cpp + +# ac_fn_cxx_try_link LINENO +# ------------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam 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:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_link + +# ac_fn_check_decl LINENO SYMBOL VAR INCLUDES EXTRA-OPTIONS FLAG-VAR +# ------------------------------------------------------------------ +# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR +# accordingly. Pass EXTRA-OPTIONS to the compiler, using FLAG-VAR. +ac_fn_check_decl () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + as_decl_name=`echo $2|sed 's/ *(.*//'` + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +printf %s "checking whether $as_decl_name is declared... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` + eval ac_save_FLAGS=\$$6 + as_fn_append $6 " $5" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +#ifndef $as_decl_name +#ifdef __cplusplus + (void) $as_decl_use; +#else + (void) $as_decl_name; +#endif +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval "$3=yes" +else $as_nop + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + eval $6=\$ac_save_FLAGS + +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_check_decl + +# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES +# ---------------------------------------------------- +# Tries to find if the field MEMBER exists in type AGGR, after including +# INCLUDES, setting cache variable VAR accordingly. +ac_fn_c_check_member () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 +printf %s "checking for $2.$3... " >&6; } +if eval test \${$4+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 +int +main (void) +{ +static $2 ac_aggr; +if (ac_aggr.$3) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval "$4=yes" +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 +int +main (void) +{ +static $2 ac_aggr; +if (sizeof ac_aggr.$3) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval "$4=yes" +else $as_nop + eval "$4=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +eval ac_res=\$$4 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_member +ac_configure_args_raw= +for ac_arg +do + case $ac_arg in + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append ac_configure_args_raw " '$ac_arg'" +done + +case $ac_configure_args_raw in + *$as_nl*) + ac_safe_unquote= ;; + *) + ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. + ac_unsafe_a="$ac_unsafe_z#~" + ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" + ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; +esac + +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 nbdkit $as_me 1.36.2, which was +generated by GNU Autoconf 2.71. Invocation command line was + + $ $0$ac_configure_args_raw + +_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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + printf "%s\n" "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=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append 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 + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset 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=$? + # Sanitize IFS. + IFS=" "" $as_nl" + # Save into config.log some information that might help in debugging. + { + echo + + printf "%s\n" "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + 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_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$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= ;; #( + *) { eval $ac_var=; 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 + + printf "%s\n" "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + printf "%s\n" "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + printf "%s\n" "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + printf "%s\n" "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + printf "%s\n" "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + printf "%s\n" "$as_me: caught signal $ac_signal" + printf "%s\n" "$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'; as_fn_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 + +printf "%s\n" "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +if test -n "$CONFIG_SITE"; then + ac_site_files="$CONFIG_SITE" +elif test "x$prefix" != xNONE; then + ac_site_files="$prefix/share/config.site $prefix/etc/config.site" +else + ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" +fi + +for ac_site_file in $ac_site_files +do + case $ac_site_file in #( + */*) : + ;; #( + *) : + ac_site_file=./$ac_site_file ;; +esac + if test -f "$ac_site_file" && test -r "$ac_site_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + 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. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +printf "%s\n" "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +printf "%s\n" "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" +# Test code for whether the C compiler supports C89 (global declarations) +ac_c_conftest_c89_globals=' +/* Does the compiler advertise C89 conformance? + Do not test the value of __STDC__, because some compilers set it to 0 + while being otherwise adequately conformant. */ +#if !defined __STDC__ +# error "Compiler does not advertise C89 conformance" +#endif + +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ +struct buf { int x; }; +struct buf * (*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 do not provoke an error unfortunately, instead are silently treated + as an "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 is necessary to write \x00 == 0 to get something + that is 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 **, int *(*)(struct buf *, struct stat *, int), + int, int);' + +# Test code for whether the C compiler supports C89 (body of main). +ac_c_conftest_c89_main=' +ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); +' + +# Test code for whether the C compiler supports C99 (global declarations) +ac_c_conftest_c99_globals=' +// Does the compiler advertise C99 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L +# error "Compiler does not advertise C99 conformance" +#endif + +#include +extern int puts (const char *); +extern int printf (const char *, ...); +extern int dprintf (int, const char *, ...); +extern void *malloc (size_t); + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +// dprintf is used instead of fprintf to avoid needing to declare +// FILE and stderr. +#define debug(...) dprintf (2, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + #error "your preprocessor is broken" +#endif +#if BIG_OK +#else + #error "your preprocessor is broken" +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static bool +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str = ""; + int number = 0; + float fnumber = 0; + + while (*format) + { + switch (*format++) + { + case '\''s'\'': // string + str = va_arg (args_copy, const char *); + break; + case '\''d'\'': // int + number = va_arg (args_copy, int); + break; + case '\''f'\'': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); + + return *str && number && fnumber; +} +' + +# Test code for whether the C compiler supports C99 (body of main). +ac_c_conftest_c99_main=' + // Check bool. + _Bool success = false; + success |= (argc != 0); + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[0] = argv[0][0]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' + || dynamic_array[ni.number - 1] != 543); +' + +# Test code for whether the C compiler supports C11 (global declarations) +ac_c_conftest_c11_globals=' +// Does the compiler advertise C11 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L +# error "Compiler does not advertise C11 conformance" +#endif + +// Check _Alignas. +char _Alignas (double) aligned_as_double; +char _Alignas (0) no_special_alignment; +extern char aligned_as_int; +char _Alignas (0) _Alignas (int) aligned_as_int; + +// Check _Alignof. +enum +{ + int_alignment = _Alignof (int), + int_array_alignment = _Alignof (int[100]), + char_alignment = _Alignof (char) +}; +_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); + +// Check _Noreturn. +int _Noreturn does_not_return (void) { for (;;) continue; } + +// Check _Static_assert. +struct test_static_assert +{ + int x; + _Static_assert (sizeof (int) <= sizeof (long int), + "_Static_assert does not work in struct"); + long int y; +}; + +// Check UTF-8 literals. +#define u8 syntax error! +char const utf8_literal[] = u8"happens to be ASCII" "another string"; + +// Check duplicate typedefs. +typedef long *long_ptr; +typedef long int *long_ptr; +typedef long_ptr long_ptr; + +// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. +struct anonymous +{ + union { + struct { int i; int j; }; + struct { int k; long int l; } w; + }; + int m; +} v1; +' + +# Test code for whether the C compiler supports C11 (body of main). +ac_c_conftest_c11_main=' + _Static_assert ((offsetof (struct anonymous, i) + == offsetof (struct anonymous, w.k)), + "Anonymous union alignment botch"); + v1.i = 2; + v1.w.k = 5; + ok |= v1.i != 5; +' + +# Test code for whether the C compiler supports C11 (complete). +ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} +${ac_c_conftest_c11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + ${ac_c_conftest_c11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C99 (complete). +ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + return ok; +} +" + +# Test code for whether the C compiler supports C89 (complete). +ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + return ok; +} +" + +as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" +as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" +as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" +as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" +as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" +as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" +as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" +as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" +as_fn_append ac_header_c_list " wchar.h wchar_h HAVE_WCHAR_H" +as_fn_append ac_header_c_list " minix/config.h minix_config_h HAVE_MINIX_CONFIG_H" +# Test code for whether the C++ compiler supports C++98 (global declarations) +ac_cxx_conftest_cxx98_globals=' +// Does the compiler advertise C++98 conformance? +#if !defined __cplusplus || __cplusplus < 199711L +# error "Compiler does not advertise C++98 conformance" +#endif + +// These inclusions are to reject old compilers that +// lack the unsuffixed header files. +#include +#include + +// and are *not* freestanding headers in C++98. +extern void assert (int); +namespace std { + extern int strcmp (const char *, const char *); +} + +// Namespaces, exceptions, and templates were all added after "C++ 2.0". +using std::exception; +using std::strcmp; + +namespace { + +void test_exception_syntax() +{ + try { + throw "test"; + } catch (const char *s) { + // Extra parentheses suppress a warning when building autoconf itself, + // due to lint rules shared with more typical C programs. + assert (!(strcmp) (s, "test")); + } +} + +template struct test_template +{ + T const val; + explicit test_template(T t) : val(t) {} + template T add(U u) { return static_cast(u) + val; } +}; + +} // anonymous namespace +' + +# Test code for whether the C++ compiler supports C++98 (body of main) +ac_cxx_conftest_cxx98_main=' + assert (argc); + assert (! argv[0]); +{ + test_exception_syntax (); + test_template tt (2.0); + assert (tt.add (4) == 6.0); + assert (true && !false); +} +' + +# Test code for whether the C++ compiler supports C++11 (global declarations) +ac_cxx_conftest_cxx11_globals=' +// Does the compiler advertise C++ 2011 conformance? +#if !defined __cplusplus || __cplusplus < 201103L +# error "Compiler does not advertise C++11 conformance" +#endif + +namespace cxx11test +{ + constexpr int get_val() { return 20; } + + struct testinit + { + int i; + double d; + }; + + class delegate + { + public: + delegate(int n) : n(n) {} + delegate(): delegate(2354) {} + + virtual int getval() { return this->n; }; + protected: + int n; + }; + + class overridden : public delegate + { + public: + overridden(int n): delegate(n) {} + virtual int getval() override final { return this->n * 2; } + }; + + class nocopy + { + public: + nocopy(int i): i(i) {} + nocopy() = default; + nocopy(const nocopy&) = delete; + nocopy & operator=(const nocopy&) = delete; + private: + int i; + }; + + // for testing lambda expressions + template Ret eval(Fn f, Ret v) + { + return f(v); + } + + // for testing variadic templates and trailing return types + template auto sum(V first) -> V + { + return first; + } + template auto sum(V first, Args... rest) -> V + { + return first + sum(rest...); + } +} +' + +# Test code for whether the C++ compiler supports C++11 (body of main) +ac_cxx_conftest_cxx11_main=' +{ + // Test auto and decltype + auto a1 = 6538; + auto a2 = 48573953.4; + auto a3 = "String literal"; + + int total = 0; + for (auto i = a3; *i; ++i) { total += *i; } + + decltype(a2) a4 = 34895.034; +} +{ + // Test constexpr + short sa[cxx11test::get_val()] = { 0 }; +} +{ + // Test initializer lists + cxx11test::testinit il = { 4323, 435234.23544 }; +} +{ + // Test range-based for + int array[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, + 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; + for (auto &x : array) { x += 23; } +} +{ + // Test lambda expressions + using cxx11test::eval; + assert (eval ([](int x) { return x*2; }, 21) == 42); + double d = 2.0; + assert (eval ([&](double x) { return d += x; }, 3.0) == 5.0); + assert (d == 5.0); + assert (eval ([=](double x) mutable { return d += x; }, 4.0) == 9.0); + assert (d == 5.0); +} +{ + // Test use of variadic templates + using cxx11test::sum; + auto a = sum(1); + auto b = sum(1, 2); + auto c = sum(1.0, 2.0, 3.0); +} +{ + // Test constructor delegation + cxx11test::delegate d1; + cxx11test::delegate d2(); + cxx11test::delegate d3(45); +} +{ + // Test override and final + cxx11test::overridden o1(55464); +} +{ + // Test nullptr + char *c = nullptr; +} +{ + // Test template brackets + test_template<::test_template> v(test_template(12)); +} +{ + // Unicode literals + char const *utf8 = u8"UTF-8 string \u2500"; + char16_t const *utf16 = u"UTF-8 string \u2500"; + char32_t const *utf32 = U"UTF-32 string \u2500"; +} +' + +# Test code for whether the C compiler supports C++11 (complete). +ac_cxx_conftest_cxx11_program="${ac_cxx_conftest_cxx98_globals} +${ac_cxx_conftest_cxx11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_cxx_conftest_cxx98_main} + ${ac_cxx_conftest_cxx11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C++98 (complete). +ac_cxx_conftest_cxx98_program="${ac_cxx_conftest_cxx98_globals} +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_cxx_conftest_cxx98_main} + return ok; +} +" + + +# Auxiliary files required by this configure script. +ac_aux_files="config.guess config.sub ltmain.sh missing install-sh compile" + +# Locations in which to look for auxiliary files. +ac_aux_dir_candidates="${srcdir}${PATH_SEPARATOR}${srcdir}/..${PATH_SEPARATOR}${srcdir}/../.." + +# Search for a directory containing all of the required auxiliary files, +# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. +# If we don't find one directory that contains all the files we need, +# we report the set of missing files from the *first* directory in +# $ac_aux_dir_candidates and give up. +ac_missing_aux_files="" +ac_first_candidate=: +printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in $ac_aux_dir_candidates +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + + printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 + ac_aux_dir_found=yes + ac_install_sh= + for ac_aux in $ac_aux_files + do + # As a special case, if "install-sh" is required, that requirement + # can be satisfied by any of "install-sh", "install.sh", or "shtool", + # and $ac_install_sh is set appropriately for whichever one is found. + if test x"$ac_aux" = x"install-sh" + then + if test -f "${as_dir}install-sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 + ac_install_sh="${as_dir}install-sh -c" + elif test -f "${as_dir}install.sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 + ac_install_sh="${as_dir}install.sh -c" + elif test -f "${as_dir}shtool"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 + ac_install_sh="${as_dir}shtool install -c" + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} install-sh" + else + break + fi + fi + else + if test -f "${as_dir}${ac_aux}"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" + else + break + fi + fi + fi + done + if test "$ac_aux_dir_found" = yes; then + ac_aux_dir="$as_dir" + break + fi + ac_first_candidate=false + + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 +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. +if test -f "${ac_aux_dir}config.guess"; then + ac_config_guess="$SHELL ${ac_aux_dir}config.guess" +fi +if test -f "${ac_aux_dir}config.sub"; then + ac_config_sub="$SHELL ${ac_aux_dir}config.sub" +fi +if test -f "$ac_aux_dir/configure"; then + ac_configure="$SHELL ${ac_aux_dir}configure" +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,) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +printf "%s\n" "$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +printf "%s\n" "$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=`printf "%s\n" "$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. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' + and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +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 + + + + + + + + + + + + + + + + +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` + +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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$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" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "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:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. +set dummy ${ac_tool_prefix}clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}clang" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="clang" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +fi + + +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion -version; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + 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. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +printf %s "checking whether the C compiler works... " >&6; } +ac_link_default=`printf "%s\n" "$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:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +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+y} && 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 $as_nop + ac_file='' +fi +if test -z "$ac_file" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +printf %s "checking for C compiler default output file name... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +printf "%s\n" "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +printf %s "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:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +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_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +printf "%s\n" "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +printf %s "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { 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:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +printf "%s\n" "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +printf %s "checking for suffix of object files... " >&6; } +if test ${ac_cv_objext+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + 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:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +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_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +printf "%s\n" "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_compiler_gnu=yes +else $as_nop + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+y} +ac_save_CFLAGS=$CFLAGS +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +printf %s "checking whether $CC accepts -g... " >&6; } +if test ${ac_cv_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +else $as_nop + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +printf "%s\n" "$ac_cv_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; 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 +ac_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +printf %s "checking for $CC option to enable C11 features... " >&6; } +if test ${ac_cv_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c11=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c11_program +_ACEOF +for ac_arg in '' -std=gnu11 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } + CC="$CC $ac_cv_prog_cc_c11" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 + ac_prog_cc_stdc=c11 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +printf %s "checking for $CC option to enable C99 features... " >&6; } +if test ${ac_cv_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c99_program +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c99" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c99" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } + CC="$CC $ac_cv_prog_cc_c99" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 + ac_prog_cc_stdc=c99 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +printf %s "checking for $CC option to enable C89 features... " >&6; } +if test ${ac_cv_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c89_program +_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" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c89" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c89" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } + CC="$CC $ac_cv_prog_cc_c89" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 + ac_prog_cc_stdc=c89 +fi +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 + + + 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +printf %s "checking whether $CC understands -c and -o together... " >&6; } +if test ${am_cv_prog_cc_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 + ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } +if test "$am_cv_prog_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 + + + +ac_header= ac_cache= +for ac_item in $ac_header_c_list +do + if test $ac_cache; then + ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" + if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then + printf "%s\n" "#define $ac_item 1" >> confdefs.h + fi + ac_header= ac_cache= + elif test $ac_header; then + ac_cache=$ac_item + else + ac_header=$ac_item + fi +done + + + + + + + + +if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes +then : + +printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h + +fi + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 +printf %s "checking whether it is safe to define __EXTENSIONS__... " >&6; } +if test ${ac_cv_safe_to_define___extensions__+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +# define __EXTENSIONS__ 1 + $ac_includes_default +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_safe_to_define___extensions__=yes +else $as_nop + ac_cv_safe_to_define___extensions__=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 +printf "%s\n" "$ac_cv_safe_to_define___extensions__" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether _XOPEN_SOURCE should be defined" >&5 +printf %s "checking whether _XOPEN_SOURCE should be defined... " >&6; } +if test ${ac_cv_should_define__xopen_source+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_should_define__xopen_source=no + if test $ac_cv_header_wchar_h = yes +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + mbstate_t x; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #define _XOPEN_SOURCE 500 + #include + mbstate_t x; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_should_define__xopen_source=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_should_define__xopen_source" >&5 +printf "%s\n" "$ac_cv_should_define__xopen_source" >&6; } + + printf "%s\n" "#define _ALL_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _DARWIN_C_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _GNU_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _HPUX_ALT_XOPEN_SOCKET_API 1" >>confdefs.h + + printf "%s\n" "#define _NETBSD_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _OPENBSD_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_BFP_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_DFP_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_TYPES_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_LIB_EXT2__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_MATH_SPEC_FUNCS__ 1" >>confdefs.h + + printf "%s\n" "#define _TANDEM_SOURCE 1" >>confdefs.h + + if test $ac_cv_header_minix_config_h = yes +then : + MINIX=yes + printf "%s\n" "#define _MINIX 1" >>confdefs.h + + printf "%s\n" "#define _POSIX_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _POSIX_1_SOURCE 2" >>confdefs.h + +else $as_nop + MINIX= +fi + if test $ac_cv_safe_to_define___extensions__ = yes +then : + printf "%s\n" "#define __EXTENSIONS__ 1" >>confdefs.h + +fi + if test $ac_cv_should_define__xopen_source = yes +then : + printf "%s\n" "#define _XOPEN_SOURCE 500" >>confdefs.h + +fi + + +am__api_version='1.16' + + + # 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. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +printf %s "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if test ${ac_cv_path_install+y} +then : + printf %s "(cached) " >&6 +else $as_nop + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + # Account for fact that we put trailing slashes in our PATH walk. +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 as_fn_executable_p "$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+y}; 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +printf "%s\n" "$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' + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +printf %s "checking whether build environment is sane... " >&6; } +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[\\\"\#\$\&\'\`$am_lf]*) + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; +esac + +# 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 ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + 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 + 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_fn_error $? "ls -t appears to fail. Make sure there is not a broken + alias in your environment" "$LINENO" 5 + fi + if test "$2" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi + +rm -f conftest.file + +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=`printf "%s\n" "$program_transform_name" | sed "$ac_script"` + + + if test x"${MISSING+set}" != xset; then + MISSING="\${SHELL} '$am_aux_dir/missing'" +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +printf "%s\n" "$as_me: WARNING: 'missing' script is too old or missing" >&2;} +fi + +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi + +# 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +printf "%s\n" "$STRIP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +printf "%s\n" "$ac_ct_STRIP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&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" + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a race-free mkdir -p" >&5 +printf %s "checking for a race-free mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if test ${ac_cv_path_mkdir+y} +then : + printf %s "(cached) " >&6 +else $as_nop + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext" || continue + case `"$as_dir$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir ('*'coreutils) '* | \ + 'BusyBox '* | \ + '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 + + test -d ./--version && rmdir ./--version + if test ${ac_cv_path_mkdir+y}; 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. + MKDIR_P="$ac_install_sh -d" + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +printf "%s\n" "$MKDIR_P" >&6; } + +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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AWK+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +printf "%s\n" "$AWK" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval test \${ac_cv_prog_make_${ac_make}_set+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + SET_MAKE= +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "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 + +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 +printf %s "checking whether ${MAKE-make} supports the include directive... " >&6; } +cat > confinc.mk << 'END' +am__doit: + @echo this is the am__doit target >confinc.out +.PHONY: am__doit +END +am__include="#" +am__quote= +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 + (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + case $?:`cat confinc.out 2>/dev/null` in #( + '0:this is the am__doit target') : + case $s in #( + BSD) : + am__include='.include' am__quote='"' ;; #( + *) : + am__include='include' am__quote='' ;; +esac ;; #( + *) : + ;; +esac + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 +printf "%s\n" "${_am_result}" >&6; } + +# Check whether --enable-dependency-tracking was given. +if test ${enable_dependency_tracking+y} +then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + +# Check whether --enable-silent-rules was given. +if test ${enable_silent_rules+y} +then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in # ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=1;; +esac +am_make=${MAKE-make} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +printf %s "checking whether $am_make supports nested variables... " >&6; } +if test ${am_cv_make_support_nested_variables+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if printf "%s\n" 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AM_BACKSLASH='\' + +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_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + 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='nbdkit' + VERSION='1.36.2' + + +printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h + + +printf "%s\n" "#define VERSION \"$VERSION\"" >>confdefs.h + +# 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"} + +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +mkdir_p='$(MKDIR_P)' + +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. +# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AMTAR='$${TAR-tar}' + + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar pax cpio none' + +am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' + + + + + +depcc="$CC" am_compiler_list= + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +printf %s "checking dependency style of $depcc... " >&6; } +if test ${am_cv_CC_dependencies_compiler_type+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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". + rm -rf conftest.dir + 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 + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + 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 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # 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. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + 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 + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj 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 $am__obj 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +printf "%s\n" "$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 + + +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi + +if test -z "$ETAGS"; then + ETAGS=etags +fi + +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi + + + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 + fi +fi + +case `pwd` in + *\ * | *\ *) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 +printf "%s\n" "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; +esac + + + +macro_version='2.4.7' +macro_revision='2.4.7' + + + + + + + + + + + + + + +ltmain=$ac_aux_dir/ltmain.sh + + + + # Make sure we can run config.sub. +$SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +printf %s "checking build system type... " >&6; } +if test ${ac_cv_build+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +printf "%s\n" "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +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 + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +printf %s "checking host system type... " >&6; } +if test ${ac_cv_host+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +printf "%s\n" "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +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 + + +# Backslashify 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' + +ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 +printf %s "checking how to print strings... " >&6; } +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "" +} + +case $ECHO in + printf*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: printf" >&5 +printf "%s\n" "printf" >&6; } ;; + print*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 +printf "%s\n" "print -r" >&6; } ;; + *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: cat" >&5 +printf "%s\n" "cat" >&6; } ;; +esac + + + + + + + + + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +printf %s "checking for a sed that does not truncate output... " >&6; } +if test ${ac_cv_path_SED+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + { ac_script=; unset 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + 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" + as_fn_executable_p "$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 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" '' >> "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 + as_fn_arith $ac_count + 1 && ac_count=$as_val + 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_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +printf "%s\n" "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" + + + + + + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +printf %s "checking for grep that handles long lines and -e... " >&6; } +if test ${ac_cv_path_GREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + 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" + as_fn_executable_p "$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 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" '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 + as_fn_arith $ac_count + 1 && ac_count=$as_val + 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_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +printf "%s\n" "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +printf %s "checking for egrep... " >&6; } +if test ${ac_cv_path_EGREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + 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" + as_fn_executable_p "$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 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" '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 + as_fn_arith $ac_count + 1 && ac_count=$as_val + 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_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +printf "%s\n" "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 +printf %s "checking for fgrep... " >&6; } +if test ${ac_cv_path_FGREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + 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" + as_fn_executable_p "$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 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" '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 + as_fn_arith $ac_count + 1 && ac_count=$as_val + 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_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_FGREP=$FGREP +fi + + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 +printf "%s\n" "$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+y} +then : + withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes +else $as_nop + with_gnu_ld=no +fi + +ac_prog=ld +if test yes = "$GCC"; then + # Check if gcc -print-prog-name=ld gives a path. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +printf %s "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 yes = "$with_gnu_ld"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +printf %s "checking for GNU ld... " >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +printf %s "checking for non-GNU ld... " >&6; } +fi +if test ${lt_cv_path_LD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 &5 +printf "%s\n" "$LD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +printf %s "checking if the linker ($LD) is GNU ld... " >&6; } +if test ${lt_cv_prog_gnu_ld+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +printf "%s\n" "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 +printf %s "checking for BSD- or MS-compatible name lister (nm)... " >&6; } +if test ${lt_cv_path_NM+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty + case $build_os in + mingw*) lt_bad_file=conftest.nm/nofile ;; + *) lt_bad_file=/dev/null ;; + esac + case `"$tmp_nm" -B $lt_bad_file 2>&1 | $SED '1q'` in + *$lt_bad_file* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break 2 + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | $SED '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break 2 + ;; + *) + 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 +printf "%s\n" "$lt_cv_path_NM" >&6; } +if test no != "$lt_cv_path_NM"; then + NM=$lt_cv_path_NM +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + if test -n "$ac_tool_prefix"; then + for ac_prog in dumpbin "link -dump" + 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_DUMPBIN+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 +printf "%s\n" "$DUMPBIN" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$DUMPBIN" && break + done +fi +if test -z "$DUMPBIN"; then + ac_ct_DUMPBIN=$DUMPBIN + for ac_prog in dumpbin "link -dump" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_DUMPBIN+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 +printf "%s\n" "$ac_ct_DUMPBIN" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "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:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DUMPBIN=$ac_ct_DUMPBIN + fi +fi + + case `$DUMPBIN -symbols -headers /dev/null 2>&1 | $SED '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols -headers" + ;; + *) + DUMPBIN=: + ;; + esac + fi + + if test : != "$DUMPBIN"; then + NM=$DUMPBIN + fi +fi +test -z "$NM" && NM=nm + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 +printf %s "checking the name lister ($NM) interface... " >&6; } +if test ${lt_cv_nm_interface+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 +printf "%s\n" "$lt_cv_nm_interface" >&6; } + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +printf %s "checking whether ln -s works... " >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +printf "%s\n" "no, using $LN_S" >&6; } +fi + +# find the maximum length of command line arguments +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 +printf %s "checking the maximum length of command line arguments... " >&6; } +if test ${lt_cv_sys_max_cmd_len+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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; + ;; + + mint*) + # On MiNT this can take a long time and run out of memory. + 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; + ;; + + bitrig* | darwin* | dragonfly* | freebsd* | midnightbsd* | netbsd* | openbsd*) + # 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 + ;; + + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; + + 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" && \ + test undefined != "$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`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test 17 != "$i" # 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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 +printf "%s\n" "$lt_cv_sys_max_cmd_len" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none" >&5 +printf "%s\n" "none" >&6; } +fi +max_cmd_len=$lt_cv_sys_max_cmd_len + + + + + + +: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} + +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 + + + + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 +printf %s "checking how to convert $build file names to $host format... " >&6; } +if test ${lt_cv_to_host_file_cmd+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac + +fi + +to_host_file_cmd=$lt_cv_to_host_file_cmd +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 +printf "%s\n" "$lt_cv_to_host_file_cmd" >&6; } + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 +printf %s "checking how to convert $build file names to toolchain format... " >&6; } +if test ${lt_cv_to_tool_file_cmd+y} +then : + printf %s "(cached) " >&6 +else $as_nop + #assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac + +fi + +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 +printf "%s\n" "$lt_cv_to_tool_file_cmd" >&6; } + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 +printf %s "checking for $LD option to reload object files... " >&6; } +if test ${lt_cv_ld_reload_flag+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_ld_reload_flag='-r' +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 +printf "%s\n" "$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 + cygwin* | mingw* | pw32* | cegcc*) + if test yes != "$GCC"; then + reload_cmds=false + fi + ;; + darwin*) + if test yes = "$GCC"; 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}file", so it can be a program name with args. +set dummy ${ac_tool_prefix}file; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_FILECMD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$FILECMD"; then + ac_cv_prog_FILECMD="$FILECMD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_FILECMD="${ac_tool_prefix}file" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +FILECMD=$ac_cv_prog_FILECMD +if test -n "$FILECMD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $FILECMD" >&5 +printf "%s\n" "$FILECMD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_FILECMD"; then + ac_ct_FILECMD=$FILECMD + # Extract the first word of "file", so it can be a program name with args. +set dummy file; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_FILECMD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_FILECMD"; then + ac_cv_prog_ac_ct_FILECMD="$ac_ct_FILECMD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_FILECMD="file" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_FILECMD=$ac_cv_prog_ac_ct_FILECMD +if test -n "$ac_ct_FILECMD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_FILECMD" >&5 +printf "%s\n" "$ac_ct_FILECMD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_FILECMD" = x; then + FILECMD=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + FILECMD=$ac_ct_FILECMD + fi +else + FILECMD="$ac_cv_prog_FILECMD" +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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OBJDUMP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +printf "%s\n" "$OBJDUMP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OBJDUMP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OBJDUMP="objdump" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +printf "%s\n" "$ac_ct_OBJDUMP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_OBJDUMP" = x; then + OBJDUMP="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OBJDUMP=$ac_ct_OBJDUMP + fi +else + OBJDUMP="$ac_cv_prog_OBJDUMP" +fi + +test -z "$OBJDUMP" && OBJDUMP=objdump + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 +printf %s "checking how to recognize dependent libraries... " >&6; } +if test ${lt_cv_deplibs_check_method+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 +# that 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='$FILECMD -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 + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + 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* | midnightbsd*) + 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=$FILECMD + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=$FILECMD + 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])(-bit)?( [LM]SB)? 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 glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | 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=$FILECMD + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd* | bitrig*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; 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 + ;; +os2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 +printf "%s\n" "$lt_cv_deplibs_check_method" >&6; } + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` + fi + ;; + esac +fi + +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}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_DLLTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +printf "%s\n" "$DLLTOOL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_DLLTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DLLTOOL="dlltool" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +printf "%s\n" "$ac_ct_DLLTOOL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_DLLTOOL" = x; then + DLLTOOL="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DLLTOOL=$ac_ct_DLLTOOL + fi +else + DLLTOOL="$ac_cv_prog_DLLTOOL" +fi + +test -z "$DLLTOOL" && DLLTOOL=dlltool + + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 +printf %s "checking how to associate runtime and link libraries... " >&6; } +if test ${lt_cv_sharedlib_from_linklib_cmd+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh; + # decide which one to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd=$ECHO + ;; +esac + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 +printf "%s\n" "$lt_cv_sharedlib_from_linklib_cmd" >&6; } +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + + + + + + + +if test -n "$ac_tool_prefix"; then + for ac_prog in ar + 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AR+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +printf "%s\n" "$AR" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$AR" && break + done +fi +if test -z "$AR"; then + ac_ct_AR=$AR + for ac_prog in ar +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_AR+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +printf "%s\n" "$ac_ct_AR" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$ac_ct_AR" && break +done + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +fi + +: ${AR=ar} + + + + + + +# Use ARFLAGS variable as AR's operation code to sync the variable naming with +# Automake. If both AR_FLAGS and ARFLAGS are specified, AR_FLAGS should have +# higher priority because thats what people were doing historically (setting +# ARFLAGS for automake and AR_FLAGS for libtool). FIXME: Make the AR_FLAGS +# variable obsoleted/removed. + +test ${AR_FLAGS+y} || AR_FLAGS=${ARFLAGS-cr} +lt_ar_flags=$AR_FLAGS + + + + + + +# Make AR_FLAGS overridable by 'make ARFLAGS='. Don't try to run-time override +# by AR_FLAGS because that was never working and AR_FLAGS is about to die. + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 +printf %s "checking for archiver @FILE support... " >&6; } +if test ${lt_cv_ar_at_file+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_ar_at_file=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test 0 -eq "$ac_status"; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test 0 -ne "$ac_status"; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 +printf "%s\n" "$lt_cv_ar_at_file" >&6; } + +if test no = "$lt_cv_ar_at_file"; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi + + + + + + + +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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +printf "%s\n" "$STRIP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +printf "%s\n" "$ac_ct_STRIP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +printf "%s\n" "$RANLIB" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +printf "%s\n" "$ac_ct_RANLIB" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&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 + bitrig* | openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" +fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# 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. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 +printf %s "checking command to parse $NM output from $compiler object... " >&6; } +if test ${lt_cv_sys_global_symbol_pipe+y} +then : + printf %s "(cached) " >&6 +else $as_nop + +# 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 ia64 = "$host_cpu"; 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 + +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Gets list of data symbols to import. + lt_cv_sys_global_symbol_to_import="$SED -n -e 's/^I .* \(.*\)$/\1/p'" + # Adjust the below global symbol transforms to fixup imported variables. + lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" + lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" + lt_c_name_lib_hook="\ + -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ + -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" +else + # Disable hooks by default. + lt_cv_sys_global_symbol_to_import= + lt_cdecl_hook= + lt_c_name_hook= + lt_c_name_lib_hook= +fi + +# 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"\ +$lt_cdecl_hook\ +" -e 's/^T .* \(.*\)$/extern int \1();/p'"\ +" -e 's/^$symcode$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"\ +$lt_c_name_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" + +# Transform an extracted symbol line into symbol name with lib prefix and +# symbol address. +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="$SED -n"\ +$lt_c_name_lib_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/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, + # D for any global variable and I for any imported variable. + # Also find C++ and __fastcall symbols from MSVC++ or ICC, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK '"\ +" {last_section=section; section=\$ 3};"\ +" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ +" /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ +" /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ +" {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ +" s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print f,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 + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | $SED '/ __gnu_lto/d'" + + # 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\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { { eval echo "\"\$as_me\":${as_lineno-$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=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && 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 +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE +/* DATA imports from DLLs on WIN32 can't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined __osf__ +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + +#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. */ +LT_DLSYM_CONST struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$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_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS + LIBS=conftstm.$ac_objext + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest$ac_exeext; then + pipe_works=yes + fi + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_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 yes = "$pipe_works"; 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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +printf "%s\n" "failed" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +printf "%s\n" "ok" >&6; } +fi + +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 +printf %s "checking for sysroot... " >&6; } + +# Check whether --with-sysroot was given. +if test ${with_sysroot+y} +then : + withval=$with_sysroot; +else $as_nop + with_sysroot=no +fi + + +lt_sysroot= +case $with_sysroot in #( + yes) + if test yes = "$GCC"; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | $SED -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 +printf "%s\n" "$with_sysroot" >&6; } + as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 + ;; +esac + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 +printf "%s\n" "${lt_sysroot:-no}" >&6; } + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 +printf %s "checking for a working dd... " >&6; } +if test ${ac_cv_path_lt_DD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + printf 0123456789abcdef0123456789abcdef >conftest.i +cat conftest.i conftest.i >conftest2.i +: ${lt_DD:=$DD} +if test -z "$lt_DD"; then + ac_path_lt_DD_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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in dd + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_lt_DD="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_lt_DD" || continue +if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: +fi + $ac_path_lt_DD_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_lt_DD"; then + : + fi +else + ac_cv_path_lt_DD=$lt_DD +fi + +rm -f conftest.i conftest2.i conftest.out +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 +printf "%s\n" "$ac_cv_path_lt_DD" >&6; } + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 +printf %s "checking how to truncate binary pipes... " >&6; } +if test ${lt_cv_truncate_bin+y} +then : + printf %s "(cached) " >&6 +else $as_nop + printf 0123456789abcdef0123456789abcdef >conftest.i +cat conftest.i conftest.i >conftest2.i +lt_cv_truncate_bin= +if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" +fi +rm -f conftest.i conftest2.i conftest.out +test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 +printf "%s\n" "$lt_cv_truncate_bin" >&6; } + + + + + + + +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +func_cc_basename () +{ + for cc_temp in $*""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac + done + func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +} + +# Check whether --enable-libtool-lock was given. +if test ${enable_libtool_lock+y} +then : + enableval=$enable_libtool_lock; +fi + +test no = "$enable_libtool_lock" || 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 what ABI is being produced by ac_compile, and set mode + # options accordingly. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `$FILECMD conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE=32 + ;; + *ELF-64*) + HPUX_IA64_MODE=64 + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo '#line '$LINENO' "configure"' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + if test yes = "$lt_cv_prog_gnu_ld"; then + case `$FILECMD conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `$FILECMD 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* + ;; + +mips64*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo '#line '$LINENO' "configure"' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + emul=elf + case `$FILECMD conftest.$ac_objext` in + *32-bit*) + emul="${emul}32" + ;; + *64-bit*) + emul="${emul}64" + ;; + esac + case `$FILECMD conftest.$ac_objext` in + *MSB*) + emul="${emul}btsmip" + ;; + *LSB*) + emul="${emul}ltsmip" + ;; + esac + case `$FILECMD conftest.$ac_objext` in + *N32*) + emul="${emul}n32" + ;; + esac + LD="${LD-ld} -m $emul" + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. Note that the listed cases only cover the + # situations where additional linker options are needed (such as when + # doing 32-bit compilation for a host where ld defaults to 64-bit, or + # vice versa); the common cases where no linker options are needed do + # not appear in the list. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `$FILECMD conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + case `$FILECMD conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac + ;; + powerpc64le-*linux*) + LD="${LD-ld} -m elf32lppclinux" + ;; + 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" + ;; + powerpcle-*linux*) + LD="${LD-ld} -m elf64lppc" + ;; + 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" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 +printf %s "checking whether the C compiler needs -belf... " >&6; } +if test ${lt_cv_cc_needs_belf+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + lt_cv_cc_needs_belf=yes +else $as_nop + lt_cv_cc_needs_belf=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 +printf "%s\n" "$lt_cv_cc_needs_belf" >&6; } + if test yes != "$lt_cv_cc_needs_belf"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS=$SAVE_CFLAGS + fi + ;; +*-*solaris*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `$FILECMD conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) + case $host in + i?86-*-solaris*|x86_64-*-solaris*) + LD="${LD-ld} -m elf_x86_64" + ;; + sparc*-*-solaris*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + # GNU ld 2.21 introduced _sol2 emulations. Use them if available. + if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then + LD=${LD-ld}_sol2 + fi + ;; + *) + 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 + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. +set dummy ${ac_tool_prefix}mt; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_MANIFEST_TOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$MANIFEST_TOOL"; then + ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL +if test -n "$MANIFEST_TOOL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 +printf "%s\n" "$MANIFEST_TOOL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_MANIFEST_TOOL"; then + ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL + # Extract the first word of "mt", so it can be a program name with args. +set dummy mt; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_MANIFEST_TOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_MANIFEST_TOOL"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL +if test -n "$ac_ct_MANIFEST_TOOL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 +printf "%s\n" "$ac_ct_MANIFEST_TOOL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_MANIFEST_TOOL" = x; then + MANIFEST_TOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL + fi +else + MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" +fi + +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 +printf %s "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } +if test ${lt_cv_path_mainfest_tool+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&5 + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest* +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 +printf "%s\n" "$lt_cv_path_mainfest_tool" >&6; } +if test yes != "$lt_cv_path_mainfest_tool"; then + MANIFEST_TOOL=: +fi + + + + + + + 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_DSYMUTIL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 +printf "%s\n" "$DSYMUTIL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_DSYMUTIL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 +printf "%s\n" "$ac_ct_DSYMUTIL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_DSYMUTIL" = x; then + DSYMUTIL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_NMEDIT+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 +printf "%s\n" "$NMEDIT" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_NMEDIT+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_NMEDIT="nmedit" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 +printf "%s\n" "$ac_ct_NMEDIT" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_NMEDIT" = x; then + NMEDIT=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_LIPO+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_LIPO="${ac_tool_prefix}lipo" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 +printf "%s\n" "$LIPO" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_LIPO+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_LIPO="lipo" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 +printf "%s\n" "$ac_ct_LIPO" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_LIPO" = x; then + LIPO=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_OTOOL="${ac_tool_prefix}otool" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 +printf "%s\n" "$OTOOL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OTOOL="otool" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 +printf "%s\n" "$ac_ct_OTOOL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_OTOOL" = x; then + OTOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OTOOL64+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 +printf "%s\n" "$OTOOL64" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OTOOL64+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OTOOL64="otool64" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 +printf "%s\n" "$ac_ct_OTOOL64" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_OTOOL64" = x; then + OTOOL64=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL64=$ac_ct_OTOOL64 + fi +else + OTOOL64="$ac_cv_prog_OTOOL64" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 +printf %s "checking for -single_module linker flag... " >&6; } +if test ${lt_cv_apple_cc_single_mod+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 there is a non-empty error log, and "single_module" + # appears in it, assume the flag caused a linker warning + if test -s conftest.err && $GREP single_module conftest.err; then + cat conftest.err >&5 + # Otherwise, if the output was created with a 0 exit code from + # the compiler, it worked. + elif test -f libconftest.dylib && test 0 = "$_lt_result"; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&5 + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 +printf "%s\n" "$lt_cv_apple_cc_single_mod" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 +printf %s "checking for -exported_symbols_list linker flag... " >&6; } +if test ${lt_cv_ld_exported_symbols_list+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + lt_cv_ld_exported_symbols_list=yes +else $as_nop + lt_cv_ld_exported_symbols_list=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 +printf "%s\n" "$lt_cv_ld_exported_symbols_list" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 +printf %s "checking for -force_load linker flag... " >&6; } +if test ${lt_cv_ld_force_load+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 + echo "$AR $AR_FLAGS libconftest.a conftest.o" >&5 + $AR $AR_FLAGS libconftest.a conftest.o 2>&5 + echo "$RANLIB libconftest.a" >&5 + $RANLIB libconftest.a 2>&5 + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -s conftest.err && $GREP force_load conftest.err; then + cat conftest.err >&5 + elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&5 + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 +printf "%s\n" "$lt_cv_ld_force_load" >&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*) + case $MACOSX_DEPLOYMENT_TARGET,$host in + 10.[012],*|,*powerpc*-darwin[5-8]*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; + *) + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test yes = "$lt_cv_apple_cc_single_mod"; then + _lt_dar_single_mod='$single_module' + fi + if test yes = "$lt_cv_ld_exported_symbols_list"; 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" && test no = "$lt_cv_ld_force_load"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac + +# func_munge_path_list VARIABLE PATH +# ----------------------------------- +# VARIABLE is name of variable containing _space_ separated list of +# directories to be munged by the contents of PATH, which is string +# having a format: +# "DIR[:DIR]:" +# string "DIR[ DIR]" will be prepended to VARIABLE +# ":DIR[:DIR]" +# string "DIR[ DIR]" will be appended to VARIABLE +# "DIRP[:DIRP]::[DIRA:]DIRA" +# string "DIRP[ DIRP]" will be prepended to VARIABLE and string +# "DIRA[ DIRA]" will be appended to VARIABLE +# "DIR[:DIR]" +# VARIABLE will be replaced by "DIR[ DIR]" +func_munge_path_list () +{ + case x$2 in + x) + ;; + *:) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" + ;; + x:*) + eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" + ;; + *::*) + eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" + eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" + ;; + *) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" + ;; + esac +} + +ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default +" +if test "x$ac_cv_header_dlfcn_h" = xyes +then : + printf "%s\n" "#define HAVE_DLFCN_H 1" >>confdefs.h + +fi + + + + + +# Set options +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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AS+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_AS="${ac_tool_prefix}as" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 +printf "%s\n" "$AS" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_AS+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AS="as" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5 +printf "%s\n" "$ac_ct_AS" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_AS" = x; then + AS="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_DLLTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +printf "%s\n" "$DLLTOOL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_DLLTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DLLTOOL="dlltool" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +printf "%s\n" "$ac_ct_DLLTOOL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_DLLTOOL" = x; then + DLLTOOL="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OBJDUMP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +printf "%s\n" "$OBJDUMP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OBJDUMP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OBJDUMP="objdump" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +printf "%s\n" "$ac_ct_OBJDUMP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_OBJDUMP" = x; then + OBJDUMP="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&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 + + + + + + + + enable_dlopen=no + + + + # Check whether --enable-shared was given. +if test ${enable_shared+y} +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 $as_nop + enable_shared=yes +fi + + + + + + + + + + # Check whether --enable-static was given. +if test ${enable_static+y} +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 $as_nop + enable_static=yes +fi + + + + + + + + + + +# Check whether --with-pic was given. +if test ${with_pic+y} +then : + withval=$with_pic; lt_p=${PACKAGE-default} + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for lt_pkg in $withval; do + IFS=$lt_save_ifs + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS=$lt_save_ifs + ;; + esac +else $as_nop + pic_mode=default +fi + + + + + + + + + # Check whether --enable-fast-install was given. +if test ${enable_fast_install+y} +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 $as_nop + enable_fast_install=yes +fi + + + + + + + + + shared_archive_member_spec= +case $host,$enable_shared in +power*-*-aix[5-9]*,yes) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 +printf %s "checking which variant of shared library versioning to provide... " >&6; } + +# Check whether --with-aix-soname was given. +if test ${with_aix_soname+y} +then : + withval=$with_aix_soname; case $withval in + aix|svr4|both) + ;; + *) + as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 + ;; + esac + lt_cv_with_aix_soname=$with_aix_soname +else $as_nop + if test ${lt_cv_with_aix_soname+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_with_aix_soname=aix +fi + + with_aix_soname=$lt_cv_with_aix_soname +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 +printf "%s\n" "$with_aix_soname" >&6; } + if test aix != "$with_aix_soname"; then + # For the AIX way of multilib, we name the shared archive member + # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', + # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. + # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, + # the AIX toolchain works better with OBJECT_MODE set (default 32). + if test 64 = "${OBJECT_MODE-32}"; then + shared_archive_member_spec=shr_64 + else + shared_archive_member_spec=shr + fi + fi + ;; +*) + with_aix_soname=aix + ;; +esac + + + + + + + + + + +# 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 + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 +printf %s "checking for objdir... " >&6; } +if test ${lt_cv_objdir+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 +printf "%s\n" "$lt_cv_objdir" >&6; } +objdir=$lt_cv_objdir + + + + + +printf "%s\n" "#define LT_OBJDIR \"$lt_cv_objdir/\"" >>confdefs.h + + + + +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 set != "${COLLECT_NAMES+set}"; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a '.a' archive for static linking (except MSVC and +# ICC, which need '.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 + +func_cc_basename $compiler +cc_basename=$func_cc_basename_result + + +# 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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 +printf %s "checking for ${ac_tool_prefix}file... " >&6; } +if test ${lt_cv_path_MAGIC_CMD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +printf "%s\n" "$MAGIC_CMD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + + + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for file" >&5 +printf %s "checking for file... " >&6; } +if test ${lt_cv_path_MAGIC_CMD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +printf "%s\n" "$MAGIC_CMD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "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* + + +## 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... +if test -n "$compiler"; then + +lt_prog_compiler_no_builtin_flag= + +if test yes = "$GCC"; then + case $cc_basename in + nvcc*) + lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; + *) + lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; + esac + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +printf %s "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } +if test ${lt_cv_prog_compiler_rtti_exceptions+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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" ## exclude from sc_useless_quotes_in_assignment + # 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:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 "$_lt_compiler_boilerplate" | $SED '/^$/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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +printf "%s\n" "$lt_cv_prog_compiler_rtti_exceptions" >&6; } + +if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; 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= + + + if test yes = "$GCC"; then + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi + lt_prog_compiler_pic='-fPIC' + ;; + + 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' + case $host_os in + os2*) + lt_prog_compiler_static='$wl-static' + ;; + esac + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + ;; + + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + lt_prog_compiler_static= + ;; + + 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 + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + lt_prog_compiler_wl='-Xlinker ' + if test -n "$lt_prog_compiler_pic"; then + lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" + fi + ;; + 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 ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + else + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + case $cc_basename in + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + esac + ;; + + 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' + case $host_os in + os2*) + lt_prog_compiler_static='$wl-static' + ;; + esac + ;; + + 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 | kopensolaris*-gnu | 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' + ;; + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + # 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* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-qpic' + lt_prog_compiler_static='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | $SED 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) + # 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='' + ;; + *Sun\ F* | *Sun*Fortran*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Qoption ld ' + ;; + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + ;; + *Intel*\ [CF]*Compiler*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + *Portland\ Group*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + 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* | sunf77* | sunf90* | sunf95*) + 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 that do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +printf %s "checking for $compiler option to produce PIC... " >&6; } +if test ${lt_cv_prog_compiler_pic+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_pic=$lt_prog_compiler_pic +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 +printf "%s\n" "$lt_cv_prog_compiler_pic" >&6; } +lt_prog_compiler_pic=$lt_cv_prog_compiler_pic + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +printf %s "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } +if test ${lt_cv_prog_compiler_pic_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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" ## exclude from sc_useless_quotes_in_assignment + # 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:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 "$_lt_compiler_boilerplate" | $SED '/^$/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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 +printf "%s\n" "$lt_cv_prog_compiler_pic_works" >&6; } + +if test yes = "$lt_cv_prog_compiler_pic_works"; 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\" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +printf %s "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if test ${lt_cv_prog_compiler_static_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 "$_lt_linker_boilerplate" | $SED '/^$/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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 +printf "%s\n" "$lt_cv_prog_compiler_static_works" >&6; } + +if test yes = "$lt_cv_prog_compiler_static_works"; then + : +else + lt_prog_compiler_static= +fi + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test ${lt_cv_prog_compiler_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 "$_lt_compiler_boilerplate" | $SED '/^$/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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +printf "%s\n" "$lt_cv_prog_compiler_c_o" >&6; } + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test ${lt_cv_prog_compiler_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 "$_lt_compiler_boilerplate" | $SED '/^$/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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +printf "%s\n" "$lt_cv_prog_compiler_c_o" >&6; } + + + + +hard_links=nottested +if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then + # do not overwrite the value of need_locks provided by the user + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +printf %s "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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +printf "%s\n" "$hard_links" >&6; } + if test no = "$hard_links"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 +printf "%s\n" "$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 + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +printf %s "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_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++ and ICC port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++ or Intel C++ Compiler. + if test yes != "$GCC"; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++ or ICC) + with_gnu_ld=yes + ;; + openbsd* | bitrig*) + with_gnu_ld=no + ;; + esac + + ld_shlibs=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no + if test yes = "$with_gnu_ld"; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; + *\ \(GNU\ Binutils\)\ [3-9]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test yes = "$lt_use_gnu_ld_interface"; 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 | $SED -e 's/([^)]\+)\s\+//' 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [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 ia64 != "$host_cpu"; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.19, 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 install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. + +_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 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' + export_dynamic_flag_spec='$wl--export-all-symbols' + 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/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' + + 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, use it as + # is; otherwise, prepend EXPORTS... + archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; 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 + ;; + + haiku*) + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + link_all_deplibs=yes + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + shrext_cmds=.dll + archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + enable_shared_with_static_runtimes=yes + file_list_spec='@' + ;; + + 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 | kopensolaris*-gnu) + tmp_diet=no + if test linux-dietlibc = "$host_os"; 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 no = "$tmp_diet" + then + tmp_addflag=' $pic_flag' + 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; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95* | pgfortran*) + # 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; func_echo_all \"$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' ;; + nagfor*) # NAGFOR 5.3 + tmp_sharedflag='-Wl,-shared' ;; + xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + compiler_needs_object=yes + ;; + 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; func_echo_all \"$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 yes = "$supports_anon_versioning"; 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 + tcc*) + export_dynamic_flag_spec='-rdynamic' + ;; + xlf* | bgf* | bgxlf* | mpixlf*) + # 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='$wl-rpath $wl$libdir' + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + if test yes = "$supports_anon_versioning"; 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 $linker_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 $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $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 $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $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 cannot +*** 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 $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $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 no = "$ld_shlibs"; 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 yes = "$GCC" && 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 ia64 = "$host_cpu"; 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 GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX 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") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | 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 + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then + aix_use_runtimelinking=yes + break + fi + done + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi + ;; + 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,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # traditional, no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + hardcode_direct=no + hardcode_direct_absolute=no + ;; + esac + + if test yes = "$GCC"; 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 yes = "$aix_use_runtimelinking"; then + shared_flag="$shared_flag "'$wl-G' + fi + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' + else + # not using gcc + if test ia64 = "$host_cpu"; 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 yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' + else + shared_flag='$wl-bM:SRE' + fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' + 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,yes = "$with_aix_soname,$aix_use_runtimelinking"; 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. + if test set = "${lt_cv_aix_libpath+set}"; then + aix_libpath=$lt_cv_aix_libpath +else + if test ${lt_cv_aix_libpath_+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_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 "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=/usr/lib:/lib + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +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 -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + else + if test ia64 = "$host_cpu"; 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. + if test set = "${lt_cv_aix_libpath+set}"; then + aix_libpath=$lt_cv_aix_libpath +else + if test ${lt_cv_aix_libpath_+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_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 "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=/usr/lib:/lib + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +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' + if test yes = "$with_gnu_ld"; then + # We only use this code for GNU lds that support --whole-archive. + whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' + fi + archive_cmds_need_lc=yes + archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d' + 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++ or Intel C++ Compiler. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + case $cc_basename in + cl* | icl*) + # Native MSVC or ICC + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + always_export_symbols=yes + file_list_spec='@' + # 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 $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, )='true' + enable_shared_with_static_runtimes=yes + exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + old_postinstall_cmds='chmod 644 $oldlib' + postlink_cmds='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile=$lt_outputfile.exe + lt_tool_outputfile=$lt_tool_outputfile.exe + ;; + esac~ + if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC and ICC wrapper + 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 `func_echo_all "$deplibs" | $SED '\''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' + enable_shared_with_static_runtimes=yes + ;; + esac + ;; + + darwin* | rhapsody*) + + + archive_cmds_need_lc=no + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + if test yes = "$lt_cv_ld_force_load"; then + whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + + else + whole_archive_flag_spec='' + fi + link_all_deplibs=yes + allow_undefined_flag=$_lt_dar_allow_undefined + case $cc_basename in + ifort*|nagfor*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test yes = "$_lt_dar_can_shared"; then + output_verbose_link_cmd=func_echo_all + 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 + ;; + + # 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* | midnightbsd*) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9*) + if test yes = "$GCC"; then + archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$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 "x$output_objdir/$soname" = "x$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 yes,no = "$GCC,$with_gnu_ld"; then + archive_cmds='$CC -shared $pic_flag $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 no = "$with_gnu_ld"; then + hardcode_libdir_flag_spec='$wl+b $wl$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 yes,no = "$GCC,$with_gnu_ld"; 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 $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared $pic_flag $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' + ;; + *) + + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 +printf %s "checking if $CC understands -b... " >&6; } +if test ${lt_cv_prog_compiler__b+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler__b=no + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -b" + 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 "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler__b=yes + fi + else + lt_cv_prog_compiler__b=yes + fi + fi + $RM -r conftest* + LDFLAGS=$save_LDFLAGS + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 +printf "%s\n" "$lt_cv_prog_compiler__b" >&6; } + +if test yes = "$lt_cv_prog_compiler__b"; then + archive_cmds='$CC -b $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 + + ;; + esac + fi + if test no = "$with_gnu_ld"; 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 yes = "$GCC"; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $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. + # This should be the same for all languages, so no per-tag cache variable. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 +printf %s "checking whether the $host_os linker accepts -exported_symbol... " >&6; } +if test ${lt_cv_irix_exported_symbol+y} +then : + printf %s "(cached) " >&6 +else $as_nop + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo (void) { return 0; } +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + lt_cv_irix_exported_symbol=yes +else $as_nop + lt_cv_irix_exported_symbol=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 +printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; } + if test yes = "$lt_cv_irix_exported_symbol"; then + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' + fi + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -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 + ;; + + linux*) + case $cc_basename in + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + ld_shlibs=yes + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + 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* | bitrig*) + 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__`"; 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 + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='$wl-rpath,$libdir' + fi + else + ld_shlibs=no + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + shrext_cmds=.dll + archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + enable_shared_with_static_runtimes=yes + file_list_spec='@' + ;; + + osf3*) + if test yes = "$GCC"; 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" && func_echo_all "$wl-set_version $wl$verstring"` $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" && func_echo_all "-set_version $verstring"` -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 yes = "$GCC"; then + allow_undefined_flag=' $wl-expect_unresolved $wl\*' + archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $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" && func_echo_all "-set_version $verstring"` -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 "-set_version $verstring"` -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 yes = "$GCC"; then + wlarc='$wl' + archive_cmds='$CC -shared $pic_flag $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 $pic_flag $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 yes = "$GCC"; 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 sequent = "$host_vendor"; 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 yes = "$GCC"; 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 CANNOT 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 yes = "$GCC"; 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 sni = "$host_vendor"; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + export_dynamic_flag_spec='$wl-Blargedynsym' + ;; + esac + fi + fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 +printf "%s\n" "$ld_shlibs" >&6; } +test no = "$ld_shlibs" && 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 yes,yes = "$GCC,$enable_shared"; 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. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +printf %s "checking whether -lc should be explicitly linked in... " >&6; } +if test ${lt_cv_archive_cmds_need_lc+y} +then : + printf %s "(cached) " >&6 +else $as_nop + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } 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\":${as_lineno-$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=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 +printf "%s\n" "$lt_cv_archive_cmds_need_lc" >&6; } + archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc + ;; + esac + fi + ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +printf %s "checking dynamic linker characteristics... " >&6; } + +if test yes = "$GCC"; then + case $host_os in + darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; + *) lt_awk_arg='/^libraries:/' ;; + esac + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; + *) lt_sed_strip_eq='s|=/|/|g' ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) + # 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 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac + # 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` + # ...but if some path component already ends with the multilib dir we assume + # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). + case "$lt_multi_os_dir; $lt_search_path_spec " in + "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) + lt_multi_os_dir= + ;; + esac + 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" + elif test -n "$lt_multi_os_dir"; then + 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; } +}'` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's|/\([A-Za-z]:\)|\1|g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` +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 # correct to gnu/linux during the next big refactor + 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 # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test ia64 = "$host_cpu"; 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 + # Using Import Files as archive members, it is possible to support + # filename-based versioning of shared library archives on AIX. While + # this would work for both with and without runtime linking, it will + # prevent static linking of such archives. So we do filename-based + # shared library versioning with .so extension only, which is used + # when both runtime linking and shared linking is enabled. + # Unfortunately, runtime linking may impact performance, so we do + # not want this to be the default eventually. Also, we use the + # versioned .so libs for executables only if there is the -brtl + # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. + # To allow for filename-based versioning support, we need to create + # libNAME.so.V as an archive file, containing: + # *) an Import File, referring to the versioned filename of the + # archive as well as the shared archive member, telling the + # bitwidth (32 or 64) of that shared object, and providing the + # list of exported symbols of that shared object, eventually + # decorated with the 'weak' keyword + # *) the shared object with the F_LOADONLY flag set, to really avoid + # it being seen by the linker. + # At run time we better use the real file rather than another symlink, + # but for link time we create the symlink libNAME.so -> libNAME.so.V + + case $with_aix_soname,$aix_use_runtimelinking in + # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + aix,yes) # traditional libtool + dynamic_linker='AIX unversionable lib.so' + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.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' + ;; + aix,no) # traditional AIX only + dynamic_linker='AIX lib.a(lib.so.V)' + # 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' + ;; + svr4,*) # full svr4 only + dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,yes) # both, prefer svr4 + dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # unpreferred sharedlib libNAME.a needs extra handling + postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' + postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,no) # both, prefer aix + dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling + postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' + postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' + ;; + esac + 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=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $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 # correct to gnu/linux during the next big refactor + 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,$cc_basename in + yes,*) + # gcc + 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="$sys_lib_search_path_spec /usr/lib/w32api" + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + ;; + 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 + dynamic_linker='Win32 ld.exe' + ;; + + *,cl* | *,icl*) + # Native MSVC or ICC + libname_spec='$name' + soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + library_names_spec='$libname.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec=$LIB + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH. + 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 + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # 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' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC and ICC wrapper + library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # 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 # correct to gnu/linux during the next big refactor + 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 + ;; + +freebsd* | dragonfly* | midnightbsd*) + # 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[23].*) 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$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + 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 + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + 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=LIBRARY_PATH + shlibpath_overrides_runpath=no + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + 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 32 = "$HPUX_IA64_MODE"; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + sys_lib_dlsearch_path_spec=/usr/lib/hpux32 + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + sys_lib_dlsearch_path_spec=/usr/lib/hpux64 + fi + ;; + 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' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[3-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + 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 yes = "$lt_cv_prog_gnu_ld"; then + version_type=linux # correct to gnu/linux during the next big refactor + 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 + ;; + +linux*android*) + version_type=none # Android doesn't support versioned libraries. + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext' + soname_spec='$libname$release$shared_ext' + finish_cmds= + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + + # 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 + + dynamic_linker='Android linker' + # Don't embed -rpath directories since the linker doesn't support them. + hardcode_libdir_flag_spec='-L$libdir' + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + 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 + if test ${lt_cv_shlibpath_overrides_runpath+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null +then : + lt_cv_shlibpath_overrides_runpath=yes +fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + +fi + + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # 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 + + # Add ABI-specific directories to the system library path. + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" + + # Ideally, we could use ldconfig to report *all* directores which are + # searched for libraries, however this is still not possible. Aside from not + # being certain /sbin/ldconfig is available, command + # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, + # even though it is searched at run-time. Try to do the best guess by + # appending ld.so.conf contents (and includes) 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;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $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 # correct to gnu/linux during the next big refactor + 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* | bitrig*) + version_type=sunos + sys_lib_dlsearch_path_spec=/usr/lib + need_lib_prefix=no + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + need_version=no + else + need_version=yes + fi + 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 + shlibpath_overrides_runpath=yes + ;; + +os2*) + libname_spec='$name' + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + # OS/2 can only load a DLL with a base name of 8 characters or less. + soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; + v=$($ECHO $release$versuffix | tr -d .-); + n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); + $ECHO $n$v`$shared_ext' + library_names_spec='${libname}_dll.$libext' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=BEGINLIBPATH + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + 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' + ;; + +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 # correct to gnu/linux during the next big refactor + 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 yes = "$with_gnu_ld"; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + 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 # correct to gnu/linux during the next big refactor + 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=sco + 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 yes = "$with_gnu_ld"; 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 # correct to gnu/linux during the next big refactor + 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 # correct to gnu/linux during the next big refactor + 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +printf "%s\n" "$dynamic_linker" >&6; } +test no = "$dynamic_linker" && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test yes = "$GCC"; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then + sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec +fi + +if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then + sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec +fi + +# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... +configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec + +# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code +func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" + +# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool +configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +printf %s "checking how to hardcode library paths into programs... " >&6; } +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || + test -n "$runpath_var" || + test yes = "$hardcode_automatic"; then + + # We can hardcode non-existent directories. + if test no != "$hardcode_direct" && + # 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 no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" && + test no != "$hardcode_minus_L"; 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 +printf "%s\n" "$hardcode_action" >&6; } + +if test relink = "$hardcode_action" || + test yes = "$inherit_rpath"; then + # Fast installation is not supported + enable_fast_install=no +elif test yes = "$shlibpath_overrides_runpath" || + test no = "$enable_shared"; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + + + + + + if test yes != "$enable_dlopen"; 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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +printf %s "checking for dlopen in -ldl... " >&6; } +if test ${ac_cv_lib_dl_dlopen+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* 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. */ +char dlopen (); +int +main (void) +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_dl_dlopen=yes +else $as_nop + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes +then : + lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl +else $as_nop + + lt_cv_dlopen=dyld + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + tpf*) + # Don't try to run any link tests for TPF. We know it's impossible + # because TPF is a cross-compiler, and we know how we open DSOs. + lt_cv_dlopen=dlopen + lt_cv_dlopen_libs= + lt_cv_dlopen_self=no + ;; + + *) + ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" +if test "x$ac_cv_func_shl_load" = xyes +then : + lt_cv_dlopen=shl_load +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 +printf %s "checking for shl_load in -ldld... " >&6; } +if test ${ac_cv_lib_dld_shl_load+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* 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. */ +char shl_load (); +int +main (void) +{ +return shl_load (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_dld_shl_load=yes +else $as_nop + ac_cv_lib_dld_shl_load=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 +printf "%s\n" "$ac_cv_lib_dld_shl_load" >&6; } +if test "x$ac_cv_lib_dld_shl_load" = xyes +then : + lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld +else $as_nop + ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" +if test "x$ac_cv_func_dlopen" = xyes +then : + lt_cv_dlopen=dlopen +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +printf %s "checking for dlopen in -ldl... " >&6; } +if test ${ac_cv_lib_dl_dlopen+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* 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. */ +char dlopen (); +int +main (void) +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_dl_dlopen=yes +else $as_nop + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes +then : + lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 +printf %s "checking for dlopen in -lsvld... " >&6; } +if test ${ac_cv_lib_svld_dlopen+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* 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. */ +char dlopen (); +int +main (void) +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_svld_dlopen=yes +else $as_nop + ac_cv_lib_svld_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 +printf "%s\n" "$ac_cv_lib_svld_dlopen" >&6; } +if test "x$ac_cv_lib_svld_dlopen" = xyes +then : + lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 +printf %s "checking for dld_link in -ldld... " >&6; } +if test ${ac_cv_lib_dld_dld_link+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* 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. */ +char dld_link (); +int +main (void) +{ +return dld_link (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_dld_dld_link=yes +else $as_nop + ac_cv_lib_dld_dld_link=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 +printf "%s\n" "$ac_cv_lib_dld_dld_link" >&6; } +if test "x$ac_cv_lib_dld_dld_link" = xyes +then : + lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test no = "$lt_cv_dlopen"; then + enable_dlopen=no + else + enable_dlopen=yes + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS=$CPPFLAGS + test yes = "$ac_cv_header_dlfcn_h" && 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" + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 +printf %s "checking whether a program can dlopen itself... " >&6; } +if test ${lt_cv_dlopen_self+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test yes = "$cross_compiling"; 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 $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#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 + +/* When -fvisibility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 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; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 +printf "%s\n" "$lt_cv_dlopen_self" >&6; } + + if test yes = "$lt_cv_dlopen_self"; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 +printf %s "checking whether a statically linked program can dlopen itself... " >&6; } +if test ${lt_cv_dlopen_self_static+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test yes = "$cross_compiling"; 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 $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#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 + +/* When -fvisibility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 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; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 +printf "%s\n" "$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= +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 +printf %s "checking whether stripping libraries is possible... " >&6; } +if test -z "$STRIP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +else + if $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + old_striplib="$STRIP --strip-debug" + striplib="$STRIP --strip-unneeded" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else + case $host_os in + darwin*) + # FIXME - insert some real tests, host_os isn't really good enough + striplib="$STRIP -x" + old_striplib="$STRIP -S" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + ;; + freebsd*) + if $STRIP -V 2>&1 | $GREP "elftoolchain" >/dev/null; then + old_striplib="$STRIP --strip-debug" + striplib="$STRIP --strip-unneeded" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + fi + ;; + *) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; + esac + fi +fi + + + + + + + + + + + + + # Report what library types will actually be built + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 +printf %s "checking if libtool supports shared libraries... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 +printf "%s\n" "$can_build_shared" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 +printf %s "checking whether to build shared libraries... " >&6; } + test no = "$can_build_shared" && 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 yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[4-9]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + fi + ;; + esac + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 +printf "%s\n" "$enable_shared" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 +printf %s "checking whether to build static libraries... " >&6; } + # Make sure either enable_shared or enable_static is yes. + test yes = "$enable_shared" || enable_static=yes + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 +printf "%s\n" "$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: + + + + +# Check whether --with-extra was given. +if test ${with_extra+y} +then : + withval=$with_extra; NBDKIT_VERSION_EXTRA="$withval" +else $as_nop + NBDKIT_VERSION_EXTRA= + +fi + + +printf "%s\n" "#define NBDKIT_VERSION_EXTRA \"$NBDKIT_VERSION_EXTRA\"" >>confdefs.h + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: nbdkit version 1.36.2 ($NBDKIT_VERSION_EXTRA)" >&5 +printf "%s\n" "$as_me: nbdkit version 1.36.2 ($NBDKIT_VERSION_EXTRA)" >&6;} + +lang_plugins="\ + cc \ + golang \ + lua \ + ocaml \ + perl \ + python \ + ruby \ + rust \ + sh \ + tcl \ + " +non_lang_plugins="\ + blkio \ + cdi \ + curl \ + data \ + eval \ + example1 \ + example2 \ + example3 \ + example4 \ + file \ + floppy \ + full \ + guestfs \ + info \ + iso \ + libvirt \ + linuxdisk \ + memory \ + nbd \ + null \ + ondemand \ + ones \ + partitioning \ + pattern \ + random \ + S3 \ + sparse-random \ + split \ + ssh \ + tmpdisk \ + torrent \ + vddk \ + zero \ + " +plugins="$(echo $(printf %s\\n $lang_plugins $non_lang_plugins | sort -u))" +filters="\ + blocksize \ + blocksize-policy \ + cache \ + cacheextents \ + checkwrite \ + cow \ + ddrescue \ + delay \ + error \ + exitlast \ + exitwhen \ + exportname \ + ext2 \ + extentlist \ + evil \ + fua \ + gzip \ + ip \ + limit \ + log \ + luks \ + multi-conn \ + nocache \ + noextents \ + nofilter \ + noparallel \ + nozero \ + offset \ + partition \ + pause \ + protect \ + qcow2dec \ + rate \ + readahead \ + retry \ + retry-request \ + scan \ + stats \ + swab \ + tar \ + tls-fallback \ + truncate \ + xz \ + " + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +printf %s "checking for a sed that does not truncate output... " >&6; } +if test ${ac_cv_path_SED+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + { ac_script=; unset 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + 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" + as_fn_executable_p "$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 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" '' >> "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 + as_fn_arith $ac_count + 1 && ac_count=$as_val + 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_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +printf "%s\n" "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + +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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +printf "%s\n" "$RANLIB" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +printf "%s\n" "$ac_ct_RANLIB" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +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 +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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$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" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "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:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. +set dummy ${ac_tool_prefix}clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}clang" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="clang" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +fi + + +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion -version; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_compiler_gnu=yes +else $as_nop + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+y} +ac_save_CFLAGS=$CFLAGS +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +printf %s "checking whether $CC accepts -g... " >&6; } +if test ${ac_cv_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +else $as_nop + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +printf "%s\n" "$ac_cv_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; 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 +ac_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +printf %s "checking for $CC option to enable C11 features... " >&6; } +if test ${ac_cv_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c11=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c11_program +_ACEOF +for ac_arg in '' -std=gnu11 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } + CC="$CC $ac_cv_prog_cc_c11" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 + ac_prog_cc_stdc=c11 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +printf %s "checking for $CC option to enable C99 features... " >&6; } +if test ${ac_cv_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c99_program +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c99" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c99" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } + CC="$CC $ac_cv_prog_cc_c99" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 + ac_prog_cc_stdc=c99 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +printf %s "checking for $CC option to enable C89 features... " >&6; } +if test ${ac_cv_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c89_program +_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" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c89" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c89" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } + CC="$CC $ac_cv_prog_cc_c89" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 + ac_prog_cc_stdc=c89 +fi +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 + + + 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +printf %s "checking whether $CC understands -c and -o together... " >&6; } +if test ${am_cv_prog_cc_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 + ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } +if test "$am_cv_prog_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 + + + +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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +printf %s "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+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # Double quotes because $CC needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" 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. + # 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + +else $as_nop + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else $as_nop + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +printf "%s\n" "$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. + # 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + +else $as_nop + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else $as_nop + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok +then : + +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +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 + +# Check whether --enable-largefile was given. +if test ${enable_largefile+y} +then : + enableval=$enable_largefile; +fi + +if test "$enable_largefile" != no; then + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 +printf %s "checking for special C compiler options needed for large files... " >&6; } +if test ${ac_cv_sys_largefile_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* 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 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF + if ac_fn_c_try_compile "$LINENO" +then : + break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + CC="$CC -n32" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_sys_largefile_CC=' -n32'; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + break + done + CC=$ac_save_CC + rm -f conftest.$ac_ext + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 +printf "%s\n" "$ac_cv_sys_largefile_CC" >&6; } + if test "$ac_cv_sys_largefile_CC" != no; then + CC=$CC$ac_cv_sys_largefile_CC + fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 +printf %s "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } +if test ${ac_cv_sys_file_offset_bits+y} +then : + printf %s "(cached) " >&6 +else $as_nop + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* 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 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_sys_file_offset_bits=no; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _FILE_OFFSET_BITS 64 +#include + /* 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 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_sys_file_offset_bits=64; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_cv_sys_file_offset_bits=unknown + break +done +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 +printf "%s\n" "$ac_cv_sys_file_offset_bits" >&6; } +case $ac_cv_sys_file_offset_bits in #( + no | unknown) ;; + *) +printf "%s\n" "#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits" >>confdefs.h +;; +esac +rm -rf conftest* + if test $ac_cv_sys_file_offset_bits = unknown; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 +printf %s "checking for _LARGE_FILES value needed for large files... " >&6; } +if test ${ac_cv_sys_large_files+y} +then : + printf %s "(cached) " >&6 +else $as_nop + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* 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 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_sys_large_files=no; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _LARGE_FILES 1 +#include + /* 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 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_sys_large_files=1; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_cv_sys_large_files=unknown + break +done +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 +printf "%s\n" "$ac_cv_sys_large_files" >&6; } +case $ac_cv_sys_large_files in #( + no | unknown) ;; + *) +printf "%s\n" "#define _LARGE_FILES $ac_cv_sys_large_files" >>confdefs.h +;; +esac +rm -rf conftest* + fi +fi + + +if test "$ac_prog_cc_stdc" != no; then + +printf "%s\n" "#define PROTOTYPES 1" >>confdefs.h + + +printf "%s\n" "#define __PROTOTYPES 1" >>confdefs.h + +fi + +test "x$U" != "x" && as_fn_error $? "Compiler not ANSI compliant" "$LINENO" 5 + + + + + +printf "%s\n" "#define host_cpu \"$host_cpu\"" >>confdefs.h + + + +printf "%s\n" "#define host_os \"$host_os\"" >>confdefs.h + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 +printf %s "checking whether byte ordering is bigendian... " >&6; } +if test ${ac_cv_c_bigendian+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_c_bigendian=unknown + # See if we're dealing with a universal compiler. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __APPLE_CC__ + not a universal capable compiler + #endif + typedef int dummy; + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + + # Check for potential -arch flags. It is not universal unless + # there are at least two -arch flags with different values. + ac_arch= + ac_prev= + for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do + if test -n "$ac_prev"; then + case $ac_word in + i?86 | x86_64 | ppc | ppc64) + if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then + ac_arch=$ac_word + else + ac_cv_c_bigendian=universal + break + fi + ;; + esac + ac_prev= + elif test "x$ac_word" = "x-arch"; then + ac_prev=arch + fi + done +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + if test $ac_cv_c_bigendian = unknown; then + # See if sys/param.h defines the BYTE_ORDER macro. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + +int +main (void) +{ +#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ + && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ + && LITTLE_ENDIAN) + bogus endian macros + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + # It does; now see whether it defined to BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + +int +main (void) +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_c_bigendian=yes +else $as_nop + ac_cv_c_bigendian=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main (void) +{ +#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) + bogus endian macros + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + # It does; now see whether it defined to _BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main (void) +{ +#ifndef _BIG_ENDIAN + not big endian + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_c_bigendian=yes +else $as_nop + ac_cv_c_bigendian=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # Compile a test program. + if test "$cross_compiling" = yes +then : + # Try to guess by grepping values from an object file. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +unsigned short int ascii_mm[] = + { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; + unsigned short int ascii_ii[] = + { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; + int use_ascii (int i) { + return ascii_mm[i] + ascii_ii[i]; + } + unsigned short int ebcdic_ii[] = + { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; + unsigned short int ebcdic_mm[] = + { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; + int use_ebcdic (int i) { + return ebcdic_mm[i] + ebcdic_ii[i]; + } + extern int foo; + +int +main (void) +{ +return use_ascii (foo) == use_ebcdic (foo); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then + ac_cv_c_bigendian=yes + fi + if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi + fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main (void) +{ + + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long int l; + char c[sizeof (long int)]; + } u; + u.l = 1; + return u.c[sizeof (long int) - 1] == 1; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + ac_cv_c_bigendian=no +else $as_nop + ac_cv_c_bigendian=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 +printf "%s\n" "$ac_cv_c_bigendian" >&6; } + case $ac_cv_c_bigendian in #( + yes) + printf "%s\n" "#define WORDS_BIGENDIAN 1" >>confdefs.h +;; #( + no) + ;; #( + universal) + +printf "%s\n" "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h + + ;; #( + *) + as_fn_error $? "unknown endianness + presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; + esac + + +# 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. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of pid_t" >&5 +printf %s "checking size of pid_t... " >&6; } +if test ${ac_cv_sizeof_pid_t+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (pid_t))" "ac_cv_sizeof_pid_t" "$ac_includes_default" +then : + +else $as_nop + if test "$ac_cv_type_pid_t" = yes; then + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (pid_t) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_pid_t=0 + fi +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_pid_t" >&5 +printf "%s\n" "$ac_cv_sizeof_pid_t" >&6; } + + + +printf "%s\n" "#define SIZEOF_PID_T $ac_cv_sizeof_pid_t" >>confdefs.h + + +# 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. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of uid_t" >&5 +printf %s "checking size of uid_t... " >&6; } +if test ${ac_cv_sizeof_uid_t+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (uid_t))" "ac_cv_sizeof_uid_t" "$ac_includes_default" +then : + +else $as_nop + if test "$ac_cv_type_uid_t" = yes; then + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (uid_t) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_uid_t=0 + fi +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_uid_t" >&5 +printf "%s\n" "$ac_cv_sizeof_uid_t" >&6; } + + + +printf "%s\n" "#define SIZEOF_UID_T $ac_cv_sizeof_uid_t" >>confdefs.h + + +# 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. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of gid_t" >&5 +printf %s "checking size of gid_t... " >&6; } +if test ${ac_cv_sizeof_gid_t+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (gid_t))" "ac_cv_sizeof_gid_t" "$ac_includes_default" +then : + +else $as_nop + if test "$ac_cv_type_gid_t" = yes; then + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (gid_t) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_gid_t=0 + fi +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_gid_t" >&5 +printf "%s\n" "$ac_cv_sizeof_gid_t" >&6; } + + + +printf "%s\n" "#define SIZEOF_GID_T $ac_cv_sizeof_gid_t" >>confdefs.h + + + + + + + + + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ + 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +printf "%s\n" "$CXX" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +printf "%s\n" "$ac_ct_CXX" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$ac_ct_CXX" && break +done + + if test "x$ac_ct_CXX" = x; then + CXX="g++" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CXX=$ac_ct_CXX + fi +fi + + fi +fi +# Provide some information about the compiler. +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C++" >&5 +printf %s "checking whether the compiler supports GNU C++... " >&6; } +if test ${ac_cv_cxx_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ac_compiler_gnu=yes +else $as_nop + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +if test $ac_compiler_gnu = yes; then + GXX=yes +else + GXX= +fi +ac_test_CXXFLAGS=${CXXFLAGS+y} +ac_save_CXXFLAGS=$CXXFLAGS +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +printf %s "checking whether $CXX accepts -g... " >&6; } +if test ${ac_cv_prog_cxx_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_cxx_werror_flag=$ac_cxx_werror_flag + ac_cxx_werror_flag=yes + ac_cv_prog_cxx_g=no + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_g=yes +else $as_nop + CXXFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + +else $as_nop + ac_cxx_werror_flag=$ac_save_cxx_werror_flag + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_cxx_werror_flag=$ac_save_cxx_werror_flag +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +printf "%s\n" "$ac_cv_prog_cxx_g" >&6; } +if test $ac_test_CXXFLAGS; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +ac_prog_cxx_stdcxx=no +if test x$ac_prog_cxx_stdcxx = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 +printf %s "checking for $CXX option to enable C++11 features... " >&6; } +if test ${ac_cv_prog_cxx_cxx11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cxx_cxx11=no +ac_save_CXX=$CXX +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_cxx_conftest_cxx11_program +_ACEOF +for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x -qlanglvl=extended0x -AA +do + CXX="$ac_save_CXX $ac_arg" + if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_cxx11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cxx_cxx11" != "xno" && break +done +rm -f conftest.$ac_ext +CXX=$ac_save_CXX +fi + +if test "x$ac_cv_prog_cxx_cxx11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cxx_cxx11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 +printf "%s\n" "$ac_cv_prog_cxx_cxx11" >&6; } + CXX="$CXX $ac_cv_prog_cxx_cxx11" +fi + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 + ac_prog_cxx_stdcxx=cxx11 +fi +fi +if test x$ac_prog_cxx_stdcxx = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 +printf %s "checking for $CXX option to enable C++98 features... " >&6; } +if test ${ac_cv_prog_cxx_cxx98+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cxx_cxx98=no +ac_save_CXX=$CXX +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_cxx_conftest_cxx98_program +_ACEOF +for ac_arg in '' -std=gnu++98 -std=c++98 -qlanglvl=extended -AA +do + CXX="$ac_save_CXX $ac_arg" + if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_cxx98=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cxx_cxx98" != "xno" && break +done +rm -f conftest.$ac_ext +CXX=$ac_save_CXX +fi + +if test "x$ac_cv_prog_cxx_cxx98" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cxx_cxx98" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 +printf "%s\n" "$ac_cv_prog_cxx_cxx98" >&6; } + CXX="$CXX $ac_cv_prog_cxx_cxx98" +fi + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 + ac_prog_cxx_stdcxx=cxx98 +fi +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 + +depcc="$CXX" am_compiler_list= + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +printf %s "checking dependency style of $depcc... " >&6; } +if test ${am_cv_CXX_dependencies_compiler_type+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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". + rm -rf conftest.dir + 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_CXX_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + 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 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # 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. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + 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 + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj 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 $am__obj 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_CXX_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 +printf "%s\n" "$am_cv_CXX_dependencies_compiler_type" >&6; } +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi + + + + +func_stripname_cnf () +{ + case $2 in + .*) func_stripname_result=`$ECHO "$3" | $SED "s%^$1%%; s%\\\\$2\$%%"`;; + *) func_stripname_result=`$ECHO "$3" | $SED "s%^$1%%; s%$2\$%%"`;; + esac +} # func_stripname_cnf + + if test -n "$CXX" && ( test no != "$CXX" && + ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || + (test g++ != "$CXX"))); then + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 +printf %s "checking how to run the C++ preprocessor... " >&6; } +if test -z "$CXXCPP"; then + if test ${ac_cv_prog_CXXCPP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # Double quotes because $CXX needs to be expanded + for CXXCPP in "$CXX -E" cpp /lib/cpp + do + ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO" +then : + +else $as_nop + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else $as_nop + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok +then : + break +fi + + done + ac_cv_prog_CXXCPP=$CXXCPP + +fi + CXXCPP=$ac_cv_prog_CXXCPP +else + ac_cv_prog_CXXCPP=$CXXCPP +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 +printf "%s\n" "$CXXCPP" >&6; } +ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO" +then : + +else $as_nop + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else $as_nop + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok +then : + +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +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 + +else + _lt_caught_CXX_error=yes +fi + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +archive_cmds_need_lc_CXX=no +allow_undefined_flag_CXX= +always_export_symbols_CXX=no +archive_expsym_cmds_CXX= +compiler_needs_object_CXX=no +export_dynamic_flag_spec_CXX= +hardcode_direct_CXX=no +hardcode_direct_absolute_CXX=no +hardcode_libdir_flag_spec_CXX= +hardcode_libdir_separator_CXX= +hardcode_minus_L_CXX=no +hardcode_shlibpath_var_CXX=unsupported +hardcode_automatic_CXX=no +inherit_rpath_CXX=no +module_cmds_CXX= +module_expsym_cmds_CXX= +link_all_deplibs_CXX=unknown +old_archive_cmds_CXX=$old_archive_cmds +reload_flag_CXX=$reload_flag +reload_cmds_CXX=$reload_cmds +no_undefined_flag_CXX= +whole_archive_flag_spec_CXX= +enable_shared_with_static_runtimes_CXX=no + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +objext_CXX=$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 yes != "$_lt_caught_CXX_error"; 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. + + + + + + +# 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 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* + + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_CFLAGS=$CFLAGS + 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++"} + CFLAGS=$CXXFLAGS + compiler=$CC + compiler_CXX=$CC + func_cc_basename $compiler +cc_basename=$func_cc_basename_result + + + if test -n "$compiler"; then + # We don't want -fno-exception when compiling C++ code, so set the + # no_builtin_flag separately + if test yes = "$GXX"; then + lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' + else + lt_prog_compiler_no_builtin_flag_CXX= + fi + + if test yes = "$GXX"; then + # Set up default GNU C++ configuration + + + +# Check whether --with-gnu-ld was given. +if test ${with_gnu_ld+y} +then : + withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes +else $as_nop + with_gnu_ld=no +fi + +ac_prog=ld +if test yes = "$GCC"; then + # Check if gcc -print-prog-name=ld gives a path. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +printf %s "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 yes = "$with_gnu_ld"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +printf %s "checking for GNU ld... " >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +printf %s "checking for non-GNU ld... " >&6; } +fi +if test ${lt_cv_path_LD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 &5 +printf "%s\n" "$LD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +printf %s "checking if the linker ($LD) is GNU ld... " >&6; } +if test ${lt_cv_prog_gnu_ld+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +printf "%s\n" "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_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 yes = "$with_gnu_ld"; then + archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + + hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' + export_dynamic_flag_spec_CXX='$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 + whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + else + whole_archive_flag_spec_CXX= + 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. + archive_cmds_CXX='$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 -v "^Configured with:" | $GREP "\-L"' + + else + GXX=no + with_gnu_ld=no + wlarc= + fi + + # PORTME: fill in a description of your system's C++ link characteristics + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + ld_shlibs_CXX=yes + case $host_os in + aix3*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aix[4-9]*) + if test ia64 = "$host_cpu"; 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 + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive + 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 + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi + ;; + 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_CXX='' + hardcode_direct_CXX=yes + hardcode_direct_absolute_CXX=yes + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + file_list_spec_CXX='$wl-f,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + hardcode_direct_CXX=no + hardcode_direct_absolute_CXX=no + ;; + esac + + if test yes = "$GXX"; 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_CXX=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_CXX=yes + hardcode_libdir_flag_spec_CXX='-L$libdir' + hardcode_libdir_separator_CXX= + fi + esac + shared_flag='-shared' + if test yes = "$aix_use_runtimelinking"; then + shared_flag=$shared_flag' $wl-G' + fi + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' + else + # not using gcc + if test ia64 = "$host_cpu"; 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 yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' + else + shared_flag='$wl-bM:SRE' + fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' + fi + fi + + export_dynamic_flag_spec_CXX='$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_CXX=yes + if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + # The "-G" linker flag allows undefined symbols. + no_undefined_flag_CXX='-bernotok' + # Determine the default libpath from the value encoded in an empty + # executable. + if test set = "${lt_cv_aix_libpath+set}"; then + aix_libpath=$lt_cv_aix_libpath +else + if test ${lt_cv_aix_libpath__CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath__CXX=`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 "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX=/usr/lib:/lib + fi + +fi + + aix_libpath=$lt_cv_aix_libpath__CXX +fi + + hardcode_libdir_flag_spec_CXX='$wl-blibpath:$libdir:'"$aix_libpath" + + archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + else + if test ia64 = "$host_cpu"; then + hardcode_libdir_flag_spec_CXX='$wl-R $libdir:/usr/lib:/lib' + allow_undefined_flag_CXX="-z nodefs" + archive_expsym_cmds_CXX="\$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. + if test set = "${lt_cv_aix_libpath+set}"; then + aix_libpath=$lt_cv_aix_libpath +else + if test ${lt_cv_aix_libpath__CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath__CXX=`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 "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX=/usr/lib:/lib + fi + +fi + + aix_libpath=$lt_cv_aix_libpath__CXX +fi + + hardcode_libdir_flag_spec_CXX='$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_CXX=' $wl-bernotok' + allow_undefined_flag_CXX=' $wl-berok' + if test yes = "$with_gnu_ld"; then + # We only use this code for GNU lds that support --whole-archive. + whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_CXX='$convenience' + fi + archive_cmds_need_lc_CXX=yes + archive_expsym_cmds_CXX='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared + # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. + archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$RM -r $output_objdir/$realname.d' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_CXX=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + else + ld_shlibs_CXX=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + cygwin* | mingw* | pw32* | cegcc*) + case $GXX,$cc_basename in + ,cl* | no,cl* | ,icl* | no,icl*) + # Native MSVC or ICC + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec_CXX=' ' + allow_undefined_flag_CXX=unsupported + always_export_symbols_CXX=yes + file_list_spec_CXX='@' + # 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_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true' + enable_shared_with_static_runtimes_CXX=yes + # Don't use ranlib + old_postinstall_cmds_CXX='chmod 644 $oldlib' + postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile=$lt_outputfile.exe + lt_tool_outputfile=$lt_tool_outputfile.exe + ;; + esac~ + func_to_tool_file "$lt_outputfile"~ + if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # g++ + # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_CXX='-L$libdir' + export_dynamic_flag_spec_CXX='$wl--export-all-symbols' + allow_undefined_flag_CXX=unsupported + always_export_symbols_CXX=no + enable_shared_with_static_runtimes_CXX=yes + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds_CXX='$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, use it as + # is; otherwise, prepend EXPORTS... + archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; 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 + ld_shlibs_CXX=no + fi + ;; + esac + ;; + darwin* | rhapsody*) + + + archive_cmds_need_lc_CXX=no + hardcode_direct_CXX=no + hardcode_automatic_CXX=yes + hardcode_shlibpath_var_CXX=unsupported + if test yes = "$lt_cv_ld_force_load"; then + whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + + else + whole_archive_flag_spec_CXX='' + fi + link_all_deplibs_CXX=yes + allow_undefined_flag_CXX=$_lt_dar_allow_undefined + case $cc_basename in + ifort*|nagfor*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test yes = "$_lt_dar_can_shared"; then + output_verbose_link_cmd=func_echo_all + archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" + module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" + archive_expsym_cmds_CXX="$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_CXX="$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" + if test yes != "$lt_cv_apple_cc_single_mod"; then + archive_cmds_CXX="\$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" + archive_expsym_cmds_CXX="$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 + ld_shlibs_CXX=no + fi + + ;; + + os2*) + hardcode_libdir_flag_spec_CXX='-L$libdir' + hardcode_minus_L_CXX=yes + allow_undefined_flag_CXX=unsupported + shrext_cmds=.dll + archive_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + archive_expsym_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + old_archive_From_new_cmds_CXX='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + enable_shared_with_static_runtimes_CXX=yes + file_list_spec_CXX='@' + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + freebsd2.*) + # C++ shared libraries reported to be fairly broken before + # switch to ELF + ld_shlibs_CXX=no + ;; + + freebsd-elf*) + archive_cmds_need_lc_CXX=no + ;; + + freebsd* | dragonfly* | midnightbsd*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + ld_shlibs_CXX=yes + ;; + + haiku*) + archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + link_all_deplibs_CXX=yes + ;; + + hpux9*) + hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir' + hardcode_libdir_separator_CXX=: + export_dynamic_flag_spec_CXX='$wl-E' + hardcode_direct_CXX=yes + hardcode_minus_L_CXX=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 + ld_shlibs_CXX=no + ;; + aCC*) + archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$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; func_echo_all "$list"' + ;; + *) + if test yes = "$GXX"; then + archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + + hpux10*|hpux11*) + if test no = "$with_gnu_ld"; then + hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir' + hardcode_libdir_separator_CXX=: + + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + export_dynamic_flag_spec_CXX='$wl-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + ;; + *) + hardcode_direct_CXX=yes + hardcode_direct_absolute_CXX=yes + hardcode_minus_L_CXX=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 + ld_shlibs_CXX=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + archive_cmds_CXX='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + archive_cmds_CXX='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + archive_cmds_CXX='$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; func_echo_all "$list"' + ;; + *) + if test yes = "$GXX"; then + if test no = "$with_gnu_ld"; then + case $host_cpu in + hppa*64*) + archive_cmds_CXX='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + archive_cmds_CXX='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -shared -nostdlib $pic_flag $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 + ld_shlibs_CXX=no + fi + ;; + esac + ;; + + interix[3-9]*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' + export_dynamic_flag_spec_CXX='$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_CXX='$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_CXX='$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++ + archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -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. + old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test yes = "$GXX"; then + if test no = "$with_gnu_ld"; then + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + else + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' + fi + fi + link_all_deplibs_CXX=yes + ;; + esac + hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' + hardcode_libdir_separator_CXX=: + inherit_rpath_CXX=yes + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu | 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. + archive_cmds_CXX='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' + archive_expsym_cmds_CXX='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; func_echo_all "$list"' + + hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' + export_dynamic_flag_spec_CXX='$wl--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + old_archive_cmds_CXX='$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."*) + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$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 + archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + archive_cmds_need_lc_CXX=no + hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' + export_dynamic_flag_spec_CXX='$wl--export-dynamic' + whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + case `$CC -V` in + *pgCC\ [1-5].* | *pgcpp\ [1-5].*) + prelink_cmds_CXX='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ + compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' + old_archive_cmds_CXX='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 | sort | $NL2SP`~ + $RANLIB $oldlib' + archive_cmds_CXX='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 | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='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 | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 6 and above use weak symbols + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$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 + + hardcode_libdir_flag_spec_CXX='$wl--rpath $wl$libdir' + export_dynamic_flag_spec_CXX='$wl--export-dynamic' + whole_archive_flag_spec_CXX='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + ;; + cxx*) + # Compaq C++ + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$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 + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + hardcode_libdir_separator_CXX=: + + # 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=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' + ;; + xl* | mpixl* | bgxl*) + # IBM XL 8.0 on PPC, with GNU ld + hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' + export_dynamic_flag_spec_CXX='$wl--export-dynamic' + archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + if test yes = "$supports_anon_versioning"; then + archive_expsym_cmds_CXX='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 + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' + hardcode_libdir_flag_spec_CXX='-R$libdir' + whole_archive_flag_spec_CXX='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + compiler_needs_object_CXX=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='func_echo_all' + + # 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. + old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; + esac + ;; + + lynxos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + + m88k*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=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*) + ld_shlibs_CXX=yes + ;; + + openbsd* | bitrig*) + if test -f /usr/libexec/ld.so; then + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + hardcode_direct_absolute_CXX=yes + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' + export_dynamic_flag_spec_CXX='$wl-E' + whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + fi + output_verbose_link_cmd=func_echo_all + else + ld_shlibs_CXX=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. + archive_cmds_CXX='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' + + hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' + hardcode_libdir_separator_CXX=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + case $host in + osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; + *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; + esac + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + cxx*) + case $host in + osf3*) + allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*' + archive_cmds_CXX='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' + ;; + *) + allow_undefined_flag_CXX=' -expect_unresolved \*' + archive_cmds_CXX='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + archive_expsym_cmds_CXX='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 "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ + $RM $lib.exp' + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + ;; + esac + + hardcode_libdir_separator_CXX=: + + # 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=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test yes,no = "$GXX,$with_gnu_ld"; then + allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*' + case $host in + osf3*) + archive_cmds_CXX='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + ;; + *) + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + ;; + esac + + hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' + hardcode_libdir_separator_CXX=: + + # 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 -v "^Configured with:" | $GREP "\-L"' + + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + + psos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + archive_cmds_need_lc_CXX=yes + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='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' + + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_shlibpath_var_CXX=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?) + whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' + ;; + esac + link_all_deplibs_CXX=yes + + output_verbose_link_cmd='func_echo_all' + + # 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. + old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + archive_cmds_CXX='$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. + old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test yes,no = "$GXX,$with_gnu_ld"; then + no_undefined_flag_CXX=' $wl-z ${wl}defs' + if $CC --version | $GREP -v '^2\.7' > /dev/null; then + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -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 -v "^Configured with:" | $GREP "\-L"' + else + # g++ 2.7 appears to require '-G' NOT '-shared' on this + # platform. + archive_cmds_CXX='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='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 $wl-h $wl$soname -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 -v "^Configured with:" | $GREP "\-L"' + fi + + hardcode_libdir_flag_spec_CXX='$wl-R $wl$libdir' + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + whole_archive_flag_spec_CXX='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' + ;; + esac + fi + ;; + esac + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag_CXX='$wl-z,text' + archive_cmds_need_lc_CXX=no + hardcode_shlibpath_var_CXX=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We CANNOT 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_CXX='$wl-z,text' + allow_undefined_flag_CXX='$wl-z,nodefs' + archive_cmds_need_lc_CXX=no + hardcode_shlibpath_var_CXX=no + hardcode_libdir_flag_spec_CXX='$wl-R,$libdir' + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + export_dynamic_flag_spec_CXX='$wl-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~ + '"$old_archive_cmds_CXX" + reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~ + '"$reload_cmds_CXX" + ;; + *) + archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$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 + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + vxworks*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 +printf "%s\n" "$ld_shlibs_CXX" >&6; } + test no = "$ld_shlibs_CXX" && can_build_shared=no + + GCC_CXX=$GXX + LD_CXX=$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... + # Dependencies to place before and after the object being linked: +predep_objects_CXX= +postdep_objects_CXX= +predeps_CXX= +postdeps_CXX= +compiler_lib_search_path_CXX= + +cat > conftest.$ac_ext <<_LT_EOF +class Foo +{ +public: + Foo (void) { a = 0; } +private: + int a; +}; +_LT_EOF + + +_lt_libdeps_save_CFLAGS=$CFLAGS +case "$CC $CFLAGS " in #( +*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; +*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; +*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; +esac + +if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; 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 $prev$p in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test x-L = "$p" || + test x-R = "$p"; then + prev=$p + continue + fi + + # Expand the sysroot to ease extracting the directories later. + if test -z "$prev"; then + case $p in + -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; + -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; + -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; + esac + fi + case $p in + =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; + esac + if test no = "$pre_test_object_deps_done"; then + case $prev 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 "$compiler_lib_search_path_CXX"; then + compiler_lib_search_path_CXX=$prev$p + else + compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} $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 "$postdeps_CXX"; then + postdeps_CXX=$prev$p + else + postdeps_CXX="${postdeps_CXX} $prev$p" + fi + fi + prev= + ;; + + *.lto.$objext) ;; # Ignore GCC LTO objects + *.$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 no = "$pre_test_object_deps_done"; then + if test -z "$predep_objects_CXX"; then + predep_objects_CXX=$p + else + predep_objects_CXX="$predep_objects_CXX $p" + fi + else + if test -z "$postdep_objects_CXX"; then + postdep_objects_CXX=$p + else + postdep_objects_CXX="$postdep_objects_CXX $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling CXX test program" +fi + +$RM -f confest.$objext +CFLAGS=$_lt_libdeps_save_CFLAGS + +# PORTME: override above test on systems where it is broken +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. + predep_objects_CXX= + postdep_objects_CXX= + postdeps_CXX= + ;; +esac + + +case " $postdeps_CXX " in +*" -lc "*) archive_cmds_need_lc_CXX=no ;; +esac + compiler_lib_search_dirs_CXX= +if test -n "${compiler_lib_search_path_CXX}"; then + compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | $SED -e 's! -L! !g' -e 's!^ !!'` +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + lt_prog_compiler_wl_CXX= +lt_prog_compiler_pic_CXX= +lt_prog_compiler_static_CXX= + + + # C++ specific cases for pic, static, wl, etc. + if test yes = "$GXX"; then + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + fi + lt_prog_compiler_pic_CXX='-fPIC' + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + lt_prog_compiler_pic_CXX='-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_CXX='-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 + lt_prog_compiler_pic_CXX='-DDLL_EXPORT' + case $host_os in + os2*) + lt_prog_compiler_static_CXX='$wl-static' + ;; + esac + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_CXX='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + lt_prog_compiler_pic_CXX= + ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + lt_prog_compiler_static_CXX= + ;; + 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_prog_compiler_pic_CXX=-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_prog_compiler_pic_CXX='-fPIC' + ;; + esac + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic_CXX='-fPIC -shared' + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + else + case $host_os in + aix[4-9]*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + else + lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--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 + ;; + 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). + lt_prog_compiler_pic_CXX='-DDLL_EXPORT' + ;; + dgux*) + case $cc_basename in + ec++*) + lt_prog_compiler_pic_CXX='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | dragonfly* | midnightbsd*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='$wl-a ${wl}archive' + if test ia64 != "$host_cpu"; then + lt_prog_compiler_pic_CXX='+Z' + fi + ;; + aCC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='$wl-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_CXX='+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_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + KCC*) + # KAI C++ Compiler + lt_prog_compiler_wl_CXX='--backend -Wl,' + lt_prog_compiler_pic_CXX='-fPIC' + ;; + ecpc* ) + # old Intel C++ for x86_64, which still supported -KPIC. + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-static' + ;; + icpc* ) + # Intel C++, used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-fPIC' + lt_prog_compiler_static_CXX='-static' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-fpic' + lt_prog_compiler_static_CXX='-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_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + xlc* | xlC* | bgxl[cC]* | mpixl[cC]*) + # IBM XL 8.0, 9.0 on PPC and BlueGene + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-qpic' + lt_prog_compiler_static_CXX='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | $SED 5q` in + *Sun\ C*) + # Sun C++ 5.9 + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + lt_prog_compiler_wl_CXX='-Qoption ld ' + ;; + esac + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + lt_prog_compiler_pic_CXX='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic_CXX='-fPIC -shared' + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + lt_prog_compiler_wl_CXX='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + lt_prog_compiler_pic_CXX='-pic' + ;; + cxx*) + # Digital/Compaq C++ + lt_prog_compiler_wl_CXX='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + lt_prog_compiler_wl_CXX='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + lt_prog_compiler_pic_CXX='-pic' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + lcc*) + # Lucid + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + lt_prog_compiler_pic_CXX='-KPIC' + ;; + *) + ;; + esac + ;; + vxworks*) + ;; + *) + lt_prog_compiler_can_build_shared_CXX=no + ;; + esac + fi + +case $host_os in + # For platforms that do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_CXX= + ;; + *) + lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" + ;; +esac + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +printf %s "checking for $compiler option to produce PIC... " >&6; } +if test ${lt_cv_prog_compiler_pic_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5 +printf "%s\n" "$lt_cv_prog_compiler_pic_CXX" >&6; } +lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_CXX"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 +printf %s "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } +if test ${lt_cv_prog_compiler_pic_works_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_pic_works_CXX=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" ## exclude from sc_useless_quotes_in_assignment + # 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:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 "$_lt_compiler_boilerplate" | $SED '/^$/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_CXX=yes + fi + fi + $RM conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 +printf "%s\n" "$lt_cv_prog_compiler_pic_works_CXX" >&6; } + +if test yes = "$lt_cv_prog_compiler_pic_works_CXX"; then + case $lt_prog_compiler_pic_CXX in + "" | " "*) ;; + *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; + esac +else + lt_prog_compiler_pic_CXX= + lt_prog_compiler_can_build_shared_CXX=no +fi + +fi + + + + + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +printf %s "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if test ${lt_cv_prog_compiler_static_works_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_static_works_CXX=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 "$_lt_linker_boilerplate" | $SED '/^$/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_CXX=yes + fi + else + lt_cv_prog_compiler_static_works_CXX=yes + fi + fi + $RM -r conftest* + LDFLAGS=$save_LDFLAGS + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 +printf "%s\n" "$lt_cv_prog_compiler_static_works_CXX" >&6; } + +if test yes = "$lt_cv_prog_compiler_static_works_CXX"; then + : +else + lt_prog_compiler_static_CXX= +fi + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test ${lt_cv_prog_compiler_c_o_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_c_o_CXX=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:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 "$_lt_compiler_boilerplate" | $SED '/^$/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_CXX=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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +printf "%s\n" "$lt_cv_prog_compiler_c_o_CXX" >&6; } + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test ${lt_cv_prog_compiler_c_o_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_c_o_CXX=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:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $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 "$_lt_compiler_boilerplate" | $SED '/^$/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_CXX=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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +printf "%s\n" "$lt_cv_prog_compiler_c_o_CXX" >&6; } + + + + +hard_links=nottested +if test no = "$lt_cv_prog_compiler_c_o_CXX" && test no != "$need_locks"; then + # do not overwrite the value of need_locks provided by the user + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +printf %s "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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +printf "%s\n" "$hard_links" >&6; } + if test no = "$hard_links"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 +printf "%s\n" "$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 + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + 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 GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX nm. + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_CXX='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + export_symbols_cmds_CXX=$ltdll_cmds + ;; + cygwin* | mingw* | cegcc*) + case $cc_basename in + cl* | icl*) + exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + ;; + *) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' + ;; + esac + ;; + *) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 +printf "%s\n" "$ld_shlibs_CXX" >&6; } +test no = "$ld_shlibs_CXX" && can_build_shared=no + +with_gnu_ld_CXX=$with_gnu_ld + + + + + + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_CXX" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_CXX=yes + + if test yes,yes = "$GCC,$enable_shared"; then + case $archive_cmds_CXX 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. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +printf %s "checking whether -lc should be explicitly linked in... " >&6; } +if test ${lt_cv_archive_cmds_need_lc_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_CXX + pic_flag=$lt_prog_compiler_pic_CXX + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_CXX + allow_undefined_flag_CXX= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + then + lt_cv_archive_cmds_need_lc_CXX=no + else + lt_cv_archive_cmds_need_lc_CXX=yes + fi + allow_undefined_flag_CXX=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5 +printf "%s\n" "$lt_cv_archive_cmds_need_lc_CXX" >&6; } + archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX + ;; + esac + fi + ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +printf %s "checking dynamic linker characteristics... " >&6; } + +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 # correct to gnu/linux during the next big refactor + 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 # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test ia64 = "$host_cpu"; 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 + # Using Import Files as archive members, it is possible to support + # filename-based versioning of shared library archives on AIX. While + # this would work for both with and without runtime linking, it will + # prevent static linking of such archives. So we do filename-based + # shared library versioning with .so extension only, which is used + # when both runtime linking and shared linking is enabled. + # Unfortunately, runtime linking may impact performance, so we do + # not want this to be the default eventually. Also, we use the + # versioned .so libs for executables only if there is the -brtl + # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. + # To allow for filename-based versioning support, we need to create + # libNAME.so.V as an archive file, containing: + # *) an Import File, referring to the versioned filename of the + # archive as well as the shared archive member, telling the + # bitwidth (32 or 64) of that shared object, and providing the + # list of exported symbols of that shared object, eventually + # decorated with the 'weak' keyword + # *) the shared object with the F_LOADONLY flag set, to really avoid + # it being seen by the linker. + # At run time we better use the real file rather than another symlink, + # but for link time we create the symlink libNAME.so -> libNAME.so.V + + case $with_aix_soname,$aix_use_runtimelinking in + # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + aix,yes) # traditional libtool + dynamic_linker='AIX unversionable lib.so' + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.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' + ;; + aix,no) # traditional AIX only + dynamic_linker='AIX lib.a(lib.so.V)' + # 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' + ;; + svr4,*) # full svr4 only + dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,yes) # both, prefer svr4 + dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # unpreferred sharedlib libNAME.a needs extra handling + postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' + postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,no) # both, prefer aix + dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling + postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' + postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' + ;; + esac + 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=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $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 # correct to gnu/linux during the next big refactor + 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,$cc_basename in + yes,*) + # gcc + 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' + + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + ;; + 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 + dynamic_linker='Win32 ld.exe' + ;; + + *,cl* | *,icl*) + # Native MSVC or ICC + libname_spec='$name' + soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + library_names_spec='$libname.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec=$LIB + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH. + 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 + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # 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' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC and ICC wrapper + library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # 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_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + 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 + ;; + +freebsd* | dragonfly* | midnightbsd*) + # 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[23].*) 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$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + 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 + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + 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=LIBRARY_PATH + shlibpath_overrides_runpath=no + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + 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 32 = "$HPUX_IA64_MODE"; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + sys_lib_dlsearch_path_spec=/usr/lib/hpux32 + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + sys_lib_dlsearch_path_spec=/usr/lib/hpux64 + fi + ;; + 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' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[3-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + 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 yes = "$lt_cv_prog_gnu_ld"; then + version_type=linux # correct to gnu/linux during the next big refactor + 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 + ;; + +linux*android*) + version_type=none # Android doesn't support versioned libraries. + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext' + soname_spec='$libname$release$shared_ext' + finish_cmds= + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + + # 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 + + dynamic_linker='Android linker' + # Don't embed -rpath directories since the linker doesn't support them. + hardcode_libdir_flag_spec_CXX='-L$libdir' + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + 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 + if test ${lt_cv_shlibpath_overrides_runpath+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null +then : + lt_cv_shlibpath_overrides_runpath=yes +fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + +fi + + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # 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 + + # Add ABI-specific directories to the system library path. + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" + + # Ideally, we could use ldconfig to report *all* directores which are + # searched for libraries, however this is still not possible. Aside from not + # being certain /sbin/ldconfig is available, command + # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, + # even though it is searched at run-time. Try to do the best guess by + # appending ld.so.conf contents (and includes) 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;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $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 # correct to gnu/linux during the next big refactor + 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* | bitrig*) + version_type=sunos + sys_lib_dlsearch_path_spec=/usr/lib + need_lib_prefix=no + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + need_version=no + else + need_version=yes + fi + 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 + shlibpath_overrides_runpath=yes + ;; + +os2*) + libname_spec='$name' + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + # OS/2 can only load a DLL with a base name of 8 characters or less. + soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; + v=$($ECHO $release$versuffix | tr -d .-); + n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); + $ECHO $n$v`$shared_ext' + library_names_spec='${libname}_dll.$libext' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=BEGINLIBPATH + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + 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' + ;; + +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 # correct to gnu/linux during the next big refactor + 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 yes = "$with_gnu_ld"; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + 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 # correct to gnu/linux during the next big refactor + 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=sco + 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 yes = "$with_gnu_ld"; 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 # correct to gnu/linux during the next big refactor + 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 # correct to gnu/linux during the next big refactor + 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +printf "%s\n" "$dynamic_linker" >&6; } +test no = "$dynamic_linker" && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test yes = "$GCC"; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then + sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec +fi + +if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then + sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec +fi + +# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... +configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec + +# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code +func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" + +# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool +configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +printf %s "checking how to hardcode library paths into programs... " >&6; } +hardcode_action_CXX= +if test -n "$hardcode_libdir_flag_spec_CXX" || + test -n "$runpath_var_CXX" || + test yes = "$hardcode_automatic_CXX"; then + + # We can hardcode non-existent directories. + if test no != "$hardcode_direct_CXX" && + # 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 no != "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" && + test no != "$hardcode_minus_L_CXX"; then + # Linking always hardcodes the temporary library directory. + hardcode_action_CXX=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_CXX=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_CXX=unsupported +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 +printf "%s\n" "$hardcode_action_CXX" >&6; } + +if test relink = "$hardcode_action_CXX" || + test yes = "$inherit_rpath_CXX"; then + # Fast installation is not supported + enable_fast_install=no +elif test yes = "$shlibpath_overrides_runpath" || + test no = "$enable_shared"; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + + + + + + + fi # test -n "$compiler" + + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS + 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 yes != "$_lt_caught_CXX_error" + +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 + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the C++ compiler really really works" >&5 +printf %s "checking if the C++ compiler really really works... " >&6; } +if $CXX --version >&5 2>&1 +then : + have_cxx=yes +else $as_nop + have_cxx=no +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_cxx" >&5 +printf "%s\n" "$have_cxx" >&6; } + if test "$have_cxx" = "yes"; then + HAVE_CXX_TRUE= + HAVE_CXX_FALSE='#' +else + HAVE_CXX_TRUE='#' + HAVE_CXX_FALSE= +fi + + +# Check whether --enable-gcc-warnings was given. +if test ${enable_gcc_warnings+y} +then : + enableval=$enable_gcc_warnings; case $enableval in + yes|no) ;; + *) as_fn_error $? "bad value $enableval for gcc-warnings option" "$LINENO" 5 ;; + esac + gcc_warnings=$enableval +else $as_nop + gcc_warnings=no + +fi + +if test "x$gcc_warnings" = "xyes"; then + WARNINGS_CFLAGS="-Wall -Wshadow -Wvla -Werror" + +fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the compiler supports -std=c90 for ANSI C test" >&5 +printf %s "checking if the compiler supports -std=c90 for ANSI C test... " >&6; } +old_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -std=c90" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + supports_std_c90=yes +else $as_nop + supports_std_c90=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +CFLAGS="$old_CFLAGS" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $supports_std_c90" >&5 +printf "%s\n" "$supports_std_c90" >&6; } + if test "x$supports_std_c90" = "xyes"; then + CAN_TEST_ANSI_C_TRUE= + CAN_TEST_ANSI_C_FALSE='#' +else + CAN_TEST_ANSI_C_TRUE='#' + CAN_TEST_ANSI_C_FALSE= +fi + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC options needed to detect all undeclared functions" >&5 +printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; } +if test ${ac_cv_c_undeclared_builtin_options+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_CFLAGS=$CFLAGS + ac_cv_c_undeclared_builtin_options='cannot detect' + for ac_arg in '' -fno-builtin; do + CFLAGS="$ac_save_CFLAGS $ac_arg" + # This test program should *not* compile successfully. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +(void) strchr; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + # This test program should compile successfully. + # No library function is consistently available on + # freestanding implementations, so test against a dummy + # declaration. Include always-available headers on the + # off chance that they somehow elicit warnings. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +extern void ac_decl (int, char *); + +int +main (void) +{ +(void) ac_decl (0, (char *) 0); + (void) ac_decl; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + if test x"$ac_arg" = x +then : + ac_cv_c_undeclared_builtin_options='none needed' +else $as_nop + ac_cv_c_undeclared_builtin_options=$ac_arg +fi + break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + done + CFLAGS=$ac_save_CFLAGS + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_undeclared_builtin_options" >&5 +printf "%s\n" "$ac_cv_c_undeclared_builtin_options" >&6; } + case $ac_cv_c_undeclared_builtin_options in #( + 'cannot detect') : + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot make $CC report undeclared builtins +See \`config.log' for more details" "$LINENO" 5; } ;; #( + 'none needed') : + ac_c_undeclared_builtin_options='' ;; #( + *) : + ac_c_undeclared_builtin_options=$ac_cv_c_undeclared_builtin_options ;; +esac + +as_ac_Symbol=`printf "%s\n" "ac_cv_have_decl___builtin_add_overflow(int, int, int *)" | $as_tr_sh` +ac_fn_check_decl "$LINENO" "__builtin_add_overflow(int, int, int *)" "$as_ac_Symbol" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if eval test \"x\$"$as_ac_Symbol"\" = x"yes" +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL___BUILTIN_ADD_OVERFLOW $ac_have_decl" >>confdefs.h +as_ac_Symbol=`printf "%s\n" "ac_cv_have_decl___builtin_mul_overflow(int, int, int *)" | $as_tr_sh` +ac_fn_check_decl "$LINENO" "__builtin_mul_overflow(int, int, int *)" "$as_ac_Symbol" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if eval test \"x\$"$as_ac_Symbol"\" = x"yes" +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL___BUILTIN_MUL_OVERFLOW $ac_have_decl" >>confdefs.h + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether OS-dependent include paths are required" >&5 +printf %s "checking whether OS-dependent include paths are required... " >&6; } +case $host_os in #( + haiku*) : + CFLAGS="$CFLAGS -I`findpaths -p /system B_FIND_PATH_HEADERS_DIRECTORY`/bsd"; { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } ;; #( + *) : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for temporary directory for large files" >&5 +printf %s "checking for temporary directory for large files... " >&6; } +case $host_os in #( + haiku*) : + LARGE_TMPDIR=/tmp ;; #( + *) : + LARGE_TMPDIR=/var/tmp + ;; +esac +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LARGE_TMPDIR" >&5 +printf "%s\n" "$LARGE_TMPDIR" >&6; } + +printf "%s\n" "#define LARGE_TMPDIR \"$LARGE_TMPDIR\"" >>confdefs.h + + +ac_fn_check_decl "$LINENO" "program_invocation_short_name" "ac_cv_have_decl_program_invocation_short_name" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_program_invocation_short_name" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME $ac_have_decl" >>confdefs.h + + + + + + + +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 + +ax_pthread_ok=no + +# We used to check for pthread.h first, but this fails if pthread.h +# requires special compiler flags (e.g. on Tru64 or Sequent). +# It gets checked for in the link test anyway. + +# First of all, check if the user has set any of the PTHREAD_LIBS, +# etcetera environment variables, and if threads linking works using +# them: +if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then + ax_pthread_save_CC="$CC" + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + if test "x$PTHREAD_CC" != "x" +then : + CC="$PTHREAD_CC" +fi + if test "x$PTHREAD_CXX" != "x" +then : + CXX="$PTHREAD_CXX" +fi + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS" >&5 +printf %s "checking for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* 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. */ +char pthread_join (); +int +main (void) +{ +return pthread_join (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ax_pthread_ok=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5 +printf "%s\n" "$ax_pthread_ok" >&6; } + if test "x$ax_pthread_ok" = "xno"; then + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" + fi + CC="$ax_pthread_save_CC" + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" +fi + +# We must check for the threads library under a number of different +# names; the ordering is very important because some systems +# (e.g. DEC) have both -lpthread and -lpthreads, where one of the +# libraries is broken (non-POSIX). + +# Create a list of thread flags to try. Items with a "," contain both +# C compiler flags (before ",") and linker flags (after ","). Other items +# starting with a "-" are C compiler flags, and remaining items are +# library names, except for "none" which indicates that we try without +# any flags at all, and "pthread-config" which is a program returning +# the flags for the Pth emulation library. + +ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" + +# The ordering *is* (sometimes) important. Some notes on the +# individual items follow: + +# pthreads: AIX (must check this before -lpthread) +# none: in case threads are in libc; should be tried before -Kthread and +# other compiler flags to prevent continual compiler warnings +# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) +# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64 +# (Note: HP C rejects this with "bad form for `-t' option") +# -pthreads: Solaris/gcc (Note: HP C also rejects) +# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it +# doesn't hurt to check since this sometimes defines pthreads and +# -D_REENTRANT too), HP C (must be checked before -lpthread, which +# is present but should not be used directly; and before -mthreads, +# because the compiler interprets this as "-mt" + "-hreads") +# -mthreads: Mingw32/gcc, Lynx/gcc +# pthread: Linux, etcetera +# --thread-safe: KAI C++ +# pthread-config: use pthread-config program (for GNU Pth library) + +case $host_os in + + freebsd*) + + # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) + # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) + + ax_pthread_flags="-kthread lthread $ax_pthread_flags" + ;; + + hpux*) + + # From the cc(1) man page: "[-mt] Sets various -D flags to enable + # multi-threading and also sets -lpthread." + + ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags" + ;; + + openedition*) + + # IBM z/OS requires a feature-test macro to be defined in order to + # enable POSIX threads at all, so give the user a hint if this is + # not set. (We don't define these ourselves, as they can affect + # other portions of the system API in unpredictable ways.) + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS) + AX_PTHREAD_ZOS_MISSING +# endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "AX_PTHREAD_ZOS_MISSING" >/dev/null 2>&1 +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support." >&5 +printf "%s\n" "$as_me: WARNING: IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support." >&2;} +fi +rm -rf conftest* + + ;; + + solaris*) + + # On Solaris (at least, for some versions), libc contains stubbed + # (non-functional) versions of the pthreads routines, so link-based + # tests will erroneously succeed. (N.B.: The stubs are missing + # pthread_cleanup_push, or rather a function called by this macro, + # so we could check for that, but who knows whether they'll stub + # that too in a future libc.) So we'll check first for the + # standard Solaris way of linking pthreads (-mt -lpthread). + + ax_pthread_flags="-mt,-lpthread pthread $ax_pthread_flags" + ;; +esac + +# Are we compiling with Clang? + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC is Clang" >&5 +printf %s "checking whether $CC is Clang... " >&6; } +if test ${ax_cv_PTHREAD_CLANG+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ax_cv_PTHREAD_CLANG=no + # Note that Autoconf sets GCC=yes for Clang as well as GCC + if test "x$GCC" = "xyes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Note: Clang 2.7 lacks __clang_[a-z]+__ */ +# if defined(__clang__) && defined(__llvm__) + AX_PTHREAD_CC_IS_CLANG +# endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "AX_PTHREAD_CC_IS_CLANG" >/dev/null 2>&1 +then : + ax_cv_PTHREAD_CLANG=yes +fi +rm -rf conftest* + + fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_CLANG" >&5 +printf "%s\n" "$ax_cv_PTHREAD_CLANG" >&6; } +ax_pthread_clang="$ax_cv_PTHREAD_CLANG" + + +# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC) + +# Note that for GCC and Clang -pthread generally implies -lpthread, +# except when -nostdlib is passed. +# This is problematic using libtool to build C++ shared libraries with pthread: +# [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25460 +# [2] https://bugzilla.redhat.com/show_bug.cgi?id=661333 +# [3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468555 +# To solve this, first try -pthread together with -lpthread for GCC + +if test "x$GCC" = "xyes" +then : + ax_pthread_flags="-pthread,-lpthread -pthread -pthreads $ax_pthread_flags" +fi + +# Clang takes -pthread (never supported any other flag), but we'll try with -lpthread first + +if test "x$ax_pthread_clang" = "xyes" +then : + ax_pthread_flags="-pthread,-lpthread -pthread" +fi + + +# The presence of a feature test macro requesting re-entrant function +# definitions is, on some systems, a strong hint that pthreads support is +# correctly enabled + +case $host_os in + darwin* | hpux* | linux* | osf* | solaris*) + ax_pthread_check_macro="_REENTRANT" + ;; + + aix*) + ax_pthread_check_macro="_THREAD_SAFE" + ;; + + *) + ax_pthread_check_macro="--" + ;; +esac +if test "x$ax_pthread_check_macro" = "x--" +then : + ax_pthread_check_cond=0 +else $as_nop + ax_pthread_check_cond="!defined($ax_pthread_check_macro)" +fi + + +if test "x$ax_pthread_ok" = "xno"; then +for ax_pthread_try_flag in $ax_pthread_flags; do + + case $ax_pthread_try_flag in + none) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether pthreads work without any flags" >&5 +printf %s "checking whether pthreads work without any flags... " >&6; } + ;; + + *,*) + PTHREAD_CFLAGS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\1/"` + PTHREAD_LIBS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\2/"` + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with \"$PTHREAD_CFLAGS\" and \"$PTHREAD_LIBS\"" >&5 +printf %s "checking whether pthreads work with \"$PTHREAD_CFLAGS\" and \"$PTHREAD_LIBS\"... " >&6; } + ;; + + -*) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with $ax_pthread_try_flag" >&5 +printf %s "checking whether pthreads work with $ax_pthread_try_flag... " >&6; } + PTHREAD_CFLAGS="$ax_pthread_try_flag" + ;; + + pthread-config) + # Extract the first word of "pthread-config", so it can be a program name with args. +set dummy pthread-config; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ax_pthread_config+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ax_pthread_config"; then + ac_cv_prog_ax_pthread_config="$ax_pthread_config" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ax_pthread_config="yes" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_ax_pthread_config" && ac_cv_prog_ax_pthread_config="no" +fi +fi +ax_pthread_config=$ac_cv_prog_ax_pthread_config +if test -n "$ax_pthread_config"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_config" >&5 +printf "%s\n" "$ax_pthread_config" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + if test "x$ax_pthread_config" = "xno" +then : + continue +fi + PTHREAD_CFLAGS="`pthread-config --cflags`" + PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" + ;; + + *) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$ax_pthread_try_flag" >&5 +printf %s "checking for the pthreads library -l$ax_pthread_try_flag... " >&6; } + PTHREAD_LIBS="-l$ax_pthread_try_flag" + ;; + esac + + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + + # Check for various functions. We must include pthread.h, + # since some functions may be macros. (On the Sequent, we + # need a special flag -Kthread to make this header compile.) + # We check for pthread_join because it is in -lpthread on IRIX + # while pthread_create is in libc. We check for pthread_attr_init + # due to DEC craziness with -lpthreads. We check for + # pthread_cleanup_push because it is one of the few pthread + # functions on Solaris that doesn't have a non-functional libc stub. + # We try pthread_create on general principles. + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +# if $ax_pthread_check_cond +# error "$ax_pthread_check_macro must be defined" +# endif + static void *some_global = NULL; + static void routine(void *a) + { + /* To avoid any unused-parameter or + unused-but-set-parameter warning. */ + some_global = a; + } + static void *start_routine(void *a) { return a; } +int +main (void) +{ +pthread_t th; pthread_attr_t attr; + pthread_create(&th, 0, start_routine, 0); + pthread_join(th, 0); + pthread_attr_init(&attr); + pthread_cleanup_push(routine, 0); + pthread_cleanup_pop(0) /* ; */ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ax_pthread_ok=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5 +printf "%s\n" "$ax_pthread_ok" >&6; } + if test "x$ax_pthread_ok" = "xyes" +then : + break +fi + + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" +done +fi + + +# Clang needs special handling, because older versions handle the -pthread +# option in a rather... idiosyncratic way + +if test "x$ax_pthread_clang" = "xyes"; then + + # Clang takes -pthread; it has never supported any other flag + + # (Note 1: This will need to be revisited if a system that Clang + # supports has POSIX threads in a separate library. This tends not + # to be the way of modern systems, but it's conceivable.) + + # (Note 2: On some systems, notably Darwin, -pthread is not needed + # to get POSIX threads support; the API is always present and + # active. We could reasonably leave PTHREAD_CFLAGS empty. But + # -pthread does define _REENTRANT, and while the Darwin headers + # ignore this macro, third-party headers might not.) + + # However, older versions of Clang make a point of warning the user + # that, in an invocation where only linking and no compilation is + # taking place, the -pthread option has no effect ("argument unused + # during compilation"). They expect -pthread to be passed in only + # when source code is being compiled. + # + # Problem is, this is at odds with the way Automake and most other + # C build frameworks function, which is that the same flags used in + # compilation (CFLAGS) are also used in linking. Many systems + # supported by AX_PTHREAD require exactly this for POSIX threads + # support, and in fact it is often not straightforward to specify a + # flag that is used only in the compilation phase and not in + # linking. Such a scenario is extremely rare in practice. + # + # Even though use of the -pthread flag in linking would only print + # a warning, this can be a nuisance for well-run software projects + # that build with -Werror. So if the active version of Clang has + # this misfeature, we search for an option to squash it. + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether Clang needs flag to prevent \"argument unused\" warning when linking with -pthread" >&5 +printf %s "checking whether Clang needs flag to prevent \"argument unused\" warning when linking with -pthread... " >&6; } +if test ${ax_cv_PTHREAD_CLANG_NO_WARN_FLAG+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown + # Create an alternate version of $ac_link that compiles and + # links in two steps (.c -> .o, .o -> exe) instead of one + # (.c -> exe), because the warning occurs only in the second + # step + ax_pthread_save_ac_link="$ac_link" + ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g' + ax_pthread_link_step=`printf "%s\n" "$ac_link" | sed "$ax_pthread_sed"` + ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)" + ax_pthread_save_CFLAGS="$CFLAGS" + for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do + if test "x$ax_pthread_try" = "xunknown" +then : + break +fi + CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS" + ac_link="$ax_pthread_save_ac_link" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int main(void){return 0;} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_link="$ax_pthread_2step_ac_link" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int main(void){return 0;} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + done + ac_link="$ax_pthread_save_ac_link" + CFLAGS="$ax_pthread_save_CFLAGS" + if test "x$ax_pthread_try" = "x" +then : + ax_pthread_try=no +fi + ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try" + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&5 +printf "%s\n" "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&6; } + + case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in + no | unknown) ;; + *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;; + esac + +fi # $ax_pthread_clang = yes + + + +# Various other checks: +if test "x$ax_pthread_ok" = "xyes"; then + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + + # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5 +printf %s "checking for joinable pthread attribute... " >&6; } +if test ${ax_cv_PTHREAD_JOINABLE_ATTR+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ax_cv_PTHREAD_JOINABLE_ATTR=unknown + for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +int attr = $ax_pthread_attr; return attr /* ; */ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + done + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_JOINABLE_ATTR" >&5 +printf "%s\n" "$ax_cv_PTHREAD_JOINABLE_ATTR" >&6; } + if test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \ + test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \ + test "x$ax_pthread_joinable_attr_defined" != "xyes" +then : + +printf "%s\n" "#define PTHREAD_CREATE_JOINABLE $ax_cv_PTHREAD_JOINABLE_ATTR" >>confdefs.h + + ax_pthread_joinable_attr_defined=yes + +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether more special flags are required for pthreads" >&5 +printf %s "checking whether more special flags are required for pthreads... " >&6; } +if test ${ax_cv_PTHREAD_SPECIAL_FLAGS+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ax_cv_PTHREAD_SPECIAL_FLAGS=no + case $host_os in + solaris*) + ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS" + ;; + esac + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_SPECIAL_FLAGS" >&5 +printf "%s\n" "$ax_cv_PTHREAD_SPECIAL_FLAGS" >&6; } + if test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \ + test "x$ax_pthread_special_flags_added" != "xyes" +then : + PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS" + ax_pthread_special_flags_added=yes +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for PTHREAD_PRIO_INHERIT" >&5 +printf %s "checking for PTHREAD_PRIO_INHERIT... " >&6; } +if test ${ax_cv_PTHREAD_PRIO_INHERIT+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +int i = PTHREAD_PRIO_INHERIT; + return i; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ax_cv_PTHREAD_PRIO_INHERIT=yes +else $as_nop + ax_cv_PTHREAD_PRIO_INHERIT=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_PRIO_INHERIT" >&5 +printf "%s\n" "$ax_cv_PTHREAD_PRIO_INHERIT" >&6; } + if test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \ + test "x$ax_pthread_prio_inherit_defined" != "xyes" +then : + +printf "%s\n" "#define HAVE_PTHREAD_PRIO_INHERIT 1" >>confdefs.h + + ax_pthread_prio_inherit_defined=yes + +fi + + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" + + # More AIX lossage: compile with *_r variant + if test "x$GCC" != "xyes"; then + case $host_os in + aix*) + case "x/$CC" in #( + x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6) : + #handle absolute path differently from PATH based program lookup + case "x$CC" in #( + x/*) : + + if as_fn_executable_p ${CC}_r +then : + PTHREAD_CC="${CC}_r" +fi + if test "x${CXX}" != "x" +then : + if as_fn_executable_p ${CXX}_r +then : + PTHREAD_CXX="${CXX}_r" +fi +fi + ;; #( + *) : + + for ac_prog in ${CC}_r +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_PTHREAD_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$PTHREAD_CC"; then + ac_cv_prog_PTHREAD_CC="$PTHREAD_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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_PTHREAD_CC="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +PTHREAD_CC=$ac_cv_prog_PTHREAD_CC +if test -n "$PTHREAD_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PTHREAD_CC" >&5 +printf "%s\n" "$PTHREAD_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$PTHREAD_CC" && break +done +test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" + + if test "x${CXX}" != "x" +then : + for ac_prog in ${CXX}_r +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_PTHREAD_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$PTHREAD_CXX"; then + ac_cv_prog_PTHREAD_CXX="$PTHREAD_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_PTHREAD_CXX="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +PTHREAD_CXX=$ac_cv_prog_PTHREAD_CXX +if test -n "$PTHREAD_CXX"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PTHREAD_CXX" >&5 +printf "%s\n" "$PTHREAD_CXX" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$PTHREAD_CXX" && break +done +test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX" + +fi + + ;; +esac + ;; #( + *) : + ;; +esac + ;; + esac + fi +fi + +test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" +test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX" + + + + + + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test "x$ax_pthread_ok" = "xyes"; then + +printf "%s\n" "#define HAVE_PTHREAD 1" >>confdefs.h + + : +else + ax_pthread_ok=no + +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 + + + +acx_nbdkit_save_CFLAGS="${CFLAGS}" +CFLAGS="${CFLAGS} -Werror" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if __attribute__((cleanup(...))) works with this compiler" >&5 +printf %s "checking if __attribute__((cleanup(...))) works with this compiler... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include +#include + +void +freep (void *ptr) +{ + exit (EXIT_SUCCESS); +} + +void +test (void) +{ + __attribute__((cleanup(freep))) char *ptr = malloc (100); + (void)ptr; +} + +int +main (int argc, char *argv[]) +{ + test (); + exit (EXIT_FAILURE); +} + + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else $as_nop + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + as_fn_error $? "'__attribute__((cleanup(...)))' does not work. + +You may not be using a sufficiently recent version of GCC or CLANG, or +you may be using a C compiler which does not support this attribute, +or the configure test may be wrong. + +This code requires the attribute to work for proper locking between threads." "$LINENO" 5 +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +CFLAGS="${acx_nbdkit_save_CFLAGS}" + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if __auto_type is available in this compiler" >&5 +printf %s "checking if __auto_type is available in this compiler... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +static int +test (int a) +{ + __auto_type at = a; + return at; +} + + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +printf "%s\n" "#define HAVE_AUTO_TYPE 1" >>confdefs.h + + +else $as_nop + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if environ is declared in header files" >&5 +printf %s "checking if environ is declared in header files... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include +#include +static int +test (void) +{ + const char **env = environ; + return env ? 1 : 0; // this just forces env to be used +} + + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +printf "%s\n" "#define HAVE_ENVIRON_DECL 1" >>confdefs.h + + +else $as_nop + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +# 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. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 +printf %s "checking size of long... " >&6; } +if test ${ac_cv_sizeof_long+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default" +then : + +else $as_nop + if test "$ac_cv_type_long" = yes; then + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (long) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_long=0 + fi +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 +printf "%s\n" "$ac_cv_sizeof_long" >&6; } + + + +printf "%s\n" "#define SIZEOF_LONG $ac_cv_sizeof_long" >>confdefs.h + + + +ac_fn_c_check_header_compile "$LINENO" "alloca.h" "ac_cv_header_alloca_h" "$ac_includes_default" +if test "x$ac_cv_header_alloca_h" = xyes +then : + printf "%s\n" "#define HAVE_ALLOCA_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "afunix.h" "ac_cv_header_afunix_h" "$ac_includes_default" +if test "x$ac_cv_header_afunix_h" = xyes +then : + printf "%s\n" "#define HAVE_AFUNIX_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "arpa/inet.h" "ac_cv_header_arpa_inet_h" "$ac_includes_default" +if test "x$ac_cv_header_arpa_inet_h" = xyes +then : + printf "%s\n" "#define HAVE_ARPA_INET_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "byteswap.h" "ac_cv_header_byteswap_h" "$ac_includes_default" +if test "x$ac_cv_header_byteswap_h" = xyes +then : + printf "%s\n" "#define HAVE_BYTESWAP_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "endian.h" "ac_cv_header_endian_h" "$ac_includes_default" +if test "x$ac_cv_header_endian_h" = xyes +then : + printf "%s\n" "#define HAVE_ENDIAN_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "grp.h" "ac_cv_header_grp_h" "$ac_includes_default" +if test "x$ac_cv_header_grp_h" = xyes +then : + printf "%s\n" "#define HAVE_GRP_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "linux/fs.h" "ac_cv_header_linux_fs_h" "$ac_includes_default" +if test "x$ac_cv_header_linux_fs_h" = xyes +then : + printf "%s\n" "#define HAVE_LINUX_FS_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "netdb.h" "ac_cv_header_netdb_h" "$ac_includes_default" +if test "x$ac_cv_header_netdb_h" = xyes +then : + printf "%s\n" "#define HAVE_NETDB_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "netinet/in.h" "ac_cv_header_netinet_in_h" "$ac_includes_default" +if test "x$ac_cv_header_netinet_in_h" = xyes +then : + printf "%s\n" "#define HAVE_NETINET_IN_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "netinet/tcp.h" "ac_cv_header_netinet_tcp_h" "$ac_includes_default" +if test "x$ac_cv_header_netinet_tcp_h" = xyes +then : + printf "%s\n" "#define HAVE_NETINET_TCP_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "pwd.h" "ac_cv_header_pwd_h" "$ac_includes_default" +if test "x$ac_cv_header_pwd_h" = xyes +then : + printf "%s\n" "#define HAVE_PWD_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "termios.h" "ac_cv_header_termios_h" "$ac_includes_default" +if test "x$ac_cv_header_termios_h" = xyes +then : + printf "%s\n" "#define HAVE_TERMIOS_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "stdatomic.h" "ac_cv_header_stdatomic_h" "$ac_includes_default" +if test "x$ac_cv_header_stdatomic_h" = xyes +then : + printf "%s\n" "#define HAVE_STDATOMIC_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "syslog.h" "ac_cv_header_syslog_h" "$ac_includes_default" +if test "x$ac_cv_header_syslog_h" = xyes +then : + printf "%s\n" "#define HAVE_SYSLOG_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/endian.h" "ac_cv_header_sys_endian_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_endian_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_ENDIAN_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/ioctl.h" "ac_cv_header_sys_ioctl_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_ioctl_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_IOCTL_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/mman.h" "ac_cv_header_sys_mman_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_mman_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_MMAN_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/prctl.h" "ac_cv_header_sys_prctl_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_prctl_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_PRCTL_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/procctl.h" "ac_cv_header_sys_procctl_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_procctl_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_PROCCTL_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/socket.h" "ac_cv_header_sys_socket_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_socket_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_SOCKET_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/statvfs.h" "ac_cv_header_sys_statvfs_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_statvfs_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_STATVFS_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/ucred.h" "ac_cv_header_sys_ucred_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_ucred_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_UCRED_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/un.h" "ac_cv_header_sys_un_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_un_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_UN_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/vsock.h" "ac_cv_header_sys_vsock_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_vsock_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_VSOCK_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/wait.h" "ac_cv_header_sys_wait_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_wait_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_WAIT_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "winsock2.h" "ac_cv_header_winsock2_h" "$ac_includes_default" +if test "x$ac_cv_header_winsock2_h" = xyes +then : + printf "%s\n" "#define HAVE_WINSOCK2_H 1" >>confdefs.h + +fi + + +ac_fn_c_check_header_compile "$LINENO" "linux/vm_sockets.h" "ac_cv_header_linux_vm_sockets_h" "#include +" +if test "x$ac_cv_header_linux_vm_sockets_h" = xyes +then : + printf "%s\n" "#define HAVE_LINUX_VM_SOCKETS_H 1" >>confdefs.h + +fi + + +ac_fn_c_check_func "$LINENO" "accept4" "ac_cv_func_accept4" +if test "x$ac_cv_func_accept4" = xyes +then : + printf "%s\n" "#define HAVE_ACCEPT4 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "fdatasync" "ac_cv_func_fdatasync" +if test "x$ac_cv_func_fdatasync" = xyes +then : + printf "%s\n" "#define HAVE_FDATASYNC 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "flockfile" "ac_cv_func_flockfile" +if test "x$ac_cv_func_flockfile" = xyes +then : + printf "%s\n" "#define HAVE_FLOCKFILE 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "funlockfile" "ac_cv_func_funlockfile" +if test "x$ac_cv_func_funlockfile" = xyes +then : + printf "%s\n" "#define HAVE_FUNLOCKFILE 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "inet_ntop" "ac_cv_func_inet_ntop" +if test "x$ac_cv_func_inet_ntop" = xyes +then : + printf "%s\n" "#define HAVE_INET_NTOP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "inet_pton" "ac_cv_func_inet_pton" +if test "x$ac_cv_func_inet_pton" = xyes +then : + printf "%s\n" "#define HAVE_INET_PTON 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "mkostemp" "ac_cv_func_mkostemp" +if test "x$ac_cv_func_mkostemp" = xyes +then : + printf "%s\n" "#define HAVE_MKOSTEMP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "mlock" "ac_cv_func_mlock" +if test "x$ac_cv_func_mlock" = xyes +then : + printf "%s\n" "#define HAVE_MLOCK 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "mlockall" "ac_cv_func_mlockall" +if test "x$ac_cv_func_mlockall" = xyes +then : + printf "%s\n" "#define HAVE_MLOCKALL 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "munlock" "ac_cv_func_munlock" +if test "x$ac_cv_func_munlock" = xyes +then : + printf "%s\n" "#define HAVE_MUNLOCK 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "open_memstream" "ac_cv_func_open_memstream" +if test "x$ac_cv_func_open_memstream" = xyes +then : + printf "%s\n" "#define HAVE_OPEN_MEMSTREAM 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "pipe" "ac_cv_func_pipe" +if test "x$ac_cv_func_pipe" = xyes +then : + printf "%s\n" "#define HAVE_PIPE 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "pipe2" "ac_cv_func_pipe2" +if test "x$ac_cv_func_pipe2" = xyes +then : + printf "%s\n" "#define HAVE_PIPE2 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "ppoll" "ac_cv_func_ppoll" +if test "x$ac_cv_func_ppoll" = xyes +then : + printf "%s\n" "#define HAVE_PPOLL 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "posix_fadvise" "ac_cv_func_posix_fadvise" +if test "x$ac_cv_func_posix_fadvise" = xyes +then : + printf "%s\n" "#define HAVE_POSIX_FADVISE 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "posix_memalign" "ac_cv_func_posix_memalign" +if test "x$ac_cv_func_posix_memalign" = xyes +then : + printf "%s\n" "#define HAVE_POSIX_MEMALIGN 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "valloc" "ac_cv_func_valloc" +if test "x$ac_cv_func_valloc" = xyes +then : + printf "%s\n" "#define HAVE_VALLOC 1" >>confdefs.h + +fi + + +ac_fn_c_check_member "$LINENO" "struct dirent" "d_type" "ac_cv_member_struct_dirent_d_type" "#include +" +if test "x$ac_cv_member_struct_dirent_d_type" = xyes +then : + +printf "%s\n" "#define HAVE_STRUCT_DIRENT_D_TYPE 1" >>confdefs.h + + +fi + +ac_fn_c_check_member "$LINENO" "struct ucred" "uid" "ac_cv_member_struct_ucred_uid" " +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_SYS_UCRED_H +#include +#endif + +" +if test "x$ac_cv_member_struct_ucred_uid" = xyes +then : + +printf "%s\n" "#define HAVE_STRUCT_UCRED_UID 1" >>confdefs.h + + +fi + +ac_fn_c_check_member "$LINENO" "struct sockpeercred" "uid" "ac_cv_member_struct_sockpeercred_uid" " +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +" +if test "x$ac_cv_member_struct_sockpeercred_uid" = xyes +then : + +printf "%s\n" "#define HAVE_STRUCT_SOCKPEERCRED_UID 1" >>confdefs.h + + +fi + + + +ac_fn_c_check_func "$LINENO" "fdatasync" "ac_cv_func_fdatasync" +if test "x$ac_cv_func_fdatasync" = xyes +then : + printf "%s\n" "#define HAVE_FDATASYNC 1" >>confdefs.h + +else $as_nop + case " $LIBOBJS " in + *" fdatasync.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS fdatasync.$ac_objext" + ;; +esac + +fi +ac_fn_c_check_func "$LINENO" "fsync" "ac_cv_func_fsync" +if test "x$ac_cv_func_fsync" = xyes +then : + printf "%s\n" "#define HAVE_FSYNC 1" >>confdefs.h + +else $as_nop + case " $LIBOBJS " in + *" fsync.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS fsync.$ac_objext" + ;; +esac + +fi +ac_fn_c_check_func "$LINENO" "get_current_dir_name" "ac_cv_func_get_current_dir_name" +if test "x$ac_cv_func_get_current_dir_name" = xyes +then : + printf "%s\n" "#define HAVE_GET_CURRENT_DIR_NAME 1" >>confdefs.h + +else $as_nop + case " $LIBOBJS " in + *" get_current_dir_name.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS get_current_dir_name.$ac_objext" + ;; +esac + +fi +ac_fn_c_check_func "$LINENO" "getdelim" "ac_cv_func_getdelim" +if test "x$ac_cv_func_getdelim" = xyes +then : + printf "%s\n" "#define HAVE_GETDELIM 1" >>confdefs.h + +else $as_nop + case " $LIBOBJS " in + *" getdelim.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS getdelim.$ac_objext" + ;; +esac + +fi +ac_fn_c_check_func "$LINENO" "getline" "ac_cv_func_getline" +if test "x$ac_cv_func_getline" = xyes +then : + printf "%s\n" "#define HAVE_GETLINE 1" >>confdefs.h + +else $as_nop + case " $LIBOBJS " in + *" getline.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS getline.$ac_objext" + ;; +esac + +fi +ac_fn_c_check_func "$LINENO" "openlog" "ac_cv_func_openlog" +if test "x$ac_cv_func_openlog" = xyes +then : + printf "%s\n" "#define HAVE_OPENLOG 1" >>confdefs.h + +else $as_nop + case " $LIBOBJS " in + *" openlog.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS openlog.$ac_objext" + ;; +esac + +fi +ac_fn_c_check_func "$LINENO" "open_memstream" "ac_cv_func_open_memstream" +if test "x$ac_cv_func_open_memstream" = xyes +then : + printf "%s\n" "#define HAVE_OPEN_MEMSTREAM 1" >>confdefs.h + +else $as_nop + case " $LIBOBJS " in + *" open_memstream.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS open_memstream.$ac_objext" + ;; +esac + +fi +ac_fn_c_check_func "$LINENO" "poll" "ac_cv_func_poll" +if test "x$ac_cv_func_poll" = xyes +then : + printf "%s\n" "#define HAVE_POLL 1" >>confdefs.h + +else $as_nop + case " $LIBOBJS " in + *" poll.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS poll.$ac_objext" + ;; +esac + +fi +ac_fn_c_check_func "$LINENO" "posix_memalign" "ac_cv_func_posix_memalign" +if test "x$ac_cv_func_posix_memalign" = xyes +then : + printf "%s\n" "#define HAVE_POSIX_MEMALIGN 1" >>confdefs.h + +else $as_nop + case " $LIBOBJS " in + *" posix_memalign.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS posix_memalign.$ac_objext" + ;; +esac + +fi +ac_fn_c_check_func "$LINENO" "pread" "ac_cv_func_pread" +if test "x$ac_cv_func_pread" = xyes +then : + printf "%s\n" "#define HAVE_PREAD 1" >>confdefs.h + +else $as_nop + case " $LIBOBJS " in + *" pread.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS pread.$ac_objext" + ;; +esac + +fi +ac_fn_c_check_func "$LINENO" "pwrite" "ac_cv_func_pwrite" +if test "x$ac_cv_func_pwrite" = xyes +then : + printf "%s\n" "#define HAVE_PWRITE 1" >>confdefs.h + +else $as_nop + case " $LIBOBJS " in + *" pwrite.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS pwrite.$ac_objext" + ;; +esac + +fi +ac_fn_c_check_func "$LINENO" "realpath" "ac_cv_func_realpath" +if test "x$ac_cv_func_realpath" = xyes +then : + printf "%s\n" "#define HAVE_REALPATH 1" >>confdefs.h + +else $as_nop + case " $LIBOBJS " in + *" realpath.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS realpath.$ac_objext" + ;; +esac + +fi +ac_fn_c_check_func "$LINENO" "strndup" "ac_cv_func_strndup" +if test "x$ac_cv_func_strndup" = xyes +then : + printf "%s\n" "#define HAVE_STRNDUP 1" >>confdefs.h + +else $as_nop + case " $LIBOBJS " in + *" strndup.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS strndup.$ac_objext" + ;; +esac + +fi +ac_fn_c_check_func "$LINENO" "sysconf" "ac_cv_func_sysconf" +if test "x$ac_cv_func_sysconf" = xyes +then : + printf "%s\n" "#define HAVE_SYSCONF 1" >>confdefs.h + +else $as_nop + case " $LIBOBJS " in + *" sysconf.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS sysconf.$ac_objext" + ;; +esac + +fi +ac_fn_c_check_func "$LINENO" "syslog" "ac_cv_func_syslog" +if test "x$ac_cv_func_syslog" = xyes +then : + printf "%s\n" "#define HAVE_SYSLOG 1" >>confdefs.h + +else $as_nop + case " $LIBOBJS " in + *" syslog.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS syslog.$ac_objext" + ;; +esac + +fi +ac_fn_c_check_func "$LINENO" "vsyslog" "ac_cv_func_vsyslog" +if test "x$ac_cv_func_vsyslog" = xyes +then : + printf "%s\n" "#define HAVE_VSYSLOG 1" >>confdefs.h + +else $as_nop + case " $LIBOBJS " in + *" vsyslog.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS vsyslog.$ac_objext" + ;; +esac + +fi + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the printf family supports %m" >&5 +printf %s "checking whether the printf family supports %m... " >&6; } +if test ${nbdkit_cv_func_printf_percent_m+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + + case "$host_os" in + *-gnu* | gnu*) nbdkit_cv_func_printf_percent_m=yes;; + *) nbdkit_cv_func_printf_percent_m="guessing no";; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#include + +int +main (void) +{ + + char buf[200] = ""; + errno = EINVAL; + snprintf(buf, sizeof buf, "%m"); + return !!strcmp (buf, strerror (EINVAL)); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + nbdkit_cv_func_printf_percent_m=yes +else $as_nop + nbdkit_cv_func_printf_percent_m=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $nbdkit_cv_func_printf_percent_m" >&5 +printf "%s\n" "$nbdkit_cv_func_printf_percent_m" >&6; } +if test "x$nbdkit_cv_func_printf_percent_m" = xyes +then : + +printf "%s\n" "#define HAVE_VFPRINTF_PERCENT_M 1" >>confdefs.h + +fi + +old_LIBS="$LIBS" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing dlsym" >&5 +printf %s "checking for library containing dlsym... " >&6; } +if test ${ac_cv_search_dlsym+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* 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. */ +char dlsym (); +int +main (void) +{ +return dlsym (); + ; + return 0; +} +_ACEOF +for ac_lib in '' dl dld +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 + if ac_fn_c_try_link "$LINENO" +then : + ac_cv_search_dlsym=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext + if test ${ac_cv_search_dlsym+y} +then : + break +fi +done +if test ${ac_cv_search_dlsym+y} +then : + +else $as_nop + ac_cv_search_dlsym=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlsym" >&5 +printf "%s\n" "$ac_cv_search_dlsym" >&6; } +ac_res=$ac_cv_search_dlsym +if test "$ac_res" != no +then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + + if test "x$ac_cv_search_dlsym" != "xnone required" +then : + DL_LIBS="$ac_cv_search_dlsym" +else $as_nop + DL_LIBS= +fi + + +else $as_nop + as_fn_error $? "unable to find the dlsym() function" "$LINENO" 5 + +fi + +LIBS="$old_LIBS" + + +# Check whether --with-iconv was given. +if test ${with_iconv+y} +then : + withval=$with_iconv; +else $as_nop + with_iconv=check +fi + +if test "x$with_iconv" != "xno" +then : + + ac_fn_c_check_header_compile "$LINENO" "iconv.h" "ac_cv_header_iconv_h" "$ac_includes_default" +if test "x$ac_cv_header_iconv_h" = xyes +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if can be used to link a program" >&5 +printf %s "checking if can be used to link a program... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include +#include +#include +int +main (int argc, char *argv[]) +{ + iconv_t ic = iconv_open ("", ""); + iconv_close (ic); + exit (0); +} + + +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + iconv_working=yes + +else $as_nop + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + +fi + + +fi + if test "x$iconv_working" = "xyes"; then + HAVE_ICONV_TRUE= + HAVE_ICONV_FALSE='#' +else + HAVE_ICONV_TRUE='#' + HAVE_ICONV_FALSE= +fi + + +use_linker_script=yes + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we should disable the linker script (FreeBSD, macOS)" >&5 +printf %s "checking if we should disable the linker script (FreeBSD, macOS)... " >&6; } +case $host_os in #( + freebsd*|darwin*) : + + use_linker_script=no + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + ;; #( + *) : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac + +acx_nbdkit_save_LDFLAGS="${LDFLAGS}" +LDFLAGS="${LDFLAGS} -rdynamic" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if linker supports -rdynamic" >&5 +printf %s "checking if linker supports -rdynamic... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include +int +main (int argc, char *argv[]) +{ + exit (EXIT_SUCCESS); +} + + +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + DL_LDFLAGS=-rdynamic + +else $as_nop + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LDFLAGS="${acx_nbdkit_save_LDFLAGS}" + + +old_LIBS="$LIBS" +LIBS="$DL_LIBS $LIBS" +ac_fn_c_check_func "$LINENO" "dladdr" "ac_cv_func_dladdr" +if test "x$ac_cv_func_dladdr" = xyes +then : + printf "%s\n" "#define HAVE_DLADDR 1" >>confdefs.h + +fi + +LIBS="$old_LIBS" + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the target is Windows" >&5 +printf %s "checking if the target is Windows... " >&6; } +case $host_os in #( + mingw*|msys*) : + + is_windows=yes + LIBS="$LIBS -lkernel32 -luser32 -lws2_32" + NO_UNDEFINED_ON_WINDOWS="-no-undefined" + IMPORT_LIBRARY_ON_WINDOWS='-Wl,-L$(top_builddir)/server -Wl,-lnbdkit' + SOEXT="dll" + DIR_SEPARATOR_STR='\\' + ;; #( + *) : + is_windows=no + SOEXT="so" + DIR_SEPARATOR_STR=/ + ;; +esac +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $is_windows" >&5 +printf "%s\n" "$is_windows" >&6; } + + + + +printf "%s\n" "#define SOEXT \"$SOEXT\"" >>confdefs.h + + +printf "%s\n" "#define EXEEXT \"$EXEEXT\"" >>confdefs.h + + +printf "%s\n" "#define DIR_SEPARATOR_STR \"$DIR_SEPARATOR_STR\"" >>confdefs.h + + if test "x$is_windows" = "xyes"; then + IS_WINDOWS_TRUE= + IS_WINDOWS_FALSE='#' +else + IS_WINDOWS_TRUE='#' + IS_WINDOWS_FALSE= +fi + + +if test "x$is_windows" = "xyes" +then : + + if test -n "$ac_tool_prefix"; then + for ac_prog in windmc mc + 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_MC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$MC"; then + ac_cv_prog_MC="$MC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_MC="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +MC=$ac_cv_prog_MC +if test -n "$MC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MC" >&5 +printf "%s\n" "$MC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$MC" && break + done +fi +if test -z "$MC"; then + ac_ct_MC=$MC + for ac_prog in windmc mc +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_MC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_MC"; then + ac_cv_prog_ac_ct_MC="$ac_ct_MC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_MC="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_MC=$ac_cv_prog_ac_ct_MC +if test -n "$ac_ct_MC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MC" >&5 +printf "%s\n" "$ac_ct_MC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$ac_ct_MC" && break +done + + if test "x$ac_ct_MC" = x; then + MC="no" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + MC=$ac_ct_MC + fi +fi + + if test "x$MC" = "xno" +then : + as_fn_error $? "mc/windmc utility must be available when compiling for Windows" "$LINENO" 5 +fi + + if test -n "$ac_tool_prefix"; then + for ac_prog in dlltool + 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_DLLTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_DLLTOOL="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +printf "%s\n" "$DLLTOOL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$DLLTOOL" && break + done +fi +if test -z "$DLLTOOL"; then + ac_ct_DLLTOOL=$DLLTOOL + for ac_prog in dlltool +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_DLLTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DLLTOOL="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +printf "%s\n" "$ac_ct_DLLTOOL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$ac_ct_DLLTOOL" && break +done + + if test "x$ac_ct_DLLTOOL" = x; then + DLLTOOL="no" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DLLTOOL=$ac_ct_DLLTOOL + fi +fi + + if test "x$DLLTOOL" = "xno" +then : + as_fn_error $? "dlltool utility must be available when compiling for Windows" "$LINENO" 5 +fi + +fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing getaddrinfo" >&5 +printf %s "checking for library containing getaddrinfo... " >&6; } +if test ${ac_cv_search_getaddrinfo+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* 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. */ +char getaddrinfo (); +int +main (void) +{ +return getaddrinfo (); + ; + return 0; +} +_ACEOF +for ac_lib in '' network socket +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 + if ac_fn_c_try_link "$LINENO" +then : + ac_cv_search_getaddrinfo=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext + if test ${ac_cv_search_getaddrinfo+y} +then : + break +fi +done +if test ${ac_cv_search_getaddrinfo+y} +then : + +else $as_nop + ac_cv_search_getaddrinfo=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_getaddrinfo" >&5 +printf "%s\n" "$ac_cv_search_getaddrinfo" >&6; } +ac_res=$ac_cv_search_getaddrinfo +if test "$ac_res" != no +then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if this is glibc >= 2.34" >&5 +printf %s "checking if this is glibc >= 2.34... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#if !defined(__GLIBC__) || __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 34) +#error "not glibc 2.34" +#endif + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + is_glibc_234=yes +else $as_nop + is_glibc_234=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $is_glibc_234" >&5 +printf "%s\n" "$is_glibc_234" >&6; } + if test "x$is_glibc_234" = "xyes"; then + HAVE_GLIBC_234_TRUE= + HAVE_GLIBC_234_FALSE='#' +else + HAVE_GLIBC_234_TRUE='#' + HAVE_GLIBC_234_FALSE= +fi + + + +# Check whether --with-selinux was given. +if test ${with_selinux+y} +then : + withval=$with_selinux; +fi + + + + + + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_PKG_CONFIG+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +printf "%s\n" "$PKG_CONFIG" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_ac_pt_PKG_CONFIG+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +printf "%s\n" "$ac_pt_PKG_CONFIG" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +printf %s "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + PKG_CONFIG="" + fi +fi +if test "x$with_selinux" != xno +then : + + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libselinux" >&5 +printf %s "checking for libselinux... " >&6; } + +if test -n "$LIBSELINUX_CFLAGS"; then + pkg_cv_LIBSELINUX_CFLAGS="$LIBSELINUX_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libselinux\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libselinux") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBSELINUX_CFLAGS=`$PKG_CONFIG --cflags "libselinux" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBSELINUX_LIBS"; then + pkg_cv_LIBSELINUX_LIBS="$LIBSELINUX_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libselinux\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libselinux") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBSELINUX_LIBS=`$PKG_CONFIG --libs "libselinux" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBSELINUX_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libselinux" 2>&1` + else + LIBSELINUX_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libselinux" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBSELINUX_PKG_ERRORS" >&5 + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: libselinux not found, sockets will not be labeled." >&5 +printf "%s\n" "$as_me: WARNING: libselinux not found, sockets will not be labeled." >&2;} +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: libselinux not found, sockets will not be labeled." >&5 +printf "%s\n" "$as_me: WARNING: libselinux not found, sockets will not be labeled." >&2;} +else + LIBSELINUX_CFLAGS=$pkg_cv_LIBSELINUX_CFLAGS + LIBSELINUX_LIBS=$pkg_cv_LIBSELINUX_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + + + + +printf "%s\n" "#define HAVE_LIBSELINUX 1" >>confdefs.h + + +fi + +fi + +if test "x$with_selinux" = xyes && test "x$LIBSELINUX_LIBS" = x +then : + + as_fn_error $? "selinux requested but not found" "$LINENO" 5 + +fi + + +# Check whether --with-gnutls was given. +if test ${with_gnutls+y} +then : + withval=$with_gnutls; +fi + + +if test "x$with_gnutls" != xno +then : + + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gnutls >= 3.3.0" >&5 +printf %s "checking for gnutls >= 3.3.0... " >&6; } + +if test -n "$GNUTLS_CFLAGS"; then + pkg_cv_GNUTLS_CFLAGS="$GNUTLS_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gnutls >= 3.3.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gnutls >= 3.3.0") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GNUTLS_CFLAGS=`$PKG_CONFIG --cflags "gnutls >= 3.3.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$GNUTLS_LIBS"; then + pkg_cv_GNUTLS_LIBS="$GNUTLS_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gnutls >= 3.3.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gnutls >= 3.3.0") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GNUTLS_LIBS=`$PKG_CONFIG --libs "gnutls >= 3.3.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + GNUTLS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gnutls >= 3.3.0" 2>&1` + else + GNUTLS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gnutls >= 3.3.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$GNUTLS_PKG_ERRORS" >&5 + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: gnutls not found or < 3.3.0, TLS support will be disabled." >&5 +printf "%s\n" "$as_me: WARNING: gnutls not found or < 3.3.0, TLS support will be disabled." >&2;} + +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: gnutls not found or < 3.3.0, TLS support will be disabled." >&5 +printf "%s\n" "$as_me: WARNING: gnutls not found or < 3.3.0, TLS support will be disabled." >&2;} + +else + GNUTLS_CFLAGS=$pkg_cv_GNUTLS_CFLAGS + GNUTLS_LIBS=$pkg_cv_GNUTLS_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + + + + +printf "%s\n" "#define HAVE_GNUTLS 1" >>confdefs.h + + +fi + +fi + +if test "x$with_gnutls" = xyes && test x"$GNUTLS_LIBS" = x +then : + + as_fn_error $? "gnutls requested but not found" "$LINENO" 5 + +fi + + if test "x$GNUTLS_LIBS" != "x"; then + HAVE_GNUTLS_TRUE= + HAVE_GNUTLS_FALSE='#' +else + HAVE_GNUTLS_TRUE='#' + HAVE_GNUTLS_FALSE= +fi + + +if test "x$GNUTLS_LIBS" != "x" +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for default TLS session priority string" >&5 +printf %s "checking for default TLS session priority string... " >&6; } + +# Check whether --with-tls-priority was given. +if test ${with_tls_priority+y} +then : + withval=$with_tls_priority; tls_priority=$withval +else $as_nop + tls_priority=NORMAL +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tls_priority" >&5 +printf "%s\n" "$tls_priority" >&6; } + +printf "%s\n" "#define TLS_PRIORITY \"$tls_priority\"" >>confdefs.h + + + # Check for APIs which may not be present. + old_LIBS="$LIBS" + LIBS="$GNUTLS_LIBS $LIBS" + ac_fn_c_check_func "$LINENO" "gnutls_base64_decode2" "ac_cv_func_gnutls_base64_decode2" +if test "x$ac_cv_func_gnutls_base64_decode2" = xyes +then : + printf "%s\n" "#define HAVE_GNUTLS_BASE64_DECODE2 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "gnutls_certificate_set_known_dh_params" "ac_cv_func_gnutls_certificate_set_known_dh_params" +if test "x$ac_cv_func_gnutls_certificate_set_known_dh_params" = xyes +then : + printf "%s\n" "#define HAVE_GNUTLS_CERTIFICATE_SET_KNOWN_DH_PARAMS 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "gnutls_group_get" "ac_cv_func_gnutls_group_get" +if test "x$ac_cv_func_gnutls_group_get" = xyes +then : + printf "%s\n" "#define HAVE_GNUTLS_GROUP_GET 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "gnutls_group_get_name" "ac_cv_func_gnutls_group_get_name" +if test "x$ac_cv_func_gnutls_group_get_name" = xyes +then : + printf "%s\n" "#define HAVE_GNUTLS_GROUP_GET_NAME 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "gnutls_pbkdf2" "ac_cv_func_gnutls_pbkdf2" +if test "x$ac_cv_func_gnutls_pbkdf2" = xyes +then : + printf "%s\n" "#define HAVE_GNUTLS_PBKDF2 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "gnutls_session_set_verify_cert" "ac_cv_func_gnutls_session_set_verify_cert" +if test "x$ac_cv_func_gnutls_session_set_verify_cert" = xyes +then : + printf "%s\n" "#define HAVE_GNUTLS_SESSION_SET_VERIFY_CERT 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "gnutls_srp_server_get_username" "ac_cv_func_gnutls_srp_server_get_username" +if test "x$ac_cv_func_gnutls_srp_server_get_username" = xyes +then : + printf "%s\n" "#define HAVE_GNUTLS_SRP_SERVER_GET_USERNAME 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "gnutls_transport_is_ktls_enabled" "ac_cv_func_gnutls_transport_is_ktls_enabled" +if test "x$ac_cv_func_gnutls_transport_is_ktls_enabled" = xyes +then : + printf "%s\n" "#define HAVE_GNUTLS_TRANSPORT_IS_KTLS_ENABLED 1" >>confdefs.h + +fi + + ac_fn_c_check_header_compile "$LINENO" "gnutls/socket.h" "ac_cv_header_gnutls_socket_h" "$ac_includes_default" +if test "x$ac_cv_header_gnutls_socket_h" = xyes +then : + printf "%s\n" "#define HAVE_GNUTLS_SOCKET_H 1" >>confdefs.h + +fi + + LIBS="$old_LIBS" + + for ac_prog in gnutls-certtool certtool +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CERTTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CERTTOOL"; then + ac_cv_prog_CERTTOOL="$CERTTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CERTTOOL="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CERTTOOL=$ac_cv_prog_CERTTOOL +if test -n "$CERTTOOL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CERTTOOL" >&5 +printf "%s\n" "$CERTTOOL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$CERTTOOL" && break +done +test -n "$CERTTOOL" || CERTTOOL="certtool" + + +fi + if test "x$GNUTLS_LIBS" != "x" && test "x$ac_cv_func_gnutls_pbkdf2" = xyes; then + HAVE_GNUTLS_PBKDF2_TRUE= + HAVE_GNUTLS_PBKDF2_FALSE='#' +else + HAVE_GNUTLS_PBKDF2_TRUE='#' + HAVE_GNUTLS_PBKDF2_FALSE= +fi + + +for ac_prog in gnucut cut +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CUT+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CUT"; then + ac_cv_prog_CUT="$CUT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CUT="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CUT=$ac_cv_prog_CUT +if test -n "$CUT"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CUT" >&5 +printf "%s\n" "$CUT" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$CUT" && break +done +test -n "$CUT" || CUT="cut" + +for ac_prog in gstat stat +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_STAT+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$STAT"; then + ac_cv_prog_STAT="$STAT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_STAT="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STAT=$ac_cv_prog_STAT +if test -n "$STAT"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STAT" >&5 +printf "%s\n" "$STAT" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$STAT" && break +done +test -n "$STAT" || STAT="stat" + +for ac_prog in gtruncate truncate +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_TRUNCATE+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$TRUNCATE"; then + ac_cv_prog_TRUNCATE="$TRUNCATE" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_TRUNCATE="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +TRUNCATE=$ac_cv_prog_TRUNCATE +if test -n "$TRUNCATE"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $TRUNCATE" >&5 +printf "%s\n" "$TRUNCATE" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$TRUNCATE" && break +done +test -n "$TRUNCATE" || TRUNCATE="truncate" + + +# Check whether --enable-linuxdisk was given. +if test ${enable_linuxdisk+y} +then : + enableval=$enable_linuxdisk; +else $as_nop + enable_linuxdisk=check +fi + +mke2fs_with_d=no +if test "$enable_linuxdisk" != "no" +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for mke2fs supporting the -d option" >&5 +printf %s "checking for mke2fs supporting the -d option... " >&6; } + if mke2fs -V >/dev/null 2>&1 +then : + + if LANG=C mke2fs -d 2>&1 | grep -sq "option requires an argument" +then : + + mke2fs_with_d=yes + +fi + +fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $mke2fs_with_d" >&5 +printf "%s\n" "$mke2fs_with_d" >&6; } + +fi + if test "x$mke2fs_with_d" = "xyes"; then + HAVE_MKE2FS_WITH_D_TRUE= + HAVE_MKE2FS_WITH_D_FALSE='#' +else + HAVE_MKE2FS_WITH_D_TRUE='#' + HAVE_MKE2FS_WITH_D_FALSE= +fi + + +# Extract the first word of "valgrind", so it can be a program name with args. +set dummy valgrind; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_VALGRIND+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$VALGRIND"; then + ac_cv_prog_VALGRIND="$VALGRIND" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_VALGRIND="valgrind" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_VALGRIND" && ac_cv_prog_VALGRIND="no" +fi +fi +VALGRIND=$ac_cv_prog_VALGRIND +if test -n "$VALGRIND"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $VALGRIND" >&5 +printf "%s\n" "$VALGRIND" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + +# Check whether --enable-valgrind was given. +if test ${enable_valgrind+y} +then : + enableval=$enable_valgrind; +else $as_nop + enable_valgrind=check +fi + +if test "x$enable_valgrind" != "xno" +then : + + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for valgrind" >&5 +printf %s "checking for valgrind... " >&6; } + +if test -n "$VALGRIND_CFLAGS"; then + pkg_cv_VALGRIND_CFLAGS="$VALGRIND_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"valgrind\""; } >&5 + ($PKG_CONFIG --exists --print-errors "valgrind") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_VALGRIND_CFLAGS=`$PKG_CONFIG --cflags "valgrind" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$VALGRIND_LIBS"; then + pkg_cv_VALGRIND_LIBS="$VALGRIND_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"valgrind\""; } >&5 + ($PKG_CONFIG --exists --print-errors "valgrind") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_VALGRIND_LIBS=`$PKG_CONFIG --libs "valgrind" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + VALGRIND_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "valgrind" 2>&1` + else + VALGRIND_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "valgrind" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$VALGRIND_PKG_ERRORS" >&5 + + + if test "x$enable_valgrind" = "xyes" +then : + + as_fn_error $? "--enable-valgrind given, but Valgrind headers are not available" "$LINENO" 5 + +fi + +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + + if test "x$enable_valgrind" = "xyes" +then : + + as_fn_error $? "--enable-valgrind given, but Valgrind headers are not available" "$LINENO" 5 + +fi + +else + VALGRIND_CFLAGS=$pkg_cv_VALGRIND_CFLAGS + VALGRIND_LIBS=$pkg_cv_VALGRIND_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + + + + +printf "%s\n" "#define HAVE_VALGRIND 1" >>confdefs.h + + +fi + +fi + +# Check whether --enable-libfuzzer was given. +if test ${enable_libfuzzer+y} +then : + enableval=$enable_libfuzzer; +else $as_nop + enable_libfuzzer=no +fi + +if test "x$enable_libfuzzer" = "xyes" +then : + + +printf "%s\n" "#define ENABLE_LIBFUZZER 1" >>confdefs.h + + # We have to disable the linker script for libFuzzer because Clang + # adds loads of fuzzer and ASAN-related symbols that are required + # by the plugins but which our linker script tries to hide. + use_linker_script=no + +fi + if test "x$enable_libfuzzer" = "xyes"; then + ENABLE_LIBFUZZER_TRUE= + ENABLE_LIBFUZZER_FALSE='#' +else + ENABLE_LIBFUZZER_TRUE='#' + ENABLE_LIBFUZZER_FALSE= +fi + + +# Check whether --enable-linker-script was given. +if test ${enable_linker_script+y} +then : + enableval=$enable_linker_script; use_linker_script=$enableval +fi + + if test "x$use_linker_script" = "xyes"; then + USE_LINKER_SCRIPT_TRUE= + USE_LINKER_SCRIPT_FALSE='#' +else + USE_LINKER_SCRIPT_TRUE='#' + USE_LINKER_SCRIPT_FALSE= +fi + + + +# Check whether --with-bash-completions was given. +if test ${with_bash_completions+y} +then : + withval=$with_bash_completions; +fi + + +if test "x$with_bash_completions" != xno +then : + + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for bash-completion >= 2.0" >&5 +printf %s "checking for bash-completion >= 2.0... " >&6; } + +if test -n "$BASH_COMPLETION_CFLAGS"; then + pkg_cv_BASH_COMPLETION_CFLAGS="$BASH_COMPLETION_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"bash-completion >= 2.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "bash-completion >= 2.0") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_BASH_COMPLETION_CFLAGS=`$PKG_CONFIG --cflags "bash-completion >= 2.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$BASH_COMPLETION_LIBS"; then + pkg_cv_BASH_COMPLETION_LIBS="$BASH_COMPLETION_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"bash-completion >= 2.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "bash-completion >= 2.0") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_BASH_COMPLETION_LIBS=`$PKG_CONFIG --libs "bash-completion >= 2.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + BASH_COMPLETION_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "bash-completion >= 2.0" 2>&1` + else + BASH_COMPLETION_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "bash-completion >= 2.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$BASH_COMPLETION_PKG_ERRORS" >&5 + + + bash_completion=no + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: bash-completion not installed" >&5 +printf "%s\n" "$as_me: WARNING: bash-completion not installed" >&2;} + +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + + bash_completion=no + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: bash-completion not installed" >&5 +printf "%s\n" "$as_me: WARNING: bash-completion not installed" >&2;} + +else + BASH_COMPLETION_CFLAGS=$pkg_cv_BASH_COMPLETION_CFLAGS + BASH_COMPLETION_LIBS=$pkg_cv_BASH_COMPLETION_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + + bash_completion=yes + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for bash-completions directory" >&5 +printf %s "checking for bash-completions directory... " >&6; } + + +if test -n "$bashcompdir"; then + pkg_cv_bashcompdir="$bashcompdir" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"bash-completion\""; } >&5 + ($PKG_CONFIG --exists --print-errors "bash-completion") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_bashcompdir=`$PKG_CONFIG --variable="completionsdir" "bash-completion" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +bashcompdir=$pkg_cv_bashcompdir + +if test "x$bashcompdir" = x"" +then : + +fi + + if test -z "$bashcompdir" +then : + + bashcompdir="${sysconfdir}/bash_completion.d" + +fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bashcompdir" >&5 +printf "%s\n" "$bashcompdir" >&6; } + + +fi + +fi + +if test "x$bash_completion" = xno && test "x$with_bash_completions" = xyes +then : + + as_fn_error $? "bash-completions requested but required packages not found" "$LINENO" 5 + +fi + + if test "x$bash_completion" = "xyes"; then + HAVE_BASH_COMPLETION_TRUE= + HAVE_BASH_COMPLETION_FALSE='#' +else + HAVE_BASH_COMPLETION_TRUE='#' + HAVE_BASH_COMPLETION_FALSE= +fi + + + + +# Check whether --with-manpages was given. +if test ${with_manpages+y} +then : + withval=$with_manpages; +else $as_nop + : +fi + + +enable_pod=no +for ac_prog in perl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_PERL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$PERL"; then + ac_cv_prog_PERL="$PERL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_PERL="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +PERL=$ac_cv_prog_PERL +if test -n "$PERL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5 +printf "%s\n" "$PERL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$PERL" && break +done + + +if test "x$with_manpages" != xno +then : + + if test "x$PERL" != "x" +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we have perl Pod::Man and Pod::Simple" >&5 +printf %s "checking if we have perl Pod::Man and Pod::Simple... " >&6; } + if $PERL -MPod::Man -MPod::Simple -e 1 >&5 2>&1 +then : + + enable_pod=yes + +fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_pod" >&5 +printf "%s\n" "$enable_pod" >&6; } + +fi + +fi + +if test "x$enable_pod" = xno && test "x$with_manpages" = xyes +then : + + as_fn_error $? "man-pages requested but required packages not found" "$LINENO" 5 + +fi + + if test "x$PERL" != "xno" && test "x$enable_pod" = "xyes"; then + HAVE_POD_TRUE= + HAVE_POD_FALSE='#' +else + HAVE_POD_TRUE='#' + HAVE_POD_FALSE= +fi + + +PODWRAPPER="$PERL $(pwd)/podwrapper.pl" + + +# Check whether --enable-plugins was given. +if test ${enable_plugins+y} +then : + enableval=$enable_plugins; +fi + + if test "x$enable_plugins" != "xno"; then + HAVE_PLUGINS_TRUE= + HAVE_PLUGINS_FALSE='#' +else + HAVE_PLUGINS_TRUE='#' + HAVE_PLUGINS_FALSE= +fi + + + +: "${CC_PLUGIN_CC:=$CC}" + +: "${CC_PLUGIN_CFLAGS:=$CFLAGS}" + +# Check whether --enable-perl was given. +if test ${enable_perl+y} +then : + enableval=$enable_perl; +else $as_nop + enable_perl=yes +fi + +if test "x$PERL" != "xno" && test "x$enable_perl" != "xno" +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Perl embed archlib" >&5 +printf %s "checking for Perl embed archlib... " >&6; } + PERL_ARCHLIB="$($PERL -MConfig -e 'print $Config{archlib}')" + if test -n "$PERL_ARCHLIB" +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PERL_ARCHLIB" >&5 +printf "%s\n" "$PERL_ARCHLIB" >&6; } + +else $as_nop + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Perl embed module disabled" >&5 +printf "%s\n" "$as_me: Perl embed module disabled" >&6;} + enable_perl=no + +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Perl embed CFLAGS" >&5 +printf %s "checking for Perl embed CFLAGS... " >&6; } + PERL_CFLAGS="$($PERL -MExtUtils::Embed -e 'ccflags')" + if test -n "$PERL_CFLAGS" +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PERL_CFLAGS" >&5 +printf "%s\n" "$PERL_CFLAGS" >&6; } + +else $as_nop + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Perl embed module disabled" >&5 +printf "%s\n" "$as_me: Perl embed module disabled" >&6;} + enable_perl=no + +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Perl embed LDOPTS" >&5 +printf %s "checking for Perl embed LDOPTS... " >&6; } + PERL_LDOPTS="$($PERL -MExtUtils::Embed -e 'ldopts')" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PERL_LDOPTS" >&5 +printf "%s\n" "$PERL_LDOPTS" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether Perl modules will compile" >&5 +printf %s "checking whether Perl modules will compile... " >&6; } + old_CFLAGS="$CFLAGS" + old_LIBS="$LIBS" + CFLAGS="$PERL_CFLAGS -I$PERL_ARCHLIB/CORE $CFLAGS" + LIBS="$PERL_LDOPTS $LIBS" + ac_fn_c_check_func "$LINENO" "perl_alloc" "ac_cv_func_perl_alloc" +if test "x$ac_cv_func_perl_alloc" = xyes +then : + printf "%s\n" "#define HAVE_PERL_ALLOC 1" >>confdefs.h + +fi + + CFLAGS="$old_CFLAGS" + LIBS="$old_LIBS" + if test "x$ac_cv_func_perl_alloc" != xyes; then + enable_perl=no + fi + +fi + if test "x$enable_perl" != "xno" && test "x$PERL" != "xno"; then + HAVE_PERL_TRUE= + HAVE_PERL_FALSE='#' +else + HAVE_PERL_TRUE='#' + HAVE_PERL_FALSE= +fi + + + + + +for ac_prog in python3 python +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_PYTHON+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $PYTHON in + [\\/]* | ?:[\\/]*) + ac_cv_path_PYTHON="$PYTHON" # 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_PYTHON="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PYTHON=$ac_cv_path_PYTHON +if test -n "$PYTHON"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5 +printf "%s\n" "$PYTHON" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$PYTHON" && break +done +test -n "$PYTHON" || PYTHON="no" + +# Check whether --enable-python was given. +if test ${enable_python+y} +then : + enableval=$enable_python; +else $as_nop + enable_python=yes +fi + +if test "x$PYTHON" != "xno" && test "x$enable_python" != "xno" +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking version of $PYTHON" >&5 +printf %s "checking version of $PYTHON... " >&6; } + PYTHON_VERSION_MAJOR=`$PYTHON -c "import sys; print (sys.version_info[0])"` + PYTHON_VERSION_MINOR=`$PYTHON -c "import sys; print (sys.version_info[1])"` + PYTHON_VERSION="$PYTHON_VERSION_MAJOR.$PYTHON_VERSION_MINOR" + if test -n "$PYTHON_VERSION" +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PYTHON_VERSION" >&5 +printf "%s\n" "$PYTHON_VERSION" >&6; } + +else $as_nop + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Python embed module disabled" >&5 +printf "%s\n" "$as_me: Python embed module disabled" >&6;} + enable_python=no + +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking Python major version is 3" >&5 +printf %s "checking Python major version is 3... " >&6; } + if test "x$PYTHON_VERSION_MAJOR" = "x3" +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else $as_nop + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + as_fn_error $? "Python $PYTHON_VERSION_MAJOR <> 3 is no longer supported. + +Python 2 end of life is 2020-01-01 and nbdkit >= 1.16 no longer +supports it. + +If you want to use Python 2, you will need to use nbdkit 1.14." "$LINENO" 5 + +fi + + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for python-\"$PYTHON_VERSION\"-embed" >&5 +printf %s "checking for python-\"$PYTHON_VERSION\"-embed... " >&6; } + +if test -n "$PYTHON_CFLAGS"; then + pkg_cv_PYTHON_CFLAGS="$PYTHON_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python-\"\$PYTHON_VERSION\"-embed\""; } >&5 + ($PKG_CONFIG --exists --print-errors "python-"$PYTHON_VERSION"-embed") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PYTHON_CFLAGS=`$PKG_CONFIG --cflags "python-"$PYTHON_VERSION"-embed" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$PYTHON_LIBS"; then + pkg_cv_PYTHON_LIBS="$PYTHON_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python-\"\$PYTHON_VERSION\"-embed\""; } >&5 + ($PKG_CONFIG --exists --print-errors "python-"$PYTHON_VERSION"-embed") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PYTHON_LIBS=`$PKG_CONFIG --libs "python-"$PYTHON_VERSION"-embed" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + PYTHON_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "python-"$PYTHON_VERSION"-embed" 2>&1` + else + PYTHON_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "python-"$PYTHON_VERSION"-embed" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$PYTHON_PKG_ERRORS" >&5 + + + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for python-\"$PYTHON_VERSION\"" >&5 +printf %s "checking for python-\"$PYTHON_VERSION\"... " >&6; } + +if test -n "$PYTHON_CFLAGS"; then + pkg_cv_PYTHON_CFLAGS="$PYTHON_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python-\"\$PYTHON_VERSION\"\""; } >&5 + ($PKG_CONFIG --exists --print-errors "python-"$PYTHON_VERSION"") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PYTHON_CFLAGS=`$PKG_CONFIG --cflags "python-"$PYTHON_VERSION"" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$PYTHON_LIBS"; then + pkg_cv_PYTHON_LIBS="$PYTHON_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python-\"\$PYTHON_VERSION\"\""; } >&5 + ($PKG_CONFIG --exists --print-errors "python-"$PYTHON_VERSION"") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PYTHON_LIBS=`$PKG_CONFIG --libs "python-"$PYTHON_VERSION"" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + PYTHON_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "python-"$PYTHON_VERSION"" 2>&1` + else + PYTHON_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "python-"$PYTHON_VERSION"" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$PYTHON_PKG_ERRORS" >&5 + + + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for python" >&5 +printf %s "checking for python... " >&6; } + +if test -n "$PYTHON_CFLAGS"; then + pkg_cv_PYTHON_CFLAGS="$PYTHON_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python\""; } >&5 + ($PKG_CONFIG --exists --print-errors "python") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PYTHON_CFLAGS=`$PKG_CONFIG --cflags "python" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$PYTHON_LIBS"; then + pkg_cv_PYTHON_LIBS="$PYTHON_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python\""; } >&5 + ($PKG_CONFIG --exists --print-errors "python") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PYTHON_LIBS=`$PKG_CONFIG --libs "python" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + PYTHON_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "python" 2>&1` + else + PYTHON_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "python" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$PYTHON_PKG_ERRORS" >&5 + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: python $PYTHON_VERSION not found" >&5 +printf "%s\n" "$as_me: WARNING: python $PYTHON_VERSION not found" >&2;} + enable_python=no + +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: python $PYTHON_VERSION not found" >&5 +printf "%s\n" "$as_me: WARNING: python $PYTHON_VERSION not found" >&2;} + enable_python=no + +else + PYTHON_CFLAGS=$pkg_cv_PYTHON_CFLAGS + PYTHON_LIBS=$pkg_cv_PYTHON_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + + + + + +printf "%s\n" "#define HAVE_PYTHON 1" >>confdefs.h + + +fi +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for python" >&5 +printf %s "checking for python... " >&6; } + +if test -n "$PYTHON_CFLAGS"; then + pkg_cv_PYTHON_CFLAGS="$PYTHON_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python\""; } >&5 + ($PKG_CONFIG --exists --print-errors "python") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PYTHON_CFLAGS=`$PKG_CONFIG --cflags "python" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$PYTHON_LIBS"; then + pkg_cv_PYTHON_LIBS="$PYTHON_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python\""; } >&5 + ($PKG_CONFIG --exists --print-errors "python") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PYTHON_LIBS=`$PKG_CONFIG --libs "python" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + PYTHON_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "python" 2>&1` + else + PYTHON_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "python" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$PYTHON_PKG_ERRORS" >&5 + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: python $PYTHON_VERSION not found" >&5 +printf "%s\n" "$as_me: WARNING: python $PYTHON_VERSION not found" >&2;} + enable_python=no + +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: python $PYTHON_VERSION not found" >&5 +printf "%s\n" "$as_me: WARNING: python $PYTHON_VERSION not found" >&2;} + enable_python=no + +else + PYTHON_CFLAGS=$pkg_cv_PYTHON_CFLAGS + PYTHON_LIBS=$pkg_cv_PYTHON_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + + + + + +printf "%s\n" "#define HAVE_PYTHON 1" >>confdefs.h + + +fi +else + PYTHON_CFLAGS=$pkg_cv_PYTHON_CFLAGS + PYTHON_LIBS=$pkg_cv_PYTHON_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + + + + + +printf "%s\n" "#define HAVE_PYTHON 1" >>confdefs.h + + +fi +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for python-\"$PYTHON_VERSION\"" >&5 +printf %s "checking for python-\"$PYTHON_VERSION\"... " >&6; } + +if test -n "$PYTHON_CFLAGS"; then + pkg_cv_PYTHON_CFLAGS="$PYTHON_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python-\"\$PYTHON_VERSION\"\""; } >&5 + ($PKG_CONFIG --exists --print-errors "python-"$PYTHON_VERSION"") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PYTHON_CFLAGS=`$PKG_CONFIG --cflags "python-"$PYTHON_VERSION"" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$PYTHON_LIBS"; then + pkg_cv_PYTHON_LIBS="$PYTHON_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python-\"\$PYTHON_VERSION\"\""; } >&5 + ($PKG_CONFIG --exists --print-errors "python-"$PYTHON_VERSION"") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PYTHON_LIBS=`$PKG_CONFIG --libs "python-"$PYTHON_VERSION"" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + PYTHON_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "python-"$PYTHON_VERSION"" 2>&1` + else + PYTHON_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "python-"$PYTHON_VERSION"" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$PYTHON_PKG_ERRORS" >&5 + + + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for python" >&5 +printf %s "checking for python... " >&6; } + +if test -n "$PYTHON_CFLAGS"; then + pkg_cv_PYTHON_CFLAGS="$PYTHON_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python\""; } >&5 + ($PKG_CONFIG --exists --print-errors "python") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PYTHON_CFLAGS=`$PKG_CONFIG --cflags "python" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$PYTHON_LIBS"; then + pkg_cv_PYTHON_LIBS="$PYTHON_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python\""; } >&5 + ($PKG_CONFIG --exists --print-errors "python") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PYTHON_LIBS=`$PKG_CONFIG --libs "python" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + PYTHON_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "python" 2>&1` + else + PYTHON_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "python" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$PYTHON_PKG_ERRORS" >&5 + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: python $PYTHON_VERSION not found" >&5 +printf "%s\n" "$as_me: WARNING: python $PYTHON_VERSION not found" >&2;} + enable_python=no + +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: python $PYTHON_VERSION not found" >&5 +printf "%s\n" "$as_me: WARNING: python $PYTHON_VERSION not found" >&2;} + enable_python=no + +else + PYTHON_CFLAGS=$pkg_cv_PYTHON_CFLAGS + PYTHON_LIBS=$pkg_cv_PYTHON_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + + + + + +printf "%s\n" "#define HAVE_PYTHON 1" >>confdefs.h + + +fi +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for python" >&5 +printf %s "checking for python... " >&6; } + +if test -n "$PYTHON_CFLAGS"; then + pkg_cv_PYTHON_CFLAGS="$PYTHON_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python\""; } >&5 + ($PKG_CONFIG --exists --print-errors "python") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PYTHON_CFLAGS=`$PKG_CONFIG --cflags "python" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$PYTHON_LIBS"; then + pkg_cv_PYTHON_LIBS="$PYTHON_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python\""; } >&5 + ($PKG_CONFIG --exists --print-errors "python") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PYTHON_LIBS=`$PKG_CONFIG --libs "python" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + PYTHON_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "python" 2>&1` + else + PYTHON_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "python" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$PYTHON_PKG_ERRORS" >&5 + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: python $PYTHON_VERSION not found" >&5 +printf "%s\n" "$as_me: WARNING: python $PYTHON_VERSION not found" >&2;} + enable_python=no + +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: python $PYTHON_VERSION not found" >&5 +printf "%s\n" "$as_me: WARNING: python $PYTHON_VERSION not found" >&2;} + enable_python=no + +else + PYTHON_CFLAGS=$pkg_cv_PYTHON_CFLAGS + PYTHON_LIBS=$pkg_cv_PYTHON_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + + + + + +printf "%s\n" "#define HAVE_PYTHON 1" >>confdefs.h + + +fi +else + PYTHON_CFLAGS=$pkg_cv_PYTHON_CFLAGS + PYTHON_LIBS=$pkg_cv_PYTHON_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + + + + + +printf "%s\n" "#define HAVE_PYTHON 1" >>confdefs.h + + +fi +else + PYTHON_CFLAGS=$pkg_cv_PYTHON_CFLAGS + PYTHON_LIBS=$pkg_cv_PYTHON_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + + + + + +printf "%s\n" "#define HAVE_PYTHON 1" >>confdefs.h + + +fi + +fi + if test "x$enable_python" != "xno" && test "x$PYTHON" != "xno"; then + HAVE_PYTHON_TRUE= + HAVE_PYTHON_FALSE='#' +else + HAVE_PYTHON_TRUE='#' + HAVE_PYTHON_FALSE= +fi + + + + + + + + # checking for ocamlc + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ocamlc", so it can be a program name with args. +set dummy ${ac_tool_prefix}ocamlc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OCAMLC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$OCAMLC"; then + ac_cv_prog_OCAMLC="$OCAMLC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_OCAMLC="${ac_tool_prefix}ocamlc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OCAMLC=$ac_cv_prog_OCAMLC +if test -n "$OCAMLC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OCAMLC" >&5 +printf "%s\n" "$OCAMLC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OCAMLC"; then + ac_ct_OCAMLC=$OCAMLC + # Extract the first word of "ocamlc", so it can be a program name with args. +set dummy ocamlc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OCAMLC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_OCAMLC"; then + ac_cv_prog_ac_ct_OCAMLC="$ac_ct_OCAMLC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OCAMLC="ocamlc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OCAMLC=$ac_cv_prog_ac_ct_OCAMLC +if test -n "$ac_ct_OCAMLC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLC" >&5 +printf "%s\n" "$ac_ct_OCAMLC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_OCAMLC" = x; then + OCAMLC="no" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OCAMLC=$ac_ct_OCAMLC + fi +else + OCAMLC="$ac_cv_prog_OCAMLC" +fi + + + if test "$OCAMLC" != "no"; then + OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version* *\(.*\)$|\1|p'` + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: OCaml version is $OCAMLVERSION" >&5 +printf "%s\n" "OCaml version is $OCAMLVERSION" >&6; } + # If OCAMLLIB is set, use it + if test "$OCAMLLIB" = ""; then + OCAMLLIB=`$OCAMLC -where 2>/dev/null || $OCAMLC -v|tail -1|cut -d ' ' -f 4` + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: OCAMLLIB previously set; preserving it." >&5 +printf "%s\n" "OCAMLLIB previously set; preserving it." >&6; } + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: OCaml library path is $OCAMLLIB" >&5 +printf "%s\n" "OCaml library path is $OCAMLLIB" >&6; } + + + + + # checking for ocamlopt + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ocamlopt", so it can be a program name with args. +set dummy ${ac_tool_prefix}ocamlopt; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OCAMLOPT+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$OCAMLOPT"; then + ac_cv_prog_OCAMLOPT="$OCAMLOPT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_OCAMLOPT="${ac_tool_prefix}ocamlopt" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OCAMLOPT=$ac_cv_prog_OCAMLOPT +if test -n "$OCAMLOPT"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OCAMLOPT" >&5 +printf "%s\n" "$OCAMLOPT" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OCAMLOPT"; then + ac_ct_OCAMLOPT=$OCAMLOPT + # Extract the first word of "ocamlopt", so it can be a program name with args. +set dummy ocamlopt; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OCAMLOPT+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_OCAMLOPT"; then + ac_cv_prog_ac_ct_OCAMLOPT="$ac_ct_OCAMLOPT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OCAMLOPT="ocamlopt" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OCAMLOPT=$ac_cv_prog_ac_ct_OCAMLOPT +if test -n "$ac_ct_OCAMLOPT"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLOPT" >&5 +printf "%s\n" "$ac_ct_OCAMLOPT" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_OCAMLOPT" = x; then + OCAMLOPT="no" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OCAMLOPT=$ac_ct_OCAMLOPT + fi +else + OCAMLOPT="$ac_cv_prog_OCAMLOPT" +fi + + OCAMLBEST=byte + if test "$OCAMLOPT" = "no"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find ocamlopt; bytecode compilation only." >&5 +printf "%s\n" "$as_me: WARNING: Cannot find ocamlopt; bytecode compilation only." >&2;} + else + TMPVERSION=`$OCAMLOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' ` + if test "$TMPVERSION" != "$OCAMLVERSION" ; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: versions differs from ocamlc; ocamlopt discarded." >&5 +printf "%s\n" "versions differs from ocamlc; ocamlopt discarded." >&6; } + OCAMLOPT=no + else + OCAMLBEST=opt + fi + fi + + + + # checking for ocamlc.opt + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ocamlc.opt", so it can be a program name with args. +set dummy ${ac_tool_prefix}ocamlc.opt; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OCAMLCDOTOPT+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$OCAMLCDOTOPT"; then + ac_cv_prog_OCAMLCDOTOPT="$OCAMLCDOTOPT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_OCAMLCDOTOPT="${ac_tool_prefix}ocamlc.opt" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OCAMLCDOTOPT=$ac_cv_prog_OCAMLCDOTOPT +if test -n "$OCAMLCDOTOPT"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OCAMLCDOTOPT" >&5 +printf "%s\n" "$OCAMLCDOTOPT" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OCAMLCDOTOPT"; then + ac_ct_OCAMLCDOTOPT=$OCAMLCDOTOPT + # Extract the first word of "ocamlc.opt", so it can be a program name with args. +set dummy ocamlc.opt; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OCAMLCDOTOPT+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_OCAMLCDOTOPT"; then + ac_cv_prog_ac_ct_OCAMLCDOTOPT="$ac_ct_OCAMLCDOTOPT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OCAMLCDOTOPT="ocamlc.opt" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OCAMLCDOTOPT=$ac_cv_prog_ac_ct_OCAMLCDOTOPT +if test -n "$ac_ct_OCAMLCDOTOPT"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLCDOTOPT" >&5 +printf "%s\n" "$ac_ct_OCAMLCDOTOPT" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_OCAMLCDOTOPT" = x; then + OCAMLCDOTOPT="no" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OCAMLCDOTOPT=$ac_ct_OCAMLCDOTOPT + fi +else + OCAMLCDOTOPT="$ac_cv_prog_OCAMLCDOTOPT" +fi + + if test "$OCAMLCDOTOPT" != "no"; then + TMPVERSION=`$OCAMLCDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' ` + if test "$TMPVERSION" != "$OCAMLVERSION" ; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: versions differs from ocamlc; ocamlc.opt discarded." >&5 +printf "%s\n" "versions differs from ocamlc; ocamlc.opt discarded." >&6; } + else + OCAMLC=$OCAMLCDOTOPT + fi + fi + + # checking for ocamlopt.opt + if test "$OCAMLOPT" != "no" ; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ocamlopt.opt", so it can be a program name with args. +set dummy ${ac_tool_prefix}ocamlopt.opt; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OCAMLOPTDOTOPT+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$OCAMLOPTDOTOPT"; then + ac_cv_prog_OCAMLOPTDOTOPT="$OCAMLOPTDOTOPT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_OCAMLOPTDOTOPT="${ac_tool_prefix}ocamlopt.opt" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OCAMLOPTDOTOPT=$ac_cv_prog_OCAMLOPTDOTOPT +if test -n "$OCAMLOPTDOTOPT"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OCAMLOPTDOTOPT" >&5 +printf "%s\n" "$OCAMLOPTDOTOPT" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OCAMLOPTDOTOPT"; then + ac_ct_OCAMLOPTDOTOPT=$OCAMLOPTDOTOPT + # Extract the first word of "ocamlopt.opt", so it can be a program name with args. +set dummy ocamlopt.opt; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OCAMLOPTDOTOPT+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_OCAMLOPTDOTOPT"; then + ac_cv_prog_ac_ct_OCAMLOPTDOTOPT="$ac_ct_OCAMLOPTDOTOPT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OCAMLOPTDOTOPT="ocamlopt.opt" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OCAMLOPTDOTOPT=$ac_cv_prog_ac_ct_OCAMLOPTDOTOPT +if test -n "$ac_ct_OCAMLOPTDOTOPT"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLOPTDOTOPT" >&5 +printf "%s\n" "$ac_ct_OCAMLOPTDOTOPT" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_OCAMLOPTDOTOPT" = x; then + OCAMLOPTDOTOPT="no" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OCAMLOPTDOTOPT=$ac_ct_OCAMLOPTDOTOPT + fi +else + OCAMLOPTDOTOPT="$ac_cv_prog_OCAMLOPTDOTOPT" +fi + + if test "$OCAMLOPTDOTOPT" != "no"; then + TMPVERSION=`$OCAMLOPTDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' ` + if test "$TMPVERSION" != "$OCAMLVERSION" ; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: version differs from ocamlc; ocamlopt.opt discarded." >&5 +printf "%s\n" "version differs from ocamlc; ocamlopt.opt discarded." >&6; } + else + OCAMLOPT=$OCAMLOPTDOTOPT + fi + fi + fi + + + fi + + + + # checking for ocaml toplevel + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ocaml", so it can be a program name with args. +set dummy ${ac_tool_prefix}ocaml; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OCAML+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$OCAML"; then + ac_cv_prog_OCAML="$OCAML" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_OCAML="${ac_tool_prefix}ocaml" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OCAML=$ac_cv_prog_OCAML +if test -n "$OCAML"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OCAML" >&5 +printf "%s\n" "$OCAML" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OCAML"; then + ac_ct_OCAML=$OCAML + # Extract the first word of "ocaml", so it can be a program name with args. +set dummy ocaml; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OCAML+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_OCAML"; then + ac_cv_prog_ac_ct_OCAML="$ac_ct_OCAML" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OCAML="ocaml" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OCAML=$ac_cv_prog_ac_ct_OCAML +if test -n "$ac_ct_OCAML"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAML" >&5 +printf "%s\n" "$ac_ct_OCAML" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_OCAML" = x; then + OCAML="no" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OCAML=$ac_ct_OCAML + fi +else + OCAML="$ac_cv_prog_OCAML" +fi + + + # checking for ocamldep + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ocamldep", so it can be a program name with args. +set dummy ${ac_tool_prefix}ocamldep; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OCAMLDEP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$OCAMLDEP"; then + ac_cv_prog_OCAMLDEP="$OCAMLDEP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_OCAMLDEP="${ac_tool_prefix}ocamldep" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OCAMLDEP=$ac_cv_prog_OCAMLDEP +if test -n "$OCAMLDEP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OCAMLDEP" >&5 +printf "%s\n" "$OCAMLDEP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OCAMLDEP"; then + ac_ct_OCAMLDEP=$OCAMLDEP + # Extract the first word of "ocamldep", so it can be a program name with args. +set dummy ocamldep; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OCAMLDEP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_OCAMLDEP"; then + ac_cv_prog_ac_ct_OCAMLDEP="$ac_ct_OCAMLDEP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OCAMLDEP="ocamldep" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OCAMLDEP=$ac_cv_prog_ac_ct_OCAMLDEP +if test -n "$ac_ct_OCAMLDEP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLDEP" >&5 +printf "%s\n" "$ac_ct_OCAMLDEP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_OCAMLDEP" = x; then + OCAMLDEP="no" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OCAMLDEP=$ac_ct_OCAMLDEP + fi +else + OCAMLDEP="$ac_cv_prog_OCAMLDEP" +fi + + + # checking for ocamlmktop + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ocamlmktop", so it can be a program name with args. +set dummy ${ac_tool_prefix}ocamlmktop; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OCAMLMKTOP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$OCAMLMKTOP"; then + ac_cv_prog_OCAMLMKTOP="$OCAMLMKTOP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_OCAMLMKTOP="${ac_tool_prefix}ocamlmktop" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OCAMLMKTOP=$ac_cv_prog_OCAMLMKTOP +if test -n "$OCAMLMKTOP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OCAMLMKTOP" >&5 +printf "%s\n" "$OCAMLMKTOP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OCAMLMKTOP"; then + ac_ct_OCAMLMKTOP=$OCAMLMKTOP + # Extract the first word of "ocamlmktop", so it can be a program name with args. +set dummy ocamlmktop; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OCAMLMKTOP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_OCAMLMKTOP"; then + ac_cv_prog_ac_ct_OCAMLMKTOP="$ac_ct_OCAMLMKTOP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OCAMLMKTOP="ocamlmktop" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OCAMLMKTOP=$ac_cv_prog_ac_ct_OCAMLMKTOP +if test -n "$ac_ct_OCAMLMKTOP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLMKTOP" >&5 +printf "%s\n" "$ac_ct_OCAMLMKTOP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_OCAMLMKTOP" = x; then + OCAMLMKTOP="no" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OCAMLMKTOP=$ac_ct_OCAMLMKTOP + fi +else + OCAMLMKTOP="$ac_cv_prog_OCAMLMKTOP" +fi + + + # checking for ocamlmklib + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ocamlmklib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ocamlmklib; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OCAMLMKLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$OCAMLMKLIB"; then + ac_cv_prog_OCAMLMKLIB="$OCAMLMKLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_OCAMLMKLIB="${ac_tool_prefix}ocamlmklib" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OCAMLMKLIB=$ac_cv_prog_OCAMLMKLIB +if test -n "$OCAMLMKLIB"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OCAMLMKLIB" >&5 +printf "%s\n" "$OCAMLMKLIB" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OCAMLMKLIB"; then + ac_ct_OCAMLMKLIB=$OCAMLMKLIB + # Extract the first word of "ocamlmklib", so it can be a program name with args. +set dummy ocamlmklib; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OCAMLMKLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_OCAMLMKLIB"; then + ac_cv_prog_ac_ct_OCAMLMKLIB="$ac_ct_OCAMLMKLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OCAMLMKLIB="ocamlmklib" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OCAMLMKLIB=$ac_cv_prog_ac_ct_OCAMLMKLIB +if test -n "$ac_ct_OCAMLMKLIB"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLMKLIB" >&5 +printf "%s\n" "$ac_ct_OCAMLMKLIB" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_OCAMLMKLIB" = x; then + OCAMLMKLIB="no" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OCAMLMKLIB=$ac_ct_OCAMLMKLIB + fi +else + OCAMLMKLIB="$ac_cv_prog_OCAMLMKLIB" +fi + + + # checking for ocamldoc + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ocamldoc", so it can be a program name with args. +set dummy ${ac_tool_prefix}ocamldoc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OCAMLDOC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$OCAMLDOC"; then + ac_cv_prog_OCAMLDOC="$OCAMLDOC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_OCAMLDOC="${ac_tool_prefix}ocamldoc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OCAMLDOC=$ac_cv_prog_OCAMLDOC +if test -n "$OCAMLDOC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OCAMLDOC" >&5 +printf "%s\n" "$OCAMLDOC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OCAMLDOC"; then + ac_ct_OCAMLDOC=$OCAMLDOC + # Extract the first word of "ocamldoc", so it can be a program name with args. +set dummy ocamldoc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OCAMLDOC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_OCAMLDOC"; then + ac_cv_prog_ac_ct_OCAMLDOC="$ac_ct_OCAMLDOC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OCAMLDOC="ocamldoc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OCAMLDOC=$ac_cv_prog_ac_ct_OCAMLDOC +if test -n "$ac_ct_OCAMLDOC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLDOC" >&5 +printf "%s\n" "$ac_ct_OCAMLDOC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_OCAMLDOC" = x; then + OCAMLDOC="no" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OCAMLDOC=$ac_ct_OCAMLDOC + fi +else + OCAMLDOC="$ac_cv_prog_OCAMLDOC" +fi + + + # checking for ocamlbuild + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ocamlbuild", so it can be a program name with args. +set dummy ${ac_tool_prefix}ocamlbuild; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OCAMLBUILD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$OCAMLBUILD"; then + ac_cv_prog_OCAMLBUILD="$OCAMLBUILD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_OCAMLBUILD="${ac_tool_prefix}ocamlbuild" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OCAMLBUILD=$ac_cv_prog_OCAMLBUILD +if test -n "$OCAMLBUILD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OCAMLBUILD" >&5 +printf "%s\n" "$OCAMLBUILD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OCAMLBUILD"; then + ac_ct_OCAMLBUILD=$OCAMLBUILD + # Extract the first word of "ocamlbuild", so it can be a program name with args. +set dummy ocamlbuild; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OCAMLBUILD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_OCAMLBUILD"; then + ac_cv_prog_ac_ct_OCAMLBUILD="$ac_ct_OCAMLBUILD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OCAMLBUILD="ocamlbuild" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OCAMLBUILD=$ac_cv_prog_ac_ct_OCAMLBUILD +if test -n "$ac_ct_OCAMLBUILD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLBUILD" >&5 +printf "%s\n" "$ac_ct_OCAMLBUILD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_OCAMLBUILD" = x; then + OCAMLBUILD="no" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OCAMLBUILD=$ac_ct_OCAMLBUILD + fi +else + OCAMLBUILD="$ac_cv_prog_OCAMLBUILD" +fi + + +# Check whether --enable-ocaml was given. +if test ${enable_ocaml+y} +then : + enableval=$enable_ocaml; +else $as_nop + enable_ocaml=yes +fi + +if test "x$OCAMLOPT" != "xno" && test "x$enable_ocaml" != "xno" +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $OCAMLOPT can create a shared library" >&5 +printf %s "checking if $OCAMLOPT can create a shared library... " >&6; } + echo 'print_endline "test"' > conftest.ml + if $OCAMLOPT $OCAMLOPTFLAGS -output-obj -runtime-variant _pic -o conftest.so conftest.ml >&5 2>&1 +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + ocaml_link_shared=yes + +else $as_nop + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +fi + rm -f conftest.ml conftest.cmi conftest.cmx conftest.so conftest.o + +fi + if test "x$OCAMLOPT" != "xno" && + test "x$ocaml_link_shared" = "xyes"; then + HAVE_OCAML_TRUE= + HAVE_OCAML_FALSE='#' +else + HAVE_OCAML_TRUE='#' + HAVE_OCAML_FALSE= +fi + + if test "x$OCAMLDOC" != "xno"; then + HAVE_OCAMLDOC_TRUE= + HAVE_OCAMLDOC_FALSE='#' +else + HAVE_OCAMLDOC_TRUE='#' + HAVE_OCAMLDOC_FALSE= +fi + + +if test "x$OCAMLC" != "xno" && test "x$OCAMLFIND" != "xno" && \ + test "x$enable_ocaml" = "xyes" +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking major version of OCaml" >&5 +printf %s "checking major version of OCaml... " >&6; } + OCAML_MAJOR=` echo $OCAMLVERSION | $SED 's/\([[:digit:]]*\).*/\1/' ` + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OCAML_MAJOR" >&5 +printf "%s\n" "$OCAML_MAJOR" >&6; } + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for what libraries are needed for OCaml plugins" >&5 +printf %s "checking for what libraries are needed for OCaml plugins... " >&6; } + if test $OCAML_MAJOR -ge 5 +then : + + OCAML_PLUGIN_LIBRARIES="-I +unix unix.cmxa -I +threads threads.cmxa" + +else $as_nop + + OCAML_PLUGIN_LIBRARIES="unix.cmxa" + +fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OCAML_PLUGIN_LIBRARIES" >&5 +printf "%s\n" "$OCAML_PLUGIN_LIBRARIES" >&6; } + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for caml_alloc_initialized_string" >&5 +printf %s "checking for caml_alloc_initialized_string... " >&6; } + cat >conftest.c <<'EOF' +#include +int main () { char *p = (void *) caml_alloc_initialized_string; return 0; } +EOF + if $OCAMLC conftest.c >&5 2>&1 +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +printf "%s\n" "#define HAVE_CAML_ALLOC_INITIALIZED_STRING 1" >>confdefs.h + + +else $as_nop + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +fi + rm -f conftest.c conftest.o + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for caml_shutdown" >&5 +printf %s "checking for caml_shutdown... " >&6; } + cat >conftest.c <<'EOF' +#include +int main () { char *p = (void *) caml_shutdown; return 0; } +EOF + if $OCAMLC conftest.c >&5 2>&1 +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +printf "%s\n" "#define HAVE_CAML_SHUTDOWN 1" >>confdefs.h + + +else $as_nop + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +fi + rm -f conftest.c conftest.o + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for caml/socketaddr.h" >&5 +printf %s "checking for caml/socketaddr.h... " >&6; } + cat >conftest.c <<'EOF' +#include +#include +int main () { return 0; } +EOF + if $OCAMLC conftest.c >&5 2>&1 +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +printf "%s\n" "#define HAVE_CAML_SOCKETADDR_H 1" >>confdefs.h + + +else $as_nop + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +fi + rm -f conftest.c conftest.o + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for caml_unix_alloc_sockaddr" >&5 +printf %s "checking for caml_unix_alloc_sockaddr... " >&6; } + cat >conftest.c <<'EOF' +#include +#include +int main () { char *p = (void *) caml_unix_alloc_sockaddr; return 0; } +EOF + if $OCAMLC conftest.c >&5 2>&1 +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +printf "%s\n" "#define HAVE_CAML_UNIX_ALLOC_SOCKADDR 1" >>confdefs.h + + +else $as_nop + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +fi + rm -f conftest.c conftest.o + +fi + +# Extract the first word of "cargo", so it can be a program name with args. +set dummy cargo; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CARGO+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CARGO"; then + ac_cv_prog_CARGO="$CARGO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CARGO="cargo" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_CARGO" && ac_cv_prog_CARGO="no" +fi +fi +CARGO=$ac_cv_prog_CARGO +if test -n "$CARGO"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CARGO" >&5 +printf "%s\n" "$CARGO" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +# Extract the first word of "rustc", so it can be a program name with args. +set dummy rustc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_RUSTC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$RUSTC"; then + ac_cv_prog_RUSTC="$RUSTC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_RUSTC="rustc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_RUSTC" && ac_cv_prog_RUSTC="no" +fi +fi +RUSTC=$ac_cv_prog_RUSTC +if test -n "$RUSTC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RUSTC" >&5 +printf "%s\n" "$RUSTC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +# Check whether --enable-rust was given. +if test ${enable_rust+y} +then : + enableval=$enable_rust; +else $as_nop + if test "x$(realpath $srcdir)" = "x$(realpath .)"; then + enable_rust=yes + else + enable_rust=no + fi +fi + +if test "x$enable_rust" != "xno" && test "x$CARGO" != "xno" && test "x$RUSTC" != "xno" +then : + have_rust=yes +else $as_nop + have_rust=no +fi + if test "x$have_rust" = "xyes"; then + HAVE_RUST_TRUE= + HAVE_RUST_FALSE='#' +else + HAVE_RUST_TRUE='#' + HAVE_RUST_FALSE= +fi + +if test "x$have_rust" = "xyes" +then : + + printf "cargo version: "; $CARGO --version + printf "rustc version: "; $RUSTC --version + +fi + +# Extract the first word of "ruby", so it can be a program name with args. +set dummy ruby; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_RUBY+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$RUBY"; then + ac_cv_prog_RUBY="$RUBY" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_RUBY="ruby" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_RUBY" && ac_cv_prog_RUBY="no" +fi +fi +RUBY=$ac_cv_prog_RUBY +if test -n "$RUBY"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RUBY" >&5 +printf "%s\n" "$RUBY" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +# Check whether --enable-ruby was given. +if test ${enable_ruby+y} +then : + enableval=$enable_ruby; +else $as_nop + enable_ruby=yes +fi + +if test "x$RUBY" != "xno" && test "x$enable_ruby" != "xno" +then : + + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ruby" >&5 +printf %s "checking for ruby... " >&6; } + +if test -n "$RUBY_CFLAGS"; then + pkg_cv_RUBY_CFLAGS="$RUBY_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ruby\""; } >&5 + ($PKG_CONFIG --exists --print-errors "ruby") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_RUBY_CFLAGS=`$PKG_CONFIG --cflags "ruby" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$RUBY_LIBS"; then + pkg_cv_RUBY_LIBS="$RUBY_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ruby\""; } >&5 + ($PKG_CONFIG --exists --print-errors "ruby") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_RUBY_LIBS=`$PKG_CONFIG --libs "ruby" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + RUBY_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "ruby" 2>&1` + else + RUBY_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "ruby" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$RUBY_PKG_ERRORS" >&5 + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: ruby not found" >&5 +printf "%s\n" "$as_me: WARNING: ruby not found" >&2;} + enable_ruby=no + +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: ruby not found" >&5 +printf "%s\n" "$as_me: WARNING: ruby not found" >&2;} + enable_ruby=no + +else + RUBY_CFLAGS=$pkg_cv_RUBY_CFLAGS + RUBY_LIBS=$pkg_cv_RUBY_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + + + + +fi + +fi + if test "x$RUBY" != "xno" && + test "x$enable_ruby" = "xyes"; then + HAVE_RUBY_TRUE= + HAVE_RUBY_FALSE='#' +else + HAVE_RUBY_TRUE='#' + HAVE_RUBY_FALSE= +fi + + +# Check whether --enable-tcl was given. +if test ${enable_tcl+y} +then : + enableval=$enable_tcl; +else $as_nop + enable_tcl=yes +fi + +if test "x$enable_tcl" != "xno" +then : + + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tcl" >&5 +printf %s "checking for tcl... " >&6; } + +if test -n "$TCL_CFLAGS"; then + pkg_cv_TCL_CFLAGS="$TCL_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"tcl\""; } >&5 + ($PKG_CONFIG --exists --print-errors "tcl") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_TCL_CFLAGS=`$PKG_CONFIG --cflags "tcl" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$TCL_LIBS"; then + pkg_cv_TCL_LIBS="$TCL_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"tcl\""; } >&5 + ($PKG_CONFIG --exists --print-errors "tcl") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_TCL_LIBS=`$PKG_CONFIG --libs "tcl" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + TCL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "tcl" 2>&1` + else + TCL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "tcl" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$TCL_PKG_ERRORS" >&5 + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Tcl not found" >&5 +printf "%s\n" "$as_me: WARNING: Tcl not found" >&2;} + enable_tcl=no + +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Tcl not found" >&5 +printf "%s\n" "$as_me: WARNING: Tcl not found" >&2;} + enable_tcl=no + +else + TCL_CFLAGS=$pkg_cv_TCL_CFLAGS + TCL_LIBS=$pkg_cv_TCL_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + + + + +fi + +fi + if test "x$enable_tcl" = "xyes"; then + HAVE_TCL_TRUE= + HAVE_TCL_FALSE='#' +else + HAVE_TCL_TRUE='#' + HAVE_TCL_FALSE= +fi + + +# Check whether --enable-lua was given. +if test ${enable_lua+y} +then : + enableval=$enable_lua; +else $as_nop + enable_lua=yes +fi + +if test "x$enable_lua" != "xno" +then : + + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for lua" >&5 +printf %s "checking for lua... " >&6; } + +if test -n "$LUA_CFLAGS"; then + pkg_cv_LUA_CFLAGS="$LUA_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lua") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LUA_CFLAGS=`$PKG_CONFIG --cflags "lua" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LUA_LIBS"; then + pkg_cv_LUA_LIBS="$LUA_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lua") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LUA_LIBS=`$PKG_CONFIG --libs "lua" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LUA_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "lua" 2>&1` + else + LUA_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "lua" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LUA_PKG_ERRORS" >&5 + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Lua not found" >&5 +printf "%s\n" "$as_me: WARNING: Lua not found" >&2;} + enable_lua=no + +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Lua not found" >&5 +printf "%s\n" "$as_me: WARNING: Lua not found" >&2;} + enable_lua=no + +else + LUA_CFLAGS=$pkg_cv_LUA_CFLAGS + LUA_LIBS=$pkg_cv_LUA_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + + + + + old_LIBS="$LIBS" + LIBS="$LUA_LIBS $LIBS" + ac_fn_c_check_func "$LINENO" "lua_isinteger" "ac_cv_func_lua_isinteger" +if test "x$ac_cv_func_lua_isinteger" = xyes +then : + printf "%s\n" "#define HAVE_LUA_ISINTEGER 1" >>confdefs.h + +fi + + LIBS="$old_LIBS" + +fi + +fi + if test "x$enable_lua" = "xyes"; then + HAVE_LUA_TRUE= + HAVE_LUA_FALSE='#' +else + HAVE_LUA_TRUE='#' + HAVE_LUA_FALSE= +fi + + +# Check whether --enable-golang was given. +if test ${enable_golang+y} +then : + enableval=$enable_golang; +else $as_nop + enable_golang=yes +fi + +if test "x$enable_golang" != "xno" +then : + + # Extract the first word of "go", so it can be a program name with args. +set dummy go; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_GOLANG+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$GOLANG"; then + ac_cv_prog_GOLANG="$GOLANG" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_GOLANG="go" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_GOLANG" && ac_cv_prog_GOLANG="no" +fi +fi +GOLANG=$ac_cv_prog_GOLANG +if test -n "$GOLANG"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $GOLANG" >&5 +printf "%s\n" "$GOLANG" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + if test "x$GOLANG" != "xno" +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $GOLANG is usable" >&5 +printf %s "checking if $GOLANG is usable... " >&6; } + if $GOLANG run $srcdir/plugins/golang/config-test.go 2>&5 && \ + $GOLANG help modules 2>&5 1>&2 +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + + # Substitute some golang environment. + GOOS=`$GOLANG env GOOS` + GOARCH=`$GOLANG env GOARCH` + GOROOT=`$GOLANG env GOROOT` + + + + +else $as_nop + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: golang ($GOLANG) is installed but not usable" >&5 +printf "%s\n" "$as_me: WARNING: golang ($GOLANG) is installed but not usable" >&2;} + GOLANG=no + +fi + +fi + +else $as_nop + GOLANG=no +fi + if test "x$GOLANG" != "xno"; then + HAVE_GOLANG_TRUE= + HAVE_GOLANG_FALSE='#' +else + HAVE_GOLANG_TRUE='#' + HAVE_GOLANG_FALSE= +fi + + + +# Check whether --with-libblkio was given. +if test ${with_libblkio+y} +then : + withval=$with_libblkio; +else $as_nop + with_libblkio=check +fi + +if test "$with_libblkio" != "no" +then : + + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for blkio" >&5 +printf %s "checking for blkio... " >&6; } + +if test -n "$LIBBLKIO_CFLAGS"; then + pkg_cv_LIBBLKIO_CFLAGS="$LIBBLKIO_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"blkio\""; } >&5 + ($PKG_CONFIG --exists --print-errors "blkio") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBBLKIO_CFLAGS=`$PKG_CONFIG --cflags "blkio" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBBLKIO_LIBS"; then + pkg_cv_LIBBLKIO_LIBS="$LIBBLKIO_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"blkio\""; } >&5 + ($PKG_CONFIG --exists --print-errors "blkio") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBBLKIO_LIBS=`$PKG_CONFIG --libs "blkio" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBBLKIO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "blkio" 2>&1` + else + LIBBLKIO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "blkio" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBBLKIO_PKG_ERRORS" >&5 + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: libblkio not found, blkio plugin will be disabled" >&5 +printf "%s\n" "$as_me: WARNING: libblkio not found, blkio plugin will be disabled" >&2;} +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: libblkio not found, blkio plugin will be disabled" >&5 +printf "%s\n" "$as_me: WARNING: libblkio not found, blkio plugin will be disabled" >&2;} +else + LIBBLKIO_CFLAGS=$pkg_cv_LIBBLKIO_CFLAGS + LIBBLKIO_LIBS=$pkg_cv_LIBBLKIO_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + + printf "libblkio version is "; $PKG_CONFIG --modversion blkio + + + +printf "%s\n" "#define HAVE_LIBBLKIO 1" >>confdefs.h + + +fi + +fi + if test "x$LIBBLKIO_LIBS" != "x"; then + HAVE_LIBBLKIO_TRUE= + HAVE_LIBBLKIO_FALSE='#' +else + HAVE_LIBBLKIO_TRUE='#' + HAVE_LIBBLKIO_FALSE= +fi + + + +# Check whether --with-curl was given. +if test ${with_curl+y} +then : + withval=$with_curl; +else $as_nop + with_curl=check +fi + +if test "$with_curl" != "no" +then : + + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libcurl" >&5 +printf %s "checking for libcurl... " >&6; } + +if test -n "$CURL_CFLAGS"; then + pkg_cv_CURL_CFLAGS="$CURL_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libcurl\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libcurl") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_CURL_CFLAGS=`$PKG_CONFIG --cflags "libcurl" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$CURL_LIBS"; then + pkg_cv_CURL_LIBS="$CURL_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libcurl\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libcurl") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_CURL_LIBS=`$PKG_CONFIG --libs "libcurl" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + CURL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libcurl" 2>&1` + else + CURL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libcurl" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$CURL_PKG_ERRORS" >&5 + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: curl not found, curl plugin will be disabled" >&5 +printf "%s\n" "$as_me: WARNING: curl not found, curl plugin will be disabled" >&2;} +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: curl not found, curl plugin will be disabled" >&5 +printf "%s\n" "$as_me: WARNING: curl not found, curl plugin will be disabled" >&2;} +else + CURL_CFLAGS=$pkg_cv_CURL_CFLAGS + CURL_LIBS=$pkg_cv_CURL_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + + printf "libcurl version is "; $PKG_CONFIG --modversion libcurl + + + +printf "%s\n" "#define HAVE_CURL 1" >>confdefs.h + + ac_fn_check_decl "$LINENO" "CURLOPT_UNIX_SOCKET_PATH" "ac_cv_have_decl_CURLOPT_UNIX_SOCKET_PATH" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_CURLOPT_UNIX_SOCKET_PATH" = xyes +then : + + +printf "%s\n" "#define HAVE_CURLOPT_UNIX_SOCKET_PATH 1" >>confdefs.h + + +fi + ac_fn_check_decl "$LINENO" "CURLOPT_PROTOCOLS_STR" "ac_cv_have_decl_CURLOPT_PROTOCOLS_STR" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_CURLOPT_PROTOCOLS_STR" = xyes +then : + + +printf "%s\n" "#define HAVE_CURLOPT_PROTOCOLS_STR 1" >>confdefs.h + + +fi + ac_fn_check_decl "$LINENO" "CURL_HTTP_VERSION_2_0" "ac_cv_have_decl_CURL_HTTP_VERSION_2_0" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_CURL_HTTP_VERSION_2_0" = xyes +then : + + +printf "%s\n" "#define HAVE_CURL_HTTP_VERSION_2_0 1" >>confdefs.h + + +fi + ac_fn_check_decl "$LINENO" "CURL_HTTP_VERSION_2TLS" "ac_cv_have_decl_CURL_HTTP_VERSION_2TLS" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_CURL_HTTP_VERSION_2TLS" = xyes +then : + + +printf "%s\n" "#define HAVE_CURL_HTTP_VERSION_2TLS 1" >>confdefs.h + + +fi + ac_fn_check_decl "$LINENO" "CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE" "ac_cv_have_decl_CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE" = xyes +then : + + +printf "%s\n" "#define HAVE_CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE 1" >>confdefs.h + + +fi + ac_fn_check_decl "$LINENO" "CURL_HTTP_VERSION_3" "ac_cv_have_decl_CURL_HTTP_VERSION_3" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_CURL_HTTP_VERSION_3" = xyes +then : + + +printf "%s\n" "#define HAVE_CURL_HTTP_VERSION_3 1" >>confdefs.h + + +fi + ac_fn_check_decl "$LINENO" "CURL_HTTP_VERSION_3ONLY" "ac_cv_have_decl_CURL_HTTP_VERSION_3ONLY" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_CURL_HTTP_VERSION_3ONLY" = xyes +then : + + +printf "%s\n" "#define HAVE_CURL_HTTP_VERSION_3ONLY 1" >>confdefs.h + + +fi + ac_fn_check_decl "$LINENO" "CURL_SSLVERSION_MAX_DEFAULT" "ac_cv_have_decl_CURL_SSLVERSION_MAX_DEFAULT" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_CURL_SSLVERSION_MAX_DEFAULT" = xyes +then : + + +printf "%s\n" "#define HAVE_CURL_SSLVERSION_MAX_DEFAULT 1" >>confdefs.h + + +fi + ac_fn_check_decl "$LINENO" "CURL_SSLVERSION_MAX_TLSv1_0" "ac_cv_have_decl_CURL_SSLVERSION_MAX_TLSv1_0" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_CURL_SSLVERSION_MAX_TLSv1_0" = xyes +then : + + +printf "%s\n" "#define HAVE_CURL_SSLVERSION_MAX_TLSv1_0 1" >>confdefs.h + + +fi + ac_fn_check_decl "$LINENO" "CURL_SSLVERSION_MAX_TLSv1_1" "ac_cv_have_decl_CURL_SSLVERSION_MAX_TLSv1_1" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_CURL_SSLVERSION_MAX_TLSv1_1" = xyes +then : + + +printf "%s\n" "#define HAVE_CURL_SSLVERSION_MAX_TLSv1_1 1" >>confdefs.h + + +fi + ac_fn_check_decl "$LINENO" "CURL_SSLVERSION_MAX_TLSv1_2" "ac_cv_have_decl_CURL_SSLVERSION_MAX_TLSv1_2" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_CURL_SSLVERSION_MAX_TLSv1_2" = xyes +then : + + +printf "%s\n" "#define HAVE_CURL_SSLVERSION_MAX_TLSv1_2 1" >>confdefs.h + + +fi + ac_fn_check_decl "$LINENO" "CURL_SSLVERSION_MAX_TLSv1_3" "ac_cv_have_decl_CURL_SSLVERSION_MAX_TLSv1_3" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_CURL_SSLVERSION_MAX_TLSv1_3" = xyes +then : + + +printf "%s\n" "#define HAVE_CURL_SSLVERSION_MAX_TLSv1_3 1" >>confdefs.h + + +fi + old_LIBS="$LIBS" + LIBS="$CURL_LIBS $LIBS" + ac_fn_c_check_func "$LINENO" "curl_multi_get_handles" "ac_cv_func_curl_multi_get_handles" +if test "x$ac_cv_func_curl_multi_get_handles" = xyes +then : + printf "%s\n" "#define HAVE_CURL_MULTI_GET_HANDLES 1" >>confdefs.h + +fi + + LIBS="$old_LIBS" + +fi + +fi + if test "x$CURL_LIBS" != "x"; then + HAVE_CURL_TRUE= + HAVE_CURL_FALSE='#' +else + HAVE_CURL_TRUE='#' + HAVE_CURL_FALSE= +fi + + + +# Check whether --with-ssh was given. +if test ${with_ssh+y} +then : + withval=$with_ssh; +else $as_nop + with_ssh=check +fi + +if test "$with_ssh" != "no" +then : + + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libssh >= 0.8.0" >&5 +printf %s "checking for libssh >= 0.8.0... " >&6; } + +if test -n "$SSH_CFLAGS"; then + pkg_cv_SSH_CFLAGS="$SSH_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libssh >= 0.8.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libssh >= 0.8.0") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SSH_CFLAGS=`$PKG_CONFIG --cflags "libssh >= 0.8.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$SSH_LIBS"; then + pkg_cv_SSH_LIBS="$SSH_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libssh >= 0.8.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libssh >= 0.8.0") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SSH_LIBS=`$PKG_CONFIG --libs "libssh >= 0.8.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + SSH_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libssh >= 0.8.0" 2>&1` + else + SSH_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libssh >= 0.8.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$SSH_PKG_ERRORS" >&5 + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: libssh not found, ssh plugin will be disabled" >&5 +printf "%s\n" "$as_me: WARNING: libssh not found, ssh plugin will be disabled" >&2;} +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: libssh not found, ssh plugin will be disabled" >&5 +printf "%s\n" "$as_me: WARNING: libssh not found, ssh plugin will be disabled" >&2;} +else + SSH_CFLAGS=$pkg_cv_SSH_CFLAGS + SSH_LIBS=$pkg_cv_SSH_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + + printf "libssh version is "; $PKG_CONFIG --modversion libssh + # Ubuntu 18.04 shipped prerelease of libssh-0.8.0 without + # SSH_OPTIONS_NODELAY + old_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $SSH_CFLAGS" + ac_fn_check_decl "$LINENO" "SSH_OPTIONS_NODELAY" "ac_cv_have_decl_SSH_OPTIONS_NODELAY" " + #include + +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_SSH_OPTIONS_NODELAY" = xyes +then : + + + + # We don't need this in the code, just in this configure + HAVE_SSH_OPTIONS_NODELAY=1 + +fi + CFLAGS="$old_CFLAGS" + +fi + +fi + if test "x$HAVE_SSH_OPTIONS_NODELAY" != "x"; then + HAVE_SSH_TRUE= + HAVE_SSH_FALSE='#' +else + HAVE_SSH_TRUE='#' + HAVE_SSH_FALSE= +fi + + +ISOPROG="no" +is_xorriso=0 + +# Check whether --with-iso was given. +if test ${with_iso+y} +then : + withval=$with_iso; +else $as_nop + with_iso=check +fi + +if test "$with_iso" != "no" +then : + + # Extract the first word of "xorriso", so it can be a program name with args. +set dummy xorriso; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_XORRISO+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$XORRISO"; then + ac_cv_prog_XORRISO="$XORRISO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_XORRISO="xorriso" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_XORRISO" && ac_cv_prog_XORRISO="no" +fi +fi +XORRISO=$ac_cv_prog_XORRISO +if test -n "$XORRISO"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $XORRISO" >&5 +printf "%s\n" "$XORRISO" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + # Extract the first word of "genisoimage", so it can be a program name with args. +set dummy genisoimage; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_GENISOIMAGE+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$GENISOIMAGE"; then + ac_cv_prog_GENISOIMAGE="$GENISOIMAGE" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_GENISOIMAGE="genisoimage" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_GENISOIMAGE" && ac_cv_prog_GENISOIMAGE="no" +fi +fi +GENISOIMAGE=$ac_cv_prog_GENISOIMAGE +if test -n "$GENISOIMAGE"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $GENISOIMAGE" >&5 +printf "%s\n" "$GENISOIMAGE" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + # Extract the first word of "mkisofs", so it can be a program name with args. +set dummy mkisofs; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_MKISOFS+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$MKISOFS"; then + ac_cv_prog_MKISOFS="$MKISOFS" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_MKISOFS="mkisofs" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_MKISOFS" && ac_cv_prog_MKISOFS="no" +fi +fi +MKISOFS=$ac_cv_prog_MKISOFS +if test -n "$MKISOFS"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MKISOFS" >&5 +printf "%s\n" "$MKISOFS" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + if test "x$XORRISO" != "xno" +then : + + ISOPROG="$XORRISO" + is_xorriso=1 + +else $as_nop + + if test "x$GENISOIMAGE" != "xno" +then : + + ISOPROG="$GENISOIMAGE" + +else $as_nop + + if test "x$MKISOFS" != "xno" +then : + + ISOPROG="$MKISOFS" + +fi + +fi + +fi + if test "x$ISOPROG" != "xno" +then : + + printf "picked %s for nbdkit-iso-plugin\n" "$ISOPROG" + +printf "%s\n" "#define ISOPROG \"$ISOPROG\"" >>confdefs.h + + if test "x$is_xorriso" = "x1" +then : + + +printf "%s\n" "#define ISOPROG_IS_XORRISO 1" >>confdefs.h + + +fi + +fi + +fi + + if test "x$ISOPROG" != "xno"; then + HAVE_ISO_TRUE= + HAVE_ISO_FALSE='#' +else + HAVE_ISO_TRUE='#' + HAVE_ISO_FALSE= +fi + + + +# Check whether --with-libvirt was given. +if test ${with_libvirt+y} +then : + withval=$with_libvirt; +else $as_nop + with_libvirt=check +fi + +if test "$with_libvirt" != "no" +then : + + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libvirt" >&5 +printf %s "checking for libvirt... " >&6; } + +if test -n "$LIBVIRT_CFLAGS"; then + pkg_cv_LIBVIRT_CFLAGS="$LIBVIRT_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libvirt\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libvirt") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBVIRT_CFLAGS=`$PKG_CONFIG --cflags "libvirt" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBVIRT_LIBS"; then + pkg_cv_LIBVIRT_LIBS="$LIBVIRT_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libvirt\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libvirt") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBVIRT_LIBS=`$PKG_CONFIG --libs "libvirt" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBVIRT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libvirt" 2>&1` + else + LIBVIRT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libvirt" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBVIRT_PKG_ERRORS" >&5 + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: libvirt not found, libvirt plugin will be disabled" >&5 +printf "%s\n" "$as_me: WARNING: libvirt not found, libvirt plugin will be disabled" >&2;} +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: libvirt not found, libvirt plugin will be disabled" >&5 +printf "%s\n" "$as_me: WARNING: libvirt not found, libvirt plugin will be disabled" >&2;} +else + LIBVIRT_CFLAGS=$pkg_cv_LIBVIRT_CFLAGS + LIBVIRT_LIBS=$pkg_cv_LIBVIRT_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + + + + +printf "%s\n" "#define HAVE_LIBVIRT 1" >>confdefs.h + + +fi + +fi + if test "x$LIBVIRT_LIBS" != "x"; then + HAVE_LIBVIRT_TRUE= + HAVE_LIBVIRT_FALSE='#' +else + HAVE_LIBVIRT_TRUE='#' + HAVE_LIBVIRT_FALSE= +fi + + + +# Check whether --with-zlib was given. +if test ${with_zlib+y} +then : + withval=$with_zlib; +else $as_nop + with_zlib=check +fi + +if test "$with_zlib" != "no" +then : + + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for zlib >= 1.2.3.5" >&5 +printf %s "checking for zlib >= 1.2.3.5... " >&6; } + +if test -n "$ZLIB_CFLAGS"; then + pkg_cv_ZLIB_CFLAGS="$ZLIB_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib >= 1.2.3.5\""; } >&5 + ($PKG_CONFIG --exists --print-errors "zlib >= 1.2.3.5") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_ZLIB_CFLAGS=`$PKG_CONFIG --cflags "zlib >= 1.2.3.5" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$ZLIB_LIBS"; then + pkg_cv_ZLIB_LIBS="$ZLIB_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib >= 1.2.3.5\""; } >&5 + ($PKG_CONFIG --exists --print-errors "zlib >= 1.2.3.5") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_ZLIB_LIBS=`$PKG_CONFIG --libs "zlib >= 1.2.3.5" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + ZLIB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "zlib >= 1.2.3.5" 2>&1` + else + ZLIB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "zlib >= 1.2.3.5" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$ZLIB_PKG_ERRORS" >&5 + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: zlib >= 1.2.3.5 not found, gzip filter will be disabled" >&5 +printf "%s\n" "$as_me: WARNING: zlib >= 1.2.3.5 not found, gzip filter will be disabled" >&2;} +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: zlib >= 1.2.3.5 not found, gzip filter will be disabled" >&5 +printf "%s\n" "$as_me: WARNING: zlib >= 1.2.3.5 not found, gzip filter will be disabled" >&2;} +else + ZLIB_CFLAGS=$pkg_cv_ZLIB_CFLAGS + ZLIB_LIBS=$pkg_cv_ZLIB_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + + + + +printf "%s\n" "#define HAVE_ZLIB 1" >>confdefs.h + + +fi + +fi + if test "x$ZLIB_LIBS" != "x"; then + HAVE_ZLIB_TRUE= + HAVE_ZLIB_FALSE='#' +else + HAVE_ZLIB_TRUE='#' + HAVE_ZLIB_FALSE= +fi + + + +# Check whether --with-zlib-ng was given. +if test ${with_zlib_ng+y} +then : + withval=$with_zlib_ng; +else $as_nop + with_zlib_ng=check +fi + +if test "$with_zlib_ng" != "no" +then : + + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for zlib-ng" >&5 +printf %s "checking for zlib-ng... " >&6; } + +if test -n "$ZLIB_NG_CFLAGS"; then + pkg_cv_ZLIB_NG_CFLAGS="$ZLIB_NG_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib-ng\""; } >&5 + ($PKG_CONFIG --exists --print-errors "zlib-ng") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_ZLIB_NG_CFLAGS=`$PKG_CONFIG --cflags "zlib-ng" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$ZLIB_NG_LIBS"; then + pkg_cv_ZLIB_NG_LIBS="$ZLIB_NG_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib-ng\""; } >&5 + ($PKG_CONFIG --exists --print-errors "zlib-ng") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_ZLIB_NG_LIBS=`$PKG_CONFIG --libs "zlib-ng" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + ZLIB_NG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "zlib-ng" 2>&1` + else + ZLIB_NG_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "zlib-ng" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$ZLIB_NG_PKG_ERRORS" >&5 + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: zlib-ng not found, zlib operations will run slower" >&5 +printf "%s\n" "$as_me: WARNING: zlib-ng not found, zlib operations will run slower" >&2;} +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: zlib-ng not found, zlib operations will run slower" >&5 +printf "%s\n" "$as_me: WARNING: zlib-ng not found, zlib operations will run slower" >&2;} +else + ZLIB_NG_CFLAGS=$pkg_cv_ZLIB_NG_CFLAGS + ZLIB_NG_LIBS=$pkg_cv_ZLIB_NG_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + + + + +printf "%s\n" "#define HAVE_ZLIB_NG 1" >>confdefs.h + + +fi + +fi + if test "x$ZLIB_LIBS" != "x"; then + HAVE_ZLIB_TRUE= + HAVE_ZLIB_FALSE='#' +else + HAVE_ZLIB_TRUE='#' + HAVE_ZLIB_FALSE= +fi + + + +# Check whether --with-libnbd was given. +if test ${with_libnbd+y} +then : + withval=$with_libnbd; +else $as_nop + with_libnbd=check +fi + +if test "$with_libnbd" != "no" +then : + + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libnbd >= 0.9.8" >&5 +printf %s "checking for libnbd >= 0.9.8... " >&6; } + +if test -n "$LIBNBD_CFLAGS"; then + pkg_cv_LIBNBD_CFLAGS="$LIBNBD_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnbd >= 0.9.8\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libnbd >= 0.9.8") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBNBD_CFLAGS=`$PKG_CONFIG --cflags "libnbd >= 0.9.8" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBNBD_LIBS"; then + pkg_cv_LIBNBD_LIBS="$LIBNBD_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnbd >= 0.9.8\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libnbd >= 0.9.8") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBNBD_LIBS=`$PKG_CONFIG --libs "libnbd >= 0.9.8" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBNBD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libnbd >= 0.9.8" 2>&1` + else + LIBNBD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libnbd >= 0.9.8" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBNBD_PKG_ERRORS" >&5 + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: libnbd >= 0.9.8 not found, nbd plugin will be crippled" >&5 +printf "%s\n" "$as_me: WARNING: libnbd >= 0.9.8 not found, nbd plugin will be crippled" >&2;} +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: libnbd >= 0.9.8 not found, nbd plugin will be crippled" >&5 +printf "%s\n" "$as_me: WARNING: libnbd >= 0.9.8 not found, nbd plugin will be crippled" >&2;} +else + LIBNBD_CFLAGS=$pkg_cv_LIBNBD_CFLAGS + LIBNBD_LIBS=$pkg_cv_LIBNBD_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + + printf "libnbd version is "; $PKG_CONFIG --modversion libnbd + + + +printf "%s\n" "#define HAVE_LIBNBD 1" >>confdefs.h + + +fi + +fi + +# Check whether --enable-nbd-plugin was given. +if test ${enable_nbd_plugin+y} +then : + enableval=$enable_nbd_plugin; +else $as_nop + enable_nbd_plugin=yes +fi + + if test "x$LIBNBD_LIBS" != "x" && test "x$enable_nbd_plugin" = "xyes"; then + HAVE_LIBNBD_TRUE= + HAVE_LIBNBD_FALSE='#' +else + HAVE_LIBNBD_TRUE='#' + HAVE_LIBNBD_FALSE= +fi + + + +# Check whether --with-liblzma was given. +if test ${with_liblzma+y} +then : + withval=$with_liblzma; +else $as_nop + with_liblzma=check +fi + +if test "$with_liblzma" != "no" +then : + + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for liblzma" >&5 +printf %s "checking for liblzma... " >&6; } + +if test -n "$LIBLZMA_CFLAGS"; then + pkg_cv_LIBLZMA_CFLAGS="$LIBLZMA_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"liblzma\""; } >&5 + ($PKG_CONFIG --exists --print-errors "liblzma") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBLZMA_CFLAGS=`$PKG_CONFIG --cflags "liblzma" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBLZMA_LIBS"; then + pkg_cv_LIBLZMA_LIBS="$LIBLZMA_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"liblzma\""; } >&5 + ($PKG_CONFIG --exists --print-errors "liblzma") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBLZMA_LIBS=`$PKG_CONFIG --libs "liblzma" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBLZMA_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "liblzma" 2>&1` + else + LIBLZMA_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "liblzma" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBLZMA_PKG_ERRORS" >&5 + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: liblzma not found, xz filter will be disabled" >&5 +printf "%s\n" "$as_me: WARNING: liblzma not found, xz filter will be disabled" >&2;} +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: liblzma not found, xz filter will be disabled" >&5 +printf "%s\n" "$as_me: WARNING: liblzma not found, xz filter will be disabled" >&2;} +else + LIBLZMA_CFLAGS=$pkg_cv_LIBLZMA_CFLAGS + LIBLZMA_LIBS=$pkg_cv_LIBLZMA_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + + + + +printf "%s\n" "#define HAVE_LIBLZMA 1" >>confdefs.h + + +fi + +fi + if test "x$LIBLZMA_LIBS" != "x"; then + HAVE_LIBLZMA_TRUE= + HAVE_LIBLZMA_FALSE='#' +else + HAVE_LIBLZMA_TRUE='#' + HAVE_LIBLZMA_FALSE= +fi + + + +# Check whether --with-libzstd was given. +if test ${with_libzstd+y} +then : + withval=$with_libzstd; +else $as_nop + with_libzstd=check +fi + +if test "$with_libzstd" != "no" +then : + + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libzstd" >&5 +printf %s "checking for libzstd... " >&6; } + +if test -n "$LIBZSTD_CFLAGS"; then + pkg_cv_LIBZSTD_CFLAGS="$LIBZSTD_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libzstd\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libzstd") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBZSTD_CFLAGS=`$PKG_CONFIG --cflags "libzstd" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBZSTD_LIBS"; then + pkg_cv_LIBZSTD_LIBS="$LIBZSTD_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libzstd\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libzstd") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBZSTD_LIBS=`$PKG_CONFIG --libs "libzstd" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBZSTD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libzstd" 2>&1` + else + LIBZSTD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libzstd" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBZSTD_PKG_ERRORS" >&5 + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: libzstd not found, allocator=zstd will be disabled" >&5 +printf "%s\n" "$as_me: WARNING: libzstd not found, allocator=zstd will be disabled" >&2;} +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: libzstd not found, allocator=zstd will be disabled" >&5 +printf "%s\n" "$as_me: WARNING: libzstd not found, allocator=zstd will be disabled" >&2;} +else + LIBZSTD_CFLAGS=$pkg_cv_LIBZSTD_CFLAGS + LIBZSTD_LIBS=$pkg_cv_LIBZSTD_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + + + + +printf "%s\n" "#define HAVE_LIBZSTD 1" >>confdefs.h + + +fi + +fi + if test "x$LIBZSTD_LIBS" != "x"; then + HAVE_LIBZSTD_TRUE= + HAVE_LIBZSTD_FALSE='#' +else + HAVE_LIBZSTD_TRUE='#' + HAVE_LIBZSTD_FALSE= +fi + + + +# Check whether --with-libguestfs was given. +if test ${with_libguestfs+y} +then : + withval=$with_libguestfs; +else $as_nop + with_libguestfs=check +fi + +if test "$with_libguestfs" != "no" +then : + + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libguestfs" >&5 +printf %s "checking for libguestfs... " >&6; } + +if test -n "$LIBGUESTFS_CFLAGS"; then + pkg_cv_LIBGUESTFS_CFLAGS="$LIBGUESTFS_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libguestfs\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libguestfs") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBGUESTFS_CFLAGS=`$PKG_CONFIG --cflags "libguestfs" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBGUESTFS_LIBS"; then + pkg_cv_LIBGUESTFS_LIBS="$LIBGUESTFS_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libguestfs\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libguestfs") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBGUESTFS_LIBS=`$PKG_CONFIG --libs "libguestfs" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBGUESTFS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libguestfs" 2>&1` + else + LIBGUESTFS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libguestfs" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBGUESTFS_PKG_ERRORS" >&5 + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: libguestfs not found, guestfs plugin and tests will be disabled" >&5 +printf "%s\n" "$as_me: WARNING: libguestfs not found, guestfs plugin and tests will be disabled" >&2;} +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: libguestfs not found, guestfs plugin and tests will be disabled" >&5 +printf "%s\n" "$as_me: WARNING: libguestfs not found, guestfs plugin and tests will be disabled" >&2;} +else + LIBGUESTFS_CFLAGS=$pkg_cv_LIBGUESTFS_CFLAGS + LIBGUESTFS_LIBS=$pkg_cv_LIBGUESTFS_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + + # Although the library was found, we want to make sure it supports nbd + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include + +int +main (void) +{ + +#ifndef GUESTFS_ADD_DRIVE_OPTS_PROTOCOL +#error unsupported +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + + + + +printf "%s\n" "#define HAVE_LIBGUESTFS 1" >>confdefs.h + + +else $as_nop + + LIBGUESTFS_LIBS= + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: libguestfs too old, guestfs plugin and tests will be disabled" >&5 +printf "%s\n" "$as_me: WARNING: libguestfs too old, guestfs plugin and tests will be disabled" >&2;} +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi + +fi + if test "x$LIBGUESTFS_LIBS" != "x"; then + HAVE_LIBGUESTFS_TRUE= + HAVE_LIBGUESTFS_FALSE='#' +else + HAVE_LIBGUESTFS_TRUE='#' + HAVE_LIBGUESTFS_FALSE= +fi + + +# Check whether --enable-libguestfs-tests was given. +if test ${enable_libguestfs_tests+y} +then : + enableval=$enable_libguestfs_tests; +else $as_nop + enable_libguestfs_tests=check + +fi + + if test "x$LIBGUESTFS_LIBS" != "x" && \ + test "x$enable_libguestfs_tests" != "xno"; then + USE_LIBGUESTFS_FOR_TESTS_TRUE= + USE_LIBGUESTFS_FOR_TESTS_FALSE='#' +else + USE_LIBGUESTFS_FOR_TESTS_TRUE='#' + USE_LIBGUESTFS_FOR_TESTS_FALSE= +fi + + + +# Check whether --with-ext2 was given. +if test ${with_ext2+y} +then : + withval=$with_ext2; +else $as_nop + with_ext2=check +fi + +if test "$with_ext2" != "no" +then : + + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ext2fs" >&5 +printf %s "checking for ext2fs... " >&6; } + +if test -n "$EXT2FS_CFLAGS"; then + pkg_cv_EXT2FS_CFLAGS="$EXT2FS_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ext2fs\""; } >&5 + ($PKG_CONFIG --exists --print-errors "ext2fs") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_EXT2FS_CFLAGS=`$PKG_CONFIG --cflags "ext2fs" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$EXT2FS_LIBS"; then + pkg_cv_EXT2FS_LIBS="$EXT2FS_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ext2fs\""; } >&5 + ($PKG_CONFIG --exists --print-errors "ext2fs") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_EXT2FS_LIBS=`$PKG_CONFIG --libs "ext2fs" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + EXT2FS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "ext2fs" 2>&1` + else + EXT2FS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "ext2fs" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$EXT2FS_PKG_ERRORS" >&5 + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: ext2fs not found, ext2 filter will be disabled" >&5 +printf "%s\n" "$as_me: WARNING: ext2fs not found, ext2 filter will be disabled" >&2;} +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: ext2fs not found, ext2 filter will be disabled" >&5 +printf "%s\n" "$as_me: WARNING: ext2fs not found, ext2 filter will be disabled" >&2;} +else + EXT2FS_CFLAGS=$pkg_cv_EXT2FS_CFLAGS + EXT2FS_LIBS=$pkg_cv_EXT2FS_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + + + + +printf "%s\n" "#define HAVE_EXT2FS 1" >>confdefs.h + + +fi + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for com_err" >&5 +printf %s "checking for com_err... " >&6; } + +if test -n "$COM_ERR_CFLAGS"; then + pkg_cv_COM_ERR_CFLAGS="$COM_ERR_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"com_err\""; } >&5 + ($PKG_CONFIG --exists --print-errors "com_err") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_COM_ERR_CFLAGS=`$PKG_CONFIG --cflags "com_err" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$COM_ERR_LIBS"; then + pkg_cv_COM_ERR_LIBS="$COM_ERR_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"com_err\""; } >&5 + ($PKG_CONFIG --exists --print-errors "com_err") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_COM_ERR_LIBS=`$PKG_CONFIG --libs "com_err" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + COM_ERR_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "com_err" 2>&1` + else + COM_ERR_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "com_err" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$COM_ERR_PKG_ERRORS" >&5 + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: com_err not found, ext2 filter will be disabled" >&5 +printf "%s\n" "$as_me: WARNING: com_err not found, ext2 filter will be disabled" >&2;} +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: com_err not found, ext2 filter will be disabled" >&5 +printf "%s\n" "$as_me: WARNING: com_err not found, ext2 filter will be disabled" >&2;} +else + COM_ERR_CFLAGS=$pkg_cv_COM_ERR_CFLAGS + COM_ERR_LIBS=$pkg_cv_COM_ERR_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + + + + +printf "%s\n" "#define HAVE_COM_ERR 1" >>confdefs.h + + +fi + + ac_fn_c_check_member "$LINENO" "struct struct_io_manager" "cache_readahead" "ac_cv_member_struct_struct_io_manager_cache_readahead" "$ac_includes_default" +if test "x$ac_cv_member_struct_struct_io_manager_cache_readahead" = xyes +then : + +printf "%s\n" "#define HAVE_STRUCT_STRUCT_IO_MANAGER_CACHE_READAHEAD 1" >>confdefs.h + + +fi +ac_fn_c_check_member "$LINENO" "struct struct_io_manager" "zeroout" "ac_cv_member_struct_struct_io_manager_zeroout" "$ac_includes_default" +if test "x$ac_cv_member_struct_struct_io_manager_zeroout" = xyes +then : + +printf "%s\n" "#define HAVE_STRUCT_STRUCT_IO_MANAGER_ZEROOUT 1" >>confdefs.h + + +fi + + +fi + if test "x$EXT2FS_LIBS" != "x" && test "x$COM_ERR_LIBS" != "x"; then + HAVE_EXT2_TRUE= + HAVE_EXT2_FALSE='#' +else + HAVE_EXT2_TRUE='#' + HAVE_EXT2_FALSE= +fi + + +# Check whether --enable-torrent was given. +if test ${enable_torrent+y} +then : + enableval=$enable_torrent; +else $as_nop + enable_torrent=check + +fi + +if test "x$enable_torrent" != "xno" +then : + + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libtorrent-rasterbar" >&5 +printf %s "checking for libtorrent-rasterbar... " >&6; } + +if test -n "$LIBTORRENT_CFLAGS"; then + pkg_cv_LIBTORRENT_CFLAGS="$LIBTORRENT_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtorrent-rasterbar\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libtorrent-rasterbar") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBTORRENT_CFLAGS=`$PKG_CONFIG --cflags "libtorrent-rasterbar" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBTORRENT_LIBS"; then + pkg_cv_LIBTORRENT_LIBS="$LIBTORRENT_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtorrent-rasterbar\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libtorrent-rasterbar") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBTORRENT_LIBS=`$PKG_CONFIG --libs "libtorrent-rasterbar" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBTORRENT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libtorrent-rasterbar" 2>&1` + else + LIBTORRENT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libtorrent-rasterbar" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBTORRENT_PKG_ERRORS" >&5 + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: libtorrent-rasterbar not found, bittorrent plugin will be disabled" >&5 +printf "%s\n" "$as_me: WARNING: libtorrent-rasterbar not found, bittorrent plugin will be disabled" >&2;} +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: libtorrent-rasterbar not found, bittorrent plugin will be disabled" >&5 +printf "%s\n" "$as_me: WARNING: libtorrent-rasterbar not found, bittorrent plugin will be disabled" >&2;} +else + LIBTORRENT_CFLAGS=$pkg_cv_LIBTORRENT_CFLAGS + LIBTORRENT_LIBS=$pkg_cv_LIBTORRENT_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + + + + +fi + +fi + if test "x$have_cxx" = "xyes" && test "x$LIBTORRENT_LIBS" != "x"; then + HAVE_TORRENT_TRUE= + HAVE_TORRENT_FALSE='#' +else + HAVE_TORRENT_TRUE='#' + HAVE_TORRENT_FALSE= +fi + + +# Check whether --enable-vddk was given. +if test ${enable_vddk+y} +then : + enableval=$enable_vddk; +else $as_nop + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the host CPU is compatible with VDDK" >&5 +printf %s "checking if the host CPU is compatible with VDDK... " >&6; } + if test "$host_cpu" = "x86_64" && test "$host_os" = "linux-gnu" +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes ($host)" >&5 +printf "%s\n" "yes ($host)" >&6; } + enable_vddk=yes + +else $as_nop + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no ($host)" >&5 +printf "%s\n" "no ($host)" >&6; } + enable_vddk=no + +fi + +fi + + if test "x$enable_vddk" = "xyes"; then + HAVE_VDDK_TRUE= + HAVE_VDDK_FALSE='#' +else + HAVE_VDDK_TRUE='#' + HAVE_VDDK_FALSE= +fi + + +NBDKIT_VERSION_MAJOR=1 +NBDKIT_VERSION_MINOR=36 +NBDKIT_VERSION_MICRO=2 + + + + +ac_config_headers="$ac_config_headers config.h" + +ac_config_files="$ac_config_files podwrapper.pl" + +ac_config_files="$ac_config_files common/protocol/generate-protostrings.sh" + +ac_config_files="$ac_config_files tests/make-pki.sh" + +ac_config_files="$ac_config_files Makefile bash-completion/Makefile common/allocators/Makefile common/bitmap/Makefile common/gpt/Makefile common/include/Makefile common/protocol/Makefile common/regions/Makefile common/replacements/Makefile common/replacements/win32/Makefile common/utils/Makefile contrib/Makefile docs/Makefile include/Makefile include/nbdkit-version.h plugins/Makefile plugins/blkio/Makefile plugins/cc/Makefile plugins/cdi/Makefile plugins/curl/Makefile plugins/data/Makefile plugins/eval/Makefile plugins/example1/Makefile plugins/example2/Makefile plugins/example3/Makefile plugins/example4/Makefile plugins/file/Makefile plugins/floppy/Makefile plugins/full/Makefile plugins/golang/Makefile plugins/guestfs/Makefile plugins/info/Makefile plugins/iso/Makefile plugins/libvirt/Makefile plugins/linuxdisk/Makefile plugins/lua/Makefile plugins/memory/Makefile plugins/nbd/Makefile plugins/null/Makefile plugins/ocaml/Makefile plugins/ondemand/Makefile plugins/ones/Makefile plugins/partitioning/Makefile plugins/pattern/Makefile plugins/perl/Makefile plugins/python/Makefile plugins/random/Makefile plugins/ruby/Makefile plugins/rust/Makefile plugins/S3/Makefile plugins/sh/Makefile plugins/ssh/Makefile plugins/sparse-random/Makefile plugins/split/Makefile plugins/tcl/Makefile plugins/tmpdisk/Makefile plugins/torrent/Makefile plugins/vddk/Makefile plugins/zero/Makefile filters/Makefile filters/blocksize/Makefile filters/blocksize-policy/Makefile filters/cache/Makefile filters/cacheextents/Makefile filters/checkwrite/Makefile filters/cow/Makefile filters/ddrescue/Makefile filters/delay/Makefile filters/error/Makefile filters/exitlast/Makefile filters/exitwhen/Makefile filters/exportname/Makefile filters/ext2/Makefile filters/extentlist/Makefile filters/evil/Makefile filters/fua/Makefile filters/gzip/Makefile filters/ip/Makefile filters/limit/Makefile filters/log/Makefile filters/luks/Makefile filters/multi-conn/Makefile filters/nocache/Makefile filters/noextents/Makefile filters/nofilter/Makefile filters/noparallel/Makefile filters/nozero/Makefile filters/offset/Makefile filters/partition/Makefile filters/pause/Makefile filters/protect/Makefile filters/qcow2dec/Makefile filters/rate/Makefile filters/readahead/Makefile filters/retry/Makefile filters/retry-request/Makefile filters/scan/Makefile filters/stats/Makefile filters/swab/Makefile filters/tar/Makefile filters/tls-fallback/Makefile filters/truncate/Makefile filters/xz/Makefile fuzzing/Makefile server/local/nbdkit.pc server/Makefile server/nbdkit.pc tests/functions.sh tests/Makefile valgrind/Makefile" + + +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_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$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= ;; #( + *) { eval $ac_var=; 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+y} || &/ + 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 + if test "x$cache_file" != "x/dev/null"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$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= +U= +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=`printf "%s\n" "$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. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +printf %s "checking that generated files are newer than configure... " >&6; } + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 +printf "%s\n" "done" >&6; } +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + if test -n "$EXEEXT"; then + am__EXEEXT_TRUE= + am__EXEEXT_FALSE='#' +else + am__EXEEXT_TRUE='#' + am__EXEEXT_FALSE= +fi + + +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_CXX_TRUE}" && test -z "${HAVE_CXX_FALSE}"; then + as_fn_error $? "conditional \"HAVE_CXX\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${CAN_TEST_ANSI_C_TRUE}" && test -z "${CAN_TEST_ANSI_C_FALSE}"; then + as_fn_error $? "conditional \"CAN_TEST_ANSI_C\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_ICONV_TRUE}" && test -z "${HAVE_ICONV_FALSE}"; then + as_fn_error $? "conditional \"HAVE_ICONV\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${IS_WINDOWS_TRUE}" && test -z "${IS_WINDOWS_FALSE}"; then + as_fn_error $? "conditional \"IS_WINDOWS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_GLIBC_234_TRUE}" && test -z "${HAVE_GLIBC_234_FALSE}"; then + as_fn_error $? "conditional \"HAVE_GLIBC_234\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_GNUTLS_TRUE}" && test -z "${HAVE_GNUTLS_FALSE}"; then + as_fn_error $? "conditional \"HAVE_GNUTLS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_GNUTLS_PBKDF2_TRUE}" && test -z "${HAVE_GNUTLS_PBKDF2_FALSE}"; then + as_fn_error $? "conditional \"HAVE_GNUTLS_PBKDF2\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_MKE2FS_WITH_D_TRUE}" && test -z "${HAVE_MKE2FS_WITH_D_FALSE}"; then + as_fn_error $? "conditional \"HAVE_MKE2FS_WITH_D\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_LIBFUZZER_TRUE}" && test -z "${ENABLE_LIBFUZZER_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_LIBFUZZER\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${USE_LINKER_SCRIPT_TRUE}" && test -z "${USE_LINKER_SCRIPT_FALSE}"; then + as_fn_error $? "conditional \"USE_LINKER_SCRIPT\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_BASH_COMPLETION_TRUE}" && test -z "${HAVE_BASH_COMPLETION_FALSE}"; then + as_fn_error $? "conditional \"HAVE_BASH_COMPLETION\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_POD_TRUE}" && test -z "${HAVE_POD_FALSE}"; then + as_fn_error $? "conditional \"HAVE_POD\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_PLUGINS_TRUE}" && test -z "${HAVE_PLUGINS_FALSE}"; then + as_fn_error $? "conditional \"HAVE_PLUGINS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_PERL_TRUE}" && test -z "${HAVE_PERL_FALSE}"; then + as_fn_error $? "conditional \"HAVE_PERL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_PYTHON_TRUE}" && test -z "${HAVE_PYTHON_FALSE}"; then + as_fn_error $? "conditional \"HAVE_PYTHON\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_OCAML_TRUE}" && test -z "${HAVE_OCAML_FALSE}"; then + as_fn_error $? "conditional \"HAVE_OCAML\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_OCAMLDOC_TRUE}" && test -z "${HAVE_OCAMLDOC_FALSE}"; then + as_fn_error $? "conditional \"HAVE_OCAMLDOC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_RUST_TRUE}" && test -z "${HAVE_RUST_FALSE}"; then + as_fn_error $? "conditional \"HAVE_RUST\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_RUBY_TRUE}" && test -z "${HAVE_RUBY_FALSE}"; then + as_fn_error $? "conditional \"HAVE_RUBY\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_TCL_TRUE}" && test -z "${HAVE_TCL_FALSE}"; then + as_fn_error $? "conditional \"HAVE_TCL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_LUA_TRUE}" && test -z "${HAVE_LUA_FALSE}"; then + as_fn_error $? "conditional \"HAVE_LUA\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_GOLANG_TRUE}" && test -z "${HAVE_GOLANG_FALSE}"; then + as_fn_error $? "conditional \"HAVE_GOLANG\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_LIBBLKIO_TRUE}" && test -z "${HAVE_LIBBLKIO_FALSE}"; then + as_fn_error $? "conditional \"HAVE_LIBBLKIO\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_CURL_TRUE}" && test -z "${HAVE_CURL_FALSE}"; then + as_fn_error $? "conditional \"HAVE_CURL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_SSH_TRUE}" && test -z "${HAVE_SSH_FALSE}"; then + as_fn_error $? "conditional \"HAVE_SSH\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_ISO_TRUE}" && test -z "${HAVE_ISO_FALSE}"; then + as_fn_error $? "conditional \"HAVE_ISO\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_LIBVIRT_TRUE}" && test -z "${HAVE_LIBVIRT_FALSE}"; then + as_fn_error $? "conditional \"HAVE_LIBVIRT\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_ZLIB_TRUE}" && test -z "${HAVE_ZLIB_FALSE}"; then + as_fn_error $? "conditional \"HAVE_ZLIB\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_ZLIB_TRUE}" && test -z "${HAVE_ZLIB_FALSE}"; then + as_fn_error $? "conditional \"HAVE_ZLIB\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_LIBNBD_TRUE}" && test -z "${HAVE_LIBNBD_FALSE}"; then + as_fn_error $? "conditional \"HAVE_LIBNBD\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_LIBLZMA_TRUE}" && test -z "${HAVE_LIBLZMA_FALSE}"; then + as_fn_error $? "conditional \"HAVE_LIBLZMA\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_LIBZSTD_TRUE}" && test -z "${HAVE_LIBZSTD_FALSE}"; then + as_fn_error $? "conditional \"HAVE_LIBZSTD\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_LIBGUESTFS_TRUE}" && test -z "${HAVE_LIBGUESTFS_FALSE}"; then + as_fn_error $? "conditional \"HAVE_LIBGUESTFS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${USE_LIBGUESTFS_FOR_TESTS_TRUE}" && test -z "${USE_LIBGUESTFS_FOR_TESTS_FALSE}"; then + as_fn_error $? "conditional \"USE_LIBGUESTFS_FOR_TESTS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_EXT2_TRUE}" && test -z "${HAVE_EXT2_FALSE}"; then + as_fn_error $? "conditional \"HAVE_EXT2\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_TORRENT_TRUE}" && test -z "${HAVE_TORRENT_FALSE}"; then + as_fn_error $? "conditional \"HAVE_TORRENT\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_VDDK_TRUE}" && test -z "${HAVE_VDDK_FALSE}"; then + as_fn_error $? "conditional \"HAVE_VDDK\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_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} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +as_nop=: +if test ${ZSH_VERSION+y} && (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 $as_nop + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. +as_nl=' +' +export as_nl +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi + +# The user is always right. +if ${PATH_SEPARATOR+false} :; 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 + + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + 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 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + printf "%s\n" "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else $as_nop + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else $as_nop + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +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 + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# 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 + + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + +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 -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`printf "%s\n" "$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 || +printf "%s\n" 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_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# 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 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=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 nbdkit $as_me 1.36.2, which was +generated by GNU Autoconf 2.71. 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 + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +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 and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + 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 the package provider." + +_ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config='$ac_cs_config_escaped' +ac_cs_version="\\ +nbdkit config.status 1.36.2 +configured by $0, generated by GNU Autoconf 2.71, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2021 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=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + 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 ) + printf "%s\n" "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + printf "%s\n" "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + printf "%s\n" "$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_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append 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 + \printf "%s\n" "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 + printf "%s\n" "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" + + +# 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' +macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' +macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' +AS='`$ECHO "$AS" | $SED "$delay_single_quote_subst"`' +DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' +OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' +enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' +enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' +pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' +enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' +shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`' +SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' +ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' +PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' +host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' +host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' +host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' +build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' +build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' +build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' +SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' +Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' +GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' +EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' +FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' +LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' +NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' +LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' +max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' +ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' +exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' +lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' +lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' +lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' +lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' +lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' +reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' +reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' +FILECMD='`$ECHO "$FILECMD" | $SED "$delay_single_quote_subst"`' +deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' +file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' +file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' +want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' +sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' +AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' +lt_ar_flags='`$ECHO "$lt_ar_flags" | $SED "$delay_single_quote_subst"`' +AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' +archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' +STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' +RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' +old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' +old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' +lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' +CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' +CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' +compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' +GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' +lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $SED "$delay_single_quote_subst"`' +nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' +lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' +lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $SED "$delay_single_quote_subst"`' +objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' +MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' +need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' +MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' +DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' +NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' +LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' +OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' +OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' +libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' +shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' +extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' +compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' +module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' +with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' +no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' +hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' +hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' +inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' +link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' +always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' +exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' +include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' +prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' +postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' +file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' +variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' +need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' +need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' +version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' +runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' +libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' +library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' +soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' +install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' +postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' +postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' +finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' +hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' +sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' +configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`' +configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`' +hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' +enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' +old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' +striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`' +predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`' +postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`' +predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`' +postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`' +LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`' +reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`' +reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`' +old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' +compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`' +GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' +compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`' +archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' +module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' +with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' +no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`' +inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`' +link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`' +always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`' +exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`' +include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`' +prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`' +postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`' +file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`' +predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`' +postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`' +predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`' +postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`' + +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + +# Quote evaled strings. +for var in AS \ +DLLTOOL \ +OBJDUMP \ +SHELL \ +ECHO \ +PATH_SEPARATOR \ +SED \ +GREP \ +EGREP \ +FGREP \ +LD \ +NM \ +LN_S \ +lt_SP2NL \ +lt_NL2SP \ +reload_flag \ +FILECMD \ +deplibs_check_method \ +file_magic_cmd \ +file_magic_glob \ +want_nocaseglob \ +sharedlib_from_linklib_cmd \ +AR \ +archiver_list_spec \ +STRIP \ +RANLIB \ +CC \ +CFLAGS \ +compiler \ +lt_cv_sys_global_symbol_pipe \ +lt_cv_sys_global_symbol_to_cdecl \ +lt_cv_sys_global_symbol_to_import \ +lt_cv_sys_global_symbol_to_c_name_address \ +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ +lt_cv_nm_interface \ +nm_file_list_spec \ +lt_cv_truncate_bin \ +lt_prog_compiler_no_builtin_flag \ +lt_prog_compiler_pic \ +lt_prog_compiler_wl \ +lt_prog_compiler_static \ +lt_cv_prog_compiler_c_o \ +need_locks \ +MANIFEST_TOOL \ +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_separator \ +exclude_expsyms \ +include_expsyms \ +file_list_spec \ +variables_saved_for_relink \ +libname_spec \ +library_names_spec \ +soname_spec \ +install_override_mode \ +finish_eval \ +old_striplib \ +striplib \ +compiler_lib_search_dirs \ +predep_objects \ +postdep_objects \ +predeps \ +postdeps \ +compiler_lib_search_path \ +LD_CXX \ +reload_flag_CXX \ +compiler_CXX \ +lt_prog_compiler_no_builtin_flag_CXX \ +lt_prog_compiler_pic_CXX \ +lt_prog_compiler_wl_CXX \ +lt_prog_compiler_static_CXX \ +lt_cv_prog_compiler_c_o_CXX \ +export_dynamic_flag_spec_CXX \ +whole_archive_flag_spec_CXX \ +compiler_needs_object_CXX \ +with_gnu_ld_CXX \ +allow_undefined_flag_CXX \ +no_undefined_flag_CXX \ +hardcode_libdir_flag_spec_CXX \ +hardcode_libdir_separator_CXX \ +exclude_expsyms_CXX \ +include_expsyms_CXX \ +file_list_spec_CXX \ +compiler_lib_search_dirs_CXX \ +predep_objects_CXX \ +postdep_objects_CXX \ +predeps_CXX \ +postdeps_CXX \ +compiler_lib_search_path_CXX; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + 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 \ +postlink_cmds \ +postinstall_cmds \ +postuninstall_cmds \ +finish_cmds \ +sys_lib_search_path_spec \ +configure_time_dlsearch_path \ +configure_time_lt_sys_library_path \ +reload_cmds_CXX \ +old_archive_cmds_CXX \ +old_archive_from_new_cmds_CXX \ +old_archive_from_expsyms_cmds_CXX \ +archive_cmds_CXX \ +archive_expsym_cmds_CXX \ +module_cmds_CXX \ +module_expsym_cmds_CXX \ +export_symbols_cmds_CXX \ +prelink_cmds_CXX \ +postlink_cmds_CXX; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +ac_aux_dir='$ac_aux_dir' + +# See if we are running on zsh, and set the options that 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' + 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 + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "podwrapper.pl") CONFIG_FILES="$CONFIG_FILES podwrapper.pl" ;; + "common/protocol/generate-protostrings.sh") CONFIG_FILES="$CONFIG_FILES common/protocol/generate-protostrings.sh" ;; + "tests/make-pki.sh") CONFIG_FILES="$CONFIG_FILES tests/make-pki.sh" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "bash-completion/Makefile") CONFIG_FILES="$CONFIG_FILES bash-completion/Makefile" ;; + "common/allocators/Makefile") CONFIG_FILES="$CONFIG_FILES common/allocators/Makefile" ;; + "common/bitmap/Makefile") CONFIG_FILES="$CONFIG_FILES common/bitmap/Makefile" ;; + "common/gpt/Makefile") CONFIG_FILES="$CONFIG_FILES common/gpt/Makefile" ;; + "common/include/Makefile") CONFIG_FILES="$CONFIG_FILES common/include/Makefile" ;; + "common/protocol/Makefile") CONFIG_FILES="$CONFIG_FILES common/protocol/Makefile" ;; + "common/regions/Makefile") CONFIG_FILES="$CONFIG_FILES common/regions/Makefile" ;; + "common/replacements/Makefile") CONFIG_FILES="$CONFIG_FILES common/replacements/Makefile" ;; + "common/replacements/win32/Makefile") CONFIG_FILES="$CONFIG_FILES common/replacements/win32/Makefile" ;; + "common/utils/Makefile") CONFIG_FILES="$CONFIG_FILES common/utils/Makefile" ;; + "contrib/Makefile") CONFIG_FILES="$CONFIG_FILES contrib/Makefile" ;; + "docs/Makefile") CONFIG_FILES="$CONFIG_FILES docs/Makefile" ;; + "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; + "include/nbdkit-version.h") CONFIG_FILES="$CONFIG_FILES include/nbdkit-version.h" ;; + "plugins/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/Makefile" ;; + "plugins/blkio/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/blkio/Makefile" ;; + "plugins/cc/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/cc/Makefile" ;; + "plugins/cdi/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/cdi/Makefile" ;; + "plugins/curl/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/curl/Makefile" ;; + "plugins/data/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/data/Makefile" ;; + "plugins/eval/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/eval/Makefile" ;; + "plugins/example1/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/example1/Makefile" ;; + "plugins/example2/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/example2/Makefile" ;; + "plugins/example3/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/example3/Makefile" ;; + "plugins/example4/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/example4/Makefile" ;; + "plugins/file/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/file/Makefile" ;; + "plugins/floppy/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/floppy/Makefile" ;; + "plugins/full/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/full/Makefile" ;; + "plugins/golang/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/golang/Makefile" ;; + "plugins/guestfs/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/guestfs/Makefile" ;; + "plugins/info/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/info/Makefile" ;; + "plugins/iso/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/iso/Makefile" ;; + "plugins/libvirt/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/libvirt/Makefile" ;; + "plugins/linuxdisk/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/linuxdisk/Makefile" ;; + "plugins/lua/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/lua/Makefile" ;; + "plugins/memory/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/memory/Makefile" ;; + "plugins/nbd/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/nbd/Makefile" ;; + "plugins/null/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/null/Makefile" ;; + "plugins/ocaml/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/ocaml/Makefile" ;; + "plugins/ondemand/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/ondemand/Makefile" ;; + "plugins/ones/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/ones/Makefile" ;; + "plugins/partitioning/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/partitioning/Makefile" ;; + "plugins/pattern/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/pattern/Makefile" ;; + "plugins/perl/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/perl/Makefile" ;; + "plugins/python/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/python/Makefile" ;; + "plugins/random/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/random/Makefile" ;; + "plugins/ruby/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/ruby/Makefile" ;; + "plugins/rust/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/rust/Makefile" ;; + "plugins/S3/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/S3/Makefile" ;; + "plugins/sh/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/sh/Makefile" ;; + "plugins/ssh/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/ssh/Makefile" ;; + "plugins/sparse-random/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/sparse-random/Makefile" ;; + "plugins/split/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/split/Makefile" ;; + "plugins/tcl/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/tcl/Makefile" ;; + "plugins/tmpdisk/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/tmpdisk/Makefile" ;; + "plugins/torrent/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/torrent/Makefile" ;; + "plugins/vddk/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/vddk/Makefile" ;; + "plugins/zero/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/zero/Makefile" ;; + "filters/Makefile") CONFIG_FILES="$CONFIG_FILES filters/Makefile" ;; + "filters/blocksize/Makefile") CONFIG_FILES="$CONFIG_FILES filters/blocksize/Makefile" ;; + "filters/blocksize-policy/Makefile") CONFIG_FILES="$CONFIG_FILES filters/blocksize-policy/Makefile" ;; + "filters/cache/Makefile") CONFIG_FILES="$CONFIG_FILES filters/cache/Makefile" ;; + "filters/cacheextents/Makefile") CONFIG_FILES="$CONFIG_FILES filters/cacheextents/Makefile" ;; + "filters/checkwrite/Makefile") CONFIG_FILES="$CONFIG_FILES filters/checkwrite/Makefile" ;; + "filters/cow/Makefile") CONFIG_FILES="$CONFIG_FILES filters/cow/Makefile" ;; + "filters/ddrescue/Makefile") CONFIG_FILES="$CONFIG_FILES filters/ddrescue/Makefile" ;; + "filters/delay/Makefile") CONFIG_FILES="$CONFIG_FILES filters/delay/Makefile" ;; + "filters/error/Makefile") CONFIG_FILES="$CONFIG_FILES filters/error/Makefile" ;; + "filters/exitlast/Makefile") CONFIG_FILES="$CONFIG_FILES filters/exitlast/Makefile" ;; + "filters/exitwhen/Makefile") CONFIG_FILES="$CONFIG_FILES filters/exitwhen/Makefile" ;; + "filters/exportname/Makefile") CONFIG_FILES="$CONFIG_FILES filters/exportname/Makefile" ;; + "filters/ext2/Makefile") CONFIG_FILES="$CONFIG_FILES filters/ext2/Makefile" ;; + "filters/extentlist/Makefile") CONFIG_FILES="$CONFIG_FILES filters/extentlist/Makefile" ;; + "filters/evil/Makefile") CONFIG_FILES="$CONFIG_FILES filters/evil/Makefile" ;; + "filters/fua/Makefile") CONFIG_FILES="$CONFIG_FILES filters/fua/Makefile" ;; + "filters/gzip/Makefile") CONFIG_FILES="$CONFIG_FILES filters/gzip/Makefile" ;; + "filters/ip/Makefile") CONFIG_FILES="$CONFIG_FILES filters/ip/Makefile" ;; + "filters/limit/Makefile") CONFIG_FILES="$CONFIG_FILES filters/limit/Makefile" ;; + "filters/log/Makefile") CONFIG_FILES="$CONFIG_FILES filters/log/Makefile" ;; + "filters/luks/Makefile") CONFIG_FILES="$CONFIG_FILES filters/luks/Makefile" ;; + "filters/multi-conn/Makefile") CONFIG_FILES="$CONFIG_FILES filters/multi-conn/Makefile" ;; + "filters/nocache/Makefile") CONFIG_FILES="$CONFIG_FILES filters/nocache/Makefile" ;; + "filters/noextents/Makefile") CONFIG_FILES="$CONFIG_FILES filters/noextents/Makefile" ;; + "filters/nofilter/Makefile") CONFIG_FILES="$CONFIG_FILES filters/nofilter/Makefile" ;; + "filters/noparallel/Makefile") CONFIG_FILES="$CONFIG_FILES filters/noparallel/Makefile" ;; + "filters/nozero/Makefile") CONFIG_FILES="$CONFIG_FILES filters/nozero/Makefile" ;; + "filters/offset/Makefile") CONFIG_FILES="$CONFIG_FILES filters/offset/Makefile" ;; + "filters/partition/Makefile") CONFIG_FILES="$CONFIG_FILES filters/partition/Makefile" ;; + "filters/pause/Makefile") CONFIG_FILES="$CONFIG_FILES filters/pause/Makefile" ;; + "filters/protect/Makefile") CONFIG_FILES="$CONFIG_FILES filters/protect/Makefile" ;; + "filters/qcow2dec/Makefile") CONFIG_FILES="$CONFIG_FILES filters/qcow2dec/Makefile" ;; + "filters/rate/Makefile") CONFIG_FILES="$CONFIG_FILES filters/rate/Makefile" ;; + "filters/readahead/Makefile") CONFIG_FILES="$CONFIG_FILES filters/readahead/Makefile" ;; + "filters/retry/Makefile") CONFIG_FILES="$CONFIG_FILES filters/retry/Makefile" ;; + "filters/retry-request/Makefile") CONFIG_FILES="$CONFIG_FILES filters/retry-request/Makefile" ;; + "filters/scan/Makefile") CONFIG_FILES="$CONFIG_FILES filters/scan/Makefile" ;; + "filters/stats/Makefile") CONFIG_FILES="$CONFIG_FILES filters/stats/Makefile" ;; + "filters/swab/Makefile") CONFIG_FILES="$CONFIG_FILES filters/swab/Makefile" ;; + "filters/tar/Makefile") CONFIG_FILES="$CONFIG_FILES filters/tar/Makefile" ;; + "filters/tls-fallback/Makefile") CONFIG_FILES="$CONFIG_FILES filters/tls-fallback/Makefile" ;; + "filters/truncate/Makefile") CONFIG_FILES="$CONFIG_FILES filters/truncate/Makefile" ;; + "filters/xz/Makefile") CONFIG_FILES="$CONFIG_FILES filters/xz/Makefile" ;; + "fuzzing/Makefile") CONFIG_FILES="$CONFIG_FILES fuzzing/Makefile" ;; + "server/local/nbdkit.pc") CONFIG_FILES="$CONFIG_FILES server/local/nbdkit.pc" ;; + "server/Makefile") CONFIG_FILES="$CONFIG_FILES server/Makefile" ;; + "server/nbdkit.pc") CONFIG_FILES="$CONFIG_FILES server/nbdkit.pc" ;; + "tests/functions.sh") CONFIG_FILES="$CONFIG_FILES tests/functions.sh" ;; + "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; + "valgrind/Makefile") CONFIG_FILES="$CONFIG_FILES valgrind/Makefile" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + 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+y} || CONFIG_FILES=$config_files + test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers + test ${CONFIG_COMMANDS+y} || 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= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# 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=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /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 {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +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_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + 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 >>"\$ac_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 +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_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 < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries 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[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +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 >"$ac_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_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + 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 +' >$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] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + 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 "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +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_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[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="$ac_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_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append 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 '` + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`printf "%s\n" "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + 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 || +printf "%s\n" 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"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf "%s\n" "$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@*) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$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 "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +printf "%s\n" "$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 "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + printf "%s\n" "/* $configure_input */" >&1 \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + printf "%s\n" "/* $configure_input */" >&1 \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + 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 || +printf "%s\n" 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) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +printf "%s\n" "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + case $CONFIG_FILES in #( + *\'*) : + eval set x "$CONFIG_FILES" ;; #( + *) : + set x $CONFIG_FILES ;; #( + *) : + ;; +esac + shift + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf + do + # Strip MF so we end up with the name of the file. + am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`$as_dirname -- "$am_mf" || +$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$am_mf" : 'X\(//\)[^/]' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$am_mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + am_filepart=`$as_basename -- "$am_mf" || +$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$am_mf" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { echo "$as_me:$LINENO: cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles" >&5 + (cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } || am_rc=$? + done + if test $am_rc -ne 0; then + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking). +See \`config.log' for more details" "$LINENO" 5; } + fi + { am_dirpart=; unset am_dirpart;} + { am_filepart=; unset am_filepart;} + { am_mf=; unset am_mf;} + { am_rc=; unset am_rc;} + rm -f conftest-deps.mk +} + ;; + "libtool":C) + + # See if we are running on zsh, and set the options that 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 +# Generated automatically by $as_me ($PACKAGE) $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. + +# Provide generalized library-building support services. +# Written by Gordon Matzigkeit, 1996 + +# Copyright (C) 2014 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# 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 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 this program. If not, see . + + +# The names of the tagged configurations supported by this script. +available_tags='CXX ' + +# Configured defaults for sys_lib_dlsearch_path munging. +: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} + +# ### BEGIN LIBTOOL CONFIG + +# Which release of libtool.m4 was used? +macro_version=$macro_version +macro_revision=$macro_revision + +# Assembler program. +AS=$lt_AS + +# DLL creation program. +DLLTOOL=$lt_DLLTOOL + +# Object dumper program. +OBJDUMP=$lt_OBJDUMP + +# 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 + +# Shared archive member basename,for filename based shared library versioning on AIX. +shared_archive_member_spec=$shared_archive_member_spec + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# An echo program that protects backslashes. +ECHO=$lt_ECHO + +# The PATH separator for the build system. +PATH_SEPARATOR=$lt_PATH_SEPARATOR + +# 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 + +# convert \$build file names to \$host format. +to_host_file_cmd=$lt_cv_to_host_file_cmd + +# convert \$build files to toolchain format. +to_tool_file_cmd=$lt_cv_to_tool_file_cmd + +# A file(cmd) program that detects file types. +FILECMD=$lt_FILECMD + +# 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 + +# How to find potential files when deplibs_check_method = "file_magic". +file_magic_glob=$lt_file_magic_glob + +# Find potential files using nocaseglob when deplibs_check_method = "file_magic". +want_nocaseglob=$lt_want_nocaseglob + +# Command to associate shared and link libraries. +sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd + +# The archiver. +AR=$lt_AR + +# Flags to create an archive (by configure). +lt_ar_flags=$lt_ar_flags + +# Flags to create an archive. +AR_FLAGS=\${ARFLAGS-"\$lt_ar_flags"} + +# How to feed a file listing to the archiver. +archiver_list_spec=$lt_archiver_list_spec + +# 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 + +# Whether to use a lock for old archive extraction. +lock_old_archive_extraction=$lock_old_archive_extraction + +# 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 into a list of symbols to manually relocate. +global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import + +# 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 lister interface. +nm_interface=$lt_lt_cv_nm_interface + +# Specify filename containing input files for \$NM. +nm_file_list_spec=$lt_nm_file_list_spec + +# The root where to search for dependent libraries,and where our libraries should be installed. +lt_sysroot=$lt_sysroot + +# Command to truncate a binary pipe. +lt_truncate_bin=$lt_lt_cv_truncate_bin + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# 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 + +# Manifest tool. +MANIFEST_TOOL=$lt_MANIFEST_TOOL + +# 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 + +# Permission mode override for installation of shared libraries. +install_override_mode=$lt_install_override_mode + +# 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 + +# Detected run-time system search path for libraries. +sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path + +# Explicit LT_SYS_LIBRARY_PATH set during ./configure time. +configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path + +# 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 + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# 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 + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# 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 + +# 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 + +# 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 + +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_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 + +# The directories searched by this compiler when creating a shared library. +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs + +# Dependencies to place before and after the objects being linked to +# create a shared library. +predep_objects=$lt_predep_objects +postdep_objects=$lt_postdep_objects +predeps=$lt_predeps +postdeps=$lt_postdeps + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path + +# ### END LIBTOOL CONFIG + +_LT_EOF + + cat <<'_LT_EOF' >> "$cfgfile" + +# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE + +# func_munge_path_list VARIABLE PATH +# ----------------------------------- +# VARIABLE is name of variable containing _space_ separated list of +# directories to be munged by the contents of PATH, which is string +# having a format: +# "DIR[:DIR]:" +# string "DIR[ DIR]" will be prepended to VARIABLE +# ":DIR[:DIR]" +# string "DIR[ DIR]" will be appended to VARIABLE +# "DIRP[:DIRP]::[DIRA:]DIRA" +# string "DIRP[ DIRP]" will be prepended to VARIABLE and string +# "DIRA[ DIRA]" will be appended to VARIABLE +# "DIR[:DIR]" +# VARIABLE will be replaced by "DIR[ DIR]" +func_munge_path_list () +{ + case x$2 in + x) + ;; + *:) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" + ;; + x:*) + eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" + ;; + *::*) + eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" + eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" + ;; + *) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" + ;; + esac +} + + +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +func_cc_basename () +{ + for cc_temp in $*""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac + done + func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +} + + +# ### END FUNCTIONS SHARED WITH CONFIGURE + +_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 set != "${COLLECT_NAMES+set}"; 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 '$q' "$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" + +# ### BEGIN LIBTOOL TAG CONFIG: CXX + +# The linker used to build libraries. +LD=$lt_LD_CXX + +# How to create reloadable object files. +reload_flag=$lt_reload_flag_CXX +reload_cmds=$lt_reload_cmds_CXX + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds_CXX + +# A language specific compiler. +CC=$lt_compiler_CXX + +# Is the compiler the GNU compiler? +with_gcc=$GCC_CXX + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_CXX + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_CXX + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_CXX + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_CXX + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object_CXX + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds_CXX +archive_expsym_cmds=$lt_archive_expsym_cmds_CXX + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds_CXX +module_expsym_cmds=$lt_module_expsym_cmds_CXX + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld_CXX + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_CXX + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_CXX + +# 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_CXX + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX + +# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct_CXX + +# 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_CXX + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L_CXX + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX + +# 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_CXX + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath_CXX + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_CXX + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols_CXX + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_CXX + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_CXX + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_CXX + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds_CXX + +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds_CXX + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec_CXX + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_CXX + +# The directories searched by this compiler when creating a shared library. +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX + +# Dependencies to place before and after the objects being linked to +# create a shared library. +predep_objects=$lt_predep_objects_CXX +postdep_objects=$lt_postdep_objects_CXX +predeps=$lt_predeps_CXX +postdeps=$lt_postdeps_CXX + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_CXX + +# ### END LIBTOOL TAG CONFIG: CXX +_LT_EOF + + ;; + "podwrapper.pl":F) chmod +x,-w podwrapper.pl ;; + "common/protocol/generate-protostrings.sh":F) chmod +x,-w common/protocol/generate-protostrings.sh ;; + "tests/make-pki.sh":F) chmod +x,-w tests/make-pki.sh ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# 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 || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + + +echo +echo +echo "----------------------------------------------------------------------" +echo "Thank you for downloading $PACKAGE_STRING" +echo +echo "This is how we have configured the optional components for you today:" +echo + +print () +{ + printf ' %.40s %s\n' \ + "$1 ........................................" "$2" +} + +feature () +{ + feat="$1" + shift + if "$@"; then + print "$feat" "yes" + else + print "$feat" "no" + fi +} + +echo "Optional server features:" +echo +feature "bash-completion" test "x$HAVE_BASH_COMPLETION_TRUE" = "x" +feature "libfuzzer" test "x$ENABLE_LIBFUZZER_TRUE" = "x" +feature "linker script" test "x$USE_LINKER_SCRIPT" = "x" +feature "manual pages" test "x$HAVE_POD_TRUE" = "x" +feature "SELinux" test "x$LIBSELINUX_LIBS" != "x" +feature "TLS" test "x$GNUTLS_LIBS" != "x" + +echo +echo "Optional plugins:" +echo +feature "blkio" test "x$HAVE_LIBBLKIO_TRUE" = "x" +feature "curl" test "x$HAVE_CURL_TRUE" = "x" +feature "example4" test "x$HAVE_PERL_TRUE" = "x" +feature "floppy" test "x$HAVE_ICONV_TRUE" = "x" +feature "guestfs" test "x$HAVE_LIBGUESTFS_TRUE" = "x" +feature "iso" test "x$HAVE_ISO_TRUE" = "x" +feature "libvirt" test "x$HAVE_LIBVIRT_TRUE" = "x" +feature "linuxdisk" test "x$HAVE_MKE2FS_WITH_D_TRUE" = "x" +feature "nbd" test "x$HAVE_LIBNBD_TRUE" = "x" +feature "S3" test "x$HAVE_PYTHON_TRUE" = "x" +feature "ssh" test "x$HAVE_SSH_TRUE" = "x" +feature "torrent" test "x$HAVE_TORRENT_TRUE" = "x" +feature "vddk" test "x$HAVE_VDDK_TRUE" = "x" + +echo +echo "Languages:" +echo +feature "go" test "x$HAVE_GOLANG_TRUE" = "x" +feature "lua" test "x$HAVE_LUA_TRUE" = "x" +feature "ocaml" test "x$HAVE_OCAML_TRUE" = "x" +feature "perl" test "x$HAVE_PERL_TRUE" = "x" +feature "python" test "x$HAVE_PYTHON_TRUE" = "x" +feature "ruby" test "x$HAVE_RUBY_TRUE" = "x" +feature "rust" test "x$HAVE_RUST_TRUE" = "x" +feature "tcl" test "x$HAVE_TCL_TRUE" = "x" + +echo +echo "Optional filters:" +echo +feature "ext2" test "x$HAVE_EXT2_TRUE" = "x" +feature "gzip" test "x$HAVE_ZLIB_TRUE" = "x" +feature "luks" test "x$HAVE_GNUTLS_PBKDF2_TRUE" = "x" +feature "stats" test "x$HAVE_CXX_TRUE" = "x" +feature "xz" test "x$HAVE_LIBLZMA_TRUE" = "x" + +echo +echo "Other optional features:" +echo +feature "allocator=zstd" test "x$HAVE_LIBZSTD_TRUE" = "x" +feature "tests using libguestfs" \ + test "x$HAVE_LIBGUESTFS_TRUE" = "x" && \ + test "x$USE_LIBGUESTFS_FOR_TESTS_TRUE" = "x" +feature "zlib-ng" test "x$ZLIB_NG_LIBS" != "x" +print cc-plugin-CC "$CC_PLUGIN_CC" +print cc-plugin-CFLAGS "$CC_PLUGIN_CFLAGS" + +echo +echo "If any optional component is configured ‘no’ when you expected ‘yes’" +echo "then you should check the preceding messages and README." +echo +echo "Please report bugs back to the mailing list:" +echo "https://lists.libguestfs.org" +echo +echo "Next you should type 'make' to build the package," +echo "then 'make check' to run the tests." + diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..3b12e35 --- /dev/null +++ b/configure.ac @@ -0,0 +1,1748 @@ +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +m4_define([NBDKIT_VERSION_MAJOR], [1]) +m4_define([NBDKIT_VERSION_MINOR], [36]) +m4_define([NBDKIT_VERSION_MICRO], [2]) +AC_INIT([nbdkit], + NBDKIT_VERSION_MAJOR.NBDKIT_VERSION_MINOR.NBDKIT_VERSION_MICRO) +AC_CONFIG_MACRO_DIR([m4]) + +dnl This must be used very early else you will get +dnl "warning: AC_RUN_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS" +m4_ifdef([AC_USE_SYSTEM_EXTENSIONS],[], + [m4_define([AC_USE_SYSTEM_EXTENSIONS],[])]) +AC_USE_SYSTEM_EXTENSIONS + +dnl NB: Do not [quote] this parameter. +AM_INIT_AUTOMAKE(foreign) +LT_INIT([win32-dll]) + +dnl Extra string, a freeform string defined by downstream packagers. +dnl eg. If you are packaging nbdkit for Linux distro X 1.1, you could +dnl ./configure --with-extra="X release 1.1" +AC_ARG_WITH([extra], + [AS_HELP_STRING([--with-extra=...], + [extra version information (for use by packagers)])], + [NBDKIT_VERSION_EXTRA="$withval"], + [NBDKIT_VERSION_EXTRA=] +) +AC_DEFINE_UNQUOTED([NBDKIT_VERSION_EXTRA], ["$NBDKIT_VERSION_EXTRA"], + [Extra version information (for use by packagers)]) + +AC_MSG_NOTICE([nbdkit version NBDKIT_VERSION_MAJOR.NBDKIT_VERSION_MINOR.NBDKIT_VERSION_MICRO ($NBDKIT_VERSION_EXTRA)]) + +dnl List of plugins and filters. +lang_plugins="\ + cc \ + golang \ + lua \ + ocaml \ + perl \ + python \ + ruby \ + rust \ + sh \ + tcl \ + " +non_lang_plugins="\ + blkio \ + cdi \ + curl \ + data \ + eval \ + example1 \ + example2 \ + example3 \ + example4 \ + file \ + floppy \ + full \ + guestfs \ + info \ + iso \ + libvirt \ + linuxdisk \ + memory \ + nbd \ + null \ + ondemand \ + ones \ + partitioning \ + pattern \ + random \ + S3 \ + sparse-random \ + split \ + ssh \ + tmpdisk \ + torrent \ + vddk \ + zero \ + " +plugins="$(echo $(printf %s\\n $lang_plugins $non_lang_plugins | sort -u))" +filters="\ + blocksize \ + blocksize-policy \ + cache \ + cacheextents \ + checkwrite \ + cow \ + ddrescue \ + delay \ + error \ + exitlast \ + exitwhen \ + exportname \ + ext2 \ + extentlist \ + evil \ + fua \ + gzip \ + ip \ + limit \ + log \ + luks \ + multi-conn \ + nocache \ + noextents \ + nofilter \ + noparallel \ + nozero \ + offset \ + partition \ + pause \ + protect \ + qcow2dec \ + rate \ + readahead \ + retry \ + retry-request \ + scan \ + stats \ + swab \ + tar \ + tls-fallback \ + truncate \ + xz \ + " +AC_SUBST([plugins]) +AC_SUBST([lang_plugins]) +AC_SUBST([non_lang_plugins]) +AC_SUBST([filters]) + +dnl Some very basic tools. +AC_PROG_SED +AC_PROG_RANLIB + +dnl Check for basic C environment. +AC_PROG_CC +AC_PROG_INSTALL +AC_PROG_CPP +AC_SYS_LARGEFILE + +AC_C_PROTOTYPES +test "x$U" != "x" && AC_MSG_ERROR([Compiler not ANSI compliant]) + +AM_PROG_CC_C_O + +dnl Define the host CPU architecture (defines 'host_cpu'). +AC_CANONICAL_HOST +AC_DEFINE_UNQUOTED([host_cpu],["$host_cpu"],[Host architecture.]) + +dnl Define 'host_os'. +AC_DEFINE_UNQUOTED([host_os],["$host_os"],[Host operating system.]) + +dnl Defines WORDS_BIGENDIAN on big endian platforms. +AC_C_BIGENDIAN + +dnl These are defined in which is included by +dnl AC_DEFAULT_INCLUDES. +AC_CHECK_SIZEOF([pid_t]) +AC_CHECK_SIZEOF([uid_t]) +AC_CHECK_SIZEOF([gid_t]) + +dnl Check for C++ (optional, we just use this to test the header +dnl can be included from C++ code). +AC_PROG_CXX + +dnl The C++ compiler test is pretty useless because even if it fails +dnl it sets CXX=g++. So test the compiler actually works. +AC_MSG_CHECKING([if the C++ compiler really really works]) +AS_IF([$CXX --version >&AS_MESSAGE_LOG_FD 2>&1],[have_cxx=yes],[have_cxx=no]) +AC_MSG_RESULT([$have_cxx]) +AM_CONDITIONAL([HAVE_CXX], [test "$have_cxx" = "yes"]) + +AC_ARG_ENABLE([gcc-warnings], + [AS_HELP_STRING([--enable-gcc-warnings], + [turn on lots of GCC warnings (for developers)])], + [case $enableval in + yes|no) ;; + *) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;; + esac + gcc_warnings=$enableval], + [gcc_warnings=no] +) +if test "x$gcc_warnings" = "xyes"; then + WARNINGS_CFLAGS="-Wall -Wshadow -Wvla -Werror" + AC_SUBST([WARNINGS_CFLAGS]) +fi + +dnl Check if the compiler supports -std=c90 flag. This is only used +dnl during a test. OpenBSD GCC does not support this flag so we skip +dnl that test. +AC_MSG_CHECKING([if the compiler supports -std=c90 for ANSI C test]) +old_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -std=c90" +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], + [supports_std_c90=yes], + [supports_std_c90=no]) +CFLAGS="$old_CFLAGS" +AC_MSG_RESULT([$supports_std_c90]) +AM_CONDITIONAL([CAN_TEST_ANSI_C], [test "x$supports_std_c90" = "xyes"]) + +dnl Check for __builtin_*_overflow. We need the dummy parameters +dnl else detection doesn't work correctly for some reason. +AC_CHECK_DECLS([__builtin_add_overflow(int, int, int *), + __builtin_mul_overflow(int, int, int *)], + [], [], []) + +dnl On Haiku we must use BSD-compatibility headers to get the endian +dnl macros we use. +AC_MSG_CHECKING(whether OS-dependent include paths are required) +AS_CASE([$host_os], + [haiku*], [CFLAGS="$CFLAGS -I`findpaths -p /system B_FIND_PATH_HEADERS_DIRECTORY`/bsd"; AC_MSG_RESULT(yes)], + [AC_MSG_RESULT(no)] +) + +dnl On Linux /tmp is often tmpfs which is not large enough, so use /var/tmp. +dnl But Haiku only has /tmp. +AC_MSG_CHECKING([for temporary directory for large files]) +AS_CASE([$host_os], + [haiku*], [LARGE_TMPDIR=/tmp], + [LARGE_TMPDIR=/var/tmp] +) +AC_MSG_RESULT([$LARGE_TMPDIR]) +AC_DEFINE_UNQUOTED([LARGE_TMPDIR],["$LARGE_TMPDIR"], + [Temporary directory for large files]) + +dnl Check if libc has program_invocation_short_name. +AC_CHECK_DECLS([program_invocation_short_name], [], [], [#include ]) + +AX_PTHREAD + +dnl Check if __attribute__((cleanup(...))) works. +dnl Set -Werror, otherwise gcc will only emit a warning for attributes +dnl that it doesn't understand. +acx_nbdkit_save_CFLAGS="${CFLAGS}" +CFLAGS="${CFLAGS} -Werror" +AC_MSG_CHECKING([if __attribute__((cleanup(...))) works with this compiler]) +AC_COMPILE_IFELSE([ +AC_LANG_SOURCE([[ +#include +#include + +void +freep (void *ptr) +{ + exit (EXIT_SUCCESS); +} + +void +test (void) +{ + __attribute__((cleanup(freep))) char *ptr = malloc (100); + (void)ptr; +} + +int +main (int argc, char *argv[]) +{ + test (); + exit (EXIT_FAILURE); +} +]]) + ],[ + AC_MSG_RESULT([yes]) + ],[ + AC_MSG_RESULT([no]) + AC_MSG_ERROR( +['__attribute__((cleanup(...)))' does not work. + +You may not be using a sufficiently recent version of GCC or CLANG, or +you may be using a C compiler which does not support this attribute, +or the configure test may be wrong. + +This code requires the attribute to work for proper locking between threads.])]) +CFLAGS="${acx_nbdkit_save_CFLAGS}" + +dnl Check for __auto_type (GCC extension). +AC_MSG_CHECKING([if __auto_type is available in this compiler]) +AC_COMPILE_IFELSE([ +AC_LANG_SOURCE([[ +static int +test (int a) +{ + __auto_type at = a; + return at; +} +]]) + ],[ + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_AUTO_TYPE],[1],[__auto_type is available]) + ],[ + AC_MSG_RESULT([no]) + ] +) + +dnl 'environ' is not always declared in public header files: +dnl Linux => Haiku => +dnl FreeBSD & OpenBSD => not declared +dnl On platforms where it's not declared we must add an extern decl. +AC_MSG_CHECKING([if environ is declared in header files]) +AC_COMPILE_IFELSE([ +AC_LANG_SOURCE([[ +#include +#include +static int +test (void) +{ + const char **env = environ; + return env ? 1 : 0; // this just forces env to be used +} +]]) + ],[ + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_ENVIRON_DECL],[1],[environ is declared in headers]) + ],[ + AC_MSG_RESULT([no]) + ] +) + +dnl Check sizeof long. +AC_CHECK_SIZEOF(long) + +dnl Check for other headers, all optional. +AC_CHECK_HEADERS([\ + alloca.h \ + afunix.h \ + arpa/inet.h \ + byteswap.h \ + endian.h \ + grp.h \ + linux/fs.h \ + netdb.h \ + netinet/in.h \ + netinet/tcp.h \ + pwd.h \ + termios.h \ + stdatomic.h \ + syslog.h \ + sys/endian.h \ + sys/ioctl.h \ + sys/mman.h \ + sys/prctl.h \ + sys/procctl.h \ + sys/socket.h \ + sys/statvfs.h \ + sys/ucred.h \ + sys/un.h \ + sys/vsock.h \ + sys/wait.h \ + winsock2.h]) + +AC_CHECK_HEADERS([linux/vm_sockets.h], [], [], [#include ]) + +dnl Check for functions in libc, all optional. +AC_CHECK_FUNCS([\ + accept4 \ + fdatasync \ + flockfile \ + funlockfile \ + inet_ntop \ + inet_pton \ + mkostemp \ + mlock \ + mlockall \ + munlock \ + open_memstream \ + pipe \ + pipe2 \ + ppoll \ + posix_fadvise \ + posix_memalign \ + valloc]) + +dnl Check for structs and members. +AC_CHECK_MEMBERS([struct dirent.d_type], [], [], [[#include ]]) +AC_CHECK_MEMBERS([struct ucred.uid], [], [], + [[ +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_SYS_UCRED_H +#include +#endif +]]) +AC_CHECK_MEMBERS([struct sockpeercred.uid], [], [], + [[ +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +]]) + +dnl Replacement functions that we provide for some platforms. +AC_CONFIG_LIBOBJ_DIR([common/replacements]) +AC_REPLACE_FUNCS([\ + fdatasync \ + fsync \ + get_current_dir_name \ + getdelim \ + getline \ + openlog \ + open_memstream \ + poll \ + posix_memalign \ + pread \ + pwrite \ + realpath \ + strndup \ + sysconf \ + syslog \ + vsyslog]) + +dnl Check whether printf("%m") works +AC_CACHE_CHECK([whether the printf family supports %m], + [nbdkit_cv_func_printf_percent_m], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM([[ +#include +#include +#include + ]], [[ + char buf[200] = ""; + errno = EINVAL; + snprintf(buf, sizeof buf, "%m"); + return !!strcmp (buf, strerror (EINVAL)); + ]])], + [nbdkit_cv_func_printf_percent_m=yes], + [nbdkit_cv_func_printf_percent_m=no], + [[ + case "$host_os" in + *-gnu* | gnu*) nbdkit_cv_func_printf_percent_m=yes;; + *) nbdkit_cv_func_printf_percent_m="guessing no";; + esac + ]])]) +AS_IF([test "x$nbdkit_cv_func_printf_percent_m" = xyes], + [AC_DEFINE([HAVE_VFPRINTF_PERCENT_M],[1], + [Define to 1 if vfprintf supports %m.])]) + +old_LIBS="$LIBS" +AC_SEARCH_LIBS([dlsym], [dl dld], [ + AS_IF([test "x$ac_cv_search_dlsym" != "xnone required"], + [DL_LIBS="$ac_cv_search_dlsym"], [DL_LIBS=]) + AC_SUBST([DL_LIBS]) + ], [AC_MSG_ERROR([unable to find the dlsym() function]) +]) +LIBS="$old_LIBS" + +dnl Test if header can build working binaries. +dnl +dnl On FreeBSD: iconv and libiconv both exist, both can be installed +dnl simultaneously, can exist in two separate places, and +dnl if you get the wrong header/library mix everything breaks. +dnl +dnl On Haiku: libiconv is required to link to iconv_* functions. +AC_ARG_WITH([iconv], + [AS_HELP_STRING([--without-iconv], + [don't try to link against iconv @<:@default=check@:>@])], + [], + [with_iconv=check]) +AS_IF([test "x$with_iconv" != "xno"],[ + AC_CHECK_HEADER([iconv.h],[ + AC_MSG_CHECKING([if can be used to link a program]) + AC_LINK_IFELSE([ +AC_LANG_SOURCE([[ +#include +#include +#include +int +main (int argc, char *argv[]) +{ + iconv_t ic = iconv_open ("", ""); + iconv_close (ic); + exit (0); +} +]]) + ],[ + AC_MSG_RESULT([yes]) + iconv_working=yes + ],[ + AC_MSG_RESULT([no]) + ]) + ]) + ]) +AM_CONDITIONAL([HAVE_ICONV], [test "x$iconv_working" = "xyes"]) + +use_linker_script=yes + +dnl Don't use linker script on FreeBSD because FreeBSD's linker is +dnl broken. See eg: +dnl https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=190851 +dnl Also on macOS (darwin) which fails with: +dnl ld: unknown option: --version-script=./nbdkit.syms +dnl clang: error: linker command failed with exit code 1 +AC_MSG_CHECKING([if we should disable the linker script (FreeBSD, macOS)]) +AS_CASE([$host_os], + [freebsd*|darwin*], [ + use_linker_script=no + AC_MSG_RESULT([yes]) + ], + [AC_MSG_RESULT([no])] +) + +dnl Check if -rdynamic linker flag works. +acx_nbdkit_save_LDFLAGS="${LDFLAGS}" +LDFLAGS="${LDFLAGS} -rdynamic" +AC_MSG_CHECKING([if linker supports -rdynamic]) +AC_LINK_IFELSE([ +AC_LANG_SOURCE([[ +#include +int +main (int argc, char *argv[]) +{ + exit (EXIT_SUCCESS); +} +]]) + ],[ + AC_MSG_RESULT([yes]) + DL_LDFLAGS=-rdynamic + ],[ + AC_MSG_RESULT([no]) +]) +dnl restore CFLAGS +LDFLAGS="${acx_nbdkit_save_LDFLAGS}" +AC_SUBST([DL_LDFLAGS]) + +dnl Check for dladdr in -ldl, optional. This is a glibc extension. +old_LIBS="$LIBS" +LIBS="$DL_LIBS $LIBS" +AC_CHECK_FUNCS([dladdr]) +LIBS="$old_LIBS" + +dnl Is this Windows? +AC_MSG_CHECKING([if the target is Windows]) +AS_CASE([$host_os], + [mingw*|msys*], [ + is_windows=yes + LIBS="$LIBS -lkernel32 -luser32 -lws2_32" + NO_UNDEFINED_ON_WINDOWS="-no-undefined" + IMPORT_LIBRARY_ON_WINDOWS='-Wl,-L$(top_builddir)/server -Wl,-lnbdkit' + SOEXT="dll" + DIR_SEPARATOR_STR='\\' + ], + [is_windows=no + SOEXT="so" + DIR_SEPARATOR_STR=/] +) +AC_MSG_RESULT([$is_windows]) +AC_SUBST([NO_UNDEFINED_ON_WINDOWS]) +AC_SUBST([IMPORT_LIBRARY_ON_WINDOWS]) +AC_SUBST([SOEXT]) +AC_DEFINE_UNQUOTED([SOEXT],["$SOEXT"],[Extension used for shared objects/DLLs.]) +AC_DEFINE_UNQUOTED([EXEEXT],["$EXEEXT"],[Extension used for executables.]) +AC_DEFINE_UNQUOTED([DIR_SEPARATOR_STR],["$DIR_SEPARATOR_STR"], + [String that separates path elements.]) +AM_CONDITIONAL([IS_WINDOWS],[test "x$is_windows" = "xyes"]) + +AS_IF([test "x$is_windows" = "xyes"],[ + dnl For Windows, look for the mc/windmc utility. + dnl XXX Do we need to check for mc.exe as well? + AC_CHECK_TOOLS([MC],[windmc mc],[no]) + AS_IF([test "x$MC" = "xno"], + [AC_MSG_ERROR([mc/windmc utility must be available when compiling for Windows])]) + + dnl On Windows look for dlltool. + AC_CHECK_TOOLS([DLLTOOL],[dlltool],[no]) + AS_IF([test "x$DLLTOOL" = "xno"], + [AC_MSG_ERROR([dlltool utility must be available when compiling for Windows])]) +]) + +AC_SEARCH_LIBS([getaddrinfo], [network socket]) + +dnl Does this platform require libc_malloc_debug.so.0 (glibc >= 2.34)? +AC_MSG_CHECKING([if this is glibc >= 2.34]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include +#if !defined(__GLIBC__) || __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 34) +#error "not glibc 2.34" +#endif + ]])], [is_glibc_234=yes], [is_glibc_234=no] +) +AC_MSG_RESULT([$is_glibc_234]) +AM_CONDITIONAL([HAVE_GLIBC_234], [test "x$is_glibc_234" = "xyes"]) + +dnl Check for SELinux socket labelling (optional). +AC_ARG_WITH([selinux], + AS_HELP_STRING([--without-selinux], [disable SELinux support, used for socket labelling @<:@default=check@:>@])) +AS_IF([test "x$with_selinux" != xno], [ + PKG_CHECK_MODULES([LIBSELINUX], [libselinux], [ + AC_SUBST([LIBSELINUX_CFLAGS]) + AC_SUBST([LIBSELINUX_LIBS]) + AC_DEFINE([HAVE_LIBSELINUX],[1],[libselinux found at compile time.]) + ], [AC_MSG_WARN([libselinux not found, sockets will not be labeled.])]) +]) + +AS_IF([test "x$with_selinux" = xyes && test "x$LIBSELINUX_LIBS" = x], [ + AC_MSG_ERROR([selinux requested but not found]) +]) + +dnl Check for GnuTLS (optional, for TLS support). +AC_ARG_WITH([gnutls], + [AS_HELP_STRING([--without-gnutls], [disable TLS support via GnuTLS @<:@default=check@:>@])]) + +AS_IF([test "x$with_gnutls" != xno], [ + PKG_CHECK_MODULES([GNUTLS], [gnutls >= 3.3.0], [ + AC_SUBST([GNUTLS_CFLAGS]) + AC_SUBST([GNUTLS_LIBS]) + AC_DEFINE([HAVE_GNUTLS],[1],[gnutls found at compile time.]) + ], [ + AC_MSG_WARN([gnutls not found or < 3.3.0, TLS support will be disabled.]) + ]) +]) + +AS_IF([test "x$with_gnutls" = xyes && test x"$GNUTLS_LIBS" = x], [ + AC_MSG_ERROR([gnutls requested but not found]) +]) + +AM_CONDITIONAL([HAVE_GNUTLS], [test "x$GNUTLS_LIBS" != "x"]) + +AS_IF([test "x$GNUTLS_LIBS" != "x"],[ + AC_MSG_CHECKING([for default TLS session priority string]) + AC_ARG_WITH([tls-priority], + [AS_HELP_STRING([--with-tls-priority=...], + [default TLS session priority string @<:@default=NORMAL@:>@])], + [tls_priority=$withval], + [tls_priority=NORMAL]) + AC_MSG_RESULT([$tls_priority]) + AC_DEFINE_UNQUOTED([TLS_PRIORITY],["$tls_priority"], + [Default TLS session priority string]) + + # Check for APIs which may not be present. + old_LIBS="$LIBS" + LIBS="$GNUTLS_LIBS $LIBS" + AC_CHECK_FUNCS([\ + gnutls_base64_decode2 \ + gnutls_certificate_set_known_dh_params \ + gnutls_group_get \ + gnutls_group_get_name \ + gnutls_pbkdf2 \ + gnutls_session_set_verify_cert \ + gnutls_srp_server_get_username \ + gnutls_transport_is_ktls_enabled \ + ]) + AC_CHECK_HEADERS([gnutls/socket.h]) + LIBS="$old_LIBS" + + dnl macOS has its own program called certtool and packages the + dnl GnuTLS tool as "gnutls-certtool". + AC_CHECK_PROGS([CERTTOOL],[gnutls-certtool certtool],[certtool]) +]) +AM_CONDITIONAL([HAVE_GNUTLS_PBKDF2], + [test "x$GNUTLS_LIBS" != "x" && test "x$ac_cv_func_gnutls_pbkdf2" = xyes]) + +dnl Check for some commands used by the tests which should be the GNU +dnl coreutils variants. On macOS these are prefixed with 'g' or 'gnu'. +AC_CHECK_PROGS([CUT],[gnucut cut],[cut]) +AC_CHECK_PROGS([STAT],[gstat stat],[stat]) +AC_CHECK_PROGS([TRUNCATE],[gtruncate truncate],[truncate]) + +AC_ARG_ENABLE([linuxdisk], + [AS_HELP_STRING([--disable-linuxdisk], + [disable linuxdisk plugin @<:@default=check@:>@])], + [], + [enable_linuxdisk=check]) +dnl Check for mke2fs -d (used by linuxdisk plugin). There are two +dnl possible outcomes that we care about: (1) We have mke2fs and +dnl it supports the -d option. (2) We either don't have mke2fs +dnl or it's too old to support the -d option (eg. on RHEL 7). +mke2fs_with_d=no +AS_IF([test "$enable_linuxdisk" != "no"], [ + AC_MSG_CHECKING([for mke2fs supporting the -d option]) + AS_IF([mke2fs -V >/dev/null 2>&1], [ + AS_IF([LANG=C mke2fs -d 2>&1 | grep -sq "option requires an argument"], [ + mke2fs_with_d=yes + ]) + ]) + AC_MSG_RESULT([$mke2fs_with_d]) +]) +AM_CONDITIONAL([HAVE_MKE2FS_WITH_D],[test "x$mke2fs_with_d" = "xyes"]) + +dnl Check for valgrind. +AC_CHECK_PROG([VALGRIND],[valgrind],[valgrind],[no]) + +dnl If valgrind headers are available (optional). +dnl Although the runtime check adds only a trivial amount of code, you can +dnl avoid it with explicit --disable-valgrind. +AC_ARG_ENABLE([valgrind], + [AS_HELP_STRING([--disable-valgrind], + [disable Valgrind probe])], + [], + [enable_valgrind=check]) +AS_IF([test "x$enable_valgrind" != "xno"],[ + PKG_CHECK_MODULES([VALGRIND], [valgrind], [ + AC_SUBST([VALGRIND_CFLAGS]) + AC_SUBST([VALGRIND_LIBS]) + AC_DEFINE([HAVE_VALGRIND],[1],[Valgrind headers found at compile time]) + ],[ + AS_IF([test "x$enable_valgrind" = "xyes"], [ + AC_MSG_ERROR([--enable-valgrind given, but Valgrind headers are not available]) + ]) + ]) +]) + +dnl Build the special libFuzzer version of nbdkit. DO NOT USE THIS for +dnl normal builds. See fuzzing/README. +AC_ARG_ENABLE([libfuzzer], + [AS_HELP_STRING([--enable-libfuzzer], + [build libFuzzer test binary (developers only)])], + [], + [enable_libfuzzer=no]) +AS_IF([test "x$enable_libfuzzer" = "xyes"],[ + AC_DEFINE([ENABLE_LIBFUZZER],[1],[Enable special libFuzzer binary]) + # We have to disable the linker script for libFuzzer because Clang + # adds loads of fuzzer and ASAN-related symbols that are required + # by the plugins but which our linker script tries to hide. + use_linker_script=no +]) +AM_CONDITIONAL([ENABLE_LIBFUZZER],[test "x$enable_libfuzzer" = "xyes"]) + +dnl Should we use the linker script (ld --version-script)? Note +dnl some tests above may set this variable. +AC_ARG_ENABLE([linker-script], + [AS_HELP_STRING([--disable-linker-script], + [disable linker script for server (developers only)])], + [use_linker_script=$enableval], + []) +AM_CONDITIONAL([USE_LINKER_SCRIPT], + [test "x$use_linker_script" = "xyes"]) + +dnl Bash completion. +AC_ARG_WITH([bash-completions], + [AS_HELP_STRING([--without-bash-completions], [disable installing bash completions @<:@default=check@:>@])]) + +AS_IF([test "x$with_bash_completions" != xno], [ + PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0], [ + bash_completion=yes + AC_MSG_CHECKING([for bash-completions directory]) + m4_ifdef([PKG_CHECK_VAR],[ + PKG_CHECK_VAR(bashcompdir, [bash-completion], [completionsdir]) + ]) + AS_IF([test -z "$bashcompdir"], [ + bashcompdir="${sysconfdir}/bash_completion.d" + ]) + AC_MSG_RESULT([$bashcompdir]) + AC_SUBST([bashcompdir]) + ],[ + bash_completion=no + AC_MSG_WARN([bash-completion not installed]) + ]) +]) + +AS_IF([test "x$bash_completion" = xno && test "x$with_bash_completions" = xyes], [ + AC_MSG_ERROR([bash-completions requested but required packages not found]) +]) + +AM_CONDITIONAL([HAVE_BASH_COMPLETION],[test "x$bash_completion" = "xyes"]) + +dnl Check we have enough to run podwrapper. + +AC_ARG_WITH([manpages], + [AS_HELP_STRING([--without-manpages], [Do not build man pages @<:@default=check@:>@])], + [], + [: m4_divert_text([DEFAULTS], [with_manpages=check])]) + +enable_pod=no +AC_CHECK_PROGS([PERL], [perl], []) + +AS_IF([test "x$with_manpages" != xno], [ + AS_IF([test "x$PERL" != "x"],[ + AC_MSG_CHECKING([if we have perl Pod::Man and Pod::Simple]) + AS_IF([$PERL -MPod::Man -MPod::Simple -e 1 >&AS_MESSAGE_LOG_FD 2>&1],[ + enable_pod=yes + ]) + AC_MSG_RESULT([$enable_pod]) + ]) +]) + +AS_IF([test "x$enable_pod" = xno && test "x$with_manpages" = xyes], [ + AC_MSG_ERROR([man-pages requested but required packages not found]) +]) + +AM_CONDITIONAL([HAVE_POD], + [test "x$PERL" != "xno" && test "x$enable_pod" = "xyes"]) + +dnl Define the path to the podwrapper program. +PODWRAPPER="$PERL $(pwd)/podwrapper.pl" +AC_SUBST([PODWRAPPER]) + +dnl Allow all plugins and filters to be disabled. +AC_ARG_ENABLE([plugins], + [AS_HELP_STRING([--disable-plugins], + [disable all bundled plugins and filters])]) +AM_CONDITIONAL([HAVE_PLUGINS], [test "x$enable_plugins" != "xno"]) + +dnl For the cc plugin, let the user hard-code their preferred compiler setup +dnl Default to the settings used for nbdkit itself +AC_ARG_VAR([CC_PLUGIN_CC], + [Value to hard-code into the cc plugin's default for CC, instead of $CC]) +: "${CC_PLUGIN_CC:=$CC}" +AC_ARG_VAR([CC_PLUGIN_CFLAGS], + [Value to hard-code into the cc plugin's default for CFLAGS, instead of + $CFLAGS]) +: "${CC_PLUGIN_CFLAGS:=$CFLAGS}" + +dnl Check for Perl, for embedding in the perl plugin. +dnl Note that the perl binary is checked above. +AC_ARG_ENABLE([perl], + [AS_HELP_STRING([--disable-perl], [disable Perl embed plugin])], + [], + [enable_perl=yes]) +AS_IF([test "x$PERL" != "xno" && test "x$enable_perl" != "xno"],[ + dnl Check for Perl archlib. + AC_MSG_CHECKING([for Perl embed archlib]) + PERL_ARCHLIB="$($PERL -MConfig -e 'print $Config{archlib}')" + AS_IF([ test -n "$PERL_ARCHLIB" ],[ + AC_MSG_RESULT([$PERL_ARCHLIB]) + ],[ + AC_MSG_NOTICE([Perl embed module disabled]) + enable_perl=no + ]) + + dnl Check for Perl CFLAGS. + AC_MSG_CHECKING([for Perl embed CFLAGS]) + PERL_CFLAGS="$($PERL -MExtUtils::Embed -e 'ccflags')" + AS_IF([ test -n "$PERL_CFLAGS" ],[ + AC_MSG_RESULT([$PERL_CFLAGS]) + ],[ + AC_MSG_NOTICE([Perl embed module disabled]) + enable_perl=no + ]) + + dnl Check for Perl LDOPTS. + AC_MSG_CHECKING([for Perl embed LDOPTS]) + PERL_LDOPTS="$($PERL -MExtUtils::Embed -e 'ldopts')" + AC_MSG_RESULT([$PERL_LDOPTS]) + + dnl Check these actually work. + AC_MSG_CHECKING([whether Perl modules will compile]) + old_CFLAGS="$CFLAGS" + old_LIBS="$LIBS" + CFLAGS="$PERL_CFLAGS -I$PERL_ARCHLIB/CORE $CFLAGS" + LIBS="$PERL_LDOPTS $LIBS" + AC_CHECK_FUNCS([perl_alloc]) + CFLAGS="$old_CFLAGS" + LIBS="$old_LIBS" + if test "x$ac_cv_func_perl_alloc" != xyes; then + enable_perl=no + fi +]) +AM_CONDITIONAL([HAVE_PERL],[test "x$enable_perl" != "xno" && test "x$PERL" != "xno"]) +AC_SUBST([PERL_ARCHLIB]) +AC_SUBST([PERL_CFLAGS]) +AC_SUBST([PERL_LDOPTS]) + +dnl Check for Python 3, for embedding in the python plugin. +AC_PATH_PROGS([PYTHON],[python3 python],[no]) +AC_ARG_ENABLE([python], + [AS_HELP_STRING([--disable-python], [disable Python embed plugin])], + [], + [enable_python=yes]) +AS_IF([test "x$PYTHON" != "xno" && test "x$enable_python" != "xno"],[ + AC_MSG_CHECKING([version of $PYTHON]) + PYTHON_VERSION_MAJOR=`$PYTHON -c "import sys; print (sys.version_info@<:@0@:>@)"` + PYTHON_VERSION_MINOR=`$PYTHON -c "import sys; print (sys.version_info@<:@1@:>@)"` + PYTHON_VERSION="$PYTHON_VERSION_MAJOR.$PYTHON_VERSION_MINOR" + AS_IF([test -n "$PYTHON_VERSION"],[ + AC_MSG_RESULT([$PYTHON_VERSION]) + ],[ + AC_MSG_NOTICE([Python embed module disabled]) + enable_python=no + ]) + + AC_MSG_CHECKING([Python major version is 3]) + AS_IF([test "x$PYTHON_VERSION_MAJOR" = "x3"],[ + AC_MSG_RESULT([yes]) + ],[ + AC_MSG_RESULT([no]) + AC_MSG_ERROR([Python $PYTHON_VERSION_MAJOR <> 3 is no longer supported. + +Python 2 end of life is 2020-01-01 and nbdkit >= 1.16 no longer +supports it. + +If you want to use Python 2, you will need to use nbdkit 1.14.]) + ]) + + dnl Check for Python CFLAGS, libraries. + dnl For Python >= 3.8 we have to use python--embed.pc, see: + dnl https://docs.python.org/3.8/whatsnew/3.8.html#debug-build-uses-the-same-abi-as-release-build + dnl The python.pc is called python-.pc on Debian and + dnl later versions of Fedora, and python.pc on older versions + dnl of Fedora. + PKG_CHECK_MODULES([PYTHON], [python-"$PYTHON_VERSION"-embed], [ + AC_SUBST([PYTHON_CFLAGS]) + AC_SUBST([PYTHON_LIBS]) + AC_SUBST([PYTHON_VERSION]) + AC_DEFINE([HAVE_PYTHON],[1],[Python library found at compile time]) + ],[ + PKG_CHECK_MODULES([PYTHON], [python-"$PYTHON_VERSION"], [ + AC_SUBST([PYTHON_CFLAGS]) + AC_SUBST([PYTHON_LIBS]) + AC_SUBST([PYTHON_VERSION]) + AC_DEFINE([HAVE_PYTHON],[1],[Python library found at compile time]) + ],[ + PKG_CHECK_MODULES([PYTHON], [python], [ + AC_SUBST([PYTHON_CFLAGS]) + AC_SUBST([PYTHON_LIBS]) + AC_SUBST([PYTHON_VERSION]) + AC_DEFINE([HAVE_PYTHON],[1],[Python library found at compile time]) + ],[ + AC_MSG_WARN([python $PYTHON_VERSION not found]) + enable_python=no + ])])]) +]) +AM_CONDITIONAL([HAVE_PYTHON],[test "x$enable_python" != "xno" && test "x$PYTHON" != "xno"]) +AC_SUBST([PYTHON_CFLAGS]) +AC_SUBST([PYTHON_LIBS]) +AC_SUBST([PYTHON_LDFLAGS]) + +dnl For the OCaml plugin, you can set OCAMLOPTFLAGS before running +dnl ./configure to specify any extra flags you want to pass to +dnl ocamlopt. For example to enable debug symbols & warnings: +dnl OCAMLOPTFLAGS="-g -warn-error +A-3" +AC_SUBST([OCAMLOPTFLAGS]) + +dnl Check for OCaml, for embedding in the ocaml plugin. +AC_PROG_OCAML +AC_ARG_ENABLE([ocaml], + [AS_HELP_STRING([--disable-ocaml], [disable OCaml embed plugin])], + [], + [enable_ocaml=yes]) +AS_IF([test "x$OCAMLOPT" != "xno" && test "x$enable_ocaml" != "xno"],[ + dnl Check OCaml can create a shared library (see README for details). + AC_MSG_CHECKING([if $OCAMLOPT can create a shared library]) + echo 'print_endline "test"' > conftest.ml + AS_IF([$OCAMLOPT $OCAMLOPTFLAGS -output-obj -runtime-variant _pic -o conftest.so conftest.ml >&AS_MESSAGE_LOG_FD 2>&1],[ + AC_MSG_RESULT([yes]) + ocaml_link_shared=yes + ],[ + AC_MSG_RESULT([no]) + ]) + rm -f conftest.ml conftest.cmi conftest.cmx conftest.so conftest.o +]) +AM_CONDITIONAL([HAVE_OCAML],[test "x$OCAMLOPT" != "xno" && + test "x$ocaml_link_shared" = "xyes"]) +AM_CONDITIONAL([HAVE_OCAMLDOC],[test "x$OCAMLDOC" != "xno"]) + +AS_IF([test "x$OCAMLC" != "xno" && test "x$OCAMLFIND" != "xno" && \ + test "x$enable_ocaml" = "xyes"],[ + dnl Check for how to link OCaml plugins. + AC_MSG_CHECKING([major version of OCaml]) + [OCAML_MAJOR=` echo $OCAMLVERSION | $SED 's/\([[:digit:]]*\).*/\1/' `] + AC_MSG_RESULT([$OCAML_MAJOR]) + AC_SUBST([OCAML_MAJOR]) + + AC_MSG_CHECKING([for what libraries are needed for OCaml plugins]) + AS_IF([test $OCAML_MAJOR -ge 5],[ + OCAML_PLUGIN_LIBRARIES="-I +unix unix.cmxa -I +threads threads.cmxa" + ],[ + OCAML_PLUGIN_LIBRARIES="unix.cmxa" + ]) + AC_MSG_RESULT([$OCAML_PLUGIN_LIBRARIES]) + AC_SUBST([OCAML_PLUGIN_LIBRARIES]) + + dnl Check if OCaml has caml_alloc_initialized_string (added 2017). + AC_MSG_CHECKING([for caml_alloc_initialized_string]) + cat >conftest.c <<'EOF' +#include +int main () { char *p = (void *) caml_alloc_initialized_string; return 0; } +EOF + AS_IF([$OCAMLC conftest.c >&AS_MESSAGE_LOG_FD 2>&1],[ + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_CAML_ALLOC_INITIALIZED_STRING],[1], + [caml_alloc_initialized_string found at compile time.]) + ],[ + AC_MSG_RESULT([no]) + ]) + rm -f conftest.c conftest.o + + dnl Check if OCaml has caml_shutdown (added 2014). + AC_MSG_CHECKING([for caml_shutdown]) + cat >conftest.c <<'EOF' +#include +int main () { char *p = (void *) caml_shutdown; return 0; } +EOF + AS_IF([$OCAMLC conftest.c >&AS_MESSAGE_LOG_FD 2>&1],[ + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_CAML_SHUTDOWN],[1], + [caml_shutdown found at compile time.]) + ],[ + AC_MSG_RESULT([no]) + ]) + rm -f conftest.c conftest.o + + dnl Check if OCaml has + AC_MSG_CHECKING([for caml/socketaddr.h]) + cat >conftest.c <<'EOF' +#include +#include +int main () { return 0; } +EOF + AS_IF([$OCAMLC conftest.c >&AS_MESSAGE_LOG_FD 2>&1],[ + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_CAML_SOCKETADDR_H],[1], + [caml/socketaddr.h found at compile time.]) + ],[ + AC_MSG_RESULT([no]) + ]) + rm -f conftest.c conftest.o + + dnl Check if OCaml has caml_unix_alloc_sockaddr (added OCaml 5 in 2022). + AC_MSG_CHECKING([for caml_unix_alloc_sockaddr]) + cat >conftest.c <<'EOF' +#include +#include +int main () { char *p = (void *) caml_unix_alloc_sockaddr; return 0; } +EOF + AS_IF([$OCAMLC conftest.c >&AS_MESSAGE_LOG_FD 2>&1],[ + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_CAML_UNIX_ALLOC_SOCKADDR],[1], + [caml_unix_alloc_sockaddr found at compile time.]) + ],[ + AC_MSG_RESULT([no]) + ]) + rm -f conftest.c conftest.o +]) + +dnl For developing plugins in Rust, optional. +dnl Rust does not play nicely with VPATH builds +AC_CHECK_PROG([CARGO],[cargo],[cargo],[no]) +AC_CHECK_PROG([RUSTC],[rustc],[rustc],[no]) +AC_ARG_ENABLE([rust], + [AS_HELP_STRING([--disable-rust], [disable Rust plugin])], + [], + [if test "x$(realpath $srcdir)" = "x$(realpath .)"; then + enable_rust=yes + else + enable_rust=no + fi]) +AS_IF([test "x$enable_rust" != "xno" && test "x$CARGO" != "xno" && test "x$RUSTC" != "xno"], + [have_rust=yes], [have_rust=no]) +AM_CONDITIONAL([HAVE_RUST], [test "x$have_rust" = "xyes"]) +AS_IF([test "x$have_rust" = "xyes"], [ + printf "cargo version: "; $CARGO --version + printf "rustc version: "; $RUSTC --version +]) + +dnl Check for Ruby, for embedding in the Ruby plugin. +AC_CHECK_PROG([RUBY],[ruby],[ruby],[no]) +AC_ARG_ENABLE([ruby], + [AS_HELP_STRING([--disable-ruby], [disable Ruby plugin])], + [], + [enable_ruby=yes]) +AS_IF([test "x$RUBY" != "xno" && test "x$enable_ruby" != "xno"],[ + PKG_CHECK_MODULES([RUBY], [ruby], [ + AC_SUBST([RUBY_CFLAGS]) + AC_SUBST([RUBY_LIBS]) + ],[ + AC_MSG_WARN([ruby not found]) + enable_ruby=no + ]) +]) +AM_CONDITIONAL([HAVE_RUBY],[test "x$RUBY" != "xno" && + test "x$enable_ruby" = "xyes"]) + +dnl Check for Tcl, for embedding in the Tcl plugin. +AC_ARG_ENABLE([tcl], + [AS_HELP_STRING([--disable-tcl], [disable Tcl plugin])], + [], + [enable_tcl=yes]) +AS_IF([test "x$enable_tcl" != "xno"],[ + PKG_CHECK_MODULES([TCL], [tcl], [ + AC_SUBST([TCL_CFLAGS]) + AC_SUBST([TCL_LIBS]) + ],[ + AC_MSG_WARN([Tcl not found]) + enable_tcl=no + ]) +]) +AM_CONDITIONAL([HAVE_TCL],[test "x$enable_tcl" = "xyes"]) + +dnl Check for Lua, for embedding in the Lua plugin. +AC_ARG_ENABLE([lua], + [AS_HELP_STRING([--disable-lua], [disable Lua plugin])], + [], + [enable_lua=yes]) +AS_IF([test "x$enable_lua" != "xno"],[ + PKG_CHECK_MODULES([LUA], [lua], [ + AC_SUBST([LUA_CFLAGS]) + AC_SUBST([LUA_LIBS]) + + dnl Lua 5.1 used by RHEL 7 does not have lua_isinteger. + old_LIBS="$LIBS" + LIBS="$LUA_LIBS $LIBS" + AC_CHECK_FUNCS([lua_isinteger]) + LIBS="$old_LIBS" + ],[ + AC_MSG_WARN([Lua not found]) + enable_lua=no + ]) +]) +AM_CONDITIONAL([HAVE_LUA],[test "x$enable_lua" = "xyes"]) + +dnl Check for golang. +AC_ARG_ENABLE([golang], + AS_HELP_STRING([--disable-golang], [disable Go language plugin]), + [], + [enable_golang=yes]) +AS_IF([test "x$enable_golang" != "xno"],[ + AC_CHECK_PROG([GOLANG],[go],[go],[no]) + AS_IF([test "x$GOLANG" != "xno"],[ + AC_MSG_CHECKING([if $GOLANG is usable]) + AS_IF([$GOLANG run $srcdir/plugins/golang/config-test.go 2>&AS_MESSAGE_LOG_FD && \ + $GOLANG help modules 2>&AS_MESSAGE_LOG_FD 1>&2],[ + AC_MSG_RESULT([yes]) + + # Substitute some golang environment. + GOOS=`$GOLANG env GOOS` + GOARCH=`$GOLANG env GOARCH` + GOROOT=`$GOLANG env GOROOT` + AC_SUBST([GOOS]) + AC_SUBST([GOARCH]) + AC_SUBST([GOROOT]) + ],[ + AC_MSG_RESULT([no]) + AC_MSG_WARN([golang ($GOLANG) is installed but not usable]) + GOLANG=no + ]) + ]) +],[GOLANG=no]) +AM_CONDITIONAL([HAVE_GOLANG],[test "x$GOLANG" != "xno"]) + +dnl Check for libblkio (only if you want to compile the blkio plugin). +AC_ARG_WITH([libblkio], + [AS_HELP_STRING([--without-libblkio], + [disable blkio plugin @<:@default=check@:>@])], + [], + [with_libblkio=check]) +AS_IF([test "$with_libblkio" != "no"],[ + PKG_CHECK_MODULES([LIBBLKIO], [blkio],[ + printf "libblkio version is "; $PKG_CONFIG --modversion blkio + AC_SUBST([LIBBLKIO_CFLAGS]) + AC_SUBST([LIBBLKIO_LIBS]) + AC_DEFINE([HAVE_LIBBLKIO],[1],[libblkio found at compile time.]) + ], + [AC_MSG_WARN([libblkio not found, blkio plugin will be disabled])]) +]) +AM_CONDITIONAL([HAVE_LIBBLKIO],[test "x$LIBBLKIO_LIBS" != "x"]) + +dnl Check for curl (only if you want to compile the curl plugin). +AC_ARG_WITH([curl], + [AS_HELP_STRING([--without-curl], + [disable curl plugin @<:@default=check@:>@])], + [], + [with_curl=check]) +AS_IF([test "$with_curl" != "no"],[ + PKG_CHECK_MODULES([CURL], [libcurl],[ + printf "libcurl version is "; $PKG_CONFIG --modversion libcurl + AC_SUBST([CURL_CFLAGS]) + AC_SUBST([CURL_LIBS]) + AC_DEFINE([HAVE_CURL],[1],[curl found at compile time.]) + AC_CHECK_DECL([CURLOPT_UNIX_SOCKET_PATH], [ + AC_DEFINE([HAVE_CURLOPT_UNIX_SOCKET_PATH],[1], + [CURLOPT_UNIX_SOCKET_PATH found at compile time.]) + ], [], [#include ]) + dnl Detect both CURLOPT_PROTOCOLS_STR and + dnl CURLOPT_REDIR_PROTOCOLS_STR. Both were added in curl + dnl 7.85.0 so we assume if one exists then both do. + AC_CHECK_DECL([CURLOPT_PROTOCOLS_STR], [ + AC_DEFINE([HAVE_CURLOPT_PROTOCOLS_STR],[1], + [CURLOPT_PROTOCOLS_STR found at compile time.]) + ], [], [#include ]) + dnl Detect various HTTP version enums supported by curl. + AC_CHECK_DECL([CURL_HTTP_VERSION_2_0], [ + AC_DEFINE([HAVE_CURL_HTTP_VERSION_2_0],[1], + [CURL_HTTP_VERSION_2_0 found at compile time.]) + ], [], [#include ]) + AC_CHECK_DECL([CURL_HTTP_VERSION_2TLS], [ + AC_DEFINE([HAVE_CURL_HTTP_VERSION_2TLS],[1], + [CURL_HTTP_VERSION_2TLS found at compile time.]) + ], [], [#include ]) + AC_CHECK_DECL([CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE], [ + AC_DEFINE([HAVE_CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE],[1], + [CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE found at compile time.]) + ], [], [#include ]) + AC_CHECK_DECL([CURL_HTTP_VERSION_3], [ + AC_DEFINE([HAVE_CURL_HTTP_VERSION_3],[1], + [CURL_HTTP_VERSION_3 found at compile time.]) + ], [], [#include ]) + AC_CHECK_DECL([CURL_HTTP_VERSION_3ONLY], [ + AC_DEFINE([HAVE_CURL_HTTP_VERSION_3ONLY],[1], + [CURL_HTTP_VERSION_3ONLY found at compile time.]) + ], [], [#include ]) + dnl Detect various newer SSL versions, added in 7.54.0 + AC_CHECK_DECL([CURL_SSLVERSION_MAX_DEFAULT], [ + AC_DEFINE([HAVE_CURL_SSLVERSION_MAX_DEFAULT],[1], + [CURL_SSLVERSION_MAX_DEFAULT found at compile time.]) + ], [], [#include ]) + AC_CHECK_DECL([CURL_SSLVERSION_MAX_TLSv1_0], [ + AC_DEFINE([HAVE_CURL_SSLVERSION_MAX_TLSv1_0],[1], + [CURL_SSLVERSION_MAX_TLSv1_0 found at compile time.]) + ], [], [#include ]) + AC_CHECK_DECL([CURL_SSLVERSION_MAX_TLSv1_1], [ + AC_DEFINE([HAVE_CURL_SSLVERSION_MAX_TLSv1_1],[1], + [CURL_SSLVERSION_MAX_TLSv1_1 found at compile time.]) + ], [], [#include ]) + AC_CHECK_DECL([CURL_SSLVERSION_MAX_TLSv1_2], [ + AC_DEFINE([HAVE_CURL_SSLVERSION_MAX_TLSv1_2],[1], + [CURL_SSLVERSION_MAX_TLSv1_2 found at compile time.]) + ], [], [#include ]) + AC_CHECK_DECL([CURL_SSLVERSION_MAX_TLSv1_3], [ + AC_DEFINE([HAVE_CURL_SSLVERSION_MAX_TLSv1_3],[1], + [CURL_SSLVERSION_MAX_TLSv1_3 found at compile time.]) + ], [], [#include ]) + dnl curl_multi_get_handles was added as a semi-experimental + dnl feature in curl 8.3.1. + dnl https://github.com/curl/curl/pull/11750 + dnl https://github.com/curl/curl/commit/9ffd4117357 + old_LIBS="$LIBS" + LIBS="$CURL_LIBS $LIBS" + AC_CHECK_FUNCS([curl_multi_get_handles]) + LIBS="$old_LIBS" + ], + [AC_MSG_WARN([curl not found, curl plugin will be disabled])]) +]) +AM_CONDITIONAL([HAVE_CURL],[test "x$CURL_LIBS" != "x"]) + +dnl Check for libssh (only if you want to compile the ssh plugin). +AC_ARG_WITH([ssh], + [AS_HELP_STRING([--without-ssh], + [disable ssh plugin @<:@default=check@:>@])], + [], + [with_ssh=check]) +AS_IF([test "$with_ssh" != "no"],[ + PKG_CHECK_MODULES([SSH], [libssh >= 0.8.0],[ + printf "libssh version is "; $PKG_CONFIG --modversion libssh + # Ubuntu 18.04 shipped prerelease of libssh-0.8.0 without + # SSH_OPTIONS_NODELAY + old_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $SSH_CFLAGS" + AC_CHECK_DECL([SSH_OPTIONS_NODELAY], [ + AC_SUBST([SSH_CFLAGS]) + AC_SUBST([SSH_LIBS]) + # We don't need this in the code, just in this configure + HAVE_SSH_OPTIONS_NODELAY=1 + ], [], [ + #include + ]) + CFLAGS="$old_CFLAGS" + ], + [AC_MSG_WARN([libssh not found, ssh plugin will be disabled])]) +]) +AM_CONDITIONAL([HAVE_SSH],[test "x$HAVE_SSH_OPTIONS_NODELAY" != "x"]) + +dnl Check for xorriso or genisoimage or mkisofs +dnl (only if you want to compile the iso plugin). +ISOPROG="no" +is_xorriso=0 +AC_ARG_WITH([iso], + [AS_HELP_STRING([--without-iso], + [disable iso plugin @<:@default=check@:>@])], + [], + [with_iso=check]) +AS_IF([test "$with_iso" != "no"],[ + AC_CHECK_PROG([XORRISO],[xorriso],[xorriso],[no]) + AC_CHECK_PROG([GENISOIMAGE],[genisoimage],[genisoimage],[no]) + AC_CHECK_PROG([MKISOFS],[mkisofs],[mkisofs],[no]) + AS_IF([test "x$XORRISO" != "xno"],[ + ISOPROG="$XORRISO" + is_xorriso=1 + ],[ + AS_IF([test "x$GENISOIMAGE" != "xno"],[ + ISOPROG="$GENISOIMAGE" + ],[ + AS_IF([test "x$MKISOFS" != "xno"],[ + ISOPROG="$MKISOFS" + ]) + ]) + ]) + AS_IF([test "x$ISOPROG" != "xno"],[ + printf "picked %s for nbdkit-iso-plugin\n" "$ISOPROG" + AC_DEFINE_UNQUOTED([ISOPROG],["$ISOPROG"], + [Program used by iso plugin to make ISOs.]) + AS_IF([test "x$is_xorriso" = "x1"], [ + AC_DEFINE([ISOPROG_IS_XORRISO],[1], + [ISO program behaves like xorriso.]) + ]) + ]) +]) +AC_SUBST([ISOPROG]) +AM_CONDITIONAL([HAVE_ISO],[test "x$ISOPROG" != "xno"]) + +dnl Check for libvirt (only if you want to compile the libvirt plugin). +AC_ARG_WITH([libvirt], + [AS_HELP_STRING([--without-libvirt], + [disable libvirt plugin @<:@default=check@:>@])], + [], + [with_libvirt=check]) +AS_IF([test "$with_libvirt" != "no"],[ + PKG_CHECK_MODULES([LIBVIRT], [libvirt],[ + AC_SUBST([LIBVIRT_CFLAGS]) + AC_SUBST([LIBVIRT_LIBS]) + AC_DEFINE([HAVE_LIBVIRT],[1],[libvirt found at compile time.]) + ], + [AC_MSG_WARN([libvirt not found, libvirt plugin will be disabled])]) +]) +AM_CONDITIONAL([HAVE_LIBVIRT],[test "x$LIBVIRT_LIBS" != "x"]) + +dnl Check for zlib (only if you want to compile the gzip filter). +AC_ARG_WITH([zlib], + [AS_HELP_STRING([--without-zlib], + [disable gzip filter @<:@default=check@:>@])], + [], + [with_zlib=check]) +AS_IF([test "$with_zlib" != "no"],[ + PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.3.5],[ + AC_SUBST([ZLIB_CFLAGS]) + AC_SUBST([ZLIB_LIBS]) + AC_DEFINE([HAVE_ZLIB],[1],[zlib found at compile time.]) + ], + [AC_MSG_WARN([zlib >= 1.2.3.5 not found, gzip filter will be disabled])]) +]) +AM_CONDITIONAL([HAVE_ZLIB],[test "x$ZLIB_LIBS" != "x"]) + +dnl Check for zlib-ng (optimizes uses of zlib). +AC_ARG_WITH([zlib-ng], + [AS_HELP_STRING([--without-zlib-ng], + [disable zlib-ng support @<:@default=check@:>@])], + [], + [with_zlib_ng=check]) +AS_IF([test "$with_zlib_ng" != "no"],[ + PKG_CHECK_MODULES([ZLIB_NG], [zlib-ng],[ + AC_SUBST([ZLIB_NG_CFLAGS]) + AC_SUBST([ZLIB_NG_LIBS]) + AC_DEFINE([HAVE_ZLIB_NG],[1],[zlib-ng found at compile time.]) + ], + [AC_MSG_WARN([zlib-ng not found, zlib operations will run slower])]) +]) +AM_CONDITIONAL([HAVE_ZLIB],[test "x$ZLIB_LIBS" != "x"]) + +dnl Check for libnbd (only if you want to compile the nbd plugin). +AC_ARG_WITH([libnbd], + [AS_HELP_STRING([--without-libnbd], + [disable nbd plugin @<:@default=check@:>@])], + [], + [with_libnbd=check]) +AS_IF([test "$with_libnbd" != "no"],[ + PKG_CHECK_MODULES([LIBNBD], [libnbd >= 0.9.8],[ + printf "libnbd version is "; $PKG_CONFIG --modversion libnbd + AC_SUBST([LIBNBD_CFLAGS]) + AC_SUBST([LIBNBD_LIBS]) + AC_DEFINE([HAVE_LIBNBD],[1],[libnbd found at compile time.]) + ], + [AC_MSG_WARN([libnbd >= 0.9.8 not found, nbd plugin will be crippled])]) +]) + +dnl For backwards compatibilty, we have a second way to disable the nbd plugin. +AC_ARG_ENABLE([nbd-plugin], + [AS_HELP_STRING([--disable-nbd-plugin], [disable nbd plugin (deprecated, use --without-libnbd)])], + [], + [enable_nbd_plugin=yes]) +AM_CONDITIONAL([HAVE_LIBNBD], + [test "x$LIBNBD_LIBS" != "x" && test "x$enable_nbd_plugin" = "xyes"]) + +dnl Check for liblzma (only if you want to compile the xz filter). +AC_ARG_WITH([liblzma], + [AS_HELP_STRING([--without-liblzma], + [disable xz filter @<:@default=check@:>@])], + [], + [with_liblzma=check]) +AS_IF([test "$with_liblzma" != "no"],[ + PKG_CHECK_MODULES([LIBLZMA], [liblzma],[ + AC_SUBST([LIBLZMA_CFLAGS]) + AC_SUBST([LIBLZMA_LIBS]) + AC_DEFINE([HAVE_LIBLZMA],[1],[liblzma found at compile time.]) + ], + [AC_MSG_WARN([liblzma not found, xz filter will be disabled])]) +]) +AM_CONDITIONAL([HAVE_LIBLZMA],[test "x$LIBLZMA_LIBS" != "x"]) + +dnl Check for zstd (only if you want to compile allocator=zstd). +AC_ARG_WITH([libzstd], + [AS_HELP_STRING([--without-libzstd], + [disable allocator=zstd @<:@default=check@:>@])], + [], + [with_libzstd=check]) +AS_IF([test "$with_libzstd" != "no"],[ + PKG_CHECK_MODULES([LIBZSTD], [libzstd],[ + AC_SUBST([LIBZSTD_CFLAGS]) + AC_SUBST([LIBZSTD_LIBS]) + AC_DEFINE([HAVE_LIBZSTD],[1],[libzstd found at compile time.]) + ], + [AC_MSG_WARN([libzstd not found, allocator=zstd will be disabled])]) +]) +AM_CONDITIONAL([HAVE_LIBZSTD],[test "x$LIBZSTD_LIBS" != "x"]) + +dnl Check for libguestfs (only for the guestfs plugin and parts of +dnl the test suite). +AC_ARG_WITH([libguestfs], + [AS_HELP_STRING([--without-libguestfs], + [disable guestfs plugin and tests @<:@default=check@:>@])], + [], + [with_libguestfs=check]) +AS_IF([test "$with_libguestfs" != "no"],[ + PKG_CHECK_MODULES([LIBGUESTFS], [libguestfs],[ + # Although the library was found, we want to make sure it supports nbd + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include + ]], [[ +#ifndef GUESTFS_ADD_DRIVE_OPTS_PROTOCOL +#error unsupported +#endif + ]])], [ + AC_SUBST([LIBGUESTFS_CFLAGS]) + AC_SUBST([LIBGUESTFS_LIBS]) + AC_DEFINE([HAVE_LIBGUESTFS],[1],[libguestfs found at compile time.]) + ],[ + LIBGUESTFS_LIBS= + AC_MSG_WARN([libguestfs too old, guestfs plugin and tests will be disabled])]) + ], + [AC_MSG_WARN([libguestfs not found, guestfs plugin and tests will be disabled])]) +]) +AM_CONDITIONAL([HAVE_LIBGUESTFS],[test "x$LIBGUESTFS_LIBS" != "x"]) + +dnl Disable tests which need libguestfs. +AC_ARG_ENABLE([libguestfs-tests], + [AS_HELP_STRING([--disable-libguestfs-tests], + [disable tests which need libguestfs])], + [], + [enable_libguestfs_tests=check] +) +AM_CONDITIONAL([USE_LIBGUESTFS_FOR_TESTS], + [test "x$LIBGUESTFS_LIBS" != "x" && \ + test "x$enable_libguestfs_tests" != "xno"]) + +dnl Check for ext2fs and com_err, for the ext2 filter. +AC_ARG_WITH([ext2], + [AS_HELP_STRING([--without-ext2], + [disable ext2 filter @<:@default=check@:>@])], + [], + [with_ext2=check]) +AS_IF([test "$with_ext2" != "no"], [ + PKG_CHECK_MODULES([EXT2FS], [ext2fs], [ + AC_SUBST([EXT2FS_CFLAGS]) + AC_SUBST([EXT2FS_LIBS]) + AC_DEFINE([HAVE_EXT2FS],[1],[ext2fs found at compile time.]) + ], + [AC_MSG_WARN([ext2fs not found, ext2 filter will be disabled])]) + PKG_CHECK_MODULES([COM_ERR], [com_err], [ + AC_SUBST([COM_ERR_CFLAGS]) + AC_SUBST([COM_ERR_LIBS]) + AC_DEFINE([HAVE_COM_ERR],[1],[com_err found at compile time.]) + ], + [AC_MSG_WARN([com_err not found, ext2 filter will be disabled])]) + + AC_CHECK_MEMBERS([struct struct_io_manager.cache_readahead, + struct struct_io_manager.zeroout]) +]) +AM_CONDITIONAL([HAVE_EXT2], + [test "x$EXT2FS_LIBS" != "x" && test "x$COM_ERR_LIBS" != "x"]) + +dnl libtorrent-rasterbar for the bittorrent plugin. +AC_ARG_ENABLE([torrent], + [AS_HELP_STRING([--disable-torrent], + [disable bittorrent plugin])], + [], + [enable_torrent=check] +) +AS_IF([test "x$enable_torrent" != "xno"], [ + PKG_CHECK_MODULES([LIBTORRENT], [libtorrent-rasterbar], [ + AC_SUBST([LIBTORRENT_CFLAGS]) + AC_SUBST([LIBTORRENT_LIBS]) + ], + [AC_MSG_WARN([libtorrent-rasterbar not found, bittorrent plugin will be disabled])]) +]) +AM_CONDITIONAL([HAVE_TORRENT], + [test "x$have_cxx" = "xyes" && test "x$LIBTORRENT_LIBS" != "x"]) + +dnl Check if the user wants to disable VDDK support. +dnl See plugins/vddk/README.VDDK. +AC_ARG_ENABLE([vddk], + [AS_HELP_STRING([--disable-vddk], + [disable VMware VDDK plugin])], + [], + [ + dnl While VDDK was available on i686 in 5.1.1, we only support + dnl newer versions which are supported only on x86-64. Don't + dnl compile on other platforms. + AC_MSG_CHECKING([if the host CPU is compatible with VDDK]) + AS_IF([test "$host_cpu" = "x86_64" && test "$host_os" = "linux-gnu"],[ + AC_MSG_RESULT([yes ($host)]) + enable_vddk=yes + ],[ + AC_MSG_RESULT([no ($host)]) + enable_vddk=no + ]) + ]) +AM_CONDITIONAL([HAVE_VDDK], [test "x$enable_vddk" = "xyes"]) + +dnl Expose version information to the public headers +[NBDKIT_]VERSION_MAJOR=NBDKIT_VERSION_MAJOR +[NBDKIT_]VERSION_MINOR=NBDKIT_VERSION_MINOR +[NBDKIT_]VERSION_MICRO=NBDKIT_VERSION_MICRO +AC_SUBST([NBDKIT_VERSION_MAJOR]) +AC_SUBST([NBDKIT_VERSION_MINOR]) +AC_SUBST([NBDKIT_VERSION_MICRO]) + +dnl Produce output files. +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_FILES([podwrapper.pl], + [chmod +x,-w podwrapper.pl]) +AC_CONFIG_FILES([common/protocol/generate-protostrings.sh], + [chmod +x,-w common/protocol/generate-protostrings.sh]) +AC_CONFIG_FILES([tests/make-pki.sh], + [chmod +x,-w tests/make-pki.sh]) +AC_CONFIG_FILES([Makefile + bash-completion/Makefile + common/allocators/Makefile + common/bitmap/Makefile + common/gpt/Makefile + common/include/Makefile + common/protocol/Makefile + common/regions/Makefile + common/replacements/Makefile + common/replacements/win32/Makefile + common/utils/Makefile + contrib/Makefile + docs/Makefile + include/Makefile + include/nbdkit-version.h + plugins/Makefile + plugins/blkio/Makefile + plugins/cc/Makefile + plugins/cdi/Makefile + plugins/curl/Makefile + plugins/data/Makefile + plugins/eval/Makefile + plugins/example1/Makefile + plugins/example2/Makefile + plugins/example3/Makefile + plugins/example4/Makefile + plugins/file/Makefile + plugins/floppy/Makefile + plugins/full/Makefile + plugins/golang/Makefile + plugins/guestfs/Makefile + plugins/info/Makefile + plugins/iso/Makefile + plugins/libvirt/Makefile + plugins/linuxdisk/Makefile + plugins/lua/Makefile + plugins/memory/Makefile + plugins/nbd/Makefile + plugins/null/Makefile + plugins/ocaml/Makefile + plugins/ondemand/Makefile + plugins/ones/Makefile + plugins/partitioning/Makefile + plugins/pattern/Makefile + plugins/perl/Makefile + plugins/python/Makefile + plugins/random/Makefile + plugins/ruby/Makefile + plugins/rust/Makefile + plugins/S3/Makefile + plugins/sh/Makefile + plugins/ssh/Makefile + plugins/sparse-random/Makefile + plugins/split/Makefile + plugins/tcl/Makefile + plugins/tmpdisk/Makefile + plugins/torrent/Makefile + plugins/vddk/Makefile + plugins/zero/Makefile + filters/Makefile + filters/blocksize/Makefile + filters/blocksize-policy/Makefile + filters/cache/Makefile + filters/cacheextents/Makefile + filters/checkwrite/Makefile + filters/cow/Makefile + filters/ddrescue/Makefile + filters/delay/Makefile + filters/error/Makefile + filters/exitlast/Makefile + filters/exitwhen/Makefile + filters/exportname/Makefile + filters/ext2/Makefile + filters/extentlist/Makefile + filters/evil/Makefile + filters/fua/Makefile + filters/gzip/Makefile + filters/ip/Makefile + filters/limit/Makefile + filters/log/Makefile + filters/luks/Makefile + filters/multi-conn/Makefile + filters/nocache/Makefile + filters/noextents/Makefile + filters/nofilter/Makefile + filters/noparallel/Makefile + filters/nozero/Makefile + filters/offset/Makefile + filters/partition/Makefile + filters/pause/Makefile + filters/protect/Makefile + filters/qcow2dec/Makefile + filters/rate/Makefile + filters/readahead/Makefile + filters/retry/Makefile + filters/retry-request/Makefile + filters/scan/Makefile + filters/stats/Makefile + filters/swab/Makefile + filters/tar/Makefile + filters/tls-fallback/Makefile + filters/truncate/Makefile + filters/xz/Makefile + fuzzing/Makefile + server/local/nbdkit.pc + server/Makefile + server/nbdkit.pc + tests/functions.sh + tests/Makefile + valgrind/Makefile]) + +AC_OUTPUT + +dnl Summary. +echo +echo +echo "----------------------------------------------------------------------" +echo "Thank you for downloading $PACKAGE_STRING" +echo +echo "This is how we have configured the optional components for you today:" +echo + +print () +{ + printf ' %.40s %s\n' \ + "$1 ........................................" "$2" +} + +feature () +{ + feat="$1" + shift + if "$@"; then + print "$feat" "yes" + else + print "$feat" "no" + fi +} + +echo "Optional server features:" +echo +feature "bash-completion" test "x$HAVE_BASH_COMPLETION_TRUE" = "x" +feature "libfuzzer" test "x$ENABLE_LIBFUZZER_TRUE" = "x" +feature "linker script" test "x$USE_LINKER_SCRIPT" = "x" +feature "manual pages" test "x$HAVE_POD_TRUE" = "x" +feature "SELinux" test "x$LIBSELINUX_LIBS" != "x" +feature "TLS" test "x$GNUTLS_LIBS" != "x" + +echo +echo "Optional plugins:" +echo +feature "blkio" test "x$HAVE_LIBBLKIO_TRUE" = "x" +feature "curl" test "x$HAVE_CURL_TRUE" = "x" +feature "example4" test "x$HAVE_PERL_TRUE" = "x" +feature "floppy" test "x$HAVE_ICONV_TRUE" = "x" +feature "guestfs" test "x$HAVE_LIBGUESTFS_TRUE" = "x" +feature "iso" test "x$HAVE_ISO_TRUE" = "x" +feature "libvirt" test "x$HAVE_LIBVIRT_TRUE" = "x" +feature "linuxdisk" test "x$HAVE_MKE2FS_WITH_D_TRUE" = "x" +feature "nbd" test "x$HAVE_LIBNBD_TRUE" = "x" +feature "S3" test "x$HAVE_PYTHON_TRUE" = "x" +feature "ssh" test "x$HAVE_SSH_TRUE" = "x" +feature "torrent" test "x$HAVE_TORRENT_TRUE" = "x" +feature "vddk" test "x$HAVE_VDDK_TRUE" = "x" + +echo +echo "Languages:" +echo +feature "go" test "x$HAVE_GOLANG_TRUE" = "x" +feature "lua" test "x$HAVE_LUA_TRUE" = "x" +feature "ocaml" test "x$HAVE_OCAML_TRUE" = "x" +feature "perl" test "x$HAVE_PERL_TRUE" = "x" +feature "python" test "x$HAVE_PYTHON_TRUE" = "x" +feature "ruby" test "x$HAVE_RUBY_TRUE" = "x" +feature "rust" test "x$HAVE_RUST_TRUE" = "x" +feature "tcl" test "x$HAVE_TCL_TRUE" = "x" + +echo +echo "Optional filters:" +echo +feature "ext2" test "x$HAVE_EXT2_TRUE" = "x" +feature "gzip" test "x$HAVE_ZLIB_TRUE" = "x" +feature "luks" test "x$HAVE_GNUTLS_PBKDF2_TRUE" = "x" +feature "stats" test "x$HAVE_CXX_TRUE" = "x" +feature "xz" test "x$HAVE_LIBLZMA_TRUE" = "x" + +echo +echo "Other optional features:" +echo +feature "allocator=zstd" test "x$HAVE_LIBZSTD_TRUE" = "x" +feature "tests using libguestfs" \ + test "x$HAVE_LIBGUESTFS_TRUE" = "x" && \ + test "x$USE_LIBGUESTFS_FOR_TESTS_TRUE" = "x" +feature "zlib-ng" test "x$ZLIB_NG_LIBS" != "x" +print cc-plugin-CC "$CC_PLUGIN_CC" +print cc-plugin-CFLAGS "$CC_PLUGIN_CFLAGS" + +echo +echo "If any optional component is configured ‘no’ when you expected ‘yes’" +echo "then you should check the preceding messages and README." +echo +echo "Please report bugs back to the mailing list:" +echo "https://lists.libguestfs.org" +echo +echo "Next you should type 'make' to build the package," +echo "then 'make check' to run the tests." diff --git a/contrib/Makefile.am b/contrib/Makefile.am new file mode 100644 index 0000000..b9866e4 --- /dev/null +++ b/contrib/Makefile.am @@ -0,0 +1,44 @@ +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 $(top_srcdir)/common-rules.mk + +if HAVE_LIBNBD + +noinst_PROGRAMS = sparseloadtest + +sparseloadtest_SOURCES = sparseloadtest.c +sparseloadtest_CPPFLAGS = -I$(top_srcdir)/common/include +sparseloadtest_CFLAGS = $(PTHREAD_CFLAGS) $(WARNINGS_CFLAGS) $(LIBNBD_CFLAGS) +sparseloadtest_LDADD = $(LIBNBD_LIBS) +sparseloadtest_LDFLAGS = $(PTHREAD_LIBS) + +endif HAVE_LIBNBD diff --git a/contrib/Makefile.in b/contrib/Makefile.in new file mode 100644 index 0000000..7d1025d --- /dev/null +++ b/contrib/Makefile.in @@ -0,0 +1,805 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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@ +@HAVE_LIBNBD_TRUE@noinst_PROGRAMS = sparseloadtest$(EXEEXT) +subdir = contrib +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ocaml.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +PROGRAMS = $(noinst_PROGRAMS) +am__sparseloadtest_SOURCES_DIST = sparseloadtest.c +@HAVE_LIBNBD_TRUE@am_sparseloadtest_OBJECTS = \ +@HAVE_LIBNBD_TRUE@ sparseloadtest-sparseloadtest.$(OBJEXT) +sparseloadtest_OBJECTS = $(am_sparseloadtest_OBJECTS) +am__DEPENDENCIES_1 = +@HAVE_LIBNBD_TRUE@sparseloadtest_DEPENDENCIES = $(am__DEPENDENCIES_1) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +sparseloadtest_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(sparseloadtest_CFLAGS) $(CFLAGS) $(sparseloadtest_LDFLAGS) \ + $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/sparseloadtest-sparseloadtest.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(sparseloadtest_SOURCES) +DIST_SOURCES = $(am__sparseloadtest_SOURCES_DIST) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/common-rules.mk \ + $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ +BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ +CARGO = @CARGO@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_PLUGIN_CC = @CC_PLUGIN_CC@ +CC_PLUGIN_CFLAGS = @CC_PLUGIN_CFLAGS@ +CERTTOOL = @CERTTOOL@ +CFLAGS = @CFLAGS@ +COM_ERR_CFLAGS = @COM_ERR_CFLAGS@ +COM_ERR_LIBS = @COM_ERR_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CUT = @CUT@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LDFLAGS = @DL_LDFLAGS@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXT2FS_CFLAGS = @EXT2FS_CFLAGS@ +EXT2FS_LIBS = @EXT2FS_LIBS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GENISOIMAGE = @GENISOIMAGE@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GOARCH = @GOARCH@ +GOLANG = @GOLANG@ +GOOS = @GOOS@ +GOROOT = @GOROOT@ +GREP = @GREP@ +IMPORT_LIBRARY_ON_WINDOWS = @IMPORT_LIBRARY_ON_WINDOWS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +ISOPROG = @ISOPROG@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBLKIO_CFLAGS = @LIBBLKIO_CFLAGS@ +LIBBLKIO_LIBS = @LIBBLKIO_LIBS@ +LIBGUESTFS_CFLAGS = @LIBGUESTFS_CFLAGS@ +LIBGUESTFS_LIBS = @LIBGUESTFS_LIBS@ +LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ +LIBLZMA_LIBS = @LIBLZMA_LIBS@ +LIBNBD_CFLAGS = @LIBNBD_CFLAGS@ +LIBNBD_LIBS = @LIBNBD_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSELINUX_CFLAGS = @LIBSELINUX_CFLAGS@ +LIBSELINUX_LIBS = @LIBSELINUX_LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTORRENT_CFLAGS = @LIBTORRENT_CFLAGS@ +LIBTORRENT_LIBS = @LIBTORRENT_LIBS@ +LIBVIRT_CFLAGS = @LIBVIRT_CFLAGS@ +LIBVIRT_LIBS = @LIBVIRT_LIBS@ +LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ +LIBZSTD_LIBS = @LIBZSTD_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LUA_CFLAGS = @LUA_CFLAGS@ +LUA_LIBS = @LUA_LIBS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MC = @MC@ +MKDIR_P = @MKDIR_P@ +MKISOFS = @MKISOFS@ +NBDKIT_VERSION_MAJOR = @NBDKIT_VERSION_MAJOR@ +NBDKIT_VERSION_MICRO = @NBDKIT_VERSION_MICRO@ +NBDKIT_VERSION_MINOR = @NBDKIT_VERSION_MINOR@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_ON_WINDOWS = @NO_UNDEFINED_ON_WINDOWS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OCAML = @OCAML@ +OCAMLBEST = @OCAMLBEST@ +OCAMLBUILD = @OCAMLBUILD@ +OCAMLC = @OCAMLC@ +OCAMLCDOTOPT = @OCAMLCDOTOPT@ +OCAMLDEP = @OCAMLDEP@ +OCAMLDOC = @OCAMLDOC@ +OCAMLLIB = @OCAMLLIB@ +OCAMLMKLIB = @OCAMLMKLIB@ +OCAMLMKTOP = @OCAMLMKTOP@ +OCAMLOPT = @OCAMLOPT@ +OCAMLOPTDOTOPT = @OCAMLOPTDOTOPT@ +OCAMLOPTFLAGS = @OCAMLOPTFLAGS@ +OCAMLVERSION = @OCAMLVERSION@ +OCAML_MAJOR = @OCAML_MAJOR@ +OCAML_PLUGIN_LIBRARIES = @OCAML_PLUGIN_LIBRARIES@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PERL_ARCHLIB = @PERL_ARCHLIB@ +PERL_CFLAGS = @PERL_CFLAGS@ +PERL_LDOPTS = @PERL_LDOPTS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PODWRAPPER = @PODWRAPPER@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_CXX = @PTHREAD_CXX@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CFLAGS = @PYTHON_CFLAGS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +RUBY_CFLAGS = @RUBY_CFLAGS@ +RUBY_LIBS = @RUBY_LIBS@ +RUSTC = @RUSTC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOEXT = @SOEXT@ +SSH_CFLAGS = @SSH_CFLAGS@ +SSH_LIBS = @SSH_LIBS@ +STAT = @STAT@ +STRIP = @STRIP@ +TCL_CFLAGS = @TCL_CFLAGS@ +TCL_LIBS = @TCL_LIBS@ +TRUNCATE = @TRUNCATE@ +VALGRIND = @VALGRIND@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VERSION = @VERSION@ +WARNINGS_CFLAGS = @WARNINGS_CFLAGS@ +XORRISO = @XORRISO@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +ZLIB_NG_CFLAGS = @ZLIB_NG_CFLAGS@ +ZLIB_NG_LIBS = @ZLIB_NG_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DLLTOOL = @ac_ct_DLLTOOL@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_MC = @ac_ct_MC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bashcompdir = @bashcompdir@ +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@ +filters = @filters@ +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@ +lang_plugins = @lang_plugins@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +non_lang_plugins = @non_lang_plugins@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugins = @plugins@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +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@ + +# Convenient list terminator +NULL = +plugindir = $(libdir)/nbdkit/plugins +filterdir = $(libdir)/nbdkit/filters +CLEANFILES = *~ *.cmi *.cmx *.cmxa *.so *.dll +@HAVE_LIBNBD_TRUE@sparseloadtest_SOURCES = sparseloadtest.c +@HAVE_LIBNBD_TRUE@sparseloadtest_CPPFLAGS = -I$(top_srcdir)/common/include +@HAVE_LIBNBD_TRUE@sparseloadtest_CFLAGS = $(PTHREAD_CFLAGS) $(WARNINGS_CFLAGS) $(LIBNBD_CFLAGS) +@HAVE_LIBNBD_TRUE@sparseloadtest_LDADD = $(LIBNBD_LIBS) +@HAVE_LIBNBD_TRUE@sparseloadtest_LDFLAGS = $(PTHREAD_LIBS) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common-rules.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign contrib/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign contrib/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; +$(top_srcdir)/common-rules.mk $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +sparseloadtest$(EXEEXT): $(sparseloadtest_OBJECTS) $(sparseloadtest_DEPENDENCIES) $(EXTRA_sparseloadtest_DEPENDENCIES) + @rm -f sparseloadtest$(EXEEXT) + $(AM_V_CCLD)$(sparseloadtest_LINK) $(sparseloadtest_OBJECTS) $(sparseloadtest_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sparseloadtest-sparseloadtest.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +sparseloadtest-sparseloadtest.o: sparseloadtest.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sparseloadtest_CPPFLAGS) $(CPPFLAGS) $(sparseloadtest_CFLAGS) $(CFLAGS) -MT sparseloadtest-sparseloadtest.o -MD -MP -MF $(DEPDIR)/sparseloadtest-sparseloadtest.Tpo -c -o sparseloadtest-sparseloadtest.o `test -f 'sparseloadtest.c' || echo '$(srcdir)/'`sparseloadtest.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/sparseloadtest-sparseloadtest.Tpo $(DEPDIR)/sparseloadtest-sparseloadtest.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sparseloadtest.c' object='sparseloadtest-sparseloadtest.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sparseloadtest_CPPFLAGS) $(CPPFLAGS) $(sparseloadtest_CFLAGS) $(CFLAGS) -c -o sparseloadtest-sparseloadtest.o `test -f 'sparseloadtest.c' || echo '$(srcdir)/'`sparseloadtest.c + +sparseloadtest-sparseloadtest.obj: sparseloadtest.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sparseloadtest_CPPFLAGS) $(CPPFLAGS) $(sparseloadtest_CFLAGS) $(CFLAGS) -MT sparseloadtest-sparseloadtest.obj -MD -MP -MF $(DEPDIR)/sparseloadtest-sparseloadtest.Tpo -c -o sparseloadtest-sparseloadtest.obj `if test -f 'sparseloadtest.c'; then $(CYGPATH_W) 'sparseloadtest.c'; else $(CYGPATH_W) '$(srcdir)/sparseloadtest.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/sparseloadtest-sparseloadtest.Tpo $(DEPDIR)/sparseloadtest-sparseloadtest.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sparseloadtest.c' object='sparseloadtest-sparseloadtest.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sparseloadtest_CPPFLAGS) $(CPPFLAGS) $(sparseloadtest_CFLAGS) $(CFLAGS) -c -o sparseloadtest-sparseloadtest.obj `if test -f 'sparseloadtest.c'; then $(CYGPATH_W) 'sparseloadtest.c'; else $(CYGPATH_W) '$(srcdir)/sparseloadtest.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: +install: 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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/sparseloadtest-sparseloadtest.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/sparseloadtest-sparseloadtest.Po + -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: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstPROGRAMS cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + 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 tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# 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/contrib/sparseloadtest.c b/contrib/sparseloadtest.c new file mode 100644 index 0000000..8b9d775 --- /dev/null +++ b/contrib/sparseloadtest.c @@ -0,0 +1,399 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +/* Load nbdkit-memory-plugin + allocator=sparse + * + * This is better than fio for this plugin since it exercises + * allocation and deallocation of pages and locking. + * + * To test a mainly read workload (90% reads, 10% writes, 10% trims): + * ./contrib/sparseloadtest 4 90 + * + * To test a write-heavy workload (20% reads, 40% writes, 40% trims): + * ./contrib/sparseloadtest 4 20 + * + * nbdkit is run from the current $PATH environment variable, so to + * run the locally built nbdkit you should do: + * + * PATH=.:$PATH ./contrib/sparseloadtest [...] + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "random.h" + +#define SPARSE_PAGE 32768 /* See common/allocators/sparse.c */ +#define L2_SIZE 4096 +#define DISK_SIZE (4*L2_SIZE*SPARSE_PAGE) +#define MAX_THREADS 16 +#define DURATION 60 /* seconds */ +#define MAX_IN_FLIGHT 64 +#define MAX_REQUEST (128*1024) /* Should be larger than SPARSE_PAGE. */ + +static pid_t pid; +static char sockfile[] = "/tmp/sockXXXXXX"; +static char pidfile[] = "/tmp/pidXXXXXX"; +static unsigned nr_threads; +static double pc_read; /* % read operations. */ + +struct stats { + size_t ops; + size_t bytes; +}; + +struct thread_data { + pthread_t thread; + int status; /* returned status from the thread */ + struct nbd_handle *nbd; /* per-thread handle */ + struct stats read_stats, write_stats, trim_stats; + struct random_state state; +}; +static struct thread_data thread[MAX_THREADS]; + +static time_t start_t; + +struct command_data { + struct stats *stats; + size_t count; +}; + +/* We don't care about the data that is read, so this is just a sink + * buffer shared across all threads. + */ +static char sink[MAX_REQUEST]; + +static char wrbuf[MAX_REQUEST]; + +static void start_nbdkit (void); +static void create_random_name (char *template); +static void cleanup (void); +static void *start_thread (void *); + +int +main (int argc, char *argv[]) +{ + unsigned i; + int err; + struct stats read_total = { 0 }; + struct stats write_total = { 0 }; + struct stats trim_total = { 0 }; + + if (argc != 3) { + fprintf (stderr, "%s nr_threads percent_reads\n", argv[0]); + exit (EXIT_FAILURE); + } + if (sscanf (argv[1], "%u", &nr_threads) != 1 || + nr_threads == 0 || nr_threads > MAX_THREADS || + sscanf (argv[2], "%lg", &pc_read) != 1 || + pc_read <= 0 || pc_read > 100) { + fprintf (stderr, "%s: incorrect parameters, read the source!\n", argv[0]); + exit (EXIT_FAILURE); + } + + start_nbdkit (); + atexit (cleanup); + + /* Connect to nbdkit. */ + for (i = 0; i < nr_threads; ++i) { + struct nbd_handle *nbd = nbd_create (); + if (nbd == NULL) { + got_nbd_error: + fprintf (stderr, "%s: thread %u: %s\n", argv[0], i, nbd_get_error ()); + exit (EXIT_FAILURE); + } + if (nbd_connect_unix (nbd, sockfile) == -1) + goto got_nbd_error; + thread[i].nbd = nbd; + } + + time (&start_t); + + /* Start threads. */ + for (i = 0; i < nr_threads; ++i) { + xsrandom (i+1, &thread[i].state); + + if (i == 0) { + size_t j; + for (j = 0; j < sizeof wrbuf; ++j) + wrbuf[j] = xrandom (&thread[i].state); + } + + err = pthread_create (&thread[i].thread, NULL, start_thread, &thread[i]); + if (err != 0) { + errno = err; + perror ("pthread_create"); + exit (EXIT_FAILURE); + } + } + + /* Wait for the threads to exit. */ + for (i = 0; i < nr_threads; ++i) { + err = pthread_join (thread[i].thread, NULL); + if (err != 0) { + errno = err; + perror ("pthread_join"); + exit (EXIT_FAILURE); + } + if (thread[i].status != 0) { + fprintf (stderr, "%s: thread %u failed, see earlier errors\n", + argv[0], i); + exit (EXIT_FAILURE); + } + + read_total.ops += thread[i].read_stats.ops; + read_total.bytes += thread[i].read_stats.bytes; + write_total.ops += thread[i].write_stats.ops; + write_total.bytes += thread[i].write_stats.bytes; + trim_total.ops += thread[i].trim_stats.ops; + trim_total.bytes += thread[i].trim_stats.bytes; + + /* Drain the command queue just to avoid errors. These requests + * don't count in the final totals. + */ + while (nbd_aio_in_flight (thread[i].nbd) > 0) { + if (nbd_poll (thread[i].nbd, -1) == -1) { + fprintf (stderr, "%s\n", nbd_get_error ()); + exit (EXIT_FAILURE); + } + } + + nbd_close (thread[i].nbd); + } + + /* Print the throughput. */ + printf ("READ: %.1f ops/s %.1f bytes/s\n", + (double) read_total.ops / DURATION, + (double) read_total.bytes / DURATION); + printf ("WRITE: %.1f ops/s %.1f bytes/s\n", + (double) write_total.ops / DURATION, + (double) write_total.bytes / DURATION); + printf ("TRIM: %.1f ops/s %.1f bytes/s\n", + (double) trim_total.ops / DURATION, + (double) trim_total.bytes / DURATION); + printf ("TOTAL: %.1f ops/s %.1f bytes/s\n", + (double) (read_total.ops + write_total.ops + trim_total.ops) + / DURATION, + (double) (read_total.bytes + write_total.bytes + trim_total.bytes) + / DURATION); + printf ("--\n"); + printf ("%%read operations requested: %.1f%%, achieved: %.1f%%\n", + pc_read, + 100.0 * read_total.ops / + (read_total.ops + write_total.ops + trim_total.ops)); + printf ("%%write operations requested: %.1f%%, achieved: %.1f%%\n", + (100 - pc_read) / 2, + 100.0 * write_total.ops / + (read_total.ops + write_total.ops + trim_total.ops)); + printf ("%%trim operations requested: %.1f%%, achieved: %.1f%%\n", + (100 - pc_read) / 2, + 100.0 * trim_total.ops / + (read_total.ops + write_total.ops + trim_total.ops)); + + exit (EXIT_SUCCESS); +} + +static void +cleanup (void) +{ + if (pid > 0) { + kill (pid, SIGTERM); + unlink (sockfile); + pid = 0; + } +} + +/* Start nbdkit. + * + * We cannot use systemd socket activation because we want to use + * multi-conn. + */ +static void +start_nbdkit (void) +{ + char size[64]; + int i; + + snprintf (size, sizeof size, "%d", DISK_SIZE); + + create_random_name (sockfile); + create_random_name (pidfile); + + /* Start nbdkit. */ + pid = fork (); + if (pid == -1) { + perror ("fork"); + exit (EXIT_FAILURE); + } + if (pid == 0) { /* Child - nbdkit */ + execlp ("nbdkit", + "nbdkit", "--exit-with-parent", "-f", + "-U", sockfile, "-P", pidfile, + "memory", size, "allocator=sparse", + NULL); + perror ("execlp"); + _exit (EXIT_FAILURE); + } + + /* Wait for the pidfile to appear, indicating that nbdkit is ready. */ + for (i = 0; i < 60; ++i) { + if (access (pidfile, F_OK) == 0) + break; + sleep (1); + } + if (i == 60) { + fprintf (stderr, "nbdkit did not start up, look for errors above\n"); + exit (EXIT_FAILURE); + } + + unlink (pidfile); +} + +/* This is racy but it doesn't matter for a test. */ +static void +create_random_name (char *template) +{ + int fd; + + fd = mkstemp (template); + if (fd == -1) { + perror (template); + exit (EXIT_FAILURE); + } + close (fd); + unlink (template); +} + +static int +cb (void *user_data, int *error) +{ + struct command_data *data = user_data; + + if (*error != 0) { + fprintf (stderr, "unexpected error in completion callback\n"); + exit (EXIT_FAILURE); + } + + data->stats->ops++; + data->stats->bytes += data->count; + + free (data); + + return 1; /* retire the command */ +} + +static void * +start_thread (void *thread_data_vp) +{ + struct thread_data *thread_data = thread_data_vp; + struct nbd_handle *nbd = thread_data->nbd; + time_t end_t; + size_t total_ops; + double pc_read_actual; + uint64_t offset; + size_t count; + struct command_data *data; + int64_t r; + + while (time (&end_t), end_t - start_t < DURATION) { + /* Run the poll loop if there are too many requests in flight. */ + while (nbd_aio_in_flight (nbd) >= MAX_IN_FLIGHT) { + if (nbd_poll (nbd, -1) == -1) { + fprintf (stderr, "%s\n", nbd_get_error ()); + exit (EXIT_FAILURE); + } + } + + /* Aim to send about pc_read% read operations, and an equal random + * distribution of writes and trims. + */ + total_ops = + thread_data->read_stats.ops + thread_data->write_stats.ops + + thread_data->trim_stats.ops; + if (total_ops == 0) + pc_read_actual = 100; + else + pc_read_actual = 100 * (thread_data->read_stats.ops / (double) total_ops); + + offset = xrandom (&thread_data->state) & (DISK_SIZE - MAX_REQUEST); + count = xrandom (&thread_data->state) & (MAX_REQUEST - 1); + if (count == 0) count = 1; + + data = malloc (sizeof *data); /* freed in callback */ + data->count = count; + + if (pc_read_actual < pc_read) { /* read op */ + data->stats = &thread_data->read_stats; + r = nbd_aio_pread (nbd, sink, count, offset, + (nbd_completion_callback) { + .callback = cb, + .user_data = data, + }, 0); + } + else { + if (xrandom (&thread_data->state) & 1) { /* write op */ + data->stats = &thread_data->write_stats; + r = nbd_aio_pwrite (nbd, wrbuf, count, offset, + (nbd_completion_callback) { + .callback = cb, + .user_data = data, + }, 0); + } + else { /* trim op */ + data->stats = &thread_data->trim_stats; + r = nbd_aio_trim (nbd, count, offset, + (nbd_completion_callback) { + .callback = cb, + .user_data = data, + }, 0); + } + } + if (r == -1) { + fprintf (stderr, "%s\n", nbd_get_error ()); + exit (EXIT_FAILURE); + } + } + + return NULL; +} diff --git a/depcomp b/depcomp new file mode 100755 index 0000000..715e343 --- /dev/null +++ b/depcomp @@ -0,0 +1,791 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2018-03-07.03; # UTC + +# Copyright (C) 1999-2021 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +case $1 in + '') + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by 'PROGRAMS ARGS'. + object Object file output by 'PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputting dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +# Get the directory component of the given path, and save it in the +# global variables '$dir'. Note that this directory component will +# be either empty or ending with a '/' character. This is deliberate. +set_dir_from () +{ + case $1 in + */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; + *) dir=;; + esac +} + +# Get the suffix-stripped basename of the given path, and save it the +# global variable '$base'. +set_base_from () +{ + base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` +} + +# If no dependency file was actually created by the compiler invocation, +# we still have to create a dummy depfile, to avoid errors with the +# Makefile "include basename.Plo" scheme. +make_dummy_depfile () +{ + echo "#dummy" > "$depfile" +} + +# Factor out some common post-processing of the generated depfile. +# Requires the auxiliary global variable '$tmpdepfile' to be set. +aix_post_process_depfile () +{ + # If the compiler actually managed to produce a dependency file, + # post-process it. + if test -f "$tmpdepfile"; then + # Each line is of the form 'foo.o: dependency.h'. + # Do two passes, one to just change these to + # $object: dependency.h + # and one to simply output + # dependency.h: + # which is needed to avoid the deleted-header problem. + { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" + sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" + } > "$depfile" + rm -f "$tmpdepfile" + else + make_dummy_depfile + fi +} + +# A tabulation character. +tab=' ' +# A newline character. +nl=' +' +# Character ranges might be problematic outside the C locale. +# These definitions help. +upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ +lower=abcdefghijklmnopqrstuvwxyz +digits=0123456789 +alpha=${upper}${lower} + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Avoid interferences from the environment. +gccflag= dashmflag= + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +cygpath_u="cygpath -u -f -" +if test "$depmode" = msvcmsys; then + # This is just like msvisualcpp but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvisualcpp +fi + +if test "$depmode" = msvc7msys; then + # This is just like msvc7 but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvc7 +fi + +if test "$depmode" = xlc; then + # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. + gccflag=-qmakedep=gcc,-MF + depmode=gcc +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. +## Unfortunately, FreeBSD c89 acceptance of flags depends upon +## the command line argument order; so add the flags where they +## appear in depend2.am. Note that the slowdown incurred here +## affects only configure: in makefiles, %FASTDEP% shortcuts this. + for arg + do + case $arg in + -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; + *) set fnord "$@" "$arg" ;; + esac + shift # fnord + shift # $arg + done + "$@" + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. +## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. +## (see the conditional assignment to $gccflag above). +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). Also, it might not be +## supported by the other compilers which use the 'gcc' depmode. +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + # The second -e expression handles DOS-style file names with drive + # letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the "deleted header file" problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. +## Some versions of gcc put a space before the ':'. On the theory +## that the space means something, we add a space to the output as +## well. hp depmode also adds that space, but also prefixes the VPATH +## to the object. Take care to not repeat it in the output. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like '#:fec' to the end of the + # dependency line. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ + | tr "$nl" ' ' >> "$depfile" + echo >> "$depfile" + # The second pass generates a dummy entry for each header file. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> "$depfile" + else + make_dummy_depfile + fi + rm -f "$tmpdepfile" + ;; + +xlc) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts '$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + set_dir_from "$object" + set_base_from "$object" + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.u + tmpdepfile2=$base.u + tmpdepfile3=$dir.libs/$base.u + "$@" -Wc,-M + else + tmpdepfile1=$dir$base.u + tmpdepfile2=$dir$base.u + tmpdepfile3=$dir$base.u + "$@" -M + fi + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + aix_post_process_depfile + ;; + +tcc) + # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 + # FIXME: That version still under development at the moment of writing. + # Make that this statement remains true also for stable, released + # versions. + # It will wrap lines (doesn't matter whether long or short) with a + # trailing '\', as in: + # + # foo.o : \ + # foo.c \ + # foo.h \ + # + # It will put a trailing '\' even on the last line, and will use leading + # spaces rather than leading tabs (at least since its commit 0394caf7 + # "Emit spaces for -MD"). + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. + # We have to change lines of the first kind to '$object: \'. + sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" + # And for each line of the second kind, we have to emit a 'dep.h:' + # dummy dependency, to avoid the deleted-header problem. + sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" + rm -f "$tmpdepfile" + ;; + +## The order of this option in the case statement is important, since the +## shell code in configure will try each of these formats in the order +## listed in this file. A plain '-MD' option would be understood by many +## compilers, so we must ensure this comes after the gcc and icc options. +pgcc) + # Portland's C compiler understands '-MD'. + # Will always output deps to 'file.d' where file is the root name of the + # source file under compilation, even if file resides in a subdirectory. + # The object file name does not affect the name of the '.d' file. + # pgcc 10.2 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using '\' : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + set_dir_from "$object" + # Use the source, not the object, to determine the base name, since + # that's sadly what pgcc will do too. + set_base_from "$source" + tmpdepfile=$base.d + + # For projects that build the same source file twice into different object + # files, the pgcc approach of using the *source* file root name can cause + # problems in parallel builds. Use a locking strategy to avoid stomping on + # the same $tmpdepfile. + lockdir=$base.d-lock + trap " + echo '$0: caught signal, cleaning up...' >&2 + rmdir '$lockdir' + exit 1 + " 1 2 13 15 + numtries=100 + i=$numtries + while test $i -gt 0; do + # mkdir is a portable test-and-set. + if mkdir "$lockdir" 2>/dev/null; then + # This process acquired the lock. + "$@" -MD + stat=$? + # Release the lock. + rmdir "$lockdir" + break + else + # If the lock is being held by a different process, wait + # until the winning process is done or we timeout. + while test -d "$lockdir" && test $i -gt 0; do + sleep 1 + i=`expr $i - 1` + done + fi + i=`expr $i - 1` + done + trap - 1 2 13 15 + if test $i -le 0; then + echo "$0: failed to acquire lock after $numtries attempts" >&2 + echo "$0: check lockdir '$lockdir'" >&2 + exit 1 + fi + + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp2) + # The "hp" stanza above does not work with aCC (C++) and HP's ia64 + # compilers, which have integrated preprocessors. The correct option + # to use with these is +Maked; it writes dependencies to a file named + # 'foo.d', which lands next to the object file, wherever that + # happens to be. + # Much of this is similar to the tru64 case; see comments there. + set_dir_from "$object" + set_base_from "$object" + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir.libs/$base.d + "$@" -Wc,+Maked + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + "$@" +Maked + fi + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" + # Add 'dependent.h:' lines. + sed -ne '2,${ + s/^ *// + s/ \\*$// + s/$/:/ + p + }' "$tmpdepfile" >> "$depfile" + else + make_dummy_depfile + fi + rm -f "$tmpdepfile" "$tmpdepfile2" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in 'foo.d' instead, so we check for that too. + # Subdirectories are respected. + set_dir_from "$object" + set_base_from "$object" + + if test "$libtool" = yes; then + # Libtool generates 2 separate objects for the 2 libraries. These + # two compilations output dependencies in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir$base.o.d # libtool 1.5 + tmpdepfile2=$dir.libs/$base.o.d # Likewise. + tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + # Same post-processing that is required for AIX mode. + aix_post_process_depfile + ;; + +msvc7) + if test "$libtool" = yes; then + showIncludes=-Wc,-showIncludes + else + showIncludes=-showIncludes + fi + "$@" $showIncludes > "$tmpdepfile" + stat=$? + grep -v '^Note: including file: ' "$tmpdepfile" + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + # The first sed program below extracts the file names and escapes + # backslashes for cygpath. The second sed program outputs the file + # name when reading, but also accumulates all include files in the + # hold buffer in order to output them again at the end. This only + # works with sed implementations that can handle large buffers. + sed < "$tmpdepfile" -n ' +/^Note: including file: *\(.*\)/ { + s//\1/ + s/\\/\\\\/g + p +}' | $cygpath_u | sort -u | sed -n ' +s/ /\\ /g +s/\(.*\)/'"$tab"'\1 \\/p +s/.\(.*\) \\/\1:/ +H +$ { + s/.*/'"$tab"'/ + G + p +}' >> "$depfile" + echo >> "$depfile" # make sure the fragment doesn't end with a backslash + rm -f "$tmpdepfile" + ;; + +msvc7msys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove '-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for ':' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. + "$@" $dashmflag | + sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this sed invocation + # correctly. Breaking it into two sed invocations is a workaround. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no eat=no + for arg + do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + if test $eat = yes; then + eat=no + continue + fi + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -arch) + eat=yes ;; + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix=`echo "$object" | sed 's/^.*\././'` + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + # makedepend may prepend the VPATH from the source file name to the object. + # No need to regex-escape $object, excess matching of '.' is harmless. + sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process the last invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed '1,2d' "$tmpdepfile" \ + | tr ' ' "$nl" \ + | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove '-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E \ + | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + | sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + IFS=" " + for arg + do + case "$arg" in + -o) + shift + ;; + $object) + shift + ;; + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E 2>/dev/null | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" + echo "$tab" >> "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvcmsys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/docs/Makefile.am b/docs/Makefile.am new file mode 100644 index 0000000..a429b5a --- /dev/null +++ b/docs/Makefile.am @@ -0,0 +1,194 @@ +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 $(top_srcdir)/common-rules.mk + +EXTRA_DIST = \ + make-links.sh \ + nbdkit.pod \ + nbdkit-captive.pod \ + nbdkit-client.pod \ + nbdkit-loop.pod \ + nbdkit-probing.pod \ + nbdkit-protocol.pod \ + nbdkit-release-notes-1.4.pod \ + nbdkit-release-notes-1.6.pod \ + nbdkit-release-notes-1.8.pod \ + nbdkit-release-notes-1.10.pod \ + nbdkit-release-notes-1.12.pod \ + nbdkit-release-notes-1.14.pod \ + nbdkit-release-notes-1.16.pod \ + nbdkit-release-notes-1.18.pod \ + nbdkit-release-notes-1.20.pod \ + nbdkit-release-notes-1.22.pod \ + nbdkit-release-notes-1.24.pod \ + nbdkit-release-notes-1.26.pod \ + nbdkit-release-notes-1.28.pod \ + nbdkit-release-notes-1.30.pod \ + nbdkit-release-notes-1.32.pod \ + nbdkit-release-notes-1.34.pod \ + nbdkit-release-notes-1.36.pod \ + nbdkit-security.pod \ + nbdkit-service.pod \ + nbdkit-tls.pod \ + nbdkit-plugin.pod \ + nbdkit-filter.pod \ + synopsis.txt \ + $(NULL) + +if HAVE_POD + +man_MANS = \ + nbdkit.1 \ + nbdkit-captive.1 \ + nbdkit-client.1 \ + nbdkit-loop.1 \ + nbdkit-probing.1 \ + nbdkit-protocol.1 \ + nbdkit-release-notes-1.4.1 \ + nbdkit-release-notes-1.6.1 \ + nbdkit-release-notes-1.8.1 \ + nbdkit-release-notes-1.10.1 \ + nbdkit-release-notes-1.12.1 \ + nbdkit-release-notes-1.14.1 \ + nbdkit-release-notes-1.16.1 \ + nbdkit-release-notes-1.18.1 \ + nbdkit-release-notes-1.20.1 \ + nbdkit-release-notes-1.22.1 \ + nbdkit-release-notes-1.24.1 \ + nbdkit-release-notes-1.26.1 \ + nbdkit-release-notes-1.28.1 \ + nbdkit-release-notes-1.30.1 \ + nbdkit-release-notes-1.32.1 \ + nbdkit-release-notes-1.34.1 \ + nbdkit-release-notes-1.36.1 \ + nbdkit-security.1 \ + nbdkit-service.1 \ + nbdkit-tls.1 \ + nbdkit-plugin.3 \ + nbdkit-filter.3 \ + $(NULL) +CLEANFILES += $(man_MANS) + +nbdkit.1: nbdkit.pod plugin-links.pod lang-plugin-links.pod filter-links.pod \ + synopsis.txt $(top_builddir)/podwrapper.pl + $(PODWRAPPER) --section=1 --man $@ \ + --html $(top_builddir)/html/$@.html \ + --insert plugin-links.pod:__PLUGIN_LINKS__ \ + --insert lang-plugin-links.pod:__LANG_PLUGIN_LINKS__ \ + --insert filter-links.pod:__FILTER_LINKS__ \ + --verbatim $(srcdir)/synopsis.txt:__SYNOPSIS__ \ + $< + +nbdkit-captive.1: nbdkit-captive.pod $(top_builddir)/podwrapper.pl + $(PODWRAPPER) --section=1 --man $@ \ + --html $(top_builddir)/html/$@.html \ + $< + +nbdkit-client.1: nbdkit-client.pod $(top_builddir)/podwrapper.pl + $(PODWRAPPER) --section=1 --man $@ \ + --html $(top_builddir)/html/$@.html \ + $< + +nbdkit-loop.1: nbdkit-loop.pod $(top_builddir)/podwrapper.pl + $(PODWRAPPER) --section=1 --man $@ \ + --html $(top_builddir)/html/$@.html \ + $< + +nbdkit-probing.1: nbdkit-probing.pod $(top_builddir)/podwrapper.pl + $(PODWRAPPER) --section=1 --man $@ \ + --html $(top_builddir)/html/$@.html \ + $< + +nbdkit-protocol.1: nbdkit-protocol.pod $(top_builddir)/podwrapper.pl + $(PODWRAPPER) --section=1 --man $@ \ + --html $(top_builddir)/html/$@.html \ + $< + +nbdkit-release-notes-%.1: nbdkit-release-notes-%.pod \ + $(top_builddir)/podwrapper.pl + $(PODWRAPPER) --section=1 --man $@ \ + --html $(top_builddir)/html/$@.html \ + $< + +nbdkit-security.1: nbdkit-security.pod $(top_builddir)/podwrapper.pl + $(PODWRAPPER) --section=1 --man $@ \ + --html $(top_builddir)/html/$@.html \ + $< + +nbdkit-service.1: nbdkit-service.pod $(top_builddir)/podwrapper.pl + $(PODWRAPPER) --section=1 --man $@ \ + --html $(top_builddir)/html/$@.html \ + $< + +nbdkit-tls.1: nbdkit-tls.pod $(top_builddir)/podwrapper.pl + $(PODWRAPPER) --section=1 --man $@ \ + --html $(top_builddir)/html/$@.html \ + $< + +nbdkit-plugin.3: nbdkit-plugin.pod plugin-links.pod lang-plugin-links.pod \ + $(top_builddir)/podwrapper.pl + $(PODWRAPPER) --section=3 --man $@ \ + --html $(top_builddir)/html/$@.html \ + --insert plugin-links.pod:__PLUGIN_LINKS__ \ + --insert lang-plugin-links.pod:__LANG_PLUGIN_LINKS__ \ + $< + +nbdkit-filter.3: nbdkit-filter.pod filter-links.pod \ + $(top_builddir)/podwrapper.pl + $(PODWRAPPER) --section=3 --man $@ \ + --html $(top_builddir)/html/$@.html \ + --insert filter-links.pod:__FILTER_LINKS__ \ + $< + +endif HAVE_POD + +# All plugins. +plugin-links.pod: $(top_srcdir)/configure.ac + rm -f $@ $@-t + $(srcdir)/make-links.sh plugin 1 $(non_lang_plugins) > $@-t + echo \; >> $@-t + $(srcdir)/make-links.sh plugin 3 $(lang_plugins) >> $@-t + mv $@-t $@ + +# Only language plugins (in section 3). +lang-plugin-links.pod: $(top_srcdir)/configure.ac + rm -f $@ $@-t + $(srcdir)/make-links.sh plugin 3 $(lang_plugins) >> $@-t + mv $@-t $@ + +# All filters. +filter-links.pod: $(top_srcdir)/configure.ac + rm -f $@ $@-t + $(srcdir)/make-links.sh filter 1 $(filters) > $@-t + mv $@-t $@ + +DISTCLEANFILES = plugin-links.pod lang-plugin-links.pod filter-links.pod diff --git a/docs/Makefile.in b/docs/Makefile.in new file mode 100644 index 0000000..3ea7803 --- /dev/null +++ b/docs/Makefile.in @@ -0,0 +1,909 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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@ +@HAVE_POD_TRUE@am__append_1 = $(man_MANS) +subdir = docs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ocaml.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +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 = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +man1dir = $(mandir)/man1 +am__installdirs = "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man3dir)" +man3dir = $(mandir)/man3 +NROFF = nroff +MANS = $(man_MANS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/common-rules.mk +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ +BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ +CARGO = @CARGO@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_PLUGIN_CC = @CC_PLUGIN_CC@ +CC_PLUGIN_CFLAGS = @CC_PLUGIN_CFLAGS@ +CERTTOOL = @CERTTOOL@ +CFLAGS = @CFLAGS@ +COM_ERR_CFLAGS = @COM_ERR_CFLAGS@ +COM_ERR_LIBS = @COM_ERR_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CUT = @CUT@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LDFLAGS = @DL_LDFLAGS@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXT2FS_CFLAGS = @EXT2FS_CFLAGS@ +EXT2FS_LIBS = @EXT2FS_LIBS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GENISOIMAGE = @GENISOIMAGE@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GOARCH = @GOARCH@ +GOLANG = @GOLANG@ +GOOS = @GOOS@ +GOROOT = @GOROOT@ +GREP = @GREP@ +IMPORT_LIBRARY_ON_WINDOWS = @IMPORT_LIBRARY_ON_WINDOWS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +ISOPROG = @ISOPROG@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBLKIO_CFLAGS = @LIBBLKIO_CFLAGS@ +LIBBLKIO_LIBS = @LIBBLKIO_LIBS@ +LIBGUESTFS_CFLAGS = @LIBGUESTFS_CFLAGS@ +LIBGUESTFS_LIBS = @LIBGUESTFS_LIBS@ +LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ +LIBLZMA_LIBS = @LIBLZMA_LIBS@ +LIBNBD_CFLAGS = @LIBNBD_CFLAGS@ +LIBNBD_LIBS = @LIBNBD_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSELINUX_CFLAGS = @LIBSELINUX_CFLAGS@ +LIBSELINUX_LIBS = @LIBSELINUX_LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTORRENT_CFLAGS = @LIBTORRENT_CFLAGS@ +LIBTORRENT_LIBS = @LIBTORRENT_LIBS@ +LIBVIRT_CFLAGS = @LIBVIRT_CFLAGS@ +LIBVIRT_LIBS = @LIBVIRT_LIBS@ +LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ +LIBZSTD_LIBS = @LIBZSTD_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LUA_CFLAGS = @LUA_CFLAGS@ +LUA_LIBS = @LUA_LIBS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MC = @MC@ +MKDIR_P = @MKDIR_P@ +MKISOFS = @MKISOFS@ +NBDKIT_VERSION_MAJOR = @NBDKIT_VERSION_MAJOR@ +NBDKIT_VERSION_MICRO = @NBDKIT_VERSION_MICRO@ +NBDKIT_VERSION_MINOR = @NBDKIT_VERSION_MINOR@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_ON_WINDOWS = @NO_UNDEFINED_ON_WINDOWS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OCAML = @OCAML@ +OCAMLBEST = @OCAMLBEST@ +OCAMLBUILD = @OCAMLBUILD@ +OCAMLC = @OCAMLC@ +OCAMLCDOTOPT = @OCAMLCDOTOPT@ +OCAMLDEP = @OCAMLDEP@ +OCAMLDOC = @OCAMLDOC@ +OCAMLLIB = @OCAMLLIB@ +OCAMLMKLIB = @OCAMLMKLIB@ +OCAMLMKTOP = @OCAMLMKTOP@ +OCAMLOPT = @OCAMLOPT@ +OCAMLOPTDOTOPT = @OCAMLOPTDOTOPT@ +OCAMLOPTFLAGS = @OCAMLOPTFLAGS@ +OCAMLVERSION = @OCAMLVERSION@ +OCAML_MAJOR = @OCAML_MAJOR@ +OCAML_PLUGIN_LIBRARIES = @OCAML_PLUGIN_LIBRARIES@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PERL_ARCHLIB = @PERL_ARCHLIB@ +PERL_CFLAGS = @PERL_CFLAGS@ +PERL_LDOPTS = @PERL_LDOPTS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PODWRAPPER = @PODWRAPPER@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_CXX = @PTHREAD_CXX@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CFLAGS = @PYTHON_CFLAGS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +RUBY_CFLAGS = @RUBY_CFLAGS@ +RUBY_LIBS = @RUBY_LIBS@ +RUSTC = @RUSTC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOEXT = @SOEXT@ +SSH_CFLAGS = @SSH_CFLAGS@ +SSH_LIBS = @SSH_LIBS@ +STAT = @STAT@ +STRIP = @STRIP@ +TCL_CFLAGS = @TCL_CFLAGS@ +TCL_LIBS = @TCL_LIBS@ +TRUNCATE = @TRUNCATE@ +VALGRIND = @VALGRIND@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VERSION = @VERSION@ +WARNINGS_CFLAGS = @WARNINGS_CFLAGS@ +XORRISO = @XORRISO@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +ZLIB_NG_CFLAGS = @ZLIB_NG_CFLAGS@ +ZLIB_NG_LIBS = @ZLIB_NG_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DLLTOOL = @ac_ct_DLLTOOL@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_MC = @ac_ct_MC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bashcompdir = @bashcompdir@ +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@ +filters = @filters@ +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@ +lang_plugins = @lang_plugins@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +non_lang_plugins = @non_lang_plugins@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugins = @plugins@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +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@ + +# Convenient list terminator +NULL = +plugindir = $(libdir)/nbdkit/plugins +filterdir = $(libdir)/nbdkit/filters +CLEANFILES = *~ *.cmi *.cmx *.cmxa *.so *.dll $(am__append_1) +EXTRA_DIST = \ + make-links.sh \ + nbdkit.pod \ + nbdkit-captive.pod \ + nbdkit-client.pod \ + nbdkit-loop.pod \ + nbdkit-probing.pod \ + nbdkit-protocol.pod \ + nbdkit-release-notes-1.4.pod \ + nbdkit-release-notes-1.6.pod \ + nbdkit-release-notes-1.8.pod \ + nbdkit-release-notes-1.10.pod \ + nbdkit-release-notes-1.12.pod \ + nbdkit-release-notes-1.14.pod \ + nbdkit-release-notes-1.16.pod \ + nbdkit-release-notes-1.18.pod \ + nbdkit-release-notes-1.20.pod \ + nbdkit-release-notes-1.22.pod \ + nbdkit-release-notes-1.24.pod \ + nbdkit-release-notes-1.26.pod \ + nbdkit-release-notes-1.28.pod \ + nbdkit-release-notes-1.30.pod \ + nbdkit-release-notes-1.32.pod \ + nbdkit-release-notes-1.34.pod \ + nbdkit-release-notes-1.36.pod \ + nbdkit-security.pod \ + nbdkit-service.pod \ + nbdkit-tls.pod \ + nbdkit-plugin.pod \ + nbdkit-filter.pod \ + synopsis.txt \ + $(NULL) + +@HAVE_POD_TRUE@man_MANS = \ +@HAVE_POD_TRUE@ nbdkit.1 \ +@HAVE_POD_TRUE@ nbdkit-captive.1 \ +@HAVE_POD_TRUE@ nbdkit-client.1 \ +@HAVE_POD_TRUE@ nbdkit-loop.1 \ +@HAVE_POD_TRUE@ nbdkit-probing.1 \ +@HAVE_POD_TRUE@ nbdkit-protocol.1 \ +@HAVE_POD_TRUE@ nbdkit-release-notes-1.4.1 \ +@HAVE_POD_TRUE@ nbdkit-release-notes-1.6.1 \ +@HAVE_POD_TRUE@ nbdkit-release-notes-1.8.1 \ +@HAVE_POD_TRUE@ nbdkit-release-notes-1.10.1 \ +@HAVE_POD_TRUE@ nbdkit-release-notes-1.12.1 \ +@HAVE_POD_TRUE@ nbdkit-release-notes-1.14.1 \ +@HAVE_POD_TRUE@ nbdkit-release-notes-1.16.1 \ +@HAVE_POD_TRUE@ nbdkit-release-notes-1.18.1 \ +@HAVE_POD_TRUE@ nbdkit-release-notes-1.20.1 \ +@HAVE_POD_TRUE@ nbdkit-release-notes-1.22.1 \ +@HAVE_POD_TRUE@ nbdkit-release-notes-1.24.1 \ +@HAVE_POD_TRUE@ nbdkit-release-notes-1.26.1 \ +@HAVE_POD_TRUE@ nbdkit-release-notes-1.28.1 \ +@HAVE_POD_TRUE@ nbdkit-release-notes-1.30.1 \ +@HAVE_POD_TRUE@ nbdkit-release-notes-1.32.1 \ +@HAVE_POD_TRUE@ nbdkit-release-notes-1.34.1 \ +@HAVE_POD_TRUE@ nbdkit-release-notes-1.36.1 \ +@HAVE_POD_TRUE@ nbdkit-security.1 \ +@HAVE_POD_TRUE@ nbdkit-service.1 \ +@HAVE_POD_TRUE@ nbdkit-tls.1 \ +@HAVE_POD_TRUE@ nbdkit-plugin.3 \ +@HAVE_POD_TRUE@ nbdkit-filter.3 \ +@HAVE_POD_TRUE@ $(NULL) + +DISTCLEANFILES = plugin-links.pod lang-plugin-links.pod filter-links.pod +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common-rules.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign docs/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign docs/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; +$(top_srcdir)/common-rules.mk $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) +install-man3: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man3dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man3dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man3dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.3[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man3dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man3dir)" || exit $$?; }; \ + done; } + +uninstall-man3: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man3dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.3[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man3dir)'; $(am__uninstall_files_from_dir) +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(MANS) +installdirs: + for dir in "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man3dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: 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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -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." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man1 install-man3 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-man + +uninstall-man: uninstall-man1 uninstall-man3 + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-man1 install-man3 install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ + uninstall-am uninstall-man uninstall-man1 uninstall-man3 + +.PRECIOUS: Makefile + + +@HAVE_POD_TRUE@nbdkit.1: nbdkit.pod plugin-links.pod lang-plugin-links.pod filter-links.pod \ +@HAVE_POD_TRUE@ synopsis.txt $(top_builddir)/podwrapper.pl +@HAVE_POD_TRUE@ $(PODWRAPPER) --section=1 --man $@ \ +@HAVE_POD_TRUE@ --html $(top_builddir)/html/$@.html \ +@HAVE_POD_TRUE@ --insert plugin-links.pod:__PLUGIN_LINKS__ \ +@HAVE_POD_TRUE@ --insert lang-plugin-links.pod:__LANG_PLUGIN_LINKS__ \ +@HAVE_POD_TRUE@ --insert filter-links.pod:__FILTER_LINKS__ \ +@HAVE_POD_TRUE@ --verbatim $(srcdir)/synopsis.txt:__SYNOPSIS__ \ +@HAVE_POD_TRUE@ $< + +@HAVE_POD_TRUE@nbdkit-captive.1: nbdkit-captive.pod $(top_builddir)/podwrapper.pl +@HAVE_POD_TRUE@ $(PODWRAPPER) --section=1 --man $@ \ +@HAVE_POD_TRUE@ --html $(top_builddir)/html/$@.html \ +@HAVE_POD_TRUE@ $< + +@HAVE_POD_TRUE@nbdkit-client.1: nbdkit-client.pod $(top_builddir)/podwrapper.pl +@HAVE_POD_TRUE@ $(PODWRAPPER) --section=1 --man $@ \ +@HAVE_POD_TRUE@ --html $(top_builddir)/html/$@.html \ +@HAVE_POD_TRUE@ $< + +@HAVE_POD_TRUE@nbdkit-loop.1: nbdkit-loop.pod $(top_builddir)/podwrapper.pl +@HAVE_POD_TRUE@ $(PODWRAPPER) --section=1 --man $@ \ +@HAVE_POD_TRUE@ --html $(top_builddir)/html/$@.html \ +@HAVE_POD_TRUE@ $< + +@HAVE_POD_TRUE@nbdkit-probing.1: nbdkit-probing.pod $(top_builddir)/podwrapper.pl +@HAVE_POD_TRUE@ $(PODWRAPPER) --section=1 --man $@ \ +@HAVE_POD_TRUE@ --html $(top_builddir)/html/$@.html \ +@HAVE_POD_TRUE@ $< + +@HAVE_POD_TRUE@nbdkit-protocol.1: nbdkit-protocol.pod $(top_builddir)/podwrapper.pl +@HAVE_POD_TRUE@ $(PODWRAPPER) --section=1 --man $@ \ +@HAVE_POD_TRUE@ --html $(top_builddir)/html/$@.html \ +@HAVE_POD_TRUE@ $< + +@HAVE_POD_TRUE@nbdkit-release-notes-%.1: nbdkit-release-notes-%.pod \ +@HAVE_POD_TRUE@ $(top_builddir)/podwrapper.pl +@HAVE_POD_TRUE@ $(PODWRAPPER) --section=1 --man $@ \ +@HAVE_POD_TRUE@ --html $(top_builddir)/html/$@.html \ +@HAVE_POD_TRUE@ $< + +@HAVE_POD_TRUE@nbdkit-security.1: nbdkit-security.pod $(top_builddir)/podwrapper.pl +@HAVE_POD_TRUE@ $(PODWRAPPER) --section=1 --man $@ \ +@HAVE_POD_TRUE@ --html $(top_builddir)/html/$@.html \ +@HAVE_POD_TRUE@ $< + +@HAVE_POD_TRUE@nbdkit-service.1: nbdkit-service.pod $(top_builddir)/podwrapper.pl +@HAVE_POD_TRUE@ $(PODWRAPPER) --section=1 --man $@ \ +@HAVE_POD_TRUE@ --html $(top_builddir)/html/$@.html \ +@HAVE_POD_TRUE@ $< + +@HAVE_POD_TRUE@nbdkit-tls.1: nbdkit-tls.pod $(top_builddir)/podwrapper.pl +@HAVE_POD_TRUE@ $(PODWRAPPER) --section=1 --man $@ \ +@HAVE_POD_TRUE@ --html $(top_builddir)/html/$@.html \ +@HAVE_POD_TRUE@ $< + +@HAVE_POD_TRUE@nbdkit-plugin.3: nbdkit-plugin.pod plugin-links.pod lang-plugin-links.pod \ +@HAVE_POD_TRUE@ $(top_builddir)/podwrapper.pl +@HAVE_POD_TRUE@ $(PODWRAPPER) --section=3 --man $@ \ +@HAVE_POD_TRUE@ --html $(top_builddir)/html/$@.html \ +@HAVE_POD_TRUE@ --insert plugin-links.pod:__PLUGIN_LINKS__ \ +@HAVE_POD_TRUE@ --insert lang-plugin-links.pod:__LANG_PLUGIN_LINKS__ \ +@HAVE_POD_TRUE@ $< + +@HAVE_POD_TRUE@nbdkit-filter.3: nbdkit-filter.pod filter-links.pod \ +@HAVE_POD_TRUE@ $(top_builddir)/podwrapper.pl +@HAVE_POD_TRUE@ $(PODWRAPPER) --section=3 --man $@ \ +@HAVE_POD_TRUE@ --html $(top_builddir)/html/$@.html \ +@HAVE_POD_TRUE@ --insert filter-links.pod:__FILTER_LINKS__ \ +@HAVE_POD_TRUE@ $< + +# All plugins. +plugin-links.pod: $(top_srcdir)/configure.ac + rm -f $@ $@-t + $(srcdir)/make-links.sh plugin 1 $(non_lang_plugins) > $@-t + echo \; >> $@-t + $(srcdir)/make-links.sh plugin 3 $(lang_plugins) >> $@-t + mv $@-t $@ + +# Only language plugins (in section 3). +lang-plugin-links.pod: $(top_srcdir)/configure.ac + rm -f $@ $@-t + $(srcdir)/make-links.sh plugin 3 $(lang_plugins) >> $@-t + mv $@-t $@ + +# All filters. +filter-links.pod: $(top_srcdir)/configure.ac + rm -f $@ $@-t + $(srcdir)/make-links.sh filter 1 $(filters) > $@-t + mv $@-t $@ + +# 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/docs/make-links.sh b/docs/make-links.sh new file mode 100755 index 0000000..ca4b73f --- /dev/null +++ b/docs/make-links.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +# Turn a list of plugins or filters into a comma-separated +# list of POD links. +# eg: +# ./make-links.sh plugin 1 foo bar +# --> L, L + +type="$1" +section="$2" +shift 2 +for (( i = 1; i <= $#; ++i )); do + printf %s "L" + if [ "$i" -lt "$#" ]; then printf %s , ; fi + echo +done diff --git a/docs/nbdkit-captive.pod b/docs/nbdkit-captive.pod new file mode 100644 index 0000000..4f9740b --- /dev/null +++ b/docs/nbdkit-captive.pod @@ -0,0 +1,180 @@ +=head1 NAME + +nbdkit-captive - run nbdkit under another process and have it +reliably cleaned up + +=head1 SYNOPSIS + + nbdkit PLUGIN [...] [-e|--exportname EXPORTNAME] \ + --run 'COMMAND ARGS ...' + +=for paragraph + + nbdkit --exit-with-parent PLUGIN [...] + +=head1 DESCRIPTION + +You can run nbdkit under another process and have nbdkit reliably +clean up. There are two techniques depending on whether you want +nbdkit to start the other process (L), or if you want +the other process to start nbdkit (L). Another way +is to have nbdkit exit after the last client connection +(L) or after an event +(L). + +=head1 CAPTIVE NBDKIT + +You can run nbdkit as a "captive process", using the I<--run> option. +This means that nbdkit runs as long as (for example) L or +L is running. When those exit, nbdkit is killed. + +Some examples should make this clear. + +To run nbdkit captive under qemu: + + nbdkit file disk.img --run 'qemu -drive file=$nbd,if=virtio' + +On the qemu command line, C<$nbd> is substituted automatically with +the right NBD path so it can connect to nbdkit. When qemu exits, +nbdkit is killed and cleaned up automatically. + +Running nbdkit captive under guestfish: + + nbdkit file disk.img --run 'guestfish --format=raw -a $nbd -i' + +When guestfish exits, nbdkit is killed. + +Running nbdkit captive under nbdsh for unit testing: + + nbdkit memory 1 --run 'nbdsh -u "$uri" -c "print(h.pread(1, 0))"' + +The following shell variables are available in the I<--run> argument: + +=over 4 + +=item C<$nbd> + +=item C<$uri> + +A URI that refers to the nbdkit port or socket in the preferred form +documented by the NBD project. + +As this variable may contain a bare C for Unix sockets, it is +safest to use $uri within double quotes to avoid unintentional +globbing. For plugins that support distinct data based on export +names, the I<-e> option to nbdkit controls which export name will be +set in the URI. + +In nbdkit E 1.22 C<$nbd> tried to guess if you were using qemu or +guestfish and expanded differently. Since NBD URIs are now widely +supported this magic is no longer necessary. In nbdkit E 1.24 +both variables expand to the same URI. + +=item C<$tls> + +Corresponds to the I<--tls> option passed to nbdkit. If I<--tls=off> +this is not set. If I<--tls=on> this is set to C<"1">. If +I<--tls=require> this is set to C<"2">. + +=item C<$port> + +If E "", the port number that nbdkit is listening on. + +=item C<$unixsocket> + +If E "", the Unix domain socket that nbdkit is listening on. + +=item C<$exportname> + +The export name (which may be "") that the process should use when +connecting to nbdkit, as set by the I<-e> (I<--exportname>) command +line option of nbdkit. This only matters to plugins that +differentiate what they serve based on the export name requested by +the client. + +=back + +I<--run> implies I<--foreground>. It is not possible, and probably +not desirable, to have nbdkit fork into the background when using +I<--run>. + +=head2 Copying data in and out of plugins with captive nbdkit + +Captive nbdkit + L can be used to copy data into and out +of nbdkit plugins. For example L contains +an embedded disk image. To copy it out: + + nbdkit example1 --run 'qemu-img convert $nbd disk.img' + +If the source suffers from temporary network failures +L or L may +help. + +To overwrite a file inside an uncompressed tar file (the file being +overwritten must be the same size), use L like +this: + + nbdkit file data.tar --filter=tar tar-entry=disk.img \ + --run 'qemu-img convert -n disk.img $nbd' + +=head1 EXIT WITH PARENT + +The I<--exit-with-parent> option is almost the opposite of +L described in the previous section. + +Running nbdkit with this option, for example from a script: + + nbdkit --exit-with-parent plugin ... & + +means that nbdkit will exit automatically if the parent program exits +for any reason. This can be used to avoid complicated cleanups or +orphaned nbdkit processes. + +I<--exit-with-parent> is incompatible with forking into the background +(because when we fork into the background we lose track of the parent +process). Therefore I<-f> / I<--foreground> is implied. + +If the parent application is multithreaded, then (in the Linux +implementation) if the parent I exits, that will cause nbdkit +to exit. Thus in multithreaded applications you usually want to run +C only from the main thread (unless you +actually want nbdkit to exit with the thread, but that may not work +reliably on all operating systems). + +To exit when an unrelated process exits, use +L C feature. + +=head2 Support for --exit-with-parent + +This is currently implemented using a non-POSIX feature available in +S, S and macOS. It won't work on +other operating systems (patches welcome to make it work). + +To test if the current binary supports this feature the most backwards +compatible way is: + + nbdkit --exit-with-parent --version && echo "supported" + +In nbdkit E 1.34, S> prints either +C or C but earlier versions +did not have this. + +=head1 SEE ALSO + +L, +L, +L, +L (on Linux), +L (on FreeBSD). + +=head1 AUTHORS + +Eric Blake + +Richard W.M. Jones + +Pino Toscano + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/docs/nbdkit-client.pod b/docs/nbdkit-client.pod new file mode 100644 index 0000000..56065c9 --- /dev/null +++ b/docs/nbdkit-client.pod @@ -0,0 +1,100 @@ +=head1 NAME + +nbdkit-client - how to mount NBD filesystems on a client machine + +=head1 DESCRIPTION + +For NBD exports that contain filesystems there are several approaches +to mounting them on a client machine. + +To ensure the nbd kernel module is loaded you may need to do: + + # echo nbd > /etc/modules-load.d/nbd.conf + +This will not take effect until you reboot, so also do: + + # modprobe nbd + +=head2 Easy mounting at boot time + +For simple setups the following method is the easiest way to get an +NBD filesystem to mount at boot. Create or edit F or +F: + + #!/bin/sh - + nm-online + modprobe nbd + nbd-client server /dev/nbd0 + mount /dev/nbd0 /mnt + +=head2 Mounting using systemd mount points + +You can use systemd mount points to mount NBD filesystems at boot +and/or on demand. + +Set up an L mapping. If F doesn't exist, then +create it first. Add this line: + + nbd0 server / bs=512,persist + +As a workaround for +L you must +currently modify the F file: + + # cp /usr/lib/systemd/system/nbd@.service /etc/systemd/system/ + # vi /etc/systemd/system/nbd@.service + +and edit or create these settings in the C<[Service]> section: + + [Service] + Type=oneshot + RemainAfterExit=yes + ExecStart=/usr/sbin/nbd-client %i + ExecStop=/usr/sbin/nbd-client -d /dev/%i + +Finally create a systemd mount file called +F: + + [Unit] + Requires=nbd@nbd0.service + [Mount] + What=/dev/nbd0 + Where=/mnt + Type=ext4 + +You can either reboot now or do: + + # systemctl start mnt.mount + +Other systemd services which need this mount point can depend on this +mount unit. + +=head1 LIMITATIONS + +Red Hat Enterprise Linux 8 enabled the C Linux kernel module +but only for Unix domain sockets (ie. local connections). This means +you cannot connect to an NBD server over a TCP network. This also +affects Linux distributions derived from RHEL like CentOS, Alma and +others. + +This does not affect use of nbdkit as an NBD server, only the Linux +kernel as an NBD client. Userspace Linux clients such as L +tools will work. + +=head1 SEE ALSO + +L, +L, +L, +L, +L, +L, +L. + +=head1 AUTHORS + +Richard W.M. Jones + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/docs/nbdkit-filter.pod b/docs/nbdkit-filter.pod new file mode 100644 index 0000000..b643df4 --- /dev/null +++ b/docs/nbdkit-filter.pod @@ -0,0 +1,1209 @@ +=head1 NAME + +nbdkit-filter - how to write nbdkit filters + +=head1 SYNOPSIS + + #include + + static int + myfilter_config (nbdkit_next_config *next, void *nxdata, + const char *key, const char *value) + { + if (strcmp (key, "myparameter") == 0) { + // ... + return 0; + } + else { + // pass through to next filter or plugin + return next (nxdata, key, value); + } + } + + static struct nbdkit_filter filter = { + .name = "filter", + .config = myfilter_config, + /* etc */ + }; + + NBDKIT_REGISTER_FILTER(filter) + +When this has been compiled to a shared library, do: + + nbdkit [--args ...] --filter=./myfilter.so plugin [key=value ...] + +When debugging, use the I<-fv> options: + + nbdkit -fv --filter=./myfilter.so plugin [key=value ...] + +=head1 DESCRIPTION + +One or more nbdkit filters can be placed in front of an nbdkit plugin +to modify the behaviour of the plugin. This manual page describes how +to create an nbdkit filter. + +Filters can be used for example to limit requests to an offset/limit, +add copy-on-write support, or inject delays or errors (for testing). + +Different filters can be stacked: + + NBD ┌─────────┐ ┌─────────┐ ┌────────┐ + client ───▶│ filter1 │───▶│ filter2 │── ─ ─ ──▶│ plugin │ + request └─────────┘ └─────────┘ └────────┘ + +Each filter intercepts plugin functions (see L) and +can call the next filter or plugin in the chain, modifying parameters, +calling before the filter function, in the middle or after. Filters +may even short-cut the chain. As an example, to process its own +parameters the filter can intercept the C<.config> method: + + static int + myfilter_config (nbdkit_next_config *next, void *nxdata, + const char *key, const char *value) + { + if (strcmp (key, "myparameter") == 0) { + // ... + // here you would handle this key, value + // ... + return 0; + } + else { + // pass through to next filter or plugin + return next (nxdata, key, value); + } + } + + static struct nbdkit_filter filter = { + // ... + .config = myfilter_config, + // ... + }; + +The call to C calls the C<.config> method of the +next filter or plugin in the chain. In the example above any +instances of C on the command line would not be seen +by the plugin. + +To see example filters: +L + +Filters must be written in C. + +Unlike plugins, where we provide a stable ABI guarantee that permits +operation across version differences, filters can only be run with the +same version of nbdkit that they were compiled with. The reason for +this is two-fold: the filter API includes access to struct +nbdkit_next_ops that is likely to change if new callbacks are added +(old nbdkit cannot safely run new filters that access new methods); +and if we added new methods then an old filter would not see them and +so they would be passed unmodified through the filter, and in some +cases that leads to data corruption (new nbdkit cannot safely run old +filters unaware of new methods). Therefore, unlike plugins, you +should not expect to distribute filters separately from nbdkit. + +=head1 C<#include Enbdkit-filter.hE> + +All filters should start by including this header file. + +=head1 C + +All filters must define and register one C, +which contains the name of the filter and pointers to plugin methods +that the filter wants to intercept. + + static struct nbdkit_filter filter = { + .name = "filter", + .longname = "My Filter", + .description = "This is my great filter for nbdkit", + .config = myfilter_config, + /* etc */ + }; + + NBDKIT_REGISTER_FILTER(filter) + +The C<.name> field is the name of the filter. This is the only field +which is required. + +=head1 NEXT PLUGIN + +F defines some function types (C, +C, C, +C, C, +C) and a structure called C. +These abstract the next plugin or filter in the chain. There is also +an opaque pointer C, C or C which must be +passed along when calling these functions. The value of C is +stable between C<.after_fork>, C<.preconnect>, C<.list_exports>, and +C<.default_export>, and can also be obtained by using +C on the C parameter to C<.open>. + +Meanwhile, if the filter does not use C, the +value of C passed to C<.prepare> has a stable lifetime that +lasts to the corresponding C<.finalize>, with all intermediate +functions (such as C<.pread>) receiving the same value for +convenience. Functions where C is not reused are C<.config>, +C<.config_complete>, and C<.get_ready>, which are all called during +initialization outside any connections. The value of C +passed to C<.after_fork> also occurs without connections, but is +shared with C<.preconnect>, C<.list_exports>, and C<.default_export>, +and can also be obtained from the C passed to C<.open>, and +has a lifetime that lasts to C<.cleanup> for use by +C. In turn, the value of C passed +to C<.open> has a lifetime that lasts until the matching C<.close> for +use by C and C. + +=head2 Next config, open and close + +The filter’s C<.config>, C<.config_complete>, C<.get_ready>, +C<.after_fork>, C<.preconnect>, C<.list_exports>, C<.default_export> +and C<.open> methods may only call the next C<.config>, +C<.config_complete>, C<.get_ready>, C<.after_fork>, C<.preconnect>, +C<.list_exports>, C<.default_export> and C<.open> method in the chain +(optionally for C<.config> and C<.open>). + +The filter’s C<.close> method is called when an old connection closed, +and this has no C parameter because it cannot be +short-circuited. + +=head2 C + +The filter generally needs to call into the underlying plugin, which +is done via a pointer to C, also available as +the typedef C. The most common behavior is to create a +next context per connection by calling the C parameter +during C<.open>, at which point the next context will be automatically +provided to the filter’s other methods like C<.prepare>, C<.get_size>, +C<.pread> etc. The C struct contains a comparable set of +accessors to plugin methods that can be called during a connection. +When using automatic registration, the C parameter is stable +between C<.prepare> and C<.finalize>, and nbdkit automatically +prepares, finalizes, and closes the next context at the right point in +the filter connection lifecycle. + +Alternatively, the filter can manage plugin contexts manually, whether +to multiplex multiple client connections through a single context into +the plugin, or to open multiple plugin contexts to perform retries or +otherwise service a single client connection more efficiently. In +this mode of operation, the filter uses C to +open a plugin context using the C parameter passed to +C<.after_fork>, C<.preconnect>, C<.list_exports>, C<.default_export>, +or obtained from using C on the C +parameter to C<.open>. The resulting next context has a lifecycle +under manual control, where the filter must use Cprepare +(next)> before using any other function pointers within the next +context, and must reclaim the memory using Cfinalize +(next)> and C when done. A filter using +manual lifecycle management may use C to +associate the next context into the current connection, which lets +nbdkit then pass that context as the C parameter to future +connection-related functions like C<.pread> and take over lifecycle +responsibility. + +=head3 C + +=head3 C + +=head3 C + +=head3 C + + nbdkit_backend *nbdkit_context_get_backend (nbdkit_context *context); + +Obtains the backend pointer from the C parameter to C<.open>, +matching the backend pointer available to C<.after_fork>, +C<.preconnect>, C<.list_exports>, and C<.default_export>. This +backend pointer has a stable lifetime from the time of C<.after_fork> +until C<.cleanup>. + + nbdkit_next *nbdkit_next_context_open (nbdkit_backend *backend, + int readonly, const char *exportname, + int shared); + +This function attempts to open a new context into the plugin in +relation to the filter's current C. The C and +C parameters behave the same as documented in C<.open>. +The resulting context will be under the filter's manual lifecycle +control unless the filter associates it into the connection with +C. The filter should be careful to not +violate any threading model restrictions of the plugin if it opens +more than one context. + +If C is false, this function must be called while servicing an +existing client connection, and the new context will share the same +connection details (export name, tls status, and shorter interned +string lifetimes) as the current connection, and thus should not be +used after the client connection ends. Conversely, if C is +true, this function may be called outside of a current client +connection (such as during C<.after_fork>), and the resulting context +may be freely shared among multiple client connections. In shared +mode, it will not be possible for the plugin to differentiate content +based on the client export name, the result of the plugin calling +nbdkit_is_tls() will depend solely whether I<--tls=require> was on the +command line, the lifetime of interned strings (via +C and friends) lasts for the life of the filter, +and the filter must take care to not expose potentially-secure +information from the backend to an insecure client. + + void nbdkit_next_context_close (nbdkit_next *next); + +This function closes a context into the plugin. If the context has +previously been prepared, it should first be finalized before using +this function. This function does not need to be called for a plugin +context that has been associated with the filter connection via +C prior to the C<.close> callback. + + nbdkit_next *nbdkit_context_set_next (nbdkit_context *context, + nbdkit_next *next); + +This function associates a plugin context with the filter's current +connection context, given by the C parameter to C<.open>. +Once associated, this plugin context will be given as the C +parameter to all other connection-specific callbacks. If associated +during C<.open>, nbdkit will take care of preparing the context prior +to C<.prepare>; if still associated before C<.finalize>, nbdkit will +take care of finalizing the context, and also for closing it. A +filter may also pass C for C, to remove any association; +if no plugin context is associated with the connection, then filter +callbacks such as C<.pread> will receive C for their C +parameter. + +This function returns the previous context that had been associated +with the connection prior to switching the association to C; +this result will be C if there was no previous association. The +filter assumes manual responsibility for any remaining lifecycle +functions that must be called on the returned context. + +=head2 Using C + +Regardless of whether the plugin context is managed automatically or +manually, it is possible for a filter to issue (for example) extra +Cpread> calls in response to a single C<.pwrite> call. + +The C parameter serves two purposes: it serves as the struct +to access the pointers to all the plugin connection functions, and it +serves as the opaque data that must be passed as the first parameter +to those functions. For example, calling the plugin's can_flush +functionality would be done via + + next->can_flush (next) + +Note that the semantics of the functions in C +are slightly different from what a plugin implements: for example, +when a plugin's C<.pread> returns -1 on error, the error value to +advertise to the client is implicit (via the plugin calling +C or setting C), whereas +Cpread> exposes this via an explicit parameter, +allowing a filter to learn or modify this error if desired. + +Use of Cprepare> and Cfinalize> is only +needed when manually managing the plugin context lifetime. + +=head2 Other considerations + +You can modify parameters when you call the C function. However +be careful when modifying strings because for some methods +(eg. C<.config>) the plugin may save the string pointer that you pass +along. So you may have to ensure that the string is not freed for the +lifetime of the server; you may find C helpful +for avoiding a memory leak while still obeying lifecycle constraints. + +Note that if your filter registers a callback but in that callback it +doesn't call the C function then the corresponding method in the +plugin will never be called. In particular, your C<.open> method, if +you have one, B call the C method if you want the +underlying plugin to be available to all further C use. + +=head1 CALLBACKS + +C has some static fields describing the filter +and optional callback functions which can be used to intercept plugin +methods. + +=head2 C<.name> + + const char *name; + +This field (a string) is required, and B contain only ASCII +alphanumeric characters or non-leading dashes, and be unique amongst +all filters. + +=head2 C<.longname> + + const char *longname; + +An optional free text name of the filter. This field is used in error +messages. + +=head2 C<.description> + + const char *description; + +An optional multi-line description of the filter. + +=head2 C<.load> + + void load (void); + +This is called once just after the filter is loaded into memory. You +can use this to perform any global initialization needed by the +filter. + +=head2 C<.unload> + + void unload (void); + +This may be called once just before the filter is unloaded from +memory. Note that it's not guaranteed that C<.unload> will always be +called (eg. the server might be killed or segfault), so you should try +to make the filter as robust as possible by not requiring cleanup. +See also L. + +=head2 C<.config> + + int (*config) (nbdkit_next_config *next, void *nxdata, + const char *key, const char *value); + +This intercepts the plugin C<.config> method and can be used by the +filter to parse its own command line parameters. You should try to +make sure that command line parameter keys that the filter uses do not +conflict with ones that could be used by a plugin. + +If there is an error, C<.config> should call C with an +error message and return C<-1>. + +=head2 C<.config_complete> + + int (*config_complete) (nbdkit_next_config_complete *next, void *nxdata); + +This intercepts the plugin C<.config_complete> method and can be used +to ensure that all parameters needed by the filter were supplied on +the command line. + +If there is an error, C<.config_complete> should call C +with an error message and return C<-1>. + +=head2 C<.config_help> + + const char *config_help; + +This optional multi-line help message should summarize any +C parameters that it takes. It does I need to repeat +what already appears in C<.description>. + +If the filter doesn't take any config parameters you should probably +omit this. + +=head2 C<.thread_model> + + int (*thread_model) (void); + +Filters may tighten (but not relax) the thread model of the plugin, by +defining this callback. Note that while plugins use a compile-time +definition of C, filters do not need to declare a model +at compile time; instead, this callback is called after +C<.config_complete> and before any connections are created. See +L for a discussion of thread models. + +The final thread model used by nbdkit is the smallest (ie. most +serialized) out of all the filters and the plugin, and applies for all +connections. Requests for a model larger than permitted by the plugin +are silently ignored. It is acceptable for decisions made during +C<.config> and C<.config_complete> to determine which model to +request. + +This callback is optional; if it is not present, the filter must be +written to handle fully parallel requests, including when multiple +requests are issued in parallel on the same connection, similar to a +plugin requesting C. This ensures the +filter doesn't slow down other filters or plugins. + +If there is an error, C<.thread_model> should call C +with an error message and return C<-1>. + +=head2 C<.dump_plugin> + + void (*dump_plugin) (void); + +This optional callback is called when the +S> command is used. +It should print any additional informative C fields to +stdout as needed. Prefixing the keys with the name of the filter will +avoid conflicts. + +=head2 C<.get_ready> + + int (*get_ready) (int thread_model); + +This optional callback is reached if the plugin C<.get_ready> method +succeeded (if the plugin failed, nbdkit has already exited), and can +be used by the filter to get ready to serve requests. + +The C parameter informs the filter about the final +thread model chosen by nbdkit after considering the results of +C<.thread_model> of all filters in the chain after +C<.config_complete>. + +If there is an error, C<.get_ready> should call C with +an error message and return C<-1>. + +=head2 C<.after_fork> + + int (*after_fork) (nbdkit_backend *backend); + +This optional callback is reached after the plugin C<.after_fork> +method has succeeded (if the plugin failed, nbdkit has already +exited), and can be used by the filter to start background threads. +The C parameter is valid until C<.cleanup>, for creating manual +contexts into the backend with C. + +If there is an error, C<.after_fork> should call C with +an error message and return C<-1>. + +=head2 C<.cleanup> + + int (cleanup) (nbdkit_backend *backend); + +This optional callback is reached once after all client connections +have been closed, but before the underlying plugin C<.cleanup> or any +C<.unload> callbacks. It can be used by the filter to gracefully +close any background threads created during C<.after_fork>, as well as +close any manual contexts into C previously opened with +C. + +Note that it's not guaranteed that C<.cleanup> will always be called +(eg. the server might be killed or segfault), so you should try to +make the filter as robust as possible by not requiring cleanup. See +also L. + +=head2 C<.preconnect> + + int (*preconnect) (nbdkit_next_preconnect *next, nbdkit_backend *nxdata, + int readonly); + +This intercepts the plugin C<.preconnect> method and can be used to +filter access to the server. + +If there is an error, C<.preconnect> should call C with +an error message and return C<-1>. + +=head2 C<.list_exports> + + int (*list_exports) (nbdkit_next_list_exports *next, nbdkit_backend *nxdata, + int readonly, int is_tls, + struct nbdkit_exports *exports); + +This intercepts the plugin C<.list_exports> method and can be used to +filter which exports are advertised. + +The C parameter matches what is passed to <.preconnect> and +C<.open>, and may be changed by the filter when calling into the +plugin. The C parameter informs the filter whether TLS +negotiation has been completed by the client, but is not passed on to +C because it cannot be altered. + +It is possible for filters to transform the exports list received back +from the layer below. Without error checking it would look like this: + + myfilter_list_exports (...) + { + size_t i; + struct nbdkit_exports *exports2; + struct nbdkit_export e; + char *name, *desc; + + exports2 = nbdkit_exports_new (); + next_list_exports (nxdata, readonly, exports); + for (i = 0; i < nbdkit_exports_count (exports2); ++i) { + e = nbdkit_get_export (exports2, i); + name = adjust (e.name); + desc = adjust (e.desc); + nbdkit_add_export (exports, name, desc); + free (name); + free (desc); + } + nbdkit_exports_free (exports2); + } + +If there is an error, C<.list_exports> should call C with +an error message and return C<-1>. + +=head3 Allocating and freeing nbdkit_exports list + +Two functions are provided to filters only for allocating and freeing +the list: + + struct nbdkit_exports *nbdkit_exports_new (void); + +Allocates and returns a new, empty exports list. + +On error this function can return C. In this case it calls +C as required. C will be set to a suitable +value. + + void nbdkit_exports_free (struct nbdkit_exports *); + +Frees an existing exports list. + +=head3 Iterating over nbdkit_exports list + +Two functions are provided to filters only to iterate over the exports +in order: + + size_t nbdkit_exports_count (const struct nbdkit_exports *); + +Returns the number of exports in the list. + + struct nbdkit_export { + char *name; + char *description; + }; + const struct nbdkit_export nbdkit_get_export (const struct nbdkit_exports *, + size_t i); + +Returns a copy of the C'th export. + +=head2 C<.default_export> + + const char *default_export (nbdkit_next_default_export *next, + nbdkit_backend *nxdata, + int readonly, int is_tls) + +This intercepts the plugin C<.default_export> method and can be used to +alter the canonical export name used in place of the default C<"">. + +The C parameter matches what is passed to <.preconnect> and +C<.open>, and may be changed by the filter when calling into the +plugin. The C parameter informs the filter whether TLS +negotiation has been completed by the client, but is not passed on to +C because it cannot be altered. + +=head2 C<.open> + + void * (*open) (nbdkit_next_open *next, nbdkit_context *context, + int readonly, const char *exportname, int is_tls); + +This is called when a new client connection is opened and can be used +to allocate any per-connection data structures needed by the filter. +The handle (which is not the same as the plugin handle) is passed back +to other filter callbacks and could be freed in the C<.close> +callback. + +Note that the handle is completely opaque to nbdkit, but it must not +be NULL. If you don't need to use a handle, return +C which is a static non-NULL pointer. + +If there is an error, C<.open> should call C with an +error message and return C. + +This callback is optional, but if provided, it should call C, +passing C and C possibly modified according to +how the filter plans to use the plugin (C is not passed, +because a filter cannot modify it). Typically, the filter passes the +same values as it received, or passes readonly=true to provide a +writable layer on top of a read-only backend. However, it is also +acceptable to attempt write access to the plugin even if this filter +is readonly, such as when a file system mounted read-only still +requires write access to the underlying device in case a journal needs +to be replayed for consistency as part of the mounting process. + +The C string is only guaranteed to be available during the +call (different than the lifetime for the return of C +used by plugins). If the filter needs to use it (other than immediately +passing it down to the next layer) it must take a copy, although +C is useful for this task. The C and +C parameters are provided so that filters do not need to use +the plugin-only interfaces of C and +C. + +The filter should generally call C as its first step, to +allocate from the plugin outwards, so that C<.close> running from the +outer filter to the plugin will be in reverse. Skipping a call to +C is acceptable if the filter will not access C +during any of the remaining callbacks reached on the same connection. +The C function is provided for convenience; the same +functionality can be obtained manually (other than error checking) by +using the following: + + nbdkit_context_set_next (context, nbdkit_next_context_open + (nbdkit_context_get_backend (context), readonly, exportname, false)); + +The value of C in this call has a lifetime that lasts until +the counterpart C<.close>, and it is this value that may be passed to +C to obtain the C parameter used +to open a plugin context with C, as well as +the C parameter used to associate a plugin context into the +current connection with C. + +=head2 C<.close> + + void (*close) (void *handle); + +This is called when the client closes the connection. It should clean +up any per-connection resources used by the filter. It is called +beginning with the outermost filter and ending with the plugin (the +opposite order of C<.open> if all filters call C first), +although this order technically does not matter since the callback +cannot report failures or access the underlying plugin. + +=head2 C<.prepare> + +=head2 C<.finalize> + + int (*prepare) (nbdkit_next *next, void *handle, int readonly); + int (*finalize) (nbdkit_next *next, void *handle); + +These two methods can be used to perform any necessary operations just +after opening the connection (C<.prepare>) or just before closing the +connection (C<.finalize>). + +For example if you need to scan the underlying disk to check for a +partition table, you could do it in your C<.prepare> method (calling +the plugin's C<.get_size> and C<.pread> methods via C). Or +if you need to cleanly update superblock data in the image on close +you can do it in your C<.finalize> method (calling the plugin's +C<.pwrite> method). Doing these things in the filter's C<.open> or +C<.close> method is not possible without using manual context +lifecycle management. + +For C<.prepare>, the value of C is the same as was passed to +C<.open>, declaring how this filter will be used. + +Note that nbdkit performs sanity checking on requests made to the +underlying plugin; for example, Cpread> cannot be +called on a given connection unless Cget_size> has +first been called at least once in the same connection (to ensure the +read requests are in bounds), and Cpwrite> further +requires an earlier successful call to Ccan_write>. In +many filters, these prerequisites will be automatically called during +the client negotiation phase, but there are cases where a filter +overrides query functions or makes I/O calls into the plugin before +handshaking is complete, where the filter needs to make those +prerequisite calls manually during C<.prepare>. + +While there are Cprepare> and Cfinalize> +functions, these are different from other filter methods, in that any +plugin context associated with the current connection (via the C +parameter to C<.open>, or via C, is prepared +and finalized automatically by nbdkit, so they are only used during +manual lifecycle management. Prepare methods are called starting with +the filter closest to the plugin and proceeding outwards (matching the +order of C<.open> if all filters call C before doing anything +locally), and only when an outer filter did not skip the C call +during C<.open>. Finalize methods are called in the reverse order of +prepare methods, with the outermost filter first (and matching the +order of C<.close>), and only if the prepare method succeeded. + +If there is an error, both callbacks should call C with +an error message and return C<-1>. An error in C<.prepare> is +reported to the client, but leaves the connection open (a client may +try again with a different export name, for example); while an error +in C<.finalize> forces the client to disconnect. + +=head2 C<.get_size> + + int64_t (*get_size) (nbdkit_next *next, void *handle); + +This intercepts the plugin C<.get_size> method and can be used to read +or modify the apparent size of the block device that the NBD client +will see. + +The returned size must be E 0. If there is an error, C<.get_size> +should call C with an error message and return C<-1>. +This function is only called once per connection and cached by nbdkit. +Similarly, repeated calls to Cget_size> will return a +cached value. + +=head2 C<.export_description> + + const char *export_description (nbdkit_next *next, void *handle); + +This intercepts the plugin C<.export_description> method and can be +used to read or modify the export description that the NBD client +will see. + +=head2 C<.block_size> + + int block_size (nbdkit_next *next, void *handle, uint32_t *minimum, + uint32_t *preferred, uint32_t *maximum); + +This intercepts the plugin C<.block_size> method and can be used to +read or modify the block size constraints that the NBD client will +see. + +=head2 C<.can_write> + +=head2 C<.can_flush> + +=head2 C<.is_rotational> + +=head2 C<.can_trim> + +=head2 C<.can_zero> + +=head2 C<.can_fast_zero> + +=head2 C<.can_extents> + +=head2 C<.can_fua> + +=head2 C<.can_multi_conn> + +=head2 C<.can_cache> + + int (*can_write) (nbdkit_next *next, void *handle); + int (*can_flush) (nbdkit_next *next, void *handle); + int (*is_rotational) (nbdkit_next *next, void *handle); + int (*can_trim) (nbdkit_next *next, void *handle); + int (*can_zero) (nbdkit_next *next, void *handle); + int (*can_fast_zero) (nbdkit_next *next, void *handle); + int (*can_extents) (nbdkit_next *next, void *handle); + int (*can_fua) (nbdkit_next *next, void *handle); + int (*can_multi_conn) (nbdkit_next *next, void *handle); + int (*can_cache) (nbdkit_next *next, void *handle); + +These intercept the corresponding plugin methods, and control feature +bits advertised to the client. + +Of note, the semantics of C<.can_zero> callback in the filter are +slightly different from the plugin, and must be one of three success +values visible only to filters: + +=over 4 + +=item C + +Completely suppress advertisement of write zero support (this can only +be done from filters, not plugins). + +=item C + +Inform nbdkit that write zeroes should immediately fall back to +C<.pwrite> emulation without trying C<.zero> (this value is returned +by Ccan_zero> if the plugin returned false in its +C<.can_zero>). + +=item C + +Inform nbdkit that write zeroes should attempt to use C<.zero>, +although it may still fall back to C<.pwrite> emulation for C +or C failures (this value is returned by +Ccan_zero> if the plugin returned true in its +C<.can_zero>). + +=back + +Remember that most of the feature check functions return merely a +boolean success value, while C<.can_zero>, C<.can_fua> and +C<.can_cache> have three success values. + +The difference between C<.can_fua> values may affect choices made in +the filter: when splitting a write request that requested FUA from the +client, if Ccan_fua> returns C, then +the filter should pass the FUA flag on to each sub-request; while if +it is known that FUA is emulated by a flush because of a return of +C, it is more efficient to only flush once after +all sub-requests have completed (often by passing C +on to only the final sub-request, or by dropping the flag and ending +with a direct call to Cflush>). + +If there is an error, the callback should call C with an +error message and return C<-1>. These functions are called at most +once per connection and cached by nbdkit. Similarly, repeated calls to +any of the C counterparts will return a cached value; by +calling into the plugin during C<.prepare>, you can ensure that later +use of the cached values during data commands like <.pwrite> will not +fail. + +=head2 C<.pread> + + int (*pread) (nbdkit_next *next, + void *handle, void *buf, uint32_t count, uint64_t offset, + uint32_t flags, int *err); + +This intercepts the plugin C<.pread> method and can be used to read or +modify data read by the plugin. + +The parameter C exists in case of future NBD protocol +extensions; at this time, it will be 0 on input, and the filter should +not pass any flags to Cpread>. + +If there is an error (including a short read which couldn't be +recovered from), C<.pread> should call C with an error +message B return -1 with C set to the positive errno value +to return to the client. + +=head2 C<.pwrite> + + int (*pwrite) (nbdkit_next *next, + void *handle, + const void *buf, uint32_t count, uint64_t offset, + uint32_t flags, int *err); + +This intercepts the plugin C<.pwrite> method and can be used to modify +data written by the plugin. + +This function will not be called if C<.can_write> returned false; in +turn, the filter should not call Cpwrite> if +Ccan_write> did not return true. + +The parameter C may include C on input based +on the result of C<.can_fua>. In turn, the filter should only pass +C on to Cpwrite> if +Ccan_fua> returned a positive value. + +If there is an error (including a short write which couldn't be +recovered from), C<.pwrite> should call C with an error +message B return -1 with C set to the positive errno value +to return to the client. + +=head2 C<.flush> + + int (*flush) (nbdkit_next *next, + void *handle, uint32_t flags, int *err); + +This intercepts the plugin C<.flush> method and can be used to modify +flush requests. + +This function will not be called if C<.can_flush> returned false; in +turn, the filter should not call Cflush> if +Ccan_flush> did not return true. + +The parameter C exists in case of future NBD protocol +extensions; at this time, it will be 0 on input, and the filter should +not pass any flags to Cflush>. + +If there is an error, C<.flush> should call C with an +error message B return -1 with C set to the positive errno +value to return to the client. + +=head2 C<.trim> + + int (*trim) (nbdkit_next *next, + void *handle, uint32_t count, uint64_t offset, + uint32_t flags, int *err); + +This intercepts the plugin C<.trim> method and can be used to modify +trim requests. + +This function will not be called if C<.can_trim> returned false; in +turn, the filter should not call Ctrim> if +Ccan_trim> did not return true. + +The parameter C may include C on input based +on the result of C<.can_fua>. In turn, the filter should only pass +C on to Ctrim> if +Ccan_fua> returned a positive value. + +If there is an error, C<.trim> should call C with an +error message B return -1 with C set to the positive errno +value to return to the client. + +=head2 C<.zero> + + int (*zero) (nbdkit_next *next, + void *handle, uint32_t count, uint64_t offset, uint32_t flags, + int *err); + +This intercepts the plugin C<.zero> method and can be used to modify +zero requests. + +This function will not be called if C<.can_zero> returned +C or C; in turn, the filter +should not call Czero> if Ccan_zero> returned +C. + +On input, the parameter C may include C +unconditionally, C based on the result of +C<.can_fua>, and C based on the result of +C<.can_fast_zero>. In turn, the filter may pass +C unconditionally, but should only pass +C or C on to +Czero> if the corresponding Ccan_fua> or +Ccan_fast_zero> returned a positive value. + +Note that unlike the plugin C<.zero> which is permitted to fail with +C or C to force a fallback to C<.pwrite>, the +function Czero> will not fail with C set to +C or C unless C was used, +because otherwise the fallback has already taken place. + +If there is an error, C<.zero> should call C with an +error message B return -1 with C set to the positive errno +value to return to the client. The filter should not fail with +C or C unless C includes +C (while plugins have automatic fallback to +C<.pwrite>, filters do not). + +=head2 C<.extents> + + int (*extents) (nbdkit_next *next, + void *handle, uint32_t count, uint64_t offset, uint32_t flags, + struct nbdkit_extents *extents, + int *err); + +This intercepts the plugin C<.extents> method and can be used to +modify extent requests. + +This function will not be called if C<.can_extents> returned false; in +turn, the filter should not call Cextents> if +Ccan_extents> did not return true. + +It is possible for filters to transform the extents list received back +from the layer below. Without error checking it would look like this: + + myfilter_extents (..., uint32_t count, uint64_t offset, ...) + { + size_t i; + struct nbdkit_extents *extents2; + struct nbdkit_extent e; + int64_t size; + + size = next->get_size (next); + extents2 = nbdkit_extents_new (offset + shift, size); + next->extents (next, count, offset + shift, flags, extents2, err); + for (i = 0; i < nbdkit_extents_count (extents2); ++i) { + e = nbdkit_get_extent (extents2, i); + e.offset -= shift; + nbdkit_add_extent (extents, e.offset, e.length, e.type); + } + nbdkit_extents_free (extents2); + } + +If there is an error, C<.extents> should call C with an +error message B return -1 with C set to the positive errno +value to return to the client. + +=head3 Allocating and freeing nbdkit_extents list + +Two functions are provided to filters only for allocating and freeing +the map: + + struct nbdkit_extents *nbdkit_extents_new (uint64_t start, uint64_t end); + +Allocates and returns a new, empty extents list. The C +parameter is the start of the range described in the list, and the +C parameter is the offset of the byte beyond the end. Normally +you would pass in C as the start and the size of the plugin as +the end, but for filters which adjust offsets, they should pass in the +adjusted offset. + +On error this function can return C. In this case it calls +C and/or C as required. C will +be set to a suitable value. + + void nbdkit_extents_free (struct nbdkit_extents *); + +Frees an existing extents list. + +=head3 Iterating over nbdkit_extents list + +Two functions are provided to filters only to iterate over the extents +in order: + + size_t nbdkit_extents_count (const struct nbdkit_extents *); + +Returns the number of extents in the list. + + struct nbdkit_extent { + uint64_t offset; + uint64_t length; + uint32_t type; + }; + struct nbdkit_extent nbdkit_get_extent (const struct nbdkit_extents *, + size_t i); + +Returns a copy of the C'th extent. + +=head3 Reading the full extents from the plugin + +A convenience function is provided to filters only which makes one or +more requests to the underlying plugin until we have a full set of +extents covering the region C<[offset..offset+count-1]>. + + struct nbdkit_extents *nbdkit_extents_full ( + nbdkit_next *next, + uint32_t count, uint64_t offset, + uint32_t flags, int *err); + +Note this allocates a new C which the caller +must free. C is passed through to the underlying plugin, but +C is removed from the set of flags so that the +plugin returns as much information as possible (this is usually what +you want). + +On error this function can return C. In this case it calls +C and/or C as required. C<*err> will +be set to a suitable value. + +=head3 Enforcing alignment of an nbdkit_extents list + +A convenience function is provided to filters only which makes it +easier to ensure that the client only encounters aligned extents. + + int nbdkit_extents_aligned (nbdkit_next *next, + uint32_t count, uint64_t offset, + uint32_t flags, uint32_t align, + struct nbdkit_extents *extents, int *err); + +Calls Cextents> as needed until at least C bytes are +obtained, where C is a power of 2. Anywhere the underlying +plugin returns differing extents within C bytes, this function +treats that portion of the disk as a single extent with zero and +sparse status bits determined by the intersection of all underlying +extents. It is an error to call this function with C or +C that is not already aligned. + +=head2 C<.cache> + + int (*cache) (nbdkit_next *next, + void *handle, uint32_t count, uint64_t offset, + uint32_t flags, int *err); + +This intercepts the plugin C<.cache> method and can be used to modify +cache requests. + +This function will not be called if C<.can_cache> returned +C or C; in turn, the filter +should not call Ccache> if +Ccan_cache> returned C. + +The parameter C exists in case of future NBD protocol +extensions; at this time, it will be 0 on input, and the filter should +not pass any flags to Ccache>. + +If there is an error, C<.cache> should call C with an +error message B return -1 with C set to the positive errno +value to return to the client. + +=head1 ERROR HANDLING + +If there is an error in the filter itself, the filter should call +C to report an error message. If the callback is +involved in serving data, the explicit C parameter determines the +error code that will be sent to the client; other callbacks should +return the appropriate error indication, eg. C or C<-1>. + +C has the following prototype and works like +L: + + void nbdkit_error (const char *fs, ...); + void nbdkit_verror (const char *fs, va_list args); + +For convenience, C preserves the value of C, and +also supports the glibc extension of a single C<%m> in a format string +expanding to C, even on platforms that don't support +that natively. + +=head1 DEBUGGING + +Run the server with I<-f> and I<-v> options so it doesn't fork and you +can see debugging information: + + nbdkit -fv --filter=./myfilter.so plugin [key=value [key=value [...]]] + +To print debugging information from within the filter, call +C, which has the following prototype and works like +L: + + void nbdkit_debug (const char *fs, ...); + void nbdkit_vdebug (const char *fs, va_list args); + +For convenience, C preserves the value of C, and +also supports the glibc extension of a single C<%m> in a format string +expanding to C, even on platforms that don't support +that natively. Note that C only prints things when the +server is in verbose mode (I<-v> option). + +=head2 Debug Flags + +Debug Flags in filters work exactly the same way as plugins. See +L. + +=head1 INSTALLING THE FILTER + +The filter is a C<*.so> file and possibly a manual page. You can of +course install the filter C<*.so> file wherever you want, and users +will be able to use it by running: + + nbdkit --filter=/path/to/filter.so plugin [args] + +However B the shared library has a name of the form +C-filter.so> B the library is installed in the +C<$filterdir> directory, then users can be run it by only typing: + + nbdkit --filter=name plugin [args] + +The location of the C<$filterdir> directory is set when nbdkit is +compiled and can be found by doing: + + nbdkit --dump-config + +If using the pkg-config/pkgconf system then you can also find the +filter directory at compile time by doing: + + pkg-config nbdkit --variable=filterdir + +=head1 PKG-CONFIG/PKGCONF + +nbdkit provides a pkg-config/pkgconf file called C which +should be installed on the correct path when the nbdkit development +environment is installed. You can use this in autoconf +F scripts to test for the development environment: + + PKG_CHECK_MODULES([NBDKIT], [nbdkit >= 1.2.3]) + +The above will fail unless nbdkit E 1.2.3 and the header file is +installed, and will set C and C +appropriately for compiling filters. + +You can also run pkg-config/pkgconf directly, for example: + + if ! pkg-config nbdkit --exists; then + echo "you must install the nbdkit development environment" + exit 1 + fi + +You can also substitute the filterdir variable by doing: + + PKG_CHECK_VAR([NBDKIT_FILTERDIR], [nbdkit], [filterdir]) + +which defines C<$(NBDKIT_FILTERDIR)> in automake-generated Makefiles. + +=head1 WRITING FILTERS IN C++ + +Instead of using C, it is possible to write filters in C++. However +for inclusion in upstream nbdkit we would generally prefer filters +written in C. + +Filters in C++ work almost exactly like those in C, but the way you +define the C struct is slightly different: + + namespace { + nbdkit_filter create_filter() { + nbdkit_filter filter = nbdkit_filter (); + filter.name = "myfilter"; + filter.config = myfilter_config; + return filter; + } + } + static struct nbdkit_filter filter = create_filter (); + NBDKIT_REGISTER_FILTER(filter) + +=head1 SEE ALSO + +L, +L. + +Standard filters provided by nbdkit: + +__FILTER_LINKS__. + +=head1 AUTHORS + +Eric Blake + +Richard W.M. Jones + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/docs/nbdkit-loop.pod b/docs/nbdkit-loop.pod new file mode 100644 index 0000000..a859ea0 --- /dev/null +++ b/docs/nbdkit-loop.pod @@ -0,0 +1,155 @@ +=head1 NAME + +nbdkit-loop - use nbdkit with the Linux kernel client to create loop +devices and loop mounts + +=head1 DESCRIPTION + +nbdkit (server) can be used with the Linux kernel nbd (client) in a +loop mode allowing any of the plugins supported by nbdkit to be turned +into Linux block devices. + +In addition to L itself, the main commands you will use +are: + +=over 4 + +=item nbd-client localhost /dev/nbd0 + +Attaches a locally running nbdkit instance to the kernel device +F. + +=item nbd-client -unix /tmp/socket /dev/nbd0 + +Alternative method using a Unix domain socket instead of a public +TCP/IP socket. Use C to serve. + +=item nbd-client -d /dev/nbd0 + +Detaches F. + +=item nbd-client -c /dev/nbd0 + +Queries whether F is attached or not. + +=item modprobe nbd + +You may be need to run this command once to load the nbd client kernel +module. + +=back + +The L and L commands must be run as root. + +=head2 Warning: Do not loop mount untrusted filesystems + +Untrusted filesystems and untrusted disk images should not be loop +mounted because they could contain exploits that attack your host +kernel. Use the tools from L instead since it safely +isolates untrusted filesystems from the host. + +=head2 Loop mount a filesystem from a compressed file + +If you have a filesystem or disk image in xz-compressed format then +you can use L and L to +loop mount it as follows: + + nbdkit --filter=xz file disk.xz + nbd-client localhost /dev/nbd0 + mount /dev/nbd0p1 /mnt + +=head2 Loop mount a filesystem from a web server + +You can use L to loop mount a filesystem from a +disk image on a web server: + + nbdkit [--filter=xz] curl https://example.com/disk.img + nbd-client localhost /dev/nbd0 + mount /dev/nbd0p1 /mnt + +Use I<--filter=xz> if the remote image is XZ-compressed. + +=head2 Create a giant btrfs filesystem + +nbdkit is useful for testing the limits of Linux filesystems. Using +L you can create virtual disks stored in RAM +with a virtual size up to S<2⁶³-1 bytes>, and then create filesystems +on these: + + nbdkit memory $(( 2**63 - 1 )) + nbd-client localhost /dev/nbd0 + +Partition the device using GPT, creating a single partition with all +default settings: + + gdisk /dev/nbd0 + +Make a btrfs filesystem on the disk and mount it: + + mkfs.btrfs -K /dev/nbd0p1 + mount /dev/nbd0p1 /mnt + +=head2 Inject errors into Linux devices + +Using L you can see how Linux devices react to +errors: + + nbdkit --filter=error \ + memory 64M \ + error-rate=100% error-file=/tmp/inject + nbd-client localhost /dev/nbd0 + mkfs -t ext4 /dev/nbd0 + mount /dev/nbd0 /mnt + +Inject errors by touching F, and stop injecting errors by +removing this file. + +=head2 Write Linux block devices in shell script + +Using L you can write custom Linux block devices +in shell script for testing. For example the following shell script +creates a disk which contains a bad sector: + + #!/bin/bash - + case "$1" in + thread_model) echo parallel ;; + get_size) echo 64M ;; + pread) + if [ $4 -le 100000 ] && [ $(( $4+$3 )) -gt 100000 ]; then + echo EIO Bad block >&2 + exit 1 + else + dd if=/dev/zero count=$3 iflag=count_bytes + fi ;; + *) exit 2 ;; + esac + +Create a loop from this shell script using: + + nbdkit sh ./bad-sector.sh + nbd-client localhost /dev/nbd0 + +You can then try running tests such as: + + badblocks /dev/nbd0 + +=head1 SEE ALSO + +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, L. + +=head1 AUTHORS + +Richard W.M. Jones + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/docs/nbdkit-plugin.pod b/docs/nbdkit-plugin.pod new file mode 100644 index 0000000..7f82c2f --- /dev/null +++ b/docs/nbdkit-plugin.pod @@ -0,0 +1,1986 @@ +=head1 NAME + +nbdkit-plugin - how to write nbdkit plugins + +=head1 SYNOPSIS + + #define NBDKIT_API_VERSION 2 + #include + + #define THREAD_MODEL NBDKIT_THREAD_MODEL_SERIALIZE_ALL_REQUESTS + + static void * + myplugin_open (void) + { + /* create a handle ... */ + return handle; + } + + static struct nbdkit_plugin plugin = { + .name = "myplugin", + .open = myplugin_open, + .get_size = myplugin_get_size, + .pread = myplugin_pread, + .pwrite = myplugin_pwrite, + /* etc */ + }; + NBDKIT_REGISTER_PLUGIN(plugin) + +Compile the plugin as a shared library: + + gcc -fPIC -shared myplugin.c -o myplugin.so + +and load it into nbdkit: + + nbdkit [--args ...] ./myplugin.so [key=value ...] + +When debugging, use the I<-fv> options: + + nbdkit -fv ./myplugin.so [key=value ...] + +=head1 DESCRIPTION + +An nbdkit plugin is a new source device which can be served using the +Network Block Device (NBD) protocol. This manual page describes how +to create an nbdkit plugin in C. + +To see example plugins: +L + +To write plugins in other languages, see: +__LANG_PLUGIN_LINKS__. + +=head2 API and ABI guarantee for C plugins + +Plugins written in C have an ABI guarantee: a plugin compiled against +an older version of nbdkit will still work correctly when loaded with +a newer nbdkit. We also try (but cannot guarantee) to support plugins +compiled against a newer version of nbdkit when loaded with an older +nbdkit, although the plugin may have reduced functionality if it +depends on features only provided by newer nbdkit. + +For plugins written in C, we also provide an API guarantee: a plugin +written against an older header will still compile unmodified with a +newer nbdkit. + +The API guarantee does not always apply to plugins written in other +(non-C) languages which may have to adapt to changes when recompiled +against a newer nbdkit. + +=head1 WRITING AN NBDKIT PLUGIN + +=head2 C<#define NBDKIT_API_VERSION 2> + +Plugins must choose which API version they want to use, by defining +NBDKIT_API_VERSION before including Cnbdkit-plugin.hE> (or +any other nbdkit header). + +If omitted, the default version is 1 for backwards-compatibility with +nbdkit v1.1.26 and earlier; however, it is recommended that new +plugins be written to the maximum version (currently 2) as it enables +more features and better interaction with nbdkit filters. + +The rest of this document only covers the version 2 interface. A +newer nbdkit will always support plugins written in C which use any +prior API version. + +=head2 C<#include Enbdkit-plugin.hE> + +All plugins should start by including this header file (after +optionally choosing an API version). + +=head2 C<#define THREAD_MODEL ...> + +All plugins must define a thread model. See L below for +details. It is generally safe to use: + + #define THREAD_MODEL NBDKIT_THREAD_MODEL_SERIALIZE_ALL_REQUESTS + +=head2 C + +All plugins must define and register one C, +which contains the name of the plugin and pointers to callback +functions, and use the C macro: + + static struct nbdkit_plugin plugin = { + .name = "myplugin", + .longname = "My Plugin", + .description = "This is my great plugin for nbdkit", + .open = myplugin_open, + .get_size = myplugin_get_size, + .pread = myplugin_pread, + .pwrite = myplugin_pwrite, + /* etc */ + }; + NBDKIT_REGISTER_PLUGIN(plugin) + +The C<.name> field is the name of the plugin. + +The callbacks are described below (see L). Only C<.name>, +C<.open>, C<.get_size> and C<.pread> are required. All other +callbacks can be omitted, although typical plugins need to use more. + +=head2 Callback lifecycle + +Callbacks are called in the following order over the lifecycle of +the plugin: + + ┌──────────────────┐ + │ load │ + └─────────┬────────┘ + │ configuration phase starts ─┐ + ┌─────────┴────────┐ ┆ + │ config │ config is called once per ┆ + └─────────┬────────┘↺ key=value on the command line ┆ + ┌─────────┴────────┐ ┆ + │ config_complete │ ┆ + └─────────┬────────┘ ┆ + ┌─────────┴────────┐ ┆ + │ thread_model │ ┆ + └─────────┬────────┘ configuration phase ends ─┘ + ┌─────────┴────────┐ + │ get_ready │ + └─────────┬────────┘ + │ nbdkit forks into the background + ┌─────────┴────────┐ + │ after_fork │ + └─────────┬────────┘ + │ nbdkit starts serving clients + │ + ┌──────────┴─────────────┬─ ─ ─ ─ ─ ─ ─ ─ ─ + ┌──────┴─────┐ client #1 │ + │ preconnect │ │ + └──────┬─────┘ │ + ┌──────┴─────┐ │ + │list_exports│ │ + └──────┬─────┘ │ + ┌──────┴─────┐ │ + │ open │ │ + └──────┬─────┘ │ + ┌──────┴─────┐ NBD option │ + │ can_write │ negotiation │ + └──────┬─────┘ │ + ┌──────┴─────┐ ┌──────┴─────┐ client #2 + │ get_size │ │ preconnect │ + └──────┬─────┘ └──────┬─────┘ + ┌──────┴─────┐ data + │ pread │ serving + └──────┬─────┘↺ ... + ┌──────┴─────┐ + │ pwrite │ + └──────┬─────┘↺ ┌──────┴─────┐ + ┌──────┴─────┐ │ close │ + │ close │ └────────────┘ + └────────────┘ + + │ before nbdkit exits + │ + ┌─────────┴────────┐ + │ cleanup │ + └─────────┬────────┘ + ┌─────────┴────────┐ + │ unload │ + └──────────────────┘ + +=head3 Notes + +=over 4 + +=item C + +The order of calls when the user queries the plugin is slightly +different: C<.config> is called once for each parameter. +C<.config_complete> is I called. C<.thread_model> is called +after C<.config>. + +=item C<.get_ready> + +This is the last chance to do any global preparation that is needed to +serve connections. In particular, error messages here will be visible +to the user, but they might not be in C<.after_fork> (see below). + +Plugins should not create background threads here. Use C<.after_fork> +instead. + +=item C<.after_fork> + +C<.after_fork> is called after the server has forked into the +background and changed UID and directory. If a plugin needs to create +background threads (or uses an external library that creates threads) +it should do so here, because background threads are invalidated by +fork. + +Because the server may have forked into the background, error messages +and failures from C<.after_fork> cannot be seen by the user unless +they look through syslog. An error in C<.after_fork> can appear to +the user as if nbdkit “just died”. So in almost all cases it is +better to use C<.get_ready> instead of this callback, or to do as much +preparation work as possible in C<.get_ready> and only start +background threads here. + +The server doesn't always fork (eg. if the I<-f> flag is used), but +even so this callback will be called. If you want to find out if the +server forked between C<.get_ready> and C<.after_fork> use +L. + +=item C<.preconnect> and C<.open> + +C<.preconnect> is called when a TCP connection has been made to the +server. This happens early, before NBD or TLS negotiation. + +C<.open> is called when a new client has connected and finished the +NBD handshake. TLS negotiation (if used) has been completed +successfully. + +=item C<.can_write>, C<.get_size> and other option negotiation callbacks + +These are called during option negotiation with the client, but before +any data is served. These callbacks may return different values +across different C<.open> calls, but within a single connection, they +are called at most once and cached by nbdkit for that connection. + +=item C<.pread>, C<.pwrite> and other data serving callbacks + +After option negotiation has finished, these may be called to serve +data. Depending on the thread model chosen, they might be called in +parallel from multiple threads. The data serving callbacks include a +flags argument; the results of the negotiation callbacks influence +whether particular flags will ever be passed to a data callback. + +=item C<.cleanup> and C<.unload> + +The difference between these two methods is that C<.cleanup> is called +before any filter has been removed from memory with L. +When C<.unload> is called, nbdkit is in the middle of calling +L. Most plugins do not need to worry about this +difference. + +=back + +=head2 Flags + +The following flags are defined by nbdkit, and used in various data +serving callbacks as follows: + +=over 4 + +=item C + +This flag is used by the C<.zero> callback; there is no way to disable +this flag, although a plugin that does not support trims as a way to +write zeroes may ignore the flag without violating expected semantics. + +=item C + +This flag represents Forced Unit Access semantics. It is used by the +C<.pwrite>, C<.zero>, and C<.trim> callbacks to indicate that the +plugin must not return a result until the action has landed in +persistent storage. This flag will not be sent to the plugin unless +C<.can_fua> is provided and returns C. + +=back + +The following defines are valid as successful return values for +C<.can_fua>: + +=over 4 + +=item C + +Forced Unit Access is not supported; the client must manually request +a flush after writes have completed. The C flag will +not be passed to the plugin's write callbacks. + +=item C + +The client may request Forced Unit Access, but it is implemented by +emulation, where nbdkit calls C<.flush> after a write operation; this +is semantically correct, but may hurt performance as it tends to flush +more data than just what the client requested. The C +flag will not be passed to the plugin's write callbacks. + +=item C + +The client may request Forced Unit Access, which results in the +C flag being passed to the plugin's write callbacks +(C<.pwrite>, C<.trim>, and C<.zero>). When the flag is set, these +callbacks must not return success until the client's request has +landed in persistent storage. + +=back + +The following defines are valid as successful return values for +C<.can_cache>: + +=over 4 + +=item C + +The server does not advertise caching support, and rejects any +client-requested caching. Any C<.cache> callback is ignored. + +=item C + +The nbdkit server advertises cache support to the client, where the +client may request that the server cache a region of the export to +potentially speed up future read and/or write operations on that +region. The nbdkit server implements the caching by calling C<.pread> +and ignoring the results. This option exists to ease the +implementation of a common form of caching; any C<.cache> callback is +ignored. + +=item C + +The nbdkit server advertises cache support to the client, where the +client may request that the server cache a region of the export to +potentially speed up future read and/or write operations on that +region. The nbdkit server calls the C<.cache> callback to perform the +caching; if that callback is missing, the client's cache request +succeeds without doing anything. + +=back + +=head2 Threads + +Each nbdkit plugin must declare its maximum thread safety model by +defining the C macro. (This macro is used by +C). Additionally, a plugin may implement the +C<.thread_model> callback, called right after C<.config_complete> to +make a runtime decision on which thread model to use. The nbdkit +server chooses the most restrictive model between the plugin's +C, the C<.thread_model> if present, any restrictions +requested by filters, and any limitations imposed by the operating +system. + +In C output, the C line +matches the C macro, and the C line +matches what the system finally settled on after applying all +restrictions. + +The possible settings for C are defined below. + +=over 4 + +=item C<#define THREAD_MODEL NBDKIT_THREAD_MODEL_SERIALIZE_CONNECTIONS> + +Only a single handle can be open at any time, and all requests happen +from one thread. + +Note this means only one client can connect to the server at any time. +If a second client tries to connect it will block waiting for the +first client to close the connection. + +=item C<#define THREAD_MODEL NBDKIT_THREAD_MODEL_SERIALIZE_ALL_REQUESTS> + +I. + +Multiple handles can be open at the same time, but requests are +serialized so that for the plugin as a whole only one +open/read/write/close (etc) request will be in progress at any time. + +This is a useful setting if the library you are using is not +thread-safe. However performance may not be good. + +=item C<#define THREAD_MODEL NBDKIT_THREAD_MODEL_SERIALIZE_REQUESTS> + +Multiple handles can be open and multiple data requests can happen in +parallel. However only one request will happen per handle at a time +(but requests on different handles might happen concurrently). + +=item C<#define THREAD_MODEL NBDKIT_THREAD_MODEL_PARALLEL> + +Multiple handles can be open and multiple data requests can happen in +parallel (even on the same handle). The server may reorder replies, +answering a later request before an earlier one. + +All the libraries you use must be thread-safe and reentrant, and any +code that creates a file descriptor should atomically set +C if you do not want it accidentally leaked to another +thread's child process. You may also need to provide mutexes for +fields in your connection handle. + +=back + +If none of the above thread models are suitable, use +C and implement your own locking using +C etc. + +=head2 Error handling + +If there is an error in the plugin, the plugin should call +C to report an error message; additionally, if the +callback is involved in serving data, the plugin should call +C to influence the error code that will be sent to +the client. These two functions can be called in either order. Then, +the callback should return the appropriate error indication, +eg. C or C<-1>. + +If the call to C is omitted while serving data, then +the global variable C may be used. For plugins which have +C<.errno_is_preserved != 0> the core code will use C. In +plugins written in non-C languages, we usually cannot trust that +C will not be overwritten when returning from that language to +C. In that case, either the plugin must call C or +hard-coded C is used. + +C has the following prototype and works like +L: + + void nbdkit_error (const char *fs, ...); + void nbdkit_verror (const char *fs, va_list args); + +For convenience, C preserves the value of C, and +also supports the glibc extension of a single C<%m> in a format string +expanding to C, even on platforms that don't support +that natively. + +C can be called at any time, but only has an impact +during callbacks for serving data, and only when the callback returns +an indication of failure. It has the following prototype: + + void nbdkit_set_error (int err); + +=head1 CALLBACKS + +=head2 C<.name> + + const char *name; + +This field (a string) is required, and B contain only ASCII +alphanumeric characters or non-leading dashes, and be unique amongst +all plugins. + +=head2 C<.version> + + const char *version; + +Plugins may optionally set a version string which is displayed in help +and debugging output. (See also L below) + +=head2 C<.longname> + + const char *longname; + +An optional free text name of the plugin. This field is used in error +messages. + +=head2 C<.description> + + const char *description; + +An optional multi-line description of the plugin. + +=head2 C<.load> + + void load (void); + +This is called once just after the plugin is loaded into memory. You +can use this to perform any global initialization needed by the +plugin. + +=head2 C<.unload> + + void unload (void); + +This may be called once just before the plugin is unloaded from +memory. Note that it's not guaranteed that C<.unload> will always be +called (eg. the server might be killed or segfault), so you should try +to make the plugin as robust as possible by not requiring cleanup. +See also L below. + +=head2 C<.dump_plugin> + + void dump_plugin (void); + +This optional callback is called when the +S> command is used. It should print +any additional informative C fields to stdout as needed. +Prefixing the keys with the name of the plugin will avoid conflicts. + +=head2 C<.config> + + int config (const char *key, const char *value); + +On the nbdkit command line, after the plugin filename, come an +optional list of C arguments. These are passed to the +plugin through this callback when the plugin is first loaded and +before any connections are accepted. + +This callback may be called zero or more times. + +Both C and C parameters will be non-NULL. The strings are +owned by nbdkit but will remain valid for the lifetime of the plugin, +so the plugin does not need to copy them. + +The key will be a non-empty string beginning with an ASCII alphabetic +character (C C). The rest of the key must contain only +ASCII alphanumeric plus period, underscore or dash characters (C +C C<0-9> C<.> C<_> C<->). The value may be an arbitrary string, +including an empty string. + +The names of Cs accepted by plugins is up to the plugin, but you +should probably look at other plugins and follow the same conventions. + +If the value is a relative path, then note that the server changes +directory when it starts up. See L above. + +If C returns 1, the value of the configuration +parameter may be used to trigger reading additional data through stdin +(such as a password or inline script). + +If the C<.config> callback is not provided by the plugin, and the user +tries to specify any C arguments, then nbdkit will exit +with an error. + +If there is an error, C<.config> should call C with an +error message and return C<-1>. + +=head2 C<.magic_config_key> + + const char *magic_config_key; + +This optional string can be used to set a "magic" key used when +parsing plugin parameters. It affects how "bare parameters" (those +which do not contain an C<=> character) are parsed on the command +line. + +If C then any bare parameters are passed to +the C<.config> method as: S>. + +If C is not set then we behave as in nbdkit E +1.7: If the first parameter on the command line is bare then it is +passed to the C<.config> method as: S>. +Any other bare parameters give errors. + +=head2 C<.config_complete> + + int config_complete (void); + +This optional callback is called after all the configuration has been +passed to the plugin. It is a good place to do checks, for example +that the user has passed the required parameters to the plugin. + +If there is an error, C<.config_complete> should call C +with an error message and return C<-1>. + +=head2 C<.config_help> + + const char *config_help; + +This optional multi-line help message should summarize any +C parameters that it takes. It does I need to repeat +what already appears in C<.description>. + +If the plugin doesn't take any config parameters you should probably +omit this. + +=head2 C<.thread_model> + + int thread_model (void) + +This optional callback is called after all the configuration has been +passed to the plugin. It can be used to force a stricter thread model +based on configuration, compared to C. See L +above for details. Attempts to request a looser (more parallel) model +are silently ignored. + +If there is an error, C<.thread_model> should call C +with an error message and return C<-1>. + +=head2 C<.get_ready> + + int get_ready (void); + +This optional callback is called before the server starts serving. It +is called before the server forks or changes directory. It is +ordinarily the last chance to do any global preparation that is needed +to serve connections. + +If there is an error, C<.get_ready> should call C with +an error message and return C<-1>. + +=head2 C<.after_fork> + + int after_fork (void); + +This optional callback is called before the server starts serving. It +is called after the server forks and changes directory. If a plugin +needs to create background threads (or uses an external library that +creates threads) it should do so here, because background threads are +killed by fork. However you should try to do as little as possible +here because error reporting is difficult. See L +above. + +If there is an error, C<.after_fork> should call C with +an error message and return C<-1>. + +=head2 C<.cleanup> + + void cleanup (void); + +This optional callback is called after the server has closed all +connections and is preparing to unload. It is only reached in the +same cases that the C<.after_fork> callback was used, making it a good +place to clean up any background threads. However, it is not +guaranteed that this callback will be reached, so you should try to +make the plugin as robust as possible by not requiring cleanup. See +also L below. + +=head2 C<.preconnect> + + int preconnect (int readonly); + +This optional callback is called when a TCP connection has been made +to the server. This happens early, before NBD or TLS negotiation. If +TLS authentication is required to access the server, then it has +B been negotiated at this point. + +For security reasons (to avoid denial of service attacks) this +callback should be written to be as fast and take as few resources as +possible. If you use this callback, only use it to do basic access +control, such as checking C, C, +C, C against a list of permitted +source addresses (see L and L). It +may be better to do access control outside the server, for example +using TCP wrappers or a firewall. + +The C flag informs the plugin that the server was started +with the I<-r> flag on the command line. + +Returning C<0> will allow the connection to continue. If there is an +error or you want to deny the connection, call C with an +error message and return C<-1>. + +=head2 C<.list_exports> + + int list_exports (int readonly, int is_tls, + struct nbdkit_exports *exports); + +This optional callback is called if the client tries to list the +exports served by the plugin (using C). If the plugin +does not supply this callback then the result of C<.default_export> is +advertised as the lone export. The NBD protocol defines C<""> as the +default export, so this is suitable for plugins which ignore the +export name and always serve the same content. See also L below. + +The C flag informs the plugin that the server was started +with the I<-r> flag on the command line, which is the same value +passed to C<.preconnect> and C<.open>. However, the NBD protocol does +not yet have a way to let the client advertise an intent to be +read-only even when the server allows writes, so this parameter may +not be as useful as it appears. + +The C flag informs the plugin whether this listing was +requested after the client has completed TLS negotiation. When +running the server in a mode that permits but does not require TLS, be +careful that any exports listed when C is C do not leak +unintended information. + +The C parameter is an opaque object for collecting the list +of exports. Call C as needed to add specific +exports to the list. + + int nbdkit_add_export (struct nbdkit_export *exports, + const char *name, const char *description); + +The C must be a non-NULL, UTF-8 string between 0 and 4096 bytes +in length. Export names must be unique. C is an +optional description of the export which some clients can display but +which is otherwise unused (if you don't want a description, you can +pass this parameter as C). The string(s) are copied into the +exports list so you may free them immediately after calling this +function. C returns C<0> on success or C<-1> on +failure; on failure C has already been called, with +C set to a suitable value. + +There are also situations where a plugin may wish to duplicate the +nbdkit default behavior of supplying an export list containing only +the result of C<.default_export> when C<.list_exports> is missing; +this is most common in a language binding where it is not known at +compile time whether the language script will be providing an +implementation for C<.list_exports>, and is done by calling +C. + + int nbdkit_use_default_export (struct nbdkit_export *exports); + +C returns C<0> on success or C<-1> on +failure; on failure C has already been called, with +C set to a suitable value. + +The plugin may also leave the export list empty, by not calling either +helper. Once the plugin is happy with the list contents, returning +C<0> will send the list of exports back to the client. If there is an +error, C<.list_exports> should call C with an error +message and return C<-1>. + +=head2 C<.default_export> + + const char *default_export (int readonly, int is_tls); + +This optional callback is called if the client tries to connect to the +default export C<"">, where the plugin provides a UTF-8 string between +0 and 4096 bytes. If the plugin does not supply this callback, the +connection continues with the empty name; if the plugin returns a +valid string, nbdkit behaves as if the client had passed that string +instead of an empty name, and returns that name to clients that +support it (see the C response to C). +Similarly, if the plugin does not supply a C<.list_exports> callback, +the result of this callback determines what export name to advertise +to a client requesting an export list. + +The C flag informs the plugin that the server was started +with the I<-r> flag on the command line, which is the same value +passed to C<.preconnect> and C<.open>. However, the NBD protocol does +not yet have a way to let the client advertise an intent to be +read-only even when the server allows writes, so this parameter may +not be as useful as it appears. + +The C flag informs the plugin whether the canonical name for +the default export is being requested after the client has completed +TLS negotiation. When running the server in a mode that permits but +does not require TLS, be careful that a default export name does not +leak unintended information. + +If the plugin returns C or an invalid string (such as longer +than 4096 bytes), the client is not permitted to connect to the +default export. However, this is not an error in the protocol, so it +is not necessary to call C. + +=head2 C<.open> + + void *open (int readonly); + +This is called when a new client connects to the nbdkit server. The +callback should allocate a handle and return it. This handle +is passed back to other callbacks and could be freed in the C<.close> +callback. + +Note that the handle is completely opaque to nbdkit, but it must not +be NULL. If you don't need to use a handle, return +C which is a static non-NULL pointer. + +The C flag informs the plugin that the server was started +with the I<-r> flag on the command line which forces connections to be +read-only. Note that the plugin may I force the +connection to be readonly (even if this flag is false) by returning +false from the C<.can_write> callback. So if your plugin can only +serve read-only, you can ignore this parameter. + +If the plugin wants to differentiate the content it serves based on +client input, then this is the spot to use C to +determine which export the client requested. See also L +below. + +This callback is called after the NBD handshake has completed; if the +server requires TLS authentication, then that has occurred as well. +But if the server is set up to have optional TLS authentication, you +may check C to learn whether the client has completed +TLS authentication. When running the server in a mode that permits +but does not require TLS, be careful that you do not allow +unauthenticated clients to cause a denial of service against +authentication. + +If there is an error, C<.open> should call C with an +error message and return C. + +=head2 C<.close> + + void close (void *handle); + +This is called when the client closes the connection. It should clean +up any per-connection resources. + +Note there is no way in the NBD protocol to communicate close errors +back to the client, for example if your plugin calls L and +you are checking for errors (as you should do). Therefore the best +you can do is to log the error on the server. Well-behaved NBD +clients I try to flush the connection before it is closed and +check for errors, but obviously this is outside the scope of nbdkit. + +=head2 C<.get_size> + + int64_t get_size (void *handle); + +This is called during the option negotiation phase of the protocol +to get the size (in bytes) of the block device being exported. + +The returned size must be E 0. If there is an error, C<.get_size> +should call C with an error message and return C<-1>. + +=head2 C<.export_description> + + const char *export_description (void *handle); + +This is called during the option negotiation phase only if the +client specifically requested an export description (see the +C response to C). Any +description provided must be human-readable UTF-8, no longer +than 4096 bytes. Ideally, this description should match any +description set during C<.list_exports>, but that is not +enforced. + +If the plugin returns C or an invalid string (such as longer +than 4096 bytes), or if this callback is omitted, no description is +offered to the client. As this is not an error in the protocol, it is +not necessary to call C. If the callback will not be +returning a compile-time constant string, you may find +C helpful for returning a value that avoids a +memory leak. + +=head2 C<.block_size> + + int block_size (void *handle, uint32_t *minimum, + uint32_t *preferred, uint32_t *maximum); + +This is called during the option negotiation phase of the protocol to +get the minimum, preferred and maximum block size (all in bytes) of +the block device. The client should obey these constraints by not +making requests which are smaller than the minimum size or larger than +the maximum size, and usually making requests of a multiple of the +preferred size. Furthermore requests should be aligned to at least +the minimum block size, and usually the preferred block size. + +"Preferred" block size in the NBD specification can be misinterpreted. +It means the I/O size which does not have a penalty for +read-modify-write. + +Even if the plugin implements this callback, this does B mean +that all client requests will obey the constraints. A client could +still ignore the constraints. nbdkit passes all requests through to +the plugin, because what the plugin does depends on the plugin's +policy. It might decide to serve the requests correctly anyway, or +reject them with an error. Plugins can avoid this complexity by using +L which allows both +setting/adjusting the constraints, and selecting an error policy. + +The minimum block size must be E 1. The maximum block size must +be E 0xffff_ffff. minimum E preferred E maximum. + +As a special case, the plugin may return minimum == preferred == +maximum == 0, meaning no information. + +If this callback is not used, then the NBD protocol assumes by default +minimum = 1, preferred = 4096. (Maximum block size depends on various +factors, see the NBD protocol specification, section "Block size +constraints"). + +=head2 C<.can_write> + + int can_write (void *handle); + +This is called during the option negotiation phase to find out if the +handle supports writes. + +If there is an error, C<.can_write> should call C with +an error message and return C<-1>. + +This callback is not required. If omitted, then we return true iff a +C<.pwrite> callback has been defined. + +=head2 C<.can_flush> + + int can_flush (void *handle); + +This is called during the option negotiation phase to find out if the +handle supports the flush-to-disk operation. + +If there is an error, C<.can_flush> should call C with +an error message and return C<-1>. + +This callback is not required. If omitted, then we return true iff a +C<.flush> callback has been defined. + +=head2 C<.is_rotational> + + int is_rotational (void *handle); + +This is called during the option negotiation phase to find out if the +backing disk is a rotational medium (like a traditional hard disk) or +not (like an SSD). If true, this may cause the client to reorder +requests to make them more efficient for a slow rotating disk. + +If there is an error, C<.is_rotational> should call C +with an error message and return C<-1>. + +This callback is not required. If omitted, then we return false. + +=head2 C<.can_trim> + + int can_trim (void *handle); + +This is called during the option negotiation phase to find out if the +plugin supports the trim/discard operation for punching holes in the +backing storage. + +If there is an error, C<.can_trim> should call C with an +error message and return C<-1>. + +This callback is not required. If omitted, then we return true iff a +C<.trim> callback has been defined. + +=head2 C<.can_zero> + + int can_zero (void *handle); + +This is called during the option negotiation phase to find out if the +plugin wants the C<.zero> callback to be utilized. Support for +writing zeroes is still advertised to the client (unless the +L is also used), so returning false merely +serves as a way to avoid complicating the C<.zero> callback to have to +fail with C or C on the connections where it will +never be more efficient than using C<.pwrite> up front. + +If there is an error, C<.can_zero> should call C with an +error message and return C<-1>. + +This callback is not required. If omitted, then for a normal zero +request, nbdkit always tries C<.zero> first if it is present, and +gracefully falls back to C<.pwrite> if C<.zero> was absent or failed +with C or C. + +=head2 C<.can_fast_zero> + + int can_fast_zero (void *handle); + +This is called during the option negotiation phase to find out if the +plugin wants to advertise support for fast zero requests. If this +support is not advertised, a client cannot attempt fast zero requests, +and has no way to tell if writing zeroes offers any speedups compared +to using C<.pwrite> (other than compressed network traffic). If +support is advertised, then C<.zero> will have +C set when the client has requested a fast +zero, in which case the plugin must fail with C or +C up front if the request would not offer any benefits +over C<.pwrite>. Advertising support for fast zero requests does not +require that writing zeroes be fast, only that the result (whether +success or failure) is fast, so this should be advertised when +feasible. + +If there is an error, C<.can_fast_zero> should call C +with an error message and return C<-1>. + +This callback is not required. If omitted, then nbdkit returns true +if C<.zero> is absent or C<.can_zero> returns false (in those cases, +nbdkit fails all fast zero requests, as its fallback to C<.pwrite> is +not inherently faster), otherwise false (since it cannot be determined +in advance if the plugin's C<.zero> will properly honor the semantics +of C). + +=head2 C<.can_extents> + + int can_extents (void *handle); + +This is called during the option negotiation phase to find out if the +plugin supports detecting allocated (non-sparse) regions of the disk +with the C<.extents> callback. + +If there is an error, C<.can_extents> should call C with +an error message and return C<-1>. + +This callback is not required. If omitted, then we return true iff a +C<.extents> callback has been defined. + +=head2 C<.can_fua> + + int can_fua (void *handle); + +This is called during the option negotiation phase to find out if the +plugin supports the Forced Unit Access (FUA) flag on write, zero, and +trim requests. If this returns C, FUA support is not +advertised to the client; if this returns C, the +C<.flush> callback must work (even if C<.can_flush> returns false), +and FUA support is emulated by calling C<.flush> after any write +operation; if this returns C, then the C<.pwrite>, +C<.zero>, and C<.trim> callbacks (if implemented) must handle the flag +C, by not returning until that action has landed in +persistent storage. + +If there is an error, C<.can_fua> should call C with an +error message and return C<-1>. + +This callback is not required unless a plugin wants to specifically +handle FUA requests. If omitted, nbdkit checks whether C<.flush> +exists, and behaves as if this function returns C or +C as appropriate. + +=head2 C<.can_multi_conn> + + int can_multi_conn (void *handle); + +This is called during the option negotiation phase to find out if the +plugin is prepared to handle multiple connections from a single +client. If the plugin sets this to true then a client may try to open +multiple connections to the nbdkit server and spread requests across +all connections to maximize parallelism. If the plugin sets it to +false (which is the default) then well-behaved clients should only +open a single connection, although we cannot control what clients do +in practice. + +Specifically it means that either the plugin does not cache requests +at all. Or if it does cache them then the effects of a C<.flush> +request or setting C on a request must be visible +across all connections to the plugin before the plugin replies to that +request. + +Properly working clients should send the same export name for each of +these connections. + +If you use Linux L option S> with +S 1> then Linux checks this flag and will refuse to connect +if C<.can_multi_conn> is false. + +If there is an error, C<.can_multi_conn> should call C +with an error message and return C<-1>. + +This callback is not required. If omitted, then we return false. + +=head2 C<.can_cache> + + int can_cache (void *handle); + +This is called during the option negotiation phase to find out if the +plugin supports a cache or prefetch operation. + +This can return: + +=over 4 + +=item C + +Cache support is not advertised to the client. + +=item C + +Caching is emulated by the server calling C<.pread> and discarding the +result. + +=item C + +Cache support is advertised to the client. The C<.cache> callback will +be called if it exists, otherwise all cache requests instantly succeed. + +=back + +If there is an error, C<.can_cache> should call C with +an error message and return C<-1>. + +This callback is not required. If omitted, then we return +C if the C<.cache> callback is missing, or +C if it is defined. + +=head2 C<.pread> + + int pread (void *handle, void *buf, uint32_t count, uint64_t offset, + uint32_t flags); + +During the data serving phase, nbdkit calls this callback to read data +from the backing store. C bytes starting at C in the +backing store should be read and copied into C. nbdkit takes +care of all bounds- and sanity-checking, so the plugin does not need +to worry about that. + +The parameter C exists in case of future NBD protocol +extensions; at this time, it will be 0 on input. + +The callback must read the whole C bytes if it can. The NBD +protocol doesn't allow partial reads (instead, these would be errors). +If the whole C bytes was read, the callback should return C<0> +to indicate there was I error. + +If there is an error (including a short read which couldn't be +recovered from), C<.pread> should call C with an error +message, and C to record an appropriate error +(unless C is sufficient), then return C<-1>. + +=head2 C<.pwrite> + + int pwrite (void *handle, const void *buf, uint32_t count, uint64_t offset, + uint32_t flags); + +During the data serving phase, nbdkit calls this callback to write +data to the backing store. C bytes starting at C in +the backing store should be written using the data in C. nbdkit +takes care of all bounds- and sanity-checking, so the plugin does not +need to worry about that. + +This function will not be called if C<.can_write> returned false. The +parameter C may include C on input based on +the result of C<.can_fua>. + +The callback must write the whole C bytes if it can. The NBD +protocol doesn't allow partial writes (instead, these would be +errors). If the whole C bytes was written successfully, the +callback should return C<0> to indicate there was I error. + +If there is an error (including a short write which couldn't be +recovered from), C<.pwrite> should call C with an error +message, and C to record an appropriate error +(unless C is sufficient), then return C<-1>. + +=head2 C<.flush> + + int flush (void *handle, uint32_t flags); + +During the data serving phase, this callback is used to +L the backing store, ie. to ensure it has been +completely written to a permanent medium. If that is not possible +then you can omit this callback. + +This function will not be called directly by the client if +C<.can_flush> returned false; however, it may still be called by +nbdkit if C<.can_fua> returned C. The parameter +C exists in case of future NBD protocol extensions; at this +time, it will be 0 on input. + +If there is an error, C<.flush> should call C with an +error message, and C to record an appropriate error +(unless C is sufficient), then return C<-1>. + +=head2 C<.trim> + + int trim (void *handle, uint32_t count, uint64_t offset, uint32_t flags); + +During the data serving phase, this callback is used to "punch holes" +in the backing store. If that is not possible then you can omit this +callback. + +This function will not be called if C<.can_trim> returned false. The +parameter C may include C on input based on +the result of C<.can_fua>. + +If there is an error, C<.trim> should call C with an +error message, and C to record an appropriate error +(unless C is sufficient), then return C<-1>. + +=head2 C<.zero> + + int zero (void *handle, uint32_t count, uint64_t offset, uint32_t flags); + +During the data serving phase, this callback is used to write C +bytes of zeroes at C in the backing store. + +This function will not be called if C<.can_zero> returned false. On +input, the parameter C may include C +unconditionally, C based on the result of +C<.can_fua>, and C based on the result of +C<.can_fast_zero>. + +If C is requested, the operation can punch a +hole instead of writing actual zero bytes, but only if subsequent +reads from the hole read as zeroes. + +If C is requested, the plugin must decide up +front if the implementation is likely to be faster than a +corresponding C<.pwrite>; if not, then it must immediately fail with +C or C (whether by C or +C) and preferably without modifying the exported image. It is +acceptable to always fail a fast zero request (as a fast failure is +better than attempting the write only to find out after the fact that +it was not fast after all). Note that on Linux, support for +C is insufficient for determining whether a zero +request to a block device will be fast (because the kernel will +perform a slow fallback when needed). + +The callback must write the whole C bytes if it can. The NBD +protocol doesn't allow partial writes (instead, these would be +errors). If the whole C bytes was written successfully, the +callback should return C<0> to indicate there was I error. + +If there is an error, C<.zero> should call C with an +error message, and C to record an appropriate error +(unless C is sufficient), then return C<-1>. + +If this callback is omitted, or if it fails with C or +C (whether by C or C), then +C<.pwrite> will be used as an automatic fallback except when the +client requested a fast zero. + +=head2 C<.extents> + + int extents (void *handle, uint32_t count, uint64_t offset, + uint32_t flags, struct nbdkit_extents *extents); + +During the data serving phase, this callback is used to detect +allocated, sparse and zeroed regions of the disk. + +This function will not be called if C<.can_extents> returned false. +nbdkit's default behaviour in this case is to treat the whole virtual +disk as if it was allocated. Also, this function will not be called +by a client that does not request structured replies (the I<--no-sr> +option of nbdkit can be used to test behavior when C<.extents> is +unavailable to the client). + +The callback should detect and return the list of extents overlapping +the range C<[offset...offset+count-1]>. The C parameter +points to an opaque object which the callback should fill in by +calling C. See L below. + +If there is an error, C<.extents> should call C with an +error message, and C to record an appropriate error +(unless C is sufficient), then return C<-1>. + +=head3 Extents list + +The plugin C callback is passed an opaque pointer C. This structure represents a list of +L +describing which areas of the disk are allocated, which are sparse +(“holes”), and, if supported, which are zeroes. + +The C callback should scan the disk starting at C and +call C for each extent found. + +Extents overlapping the range C<[offset...offset+count-1]> should be +returned if possible. However nbdkit ignores extents E offset so +the plugin may, if it is easier to implement, return all extent +information for the whole disk. The plugin may return extents beyond +the end of the range. It may also return extent information for less +than the whole range, but it must return at least one extent +overlapping C. + +The extents B be added in ascending order, and B be +contiguous. + +The C parameter of the C<.extents> callback may contain the +flag C. This means that the client is only +requesting information about the extent overlapping C. The +plugin may ignore this flag, or as an optimization it may return just +a single extent for C. + + int nbdkit_add_extent (struct nbdkit_extents *extents, + uint64_t offset, uint64_t length, uint32_t type); + +Add an extent covering C<[offset...offset+length-1]> of one of +the following four types: + +=over 4 + +=item C + +A normal, allocated data extent. + +=item C + +An unallocated extent, a.k.a. a “hole”, which reads back as zeroes. +This is the normal type of hole applicable to most disks. + +=item C + +An allocated extent which is known to contain only zeroes. + +=item C + +An unallocated extent (hole) which does not read back as zeroes. Note +this should only be used in specialized circumstances such as when +writing a plugin for (or to emulate) certain SCSI drives which do not +guarantee that trimmed blocks read back as zeroes. + +=back + +C returns C<0> on success or C<-1> on failure. On +failure C and/or C has already been +called. C will be set to a suitable value. + +=head2 C<.cache> + + int cache (void *handle, uint32_t count, uint64_t offset, uint32_t flags); + +During the data serving phase, this callback is used to give the +plugin a hint that the client intends to make further accesses to the +given region of the export. + +The nature of caching/prefetching is not specified further by the NBD +specification. For example, a server may place limits on how much may +be cached at once, and there is no way to control if writes to a +cached area have write-through or write-back semantics. In fact, the +cache command can always fail and still be compliant, and success +might not guarantee a performance gain. + +If this callback is omitted, then the results of C<.can_cache> +determine whether nbdkit will reject cache requests, treat them as +instant success, or emulate caching by calling C<.pread> over the same +region and ignoring the results. + +This function will not be called if C<.can_cache> did not return +C. + +The C parameter exists in case of future NBD protocol +extensions; at this time, it will be 0 on input. A plugin must fail +this function if C includes an unrecognized flag, as that may +indicate a requirement that the plugin must comply with to provide a +specific caching semantic. + +If there is an error, C<.cache> should call C with an +error message, and C to record an appropriate error +(unless C is sufficient), then return C<-1>. + +=head2 C<.errno_is_preserved> + +This field defaults to 0; if non-zero, nbdkit can reliably use the +value of C when a callback reports failure, rather than the +plugin having to call C. + +=head1 SHUTDOWN + +When nbdkit receives certain signals it will shut down (see +L). The server will wait for any currently running +plugin callbacks to finish, call C<.close> on those connections, then +call the C<.cleanup> and C<.unload> callbacks before unloading the +plugin. + +Note that it's not guaranteed this can always happen (eg. the server +might be killed by C or segfault). + +=head2 Requesting asynchronous shutdown + +Plugins and filters can call L in the configuration phase +(before and including C<.get_ready>, but not in connected callbacks). + +Once nbdkit has started serving connections, plugins and filters +should not call L. However they may instruct nbdkit to shut +down by calling C, or to disconnect a single client +by calling C: + + void nbdkit_shutdown (void); + +This function requests an asynchronous shutdown and returns (I +that it does I exit the process immediately). It ensures that +the plugin and all filters are unloaded cleanly which may take some +time. Further callbacks from nbdkit into the plugin or filter may +occur after you have called this. + + void nbdkit_disconnect (int force); + +This function requests that the current connection be disconnected +(I that it does not affect other connections, and the client may +try to reconnect). It is only useful from connected callbacks (that +is, after C<.open> and before C<.close>). If C is true, nbdkit +will disconnect the client immediately, and the client will not +receive any response to the current command or any other commands in +flight in parallel threads; otherwise, nbdkit will not accept any new +commands from the client (failing all commands other than +C with C), but will allow existing commands +to complete gracefully. Either way, the next callback for the current +connection should be C<.close>. + +=head1 PARSING COMMAND LINE PARAMETERS + +=head2 Parsing numbers + +There are several functions for parsing numbers. These all deal +correctly with overflow, out of range and parse errors, and you should +use them instead of unsafe functions like L, L and +similar. + + int nbdkit_parse_int (const char *what, const char *str, int *r); + int nbdkit_parse_unsigned (const char *what, + const char *str, unsigned *r); + int nbdkit_parse_int8_t (const char *what, + const char *str, int8_t *r); + int nbdkit_parse_uint8_t (const char *what, + const char *str, uint8_t *r); + int nbdkit_parse_int16_t (const char *what, + const char *str, int16_t *r); + int nbdkit_parse_uint16_t (const char *what, + const char *str, uint16_t *r); + int nbdkit_parse_int32_t (const char *what, + const char *str, int32_t *r); + int nbdkit_parse_uint32_t (const char *what, + const char *str, uint32_t *r); + int nbdkit_parse_int64_t (const char *what, + const char *str, int64_t *r); + int nbdkit_parse_uint64_t (const char *what, + const char *str, uint64_t *r); + +Parse string C into an integer of various types. These functions +parse a decimal, hexadecimal (C<"0x...">) or octal (C<"0...">) number. + +On success the functions return C<0> and set C<*r> to the parsed value +(unless C<*r == NULL> in which case the result is discarded). On +error, C is called and the functions return C<-1>. On +error C<*r> is always unchanged. + +The C parameter is printed in error messages to provide context. +It should usually be a short descriptive string of what you are trying +to parse, eg: + + if (nbdkit_parse_int ("random seed", value, &seed) == -1) + return -1; + +might print an error: + + random seed: could not parse number: "lalala" + +=head2 Parsing sizes + +Use the C utility function to parse human-readable +size strings such as "100M" into the size in bytes. + + int64_t nbdkit_parse_size (const char *str); + +C can be a string in a number of common formats. The function +returns the size in bytes. If there was an error, it returns C<-1>. + +=head2 Parsing booleans + +Use the C utility function to parse human-readable +strings such as "on" into a boolean value. + + int nbdkit_parse_bool (const char *str); + +C can be a string containing a case-insensitive form of various +common toggle values. The function returns 0 or 1 if the parse was +successful. If there was an error, it returns C<-1>. + +=head2 Parsing probabilities + +Use the C utility function to parse +probabilities. Common formats understood include: C<"0.1">, +C<"1e-1">, C<"10%">, C<"1:10"> or C<"1/10">, which all mean a +probability of 1 in 10. + + int nbdkit_parse_probability (const char *what, const char *str, + double *ret); + +The C parameter is printed in error messages to provide context. +The C parameter is the probability string. + +On success the function returns C<0> and sets C<*ret>. The +probability is always a finite number E 0.0, but B (for example if S> then the +function will set S>). If you want to clamp the upper +bound the caller must do that. + +On error, nbdkit_error is called and C<-1> is returned. + +=head2 Reading passwords + +The C utility function can be used to read +passwords from config parameters: + + int nbdkit_read_password (const char *value, char **password); + +For example: + + char *password = NULL; + + static int + myplugin_config (const char *key, const char *value) + { + .. + if (strcmp (key, "password") == 0) { + free (password); + if (nbdkit_read_password (value, &password) == -1) + return -1; + } + .. + } + +The C result string is allocated by malloc, and so you may +need to free it. + +This function recognizes several password formats. A password may be +used directly on the command line, eg: + + nbdkit myplugin password=mostsecret + +But more securely this function can also read a password +interactively: + + nbdkit myplugin password=- + +or from a file: + + nbdkit myplugin password=+/tmp/secret + +or from a file descriptor inherited by nbdkit: + + nbdkit myplugin password=-99 + +=head3 Notes on reading passwords + +If the password begins with a C<-> or C<+> character then it must be +passed in a file. + +C can only be used when stdin is a terminal. + +C cannot be used with stdin, stdout or stderr +(ie. C<-0>, C<-1> or C<-2>). The reason is that after reading the +password the file descriptor is closed, which causes bad stuff to +happen. + +=head2 Safely interacting with stdin and stdout + + int nbdkit_stdio_safe (void); + +The C utility function returns C<1> if it is safe +to interact with stdin and stdout during the configuration phase, and +C<0> otherwise. This is because when the nbdkit I<-s> option is used +the plugin must not directly interact with stdin, because that would +interfere with the client. + +The result of this function only matters in callbacks up to +C<.config_complete>. Once nbdkit reaches C<.get_ready>, the plugin +should assume that nbdkit may have closed the original stdin and +stdout in order to become a daemon. + +L uses this function to determine whether it is +safe to support C to read a script from stdin. Also +constructs like C (see L above) are +disabled when reading from stdio is not safe. + +=head1 FILENAMES AND PATHS + +The server usually (not always) changes directory to C before it +starts serving connections. This means that any relative paths passed +during configuration will not work when the server is running +(example: S>). + +To avoid problems, prepend relative paths with the current directory +before storing them in the handle. Or open files and store the file +descriptor. + +=head2 C + + char *nbdkit_absolute_path (const char *filename); + +The utility function C converts any path to an +absolute path: if it is relative, then all this function does is +prepend the current working directory to the path, with no extra +checks. + +Note that this function works I when used in the C<.config>, +C<.config_complete> and C<.get_ready> callbacks. + +If conversion was not possible, this calls C and returns +C. Note that this function does not check that the file exists. + +The returned string must be freed by the caller. + +=head2 C + + char *nbdkit_realpath (const char *filename); + +The utility function C converts any path to an +absolute path, resolving symlinks. Under the hood it uses the +C function, and thus it fails if the path does not exist, +or it is not possible to access to any of the components of the path. + +Note that this function works I when used in the C<.config>, +C<.config_complete> and C<.get_ready> callbacks. + +If the path resolution was not possible, this calls C +and returns C. + +The returned string must be freed by the caller. + +=head2 umask + +All plugins will see a L of C<0022>. + +=head1 SLEEPING + +A plugin that needs to sleep may call L, L and +similar. However that can cause nbdkit to delay excessively when +shutting down (since it must wait for any plugin or filter which is +sleeping). To avoid this there is a special wrapper around nanosleep +which plugins and filters should use instead. + +=head2 C + + int nbdkit_nanosleep (unsigned sec, unsigned nsec); + +The utility function C suspends the current thread, +and returns 0 if it slept at least as many seconds and nanoseconds as +requested, or -1 after calling C if there is no point in +continuing the current command. Attempts to sleep more than +C seconds are treated as an error. + +=head1 EXPORT NAME + +If the client negotiated an NBD export name with nbdkit then plugins +may read this from any connected callbacks. Nbdkit's normal behaviour +is to accept any export name passed by the client, log it in debug +output, but otherwise ignore it. By using C +plugins may choose to filter by export name or serve different +content. + +=head2 C + + const char *nbdkit_export_name (void); + +Return the optional NBD export name if one was negotiated with the +current client (this uses thread-local magic so no parameter is +required). The returned string is valid at least through the +C<.close> of the current connection, but if you need to store it +in the plugin for use by more than one client you must copy it. + +The export name is a free-form text string, it is not necessarily a +path or filename and it does not need to begin with a C<'/'> +character. The NBD protocol describes the empty string (C<"">) as a +representing a "default export" or to be used in cases where the +export name does not make sense. B + +On error, C is called and the call returns C. + +=head1 STRING LIFETIME + +Some callbacks are specified to return C, even when a +plugin may not have a suitable compile-time constant to return. +Returning dynamically-allocated memory for such a callback would +induce a memory leak or otherwise complicate the plugin to perform +additional bookkeeping. For these cases, nbdkit provides several +convenience functions for creating a copy of a string for better +lifetime management. + +=head2 C + +=head2 C + + const char *nbdkit_strdup_intern (const char *str); + const char *nbdkit_strndup_intern (const char *str, size_t n); + +Returns a copy of C, possibly limited to a maximum of C bytes, +so that the caller may reclaim str and use the copy in its place. If +the copy is created outside the scope of a connection (such as during +C<.load> or C<.config>), the lifetime of the copy will last at least +through C<.unload>. If the copy is created after a client has +triggered a connection (such as during C<.preconnect> or C<.open>), +the lifetime will last at least through C<.close>, but the copy is not +safe to share with other connections. + +On error, C is called and the call returns C. + +=head2 C + +=head2 C + + const char *nbdkit_printf_intern (const char *fmt, ...); + const char *nbdkit_vprintf_intern (const char *fmt, va_list ap); + +Return a string created from a format template, with a lifetime longer +than the current connection. Shorthand for passing C to +L on a temporary string, then passing that result to +C. + +On error, C is called and the call returns C. + +=head1 AUTHENTICATION + +A server may use C to limit which export names work +until after a client has completed TLS authentication. See +L. It is also possible to use +L to automatically ensure that the +plugin is only used with authentication. + +=head2 C + + int nbdkit_is_tls (void); + +Return true if the client has completed TLS authentication, or false +if the connection is still plaintext. + +On error (such as calling this function outside of the context of +C<.open>), C is called and the call returns C<-1>. + +=head1 PEER NAME + +It is possible to get the source address of the client when you are +running in any connected callback. + +=head2 C + + int nbdkit_peer_name (struct sockaddr *addr, socklen_t *addrlen); + +Return the peer (client) address, if available. The C and +C parameters behave like L. In particular +you must initialize C with the size of the buffer pointed to +by C, and if C is not large enough then the address will +be truncated. + +In some cases this is not available or the address returned will be +meaningless (eg. if there is a proxy between the client and nbdkit). +This call uses thread-local magic so no parameter is required to +specify the current connection. + +On success this returns C<0>. On error, C is called and +this call returns C<-1>. + +=head2 C + +(nbdkit E 1.24, Linux only) + + int64_t nbdkit_peer_pid (void); + +Return the peer process ID. This is only available when the client +connected over a Unix domain socket. + +On success this returns the peer process ID. On error, +C is called and this call returns C<-1>. + +=head2 C + +(nbdkit E 1.24) + + int64_t nbdkit_peer_uid (void); + +Return the peer user ID. This is only available when the client +connected over a Unix domain socket. + +On success this returns the user ID. On error, C is +called and this call returns C<-1>. + +=head2 C + +(nbdkit E 1.24) + + int64_t nbdkit_peer_gid (void); + +Return the peer group ID. This is only available when the client +connected over a Unix domain socket. + +On success this returns the user ID. On error, C is +called and this call returns C<-1>. + +=head2 C + +(nbdkit E 1.36, not Windows) + + char *nbdkit_peer_security_context (void); + +Return the peer security context (usually the SELinux label, IPSEC +label or NetLabel, see the description of C in L +and L. + +On success this returns the security context as a string. The caller +must free the string. On error (which can include missing label or +unsupported protocol), C is called and this call returns +C. + +=head1 VERSION + +=head2 Compile-time version of nbdkit + +The macros C, C and +C expand to integers containing the version of +the nbdkit headers that you are compiling against. + +C is always 1. C is even +for stable releases of nbdkit and odd for development releases. + +The macro C expands to the same version as a +string. + +=head2 Run-time version of nbdkit + +When the plugin is loaded into nbdkit, it may not be the same version +that it was compiled against. nbdkit guarantees backwards +compatibility of the API and ABI, so provided that nbdkit is the same +version or newer, the plugin will still work. There is no way to get +the version of nbdkit from the plugin. + +=head2 Version of the plugin + +The plugin itself can use any versioning scheme you want, and put any +string into the C<.version> field of the plugin struct (or leave the +field NULL). + +=head2 API version + +See L above. + +=head1 DEBUGGING + +Run the server with I<-f> and I<-v> options so it doesn't fork and you +can see debugging information: + + nbdkit -fv ./myplugin.so [key=value [key=value [...]]] + +To print debugging information from within the plugin, call +C, which has the following prototype and works like +L: + + void nbdkit_debug (const char *fs, ...); + void nbdkit_vdebug (const char *fs, va_list args); + +For convenience, C preserves the value of C, and +also supports the glibc extension of a single C<%m> in a format string +expanding to C, even on platforms that don't support +that natively. Note that C only prints things when the +server is in verbose mode (I<-v> option). + +=head2 Debug Flags + +The I<-v> option switches general debugging on or off, and this +debugging should be used for messages which are useful for all users +of your plugin. + +In cases where you want to enable specific extra debugging to track +down bugs in plugins or filters — mainly for use by the plugin/filter +developers themselves — you can define Debug Flags. These are global +ints called C: + + int myplugin_debug_foo; + int myplugin_debug_bar; + ... + if (myplugin_debug_foo) { + nbdkit_debug ("lots of extra debugging about foo: ..."); + } + +Debug Flags can be controlled on the command line using the I<-D> (or +I<--debug>) option: + + nbdkit -f -v -D myplugin.foo=1 -D myplugin.bar=2 myplugin [...] + +Note C is the name passed to C<.name> in the C. + +You should only use this feature for debug settings. For general +settings use ordinary plugin parameters. Debug Flags can only be C +ints. They are not supported by non-C language plugins. + +For convenience C<'.'> characters are replaced with C<'_'> characters +in the variable name, so both of these parameters: + + -D myplugin.foo_bar=1 + -D myplugin.foo.bar=1 + +correspond to the plugin variable C. + +=head1 COMPILING THE PLUGIN + +Plugins should be compiled as shared libraries. There are various +ways to achieve this, but most Linux compilers support a I<-shared> +option to create the shared library directly, for example: + + gcc -fPIC -shared myplugin.c -o myplugin.so + +Note that the shared library will have undefined symbols for functions +that you call like C or C. These will +be resolved by the server binary when nbdkit dlopens the plugin. + +=head2 PKG-CONFIG/PKGCONF + +nbdkit provides a pkg-config/pkgconf file called C which +should be installed on the correct path when the nbdkit plugin +development environment is installed. You can use this in autoconf +F scripts to test for the development environment: + + PKG_CHECK_MODULES([NBDKIT], [nbdkit >= 1.2.3]) + +The above will fail unless nbdkit E 1.2.3 and the header file is +installed, and will set C and C +appropriately for compiling plugins. + +You can also run pkg-config/pkgconf directly, for example: + + if ! pkg-config nbdkit --exists; then + echo "you must install the nbdkit plugin development environment" + exit 1 + fi + +You can also substitute the plugindir variable by doing: + + PKG_CHECK_VAR([NBDKIT_PLUGINDIR], [nbdkit], [plugindir]) + +which defines C<$(NBDKIT_PLUGINDIR)> in automake-generated Makefiles. + +If nbdkit development headers are installed in a non-standard location +then you may need to compile plugins using: + + gcc -fPIC -shared myplugin.c -o myplugin.so \ + `pkg-config nbdkit --cflags --libs` + +=head1 INSTALLING THE PLUGIN + +The plugin is a C<*.so> file and possibly a manual page. You can of +course install the plugin C<*.so> file wherever you want, and users +will be able to use it by running: + + nbdkit /path/to/plugin.so [args] + +However B the shared library has a name of the form +C-plugin.so> B the library is installed in the +C<$plugindir> directory, then users can be run it by only typing: + + nbdkit name [args] + +The location of the C<$plugindir> directory is set when nbdkit is +compiled and can be found by doing: + + nbdkit --dump-config + +If using the pkg-config/pkgconf system then you can also find the +plugin directory at compile time by doing: + + pkg-config nbdkit --variable=plugindir + +=head1 WRITING PLUGINS IN C++ + +Plugins in C++ work almost exactly like those in C, but the way you +define the C struct is slightly different: + + namespace { + nbdkit_plugin create_plugin() { + nbdkit_plugin plugin = nbdkit_plugin (); + plugin.name = "myplugin"; + plugin.open = myplugin_open; + plugin.get_size = myplugin_get_size; + plugin.pread = myplugin_pread; + plugin.pwrite = myplugin_pwrite; + return plugin; + } + } + static struct nbdkit_plugin plugin = create_plugin (); + NBDKIT_REGISTER_PLUGIN(plugin) + +=head1 WRITING PLUGINS IN OTHER PROGRAMMING LANGUAGES + +You can also write nbdkit plugins in Go, Lua, OCaml, Perl, Python, +Ruby, Rust, shell script or Tcl. Other programming languages may be +offered in future. + +For more information see: +__LANG_PLUGIN_LINKS__. + +Plugins written in scripting languages may also be installed in +C<$plugindir>. These must be called C-plugin> without +any extension. They must be executable, and they must use the shebang +header (see L). For example a plugin +written in Perl called C might be installed like this: + + $ head -1 foo.pl + #!/usr/sbin/nbdkit perl + +=for paragraph + + $ sudo install -m 0755 foo.pl $plugindir/nbdkit-foo-plugin + +and then users will be able to run it like this: + + $ nbdkit foo [args ...] + +=head1 SEE ALSO + +L, +L, +L, +L. + +Standard plugins provided by nbdkit: + +__PLUGIN_LINKS__. + +=head1 AUTHORS + +Eric Blake + +Richard W.M. Jones + +Pino Toscano + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/docs/nbdkit-probing.pod b/docs/nbdkit-probing.pod new file mode 100644 index 0000000..0b87e6c --- /dev/null +++ b/docs/nbdkit-probing.pod @@ -0,0 +1,171 @@ +=head1 NAME + +nbdkit-probing - how to probe for nbdkit configuration and plugins + +=head1 SYNOPSIS + + nbdkit --dump-config + +=for paragraph + + nbdkit PLUGIN --dump-plugin + +=for paragraph + + nbdkit --version + +=for paragraph + + nbdkit PLUGIN --version + +=for paragraph + + nbdkit --filter=FILTER null --version + +=for paragraph + + nbdkit --filter=FILTER null --dump-plugin + +=head1 DESCRIPTION + +You can query information about nbdkit and available plugins and +filters using the nbdkit binary. This can include whether nbdkit is +installed, and whether plugins or filters are installed. + +=head2 Query if nbdkit is installed + +Use this command to see if the nbdkit program is installed: + + nbdkit --version + +This will fail with an error and non-zero exit code if nbdkit is not +installed or not working. + +=head2 Query basic configuration + + nbdkit --dump-config + +lists information about how nbdkit was configured. The most important +fields in the output are the name of the directory where nbdkit looks +for plugins and the version of nbdkit, eg: + + plugindir=/usr/lib64/nbdkit/plugins + version=1.20.1 + version_major=1 + version_minor=20 + +=head2 Test nbdkit E version + +To test if nbdkit E a particular version is installed, use the +I<--dump-config> option and look for the C and +C fields: + + $ nbdkit --dump-config | grep ^version_minor + version_minor=20 + $ major=$( nbdkit --dump-config | grep ^version_major | cut -d= -f2 ) + $ minor=$( nbdkit --dump-config | grep ^version_minor | cut -d= -f2 ) + $ if [ $major -eq 1 ] && [ $minor -lt 12 ] + then echo 'nbdkit >= 1.12 is required'; exit 1; fi + +These fields were first added in nbdkit 1.16.5 and were not present in +earlier versions. + +You can also probe the minimum version using L. See +L. + +=head2 Query information about a particular plugin + + nbdkit pluginname --dump-plugin + +(where I is the name or full path of a plugin) will dump +information about that plugin, eg: + + $ nbdkit file --dump-plugin + path=/usr/lib64/nbdkit/plugins/nbdkit-file-plugin.so + name=file + version=1.20.1 + api_version=1 + struct_size=176 + thread_model=serialize_requests + [etc] + +Plugins which ship with nbdkit usually have the same version as the +corresponding nbdkit binary. The nbdkit binary will always be able to +utilize plugins compiled against an older version of the header; +however, newer plugins may not be fully supported by an older nbdkit +binary (for example, a plugin compiled with C of 2 +fails to load with an older nbdkit that only knows +C 1). + +=head2 Query information about a particular filter + +You can use the I<--dump-plugin> option to dump information about a +filter, by using the null plugin with the I<--filter> parameter: + + $ nbdkit null --filter=qcow2dec --dump-plugin + [...] + qcow2dec_path=/usr/lib64/nbdkit/filters/nbdkit-qcow2dec-filter.so + qcow2dec_name=qcow2dec + qcow2dec_deflate=yes + qcow2dec_zstd=yes + +=head2 Detect if a plugin is installed + +To find out if a plugin is installed (and working) in the plugin +directory, use: + + $ nbdkit foo --version + nbdkit: error: cannot open plugin 'foo': /usr/lib64/nbdkit/plugins/nbdkit-foo-plugin.so: cannot open shared object file: No such file or directory + Use 'nbdkit --help' or read the nbdkit(1) manual page for documentation. + +This will fail with an error and non-zero exit code if the C +plugin cannot be loaded. + +Note it is better to test for the existence of plugins this way rather +than just seeing if the F<.so> file exists, because nbdkit will load +the plugin and check that all its dependencies can be satisfied, and +also that plugin registration works. + +=head2 List all plugins in the plugin directory + +You could simply get the plugin directory (from I<--dump-config>) and +list all files in this directory called F. + +However a better test is to run I<--dump-plugin> (see above) on each +one to check that it is working and all of its dependencies are +installed. A complete shell script which does this is: + + #!/bin/sh - + plugindir=`nbdkit --dump-config | grep ^plugindir= | sed 's/[^=]*=//'` + for f in $plugindir/nbdkit-*-plugin.so; do + if nbdkit "$f" --version >/dev/null 2>&1; then + b=`echo "$f" | sed 's,.*/nbdkit-\(.*\)-plugin.so$,\1,'` + echo "$b ($f)" + fi + done + +=head2 Detect if a filter is installed + +To find out if a filter is installed (and working) use I<--version> +with the C plugin and the name of the filter to test: + + nbdkit --version --filter=foo null + +This will fail with an error and non-zero exit code if the C +filter cannot be loaded. + +=head1 SEE ALSO + +L. + +=head1 AUTHORS + +Eric Blake + +Richard W.M. Jones + +Pino Toscano + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/docs/nbdkit-protocol.pod b/docs/nbdkit-protocol.pod new file mode 100644 index 0000000..dabdf23 --- /dev/null +++ b/docs/nbdkit-protocol.pod @@ -0,0 +1,239 @@ +=head1 NAME + +nbdkit-protocol - which parts of the NBD protocol nbdkit supports + +=head1 SYNOPSIS + + nbdkit [-n|--newstyle] [--mask-handshake MASK] [--no-sr] [-o|--oldstyle] + [...] + +=head1 DESCRIPTION + +This page documents the level of support in nbdkit for various parts +of the NBD protocol. + +=head1 NEW STYLE VS OLD STYLE PROTOCOL + +The NBD protocol comes in two incompatible forms that we call +"oldstyle" and "newstyle". Unfortunately which protocol you should +use depends on the client and cannot be known in advance, nor can it +be negotiated from the server side. + +nbdkit defaults to the newstyle protocol since nbdkit E 1.3. The +newstyle protocol is better in every respect than the oldstyle +protocol and you should prefer it if possible. The newstyle protocol +also includes an extension where a client may request structured +replies for even more capabilities, such as sparse reads or obtaining +block status. By default, nbdkit advertises as many features as it +can support (in some cases, this can be limited by what callbacks the +plugin handles), even if the client does not negotiate to use all +advertised features. + +Nbdkit also includes some options that are useful mainly when +performing integration tests, for proving whether clients have sane +fallback behavior when dealing various older servers permitted by the +NBD protocol. Use the I<--no-sr> flag to force the newstyle protocol +to decline any client request for structured replies. Use the +I<--mask-handshake> parameter to mask off particular global features +which are advertised during new-style handshake (defaulting to all +supported bits set). Clearing bit 0 (the low order bit) limits a +client to using just C (and is incompatible with +TLS or structured replies); clearing bit 1 causes the handshake to +send more padding bytes in response to C. Other +bits in the mask will only have an effect if the NBD protocol is +extended in the future to define other global bits. + +Use the I<-o> or I<--oldstyle> flag to force the oldstyle protocol. +In this mode, I<--no-sr> and I<--mask-handshake> have no effect. + +=head2 Common clients and the protocol they require + + Client Protocol + ------------------------------------------------------------ + qemu <= 2.5 without exportname oldstyle + qemu <= 2.5 with exportname newstyle + qemu >= 2.6 client can talk either protocol + qemu >= 2.11 client tries structured replies + nbd-client < 3.10 client can talk either protocol + nbd-client >= 3.10 newstyle, no structured replies + any TLS (encrypted) client newstyle + nbdkit nbd plugin client can talk either protocol + nbdkit >= 1.13.3 nbd plugin tries structured replies + libnbd either protocol, tries structured replies + +=head2 Errors seen if using the wrong protocol + +If you use qemu E 2.5 without the exportname field against a +newstyle server, it will give the error: + + Server requires an export name + +If you use qemu E 2.5 with the exportname field against an +oldstyle server, it will give the error: + + Server does not support export names + +If you use the oldstyle protocol with nbd-client E 3.10, it will +give the error: + + Error: It looks like you're trying to connect to an oldstyle server. + +=head2 NBD protocol and port number + +Port 10809/tcp is reserved by IANA for the NBD protocol, but you can +use nbdkit on any port or on Unix domain sockets. + +The NBD protocol specification claims that you should always use +newstyle when using port 10809, and use oldstyle on all other ports, +but this claim is not based on the reality of what NBD servers do, and +nbdkit does not require or encourage this. + +=head1 NBD PROTOCOL FEATURES SUPPORTED BY NBDKIT + +=over 4 + +=item newstyle protocol + +Supported in nbdkit E 1.1.12, and the default in nbdkit E 1.3. + +=item export names + +Partially supported in nbdkit E 1.1.12. Support for plugins to +read the client export name added in nbdkit E 1.15.2. + +Versions of nbdkit before 1.16 could advertise a single export name to +clients, via a now deprecated side effect of the I<-e> option. In nbdkit +1.15.2, plugins could read the client requested export name using +C and serve different content. In nbdkit +1.21.22, plugins could implement C<.list_exports> to answer +C queries. + +=item C + +Supported in nbdkit E 1.1.13. + +This protocol optimization avoids sending a useless block of zero +bytes during protocol negotiation. + +=item C + +Supported in nbdkit E 1.1.13. + +=item TLS with X.509 certificates + +Supported in nbdkit E 1.1.15. + +=item TLS with Pre-Shared Keys (PSK) + +Supported in nbdkit E 1.4.0. + +=item C + +Supported in nbdkit E 1.5.3. + +This protocol enhancement allows the server to return errors when +negotiating the export name. + +=item C + +Supported in nbdkit E 1.9.3. + +This protocol enhancement allows a client to inspect details about +the export without actually connecting. + +=item C + +Supported in nbdkit E 1.9.9. + +=item Structured Replies + +Supported in nbdkit E 1.11.8. + +However we don’t expose the capability to send structured replies to +plugins yet, nor do we send human-readable error messages using this +facility. + +In nbdkit E 1.13.9, the command-line option I<--no-sr> can be +used to disable server support for structured replies, for testing +client fallbacks. + +=item Metadata Querying + +Supported in nbdkit E 1.11.8. + +=item Block Status + +Supported in nbdkit E 1.11.10. + +Only C (ie. querying which parts of an image are +sparse) is supported. + +Sparse reads (using C are not directly +supported, but a client can use block status to infer which portions +of the export do not need to be read. + +=item C + +Supported in nbdkit E 1.11.11. + +This protocol extension allows a client to force an all-or-none read +when structured replies are in effect. However, the flag is a no-op +until we extend the plugin API to allow a fragmented read in the first +place. + +=item C + +Supported in nbdkit E 1.13.4. + +This protocol extension allows a client to inform the server about +intent to access a portion of the export, to allow the server an +opportunity to cache things appropriately. + +=item C + +Supported in nbdkit E 1.15.0. + +This protocol extension allows a server to advertise that it can rank +all zero requests as fast or slow, at which point the client can make +fast zero requests which fail immediately with C if the +request is no faster than a counterpart write would be, while normal +zero requests still benefit from compressed network traffic regardless +of the time taken. + +=item C, C + +Supported in nbdkit E 1.23.6. + +These protocol extensions allow a client to learn more information +about an export during C. The C<.default_export> callback +can inform a client of a canonical non-empty name in place of the +default export C<"">, and the C<.export_description> callback can give +a client more details about the export. + +=item C + +Supported in nbdkit E 1.30. + +=item Resize Extension + +I. + +=back + +=head1 SEE ALSO + +L, +L, +L. + +=head1 AUTHORS + +Eric Blake + +Richard W.M. Jones + +Pino Toscano + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/docs/nbdkit-release-notes-1.10.pod b/docs/nbdkit-release-notes-1.10.pod new file mode 100644 index 0000000..e2279ab --- /dev/null +++ b/docs/nbdkit-release-notes-1.10.pod @@ -0,0 +1,131 @@ +=head1 NAME + +nbdkit-release-notes-1.10 - release notes for nbdkit 1.10 + +=head1 DESCRIPTION + +These are the release notes for nbdkit stable release 1.10. +This describes the major changes since 1.8. + +nbdkit 1.10.0 was released on 18th January 2019. + +=head2 New features + +=over 4 + +=item * + +Implemented C which greatly improves +performance for clients that support it. + +=item * + +Implemented C (Eric Blake). + +=item * + +L and L: By adding +fine-grained locking, these plugins now use the fully parallel thread +model. + +=item * + +L: The size of the cache can now be limited, +and the cache reclaims space using an LRU algorithm. It has also been +enhanced to support cache-on-read mode. The filter now uses a fully +parallel thread model. + +=item * + +L: Use a fully parallel thread model. + +=item * + +L: Inline scripts: +L + +=item * + +L: Full API version 2 is now supported. + +=item * + +L: Full API version 2 is now supported. + +=item * + +L allows you to specify the read, write, zero +and trim delays individually. + +=item * + +L: Add support for connecting to servers over +Unix domain sockets. + +=item * + +Bash tab completion has been improved: Partial plugin names are +expanded correctly, and plugin parameters containing C<-> work. + +=item * + +Public header files can now be consumed by ISO C90 compilers (but +GCC or Clang is still required to compile nbdkit itself). + +=item * + +A better non-cryptographically secure pseudo-random number generator +(xoshiro256** 1.0) is now used on all platforms, replacing previous +uses of L. + +=item * + +Fuzzing using American Fuzzy Lop is now supported, and was carried +out, resulting in one error being found in the server (not security +related). + +=item * + +New L: This replaces nbdkit-xz-plugin which will +be removed in nbdkit 1.12. + +=item * + +New L man page documenting how to use nbdkit for loop +mounts. See also: L + +=item * + +New L: Returns C on every request. + +=item * + +C, C and +C are used in internal header files to improve +code quality. + +=item * + +Logging using C<%m> now works on all platforms, not just on Linux with +glibc (Eric Blake). + +=item * + +VPATH builds partially supported (Eric Blake). + +=back + +=head1 SEE ALSO + +L, +L. + +=head1 AUTHORS + +Eric Blake + +Richard W.M. Jones + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/docs/nbdkit-release-notes-1.12.pod b/docs/nbdkit-release-notes-1.12.pod new file mode 100644 index 0000000..4df7b11 --- /dev/null +++ b/docs/nbdkit-release-notes-1.12.pod @@ -0,0 +1,105 @@ +=head1 NAME + +nbdkit-release-notes-1.12 - release notes for nbdkit 1.12 + +=head1 DESCRIPTION + +These are the release notes for nbdkit stable release 1.12. +This describes the major changes since 1.10. + +nbdkit 1.12.0 was released on 10th April 2019. + +=head2 New features + +New L which lets you turn any disk image on a +remote Unix server accessible by ssh into an NBD source. + +New L for bandwidth-limiting connections. +Either single connections or the whole server can be +bandwidth-limited, and the limit can be dynamically changed at +runtime. + +New L improves performance when reading +sequentially from plugins with a high request overhead like curl. + +New L lets you create complete ext2, ext3 +or ext4 filesystems in a GPT partitioned disk image, from a local +directory. This can be attached to existing Linux VMs or used to +create new ones from scratch. + +New L can make sparse disks appear fully +allocated. + +Plugins can now be written in the Rust programming language, see +L. + +The old nbdkit-xz-plugin has been removed. Use + + nbdkit --filter=xz file file.xz + +as a replacement. This filter can be placed on top of other plugins +such as curl (for decompressing a remote web URL). + +C has been implemented allowing clients to query +which parts of the disk are allocated, holes or zeroes. Plugins and +filters have been extended to supply this information in many cases. +This required adding minimal support for NBD protocol Structured +Replies, C and C. (Thanks to +Eric Blake for extensive help with this one.) + +L has been updated to VDDK 6.7, but now also +works back as far as VDDK 5.1.1. It supports extents, flush and FUA. +Also added: new flags C and C. (Thanks to +Martin Kletzander). + +The line "All rights reserved." was removed from the license, with the +agreement of all nbdkit contributors. Note this does not change the +license. + +C errors are printed in red when writing to the +terminal, making them much easier to see. + +C rejects negative values, eg. +S> (Nikolay Ivanets). + +L now supports cookies, password auth and +proxies. It can also limit URLs to whitelisted protocols. This makes +it broadly feature equivalent to and a replacement for the qemu curl +block driver. + +L can now create MBR logical +partitions. Previously it only supported 4 MBR primary partitions and +if you wanted more than that you had to use GPT. + +L also supports MBR logical partitions. + +L creates plugins which are compatible with +Python >= 3.7. + +Tests are now run under C and +C>. This causes some tests to crash +(silently) because of a shutdown race which needs to be fixed. + +Test shell scripts now have a generic C function to skip +tests if features are not present. + +C99 type C is now used in most places where appropriate. + +The protocol and connections code in the server has been split up +because the single file had grown very large. (Thanks to Eric Blake +for helping with protocol issues). + +=head1 SEE ALSO + +L, +L. + +=head1 AUTHORS + +Eric Blake + +Richard W.M. Jones + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/docs/nbdkit-release-notes-1.14.pod b/docs/nbdkit-release-notes-1.14.pod new file mode 100644 index 0000000..8cc1e2a --- /dev/null +++ b/docs/nbdkit-release-notes-1.14.pod @@ -0,0 +1,145 @@ +=head1 NAME + +nbdkit-release-notes-1.14 - release notes for nbdkit 1.14 + +=head1 DESCRIPTION + +These are the release notes for nbdkit stable release 1.14. +This describes the major changes since 1.12. + +nbdkit 1.14.0 was released on 28th August 2019. + +=head2 New features + +Server performance improvements: Nagle’s algorithm is disabled; +instead C is used to control when outgoing packets are sent. +Ramdisk plugins now support more efficient zeroing. (Eric Blake). + +Plugins can now select their thread model at run time. Thread model +selection is not finalized until after the config stage (Eric Blake). + +The server supports C for prefetching. Plugins and +filters have been updated to implement this where it makes sense (Eric +Blake). + +Low level pthread lock failures now call L. This should +never happen in real situations (Eric Blake). + +The server will not advertize multi-conn support if the internal +thread model is serialized, avoiding a possible deadlock in some +clients (Eric Blake). + +New server option I<--no-sr> can be used to disable structured replies +(Eric Blake). + +The server will now refuse to start if stdin/stdout/stderr are closed, +to avoid potential issues with file descriptor handling in plugins +(Eric Blake). + +C<$uri> can be used to specify an NBD URI in I<--run> parameters (Eric +Blake). + +New L displays elapsed statistics about NBD +operations, such as the number of bytes read and written. + +New L which disables cache requests, used to +determine how effective they are (Eric Blake). + +New L which can be used to override the +plugin’s own choice of thread model. Used to determine how the thread +model affects performance, or to serialize plugins if required (Eric +Blake). + +New L to cache extents requests, +especially useful with VDDK which has a slow implementation of extents +(Martin Kletzander). + +In L, L, +L, L and +L, the C prefix can be omitted, ie: +S> (instead of C). + +L has multiple enhancements (all added by Eric +Blake): + +=over 4 + +=item * + +It may be built using libnbd instead of constructing raw NBD packets. + +=item * + +C is supported. + +=item * + +Add structured reads. + +=item * + +Implement C. + +=item * + +Supports TCP sockets. + +=item * + +Forwards C. + +=item * + +Retry connections. + +=item * + +Shared connections. + +=item * + +Magic C parameter. + +=item * + +TLS support. + +=back + +L now reports hole extents correctly when using +the C flag (Martin Kletzander). + +L and L now avoid +copying data through a bounce buffer when it is already sufficiently +aligned (Eric Blake). + +Filters (such as L and +L) which sleep no longer cause long delays when +the server is shut down (Eric Blake). + +Multiple fixes to L (Martin Kletzander). + +Multiple enhancements and clean ups to the test suite which should +make tests better and more reliable. + +OCaml plugins can now use C, C, +C calls, and there is also a new example plugin. + +On platforms which lack atomic C support the most +serialized thread model is always selected to avoid leaking file +descriptors (Eric Blake). + +=head1 SEE ALSO + +L, +L. + +=head1 AUTHORS + +Eric Blake + +Richard W.M. Jones + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/docs/nbdkit-release-notes-1.16.pod b/docs/nbdkit-release-notes-1.16.pod new file mode 100644 index 0000000..3ae36a1 --- /dev/null +++ b/docs/nbdkit-release-notes-1.16.pod @@ -0,0 +1,172 @@ +=head1 NAME + +nbdkit-release-notes-1.16 - release notes for nbdkit 1.16 + +=head1 DESCRIPTION + +These are the release notes for nbdkit stable release 1.16. +This describes the major changes since 1.14. + +nbdkit 1.16.0 was released on 14th November 2019. + +=head2 Security + +Two security issues were found during development of nbdkit 1.16. +Fixes for these were backported to older stable branches. Upgrading +to the fixed versions is highly recommended. The new +L man page contains an up to date list of past +security issues. + +=head3 CVE-2019-14850 +denial of service due to premature opening of back-end connection + +See the full announcement and links to mitigation, tests and fixes +here: +https://www.redhat.com/archives/libguestfs/2019-September/msg00084.html + +=head3 CVE-2019-14851 +assertion failure by issuing commands in the wrong order + +This CVE was caused by the fix to the previous issue. + +See the full announcement and links to mitigation, tests and fixes +here: +https://www.redhat.com/archives/libguestfs/2019-September/msg00272.html + +=head2 New features + +Add support for fast zeroing. Plugins can expose this using the new +C<.can_fast_zero> method (Eric Blake). + +L allows use of C or +C to go back to the default MBR byte or partition +type GUID. + +New I<--mask-handshake> server flag can be used for testing client +feature negotiation (Eric Blake). + +The client export name is passed to L I<--run> +parameter as C<$exportname> (Eric Blake). + +Captive I<--run> commands which fail (eg. aborting) now cause nbdkit +to exit with an error instead of errors being silently ignored (Eric +Blake). + +File descriptors can be passed to password parameters, eg: +C which means that the password should be read from file +descriptor 3. + +nbdkit can now serve over the C protocol (thanks Stefan +Hajnoczi). + +New I<--log=null> option discards error messages. + +=head2 Plugins + +Python 2 support has been B from L +in line with Python 2 end of life at the beginning of 2020. Python +E 3.3 is required by this plugin. If you wish to continue to use +Python 2 then you will need to use nbdkit 1.14. + +New L which returns various server information +back to the client. It can be used for testing server latency amongst +other things. + +L now allows you to write C to get +repeated bytes (eg. S>). + +L new parameter C to +control transport compression. + +L is no longer compiled on non-x86 platforms +since VMware has only ever shipped VDDK on x86. + +L scripts can now see the client exportname and +can use the C feature. + +=head2 Filters + +New L which can reopen the plugin +transparently on certain types of failures (lots of help from Eric +Blake). + +=head2 API + +Macros C, C, +C expose the compile-time version of nbdkit to +plugins and filters (Eric Blake). + +Filters (which unlike plugins do I have a public stable API) must +now exactly match the version of nbdkit when loaded (Eric Blake). + +New C<.can_fast_zero> method (Eric Blake). + +New C server function for reading the export name +passed by the client. + +New C server function to return the client address +(like L). + +New server functions for safely parsing integers: C, +C, C, +C, C, +C, C, +C, C, +C. + +=head2 Bug fixes + +C<.trim> with FUA flag set now works (Eric Blake). + +=head2 Documentation + +The previous release notes have been turned into man pages. + +=head2 Tests + +Several tests now optionally use L instead of qemu-io. + +You can now fuzz nbdkit using either American Fuzzy Lop or clang’s +libFuzzer. + +Several tests have had sleep times increased to make them more stable +when run on slow or heavily loaded machines. + +=head2 Internals + +Reproducible builds (Chris Lamb). + +Compile code with I<-Wshadow> warning (Eric Blake). + +The internal backend system has been extensively overhauled. In +particular this means that we now validate request ranges as requests +are passed between filters and down to the plugin, making it easier to +find bugs in filters early (Eric Blake). + +Plugin size and C flags are cached more aggressively by the +server (Eric Blake). + +Variable Length Arrays (VLAs) on stack are now banned throughout the +code. + +The F header describing the NBD protocol is now shared +with L. + +Plugin C<.unload> method is now called after all worker threads have +exited, avoiding races at server shutdown. + +Code was audited using Coverity and various problems were fixed. + +=head1 SEE ALSO + +L. + +=head1 AUTHORS + +Eric Blake + +Richard W.M. Jones + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/docs/nbdkit-release-notes-1.18.pod b/docs/nbdkit-release-notes-1.18.pod new file mode 100644 index 0000000..d660a6c --- /dev/null +++ b/docs/nbdkit-release-notes-1.18.pod @@ -0,0 +1,210 @@ +=head1 NAME + +nbdkit-release-notes-1.18 - release notes for nbdkit 1.18 + +=head1 DESCRIPTION + +These are the release notes for nbdkit stable release 1.18. +This describes the major changes since 1.16. + +nbdkit 1.18.0 was released on 27th February 2020. + +=head2 Security + +There were no security issues found. All past security issues and +information about how to report new ones can be found in +L. + +=head2 Plugins + +New L lets you write a plugin entirely on a +single command line. It is similar to L. + +nbdkit-ext2-plugin is deprecated and will be removed in the next +release after this one (S). As a replacement use +L like this: + + nbdkit --filter=ext2 file fs.img ext2file=/disks/disk.raw + +L now offers a version 2 API which avoids +copying the data buffer, improving performance. The original protocol +(now retrospectively called version 1) is still supported for +backwards compatibility. The version 1 protocol was also enhanced to +support the buffer protocol for the pread method, and memoryview for +pwrite, improving performance by reducing copies (Nir Soffer). + +The Python plugin now prints readable stack traces when an exception +is thrown (Nir Soffer). + +New methods implemented in the Python plugin: cache, can_cache, +can_zero, can_fast_zero, can_multi_conn, can_fua. + +In L, new options C and C +(Wiktor Gołgowski). + +L now supports extents (Eric Blake). + +In L, C is now a magic config key, +meaning it can be omitted in most circumstances (Eric Blake). + +The VDDK plugin now no longer needs C<$LD_LIBRARY_PATH> to be set. +The correct library load path is automatically inferred from the +C parameter (Eric Blake). + +Verbose messages about calls to VDDK functions Read and Write can now +be suppressed by setting S>. + +=head2 Filters + +New L, which replaces the deprecated +nbdkit-ext2-plugin. This filter allows you to read and write files +inside ext2, ext3 or ext4 filesystems. The new filter has the same +features as the plugin, and one enhancement: optionally the name of +the file to serve can be picked from the client-supplied exportname. +The old plugin will be removed in S (Eric Blake). + +New L lets you specify a static list of +extents from a file which can be placed on top of plugins which don't +export extent information. + +New L lets you allow and deny incoming +connections by client IP address, similar to TCP wrappers or a +firewall. + +New L is a null filter, used for testing. + +The stats filter now collects time elapsed per operation, per +operation and total rates, and adds stats for the flush method. The +output is shown in human sizes making it easier to understand. (Nir +Soffer). + +=head2 Server + +New I<--swap> option which allows nbdkit to be safely used to serve +swap space to the same machine. + +Debug flags (I<-D>) can now be applied to the server core (using +S>). Underscores in debug flags can now be replaced by +dots, allowing a kind of namespacing. Debug flags which are not +consumed now no longer give an error, so you can use them without +needing to detect if the plugin supports them. New server debug flags +S> and +S> were added to suppress some very +verbose messages when verbose mode is enabled. + +=head2 API + +There is a new C<.get_ready> method which is called after +C<.config_complete> and before the server forks or changes directory. +It is the last chance to do any global preparation that is needed to +serve connections. Plugins have previously done this work in +C<.config_complete>, but by splitting this into a new method it makes +the API clearer. (Note that existing plugins may continue to use +C<.config_complete> for this work if they prefer.) + +There is a new C<.preconnect> method available which is called just +after the client makes a connection but before any NBD negotiation or +TLS authentication is done. It can be used for early whitelisting or +rate limiting of connections, and in particular is used by the new +L. + +=head2 Bug fixes + +In L, C is +used (if available) so that file sizes up to 63 bits should now work +on all platforms (Pino Toscano and Adrian Ambrożewicz). + +nbdkit is now compatible with OCaml 4.10. + +L now supports C (Eric Blake). + +=head2 Documentation + +Plugins which were actually added in S are now +documented as such properly. + +Improved methods for probing plugins and filters are documented in +L. + +=head2 Tests + +Old plugins from nbdkit 1.0, 1.2, 1.8 and 1.12 are now bundled with +the nbdkit sources and tested to try to ensure that they do not +accidentally regress. Note these are included as binary blobs. See +F for more information about this, including +how to delete these tests. + +Various tests, especially ones which rely on timeouts, have been made +more stable so they should not fail on slow or overloaded machines. + +Many tests now use libnbd and nbdsh (instead of libguestfs and +guestfish) as the test client. This should improve the performance of +the tests for most people. + +The I<--vsock> option (added in nbdkit 1.16) can now be tested if the +host is running Linux E 5.6 (Stefano Garzarella). + +=head2 Build + +You can use C<./configure --disable-nbd-plugin> to completely +disable the NBD plugin. + +The automake feature C is no longer used, which may +improve compatibility on platforms with ancient and buggy automake +(S being one such platform). + +=head2 Internals + +The explicit connection parameter passed around many functions in the +server is now fetched from thread-local storage. + +The server no longer calls the finalize method if prepare fails. Also +failing to reopen the plugin from L no longer +hangs (Eric Blake). + +C was enhanced to make patches easier to read (Eric +Blake). + +Internal calls to methods like get_size, can_write will now no longer +produce debug messages I the data is simply being returned from +the internal cache (but calls into the plugin are still logged). + +=head1 SEE ALSO + +L. + +=head1 AUTHORS + +Authors of nbdkit 1.18: + +=over 4 + +=item Adrian Ambrożewicz + +(1 commit) + +=item Eric Blake + +(30 commits) + +=item Wiktor Gołgowski + +(1 commit) + +=item Richard W.M. Jones + +(130 commits) + +=item Nir Soffer + +(11 commits) + +=item Pino Toscano + +(1 commit) + +=back + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/docs/nbdkit-release-notes-1.20.pod b/docs/nbdkit-release-notes-1.20.pod new file mode 100644 index 0000000..7e43b76 --- /dev/null +++ b/docs/nbdkit-release-notes-1.20.pod @@ -0,0 +1,181 @@ +=head1 NAME + +nbdkit-release-notes-1.20 - release notes for nbdkit 1.20 + +=head1 DESCRIPTION + +These are the release notes for nbdkit stable release 1.20. +This describes the major changes since 1.18. + +nbdkit 1.20.0 was released on B<2nd May 2020>. + +=head2 Security + +There were no security issues found. All past security issues and +information about how to report new ones can be found in +L. + +=head2 Plugins + +New L is a scriptable “remote tmpfs” for +creating temporary filesystems (eg. for thin clients), and also for +blank or prepopulated temporary disks. + +L now has support for prepopulating disks with +more complex test patterns such as repeated sequences of bytes. + +L now supports setting a proxy, enabling TCP +keepalives, and disabling Nagle’s algorithm. + +L now supports API version 2. In particular +the full NBD client flags are visible to plugins, along with support +for the C<.get_ready> callback. Also there is a new function +C which is a wrapper around the C API. + +L drops support for VDDK 5.1.1. This version +was last updated in 2014 and is no longer supported by VMware. Since +this was the last version of VDDK to support i686, 32-bit support is +also dropped (Eric Blake). + +=head2 Language bindings + +Plugins may now be written in Golang, see L +(thanks Dan Berrangé, James Shubin). + +OCaml plugins can now access C, C, +C and C. + +Python plugins now transparently support fail-fast zero (Eric Blake). + +=head2 Filters + +New L causes nbdkit to exit after the last +client connection. + +New L allows you to limit the number of +clients which can simultaneously connect to any plugin. + +=head2 Server + +The I<--run> option now waits for the nbdkit plugin and nbdkit to exit +before returning to the caller. This allows for more predictable +clean up in shell scripts using this feature. + +nbdkit I<--dump-config> output now includes separate lines for +C and C, making it easier to find out +from shell scripts which version of nbdkit is installed. + +nbdkit I<-s> option (which connects to the client over stdin/stdout) +now rejects various options that would also try to read from or write +to stdin/stdout, for example I<--dump-plugin> or C +(Eric Blake). + +=head2 API + +New C call which allows plugins to ask for nbdkit +to exit. This is used to implement the new C filter. + +New C call allows plugins to check if reading from +stdin or writing to stdout is safe, eg. if it is safe to read +passwords interactively (Eric Blake). + +C callbacks which return booleans can return any value E 1 +to mean true. Previous versions of nbdkit had inconsistent behaviour +if plugins returned anything other than 1 for true (Eric Blake). + +=head2 Bug fixes + +nbdkit-tar-plugin now works and there is a regression test for +it. + +L S> option now works. + +Fixed a rare hang when closing a connection in L +(Eric Blake). + +Fix compilation on certain platforms with clang (Khem Raj). + +Don’t leak C<$tmpdir> from L into the I<--run> +subcommand. + +nbdkit now correctly sets C when using systemd socket +activation (Eric Blake). + +=head2 Documentation + +The L man page has been overhauled completely to +make it easier to follow. Also we now have documentation for how to +compile plugins in various environments which was missing before. + +=head2 Tests + +All valgrind tests now pass. + +“Old plugin” tests were added for v1.18.2 on x86-64, and a variety of +old plugins compiled on i686. The i686 plugins will allow us to test +for regressions in 32 bit support. + +Tests of the nbd plugin should now be stable (Eric Blake). + +There is an additional test combining the offset and truncate filters, +which tests several corner cases as well as providing tests of error +handling between layers. + +=head2 Build + +L now requires libnbd. (If libnbd is not +present at build time then this plugin is not built). The fallback +code in this plugin which made NBD connections by constructing NBD +command packets without using libnbd has been removed (Eric Blake). + +F has been improved so that commands like +S> and S> display OCaml sources in a natural +order with interface first followed by implementation. + +Various fixes for MinGW. Note MinGW / MSYS support is a work in +progress and not finished yet (Frank Gu). + +Multiple fixes to Haiku build. + +L is no longer required to run the tests. It was a “hidden” +required dependency, but all use of it has now been eliminated. + +=head2 Internals + +There is now an internal utility library for creating vectors/lists of +objects, for example lists of strings (F). It +is widely used by the server, plugins and filters. + +F discusses how to use L for code coverage reports. + +=head1 SEE ALSO + +L. + +=head1 AUTHORS + +Authors of nbdkit 1.20: + +=over 4 + +=item Eric Blake + +(33 commits) + +=item Khem Raj + +(1 commit) + +=item Richard W.M. Jones + +(134 commits) + +=item Frank Gu + +(6 commits) + +=back + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/docs/nbdkit-release-notes-1.22.pod b/docs/nbdkit-release-notes-1.22.pod new file mode 100644 index 0000000..229549b --- /dev/null +++ b/docs/nbdkit-release-notes-1.22.pod @@ -0,0 +1,250 @@ +=head1 NAME + +nbdkit-release-notes-1.22 - release notes for nbdkit 1.22 + +=head1 DESCRIPTION + +These are the release notes for nbdkit stable release 1.22. +This describes the major changes since 1.20. + +nbdkit 1.22.0 was released on B<27 August 2020>. + +=head2 Security + +There were no security issues found. All past security issues and +information about how to report new ones can be found in +L. + +=head2 Plugins + +New L (Containerized Data Importer) lets you +export a single layer from a container image, allowing you to access +disk images distributed using container registry infrastructure. + +New L creates filesystems for clients on +demand. + +New L serves a BitTorrent file or magnet +link over NBD. + +L and L have a new +C parameter giving more fine-grained control over the +allocation strategy. Currently implemented strategies are: sparse +array, sparse array with zstd compression, malloc, and malloc with +mlock. + +L data format now supports strings and +alignment. The C script has been enhanced to detect +repeated sequences and produce a more compact output. + +L adds support for arbitrary custom request +headers. Also it now supports scripts for generating cookies and +custom request headers. This is especially useful when accessing web +servers that require authentication which has to be renewed +periodically. + +L now supports HTTP/2 servers +(David Edmondson, Pino Toscano, Zi Liu). + +L adds support for the C header. + +L can export multiple files in a directory as +separate exports (Eric Blake). + +L supports new C and +C parameters which can be used to +optimize access patterns and avoid filling the page cache. + +L supports proxying to another NBD server over +C (Eric Blake). + +L supports new C and C +parameters which allow you to run a subordinate NBD server as a +command directly from the plugin, or pass in an already connected NBD +endpoint. + +nbdkit-streaming-plugin(1) supports streaming to and from local +pipes. + +L now has support for VDDK 7.0. A new and +useless "error" message printed by VDDK 7 has been suppressed +(thanks Ming Xie, Pino Toscano). + +nbdkit-ext2-plugin has been removed. It was deprecated in +S. All existing uses can be replaced with +L. + +The C<-> character is now permitted within plugin and filter names +(Eric Blake). + +=head2 Filters + +New L lets you test disk images recovered +by L (François Revol). + +New L can decompress a plugin that contains +gzip-compressed data. It replaces nbdkit-gzip-plugin which is +deprecated and will be removed in S. + +New L can temporarily stop and later resume +NBD requests. This can be used when taking snapshots. + +New L swaps bytes in the underlying plugin, +which can be used to adjust images that have an incorrect byte order +(François Revol). + +New L reads and writes files inside a tar file +in the underlying plugin. It replaces nbdkit-tar-plugin which +is deprecated and will be removed in S. + +New L provides alternate content when a +client connects without using TLS to a server that permits but does +not require TLS (Eric Blake). + +L has new option C to pass through +FUA and flush requests unchanged (disabling the filter). A new, +unsafe C mode was added which discards FUA and flush +requests. + +=head2 Language bindings + +New L lets you write small nbdkit plugins as +inline C, C++ or OCaml "scripts" (and potentially other ahead-of-time +compiled programming languages). + +L bindings have been replaced by higher level +and more idiomatic bindings. These also support a greater range of +server features (Alan Somers). + +L now supports parallel plugins. These +cannot run Python code in parallel (because of the Python GIL), but +for Python code that blocks, eg. calling out to external services, +requests can now be handled in parallel (thanks Nir Soffer). + +L has a greater range of examples (Nir Soffer). + +L adds support for getting the client export +name, calling C, and also for extents. + +=head2 Server + +C has new fields: C and +C to allow easier version parsing from scripts. +C and C so you can find out if nbdkit was +cross-compiled for another platform. C so you can find +out if nbdkit was compiled with zstd compression support. + +The I<-e>/I<--exportname> option (which never did anything useful +previously) is now used to pass the preferred exportname to the +I<--run> option. In general you should never use this option except +in very limited and exceptional circumstances (Eric Blake). + +=head2 API + +New C<.after_fork> callback which can be used for plugins which need +to create background threads, since those threads would otherwise be +stranded if the server forks into the background. The VDDK plugin now +defers VDDK library initialization til C<.after_fork> because it is +thought that the library creates background threads especially when +accessing remote servers. + +New API C is a helper function for filters +that retrieves extents as needed until at least a certain range is +covered (Eric Blake). + +New C can be called to determine if TLS was negotiated +on the connection. Plugins could use this to hide certain exports +from non-authenticated/non-encrypted clients (Eric Blake). + +C with C will now return an error if +the input is not a tty. Also C is disallowed if the +file descriptor is 0, 1 or 2. + +=head2 Bug fixes + +The VDDK plugin was extensively refactored to fix many bugs: Reading +passwords from a tty should work again. The plugin should now work +properly when daemonized or using the I<--run> option. The threading +model has been relaxed to C which should give +small performance improvements when using multiple connections. + +The C option of L has been fixed so it +sets the implicit size correctly. + +The CFILE> formatter of L now works if +you use it more than once. + +=head2 Documentation + +New L manual page documents how to mount filesystems +from NBD exports on client machines, either directly or using systemd +mountpoints. + +Examples now use C so that the examples match +the documentation. + +=head2 Tests + +The tests should now pass on OpenBSD E 6.4. + +F was refactored: There is now no longer a single +massive C. Creation of test disks was refactored. + +Some tests will now use new libnbd 1.4 tools L and +L if available, and skip the tests otherwise. + +New test functions C and C allows +tests to be skipped if the corresponding plugin/filter was not +compiled on a particular platform. So tests should now not fail when +an optional external library needed by a plugin/filter is not +available. + +=head2 Build + +Honggfuzz may now be used for fuzz testing. + +If L is enabled, Python E 3.6 must be +used. + +=head2 Internals + +The export name is now passed down through filter C<.open> callbacks, +allowing filters to modify the export name passed through to plugins. + +The final thread model is passed to filter C<.get_ready> callbacks. + +=head1 SEE ALSO + +L. + +=head1 AUTHORS + +Authors of nbdkit 1.22: + +=over 4 + +=item Alan Somers + +(7 commits) + +=item Eric Blake + +(53 commits) + +=item François Revol + +(2 commits) + +=item Nir Soffer + +(2 commits) + +=item Richard W.M. Jones + +(285 commits) + +=back + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/docs/nbdkit-release-notes-1.24.pod b/docs/nbdkit-release-notes-1.24.pod new file mode 100644 index 0000000..c6d35e6 --- /dev/null +++ b/docs/nbdkit-release-notes-1.24.pod @@ -0,0 +1,164 @@ +=head1 NAME + +nbdkit-release-notes-1.24 - release notes for nbdkit 1.24 + +=head1 DESCRIPTION + +These are the release notes for nbdkit stable release 1.24. +This describes the major changes since 1.22. + +nbdkit 1.24.0 was released on B<7 January 2021>. + +=head2 Security + +There were no security issues found. All past security issues and +information about how to report new ones can be found in +L. + +=head2 Server + +The server and a subset of the plugins and filters have been ported to +Windows using the Win32 API. Only the mingw-w64 toolchain is +supported for building nbdkit (not MSVC). You can also cross-compile +from Linux and test under Wine. Some features are missing although it +is very usable. + +New S> and S> debug +flags which enable additional debugging for TLS sessions. + +The server now responds to C (Eric Blake). + +Options I<--run> and I<--vsock> may now be used together. + +In I<--run>, C<$nbd> is now a synonym for C<$uri> instead of having +confusing magical properties. + +=head2 Plugins + +New L to access disks stored on AWS S3 and Ceph. + +New L which generates large disks +sparsely filled with random blocks of data. These look like virtual +disk images and can be used to benchmark copying tools. + +L has been greatly enhanced. New features +include: C<(...)[N:M]> (slice syntax), assignments, comments, +variables, C(SCRIPT)> (inlined shell script). In addition a +parse tree is built, allowing optimizations and other enhancements. +The plugin is now 64 bit clean allowing patterns larger than 2^32 +bytes to work correctly. + +L can now be used to test copying tools. + +L supports enabling compression between VDDK +and the VMware server which in some situations can improve +performance. + +=head2 Filters + +New L can be used to extend, mask and +modify the exports exposed by a plugin (Eric Blake). + +New L allowing the server to gracefully +exit on various events including external scripts. + +New L can be used to benchmark copying +tools. + +L now supports filtering clients by PID, user ID +or group ID, for clients connected over a Unix domain socket. Also +you can filter clients using C and vsock port number. + +L now logs C, C and +C methods, and there is a new C feature +allowing scripts to be run on logging events. + +L new option C can be used +to allow the client to select which file to see from the filesystem +using the NBD export name (Eric Blake). + +=head2 Language bindings + +Python style cleanups (Eric Blake). + +The OCaml plugin now correctly acquires and releases the GC lock on +all paths in and out. + +There is a new OCaml C function returning the version +of nbdkit that the plugin was compiled against. + +Multiple enhancements to the Rust plugin (Alan Somers). + +=head2 API + +New C<.list_exports>, C<.default_export> and C<.export_description> +plugin methods allowing plugins to be queried about what export names +they support, and give additional descriptions of exports. New +C helper function (Eric Blake). + +New C, C +C and C functions which +allow you to allocate a string in a plugin without worrying about +freeing it (Eric Blake). + +New C, C and C +allows plugins and filters to read the client’s credentials, for +clients connected over a Unix domain socket. + +=begin comment + +=head2 Bug fixes + +=head2 Documentation + +=end comment + +=head2 Tests + +Many tests now use L, L, L and +L as lighter weight replacements for qemu tools. + +Fix compatibility with qemu E 5.2.0. + +=head2 Build + +Downstream packagers can now use this to add extra downstream +information which is printed in version strings etc: + ./configure --with-extra=... + +If L is installed at build time, then it will be used to +build the L manual page for OCaml documentation. + +=begin comment + +=head2 Internals + +=end comment + +=head1 SEE ALSO + +L. + +=head1 AUTHORS + +Authors of nbdkit 1.24: + +=over 4 + +=item * + +Alan Somers + +=item * + +Eric Blake + +=item * + +Richard W.M. Jones + +=back + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/docs/nbdkit-release-notes-1.26.pod b/docs/nbdkit-release-notes-1.26.pod new file mode 100644 index 0000000..d438d56 --- /dev/null +++ b/docs/nbdkit-release-notes-1.26.pod @@ -0,0 +1,196 @@ +=head1 NAME + +nbdkit-release-notes-1.26 - release notes for nbdkit 1.26 + +=head1 DESCRIPTION + +These are the release notes for nbdkit stable release 1.26. +This describes the major changes since 1.24. + +nbdkit 1.26.0 was released on B<7 June 2021>. + +nbdkit is now hosted on gitlab: +L + +=head2 Security + +There were no security issues found. All past security issues and +information about how to report new ones can be found in +L. + +=begin comment + +=head2 Server + +=end comment + +=head2 Plugins + +nbdkit-gzip-plugin and nbdkit-tar-plugin have been removed. They were +deprecated in nbdkit 1.22. The functionality has been replaced by +L and L respectively. + +nbdkit-streaming-plugin(1) has been deprecated and will be removed +in S. You can use L instead. + +L adds these features: C +to disable following redirects. C and C to +control saving cookies. + +L now advertises multi-conn if the server is +OpenSSH, improving performance (Eric Blake). + +L has a new C flag allowing you +to choose between clients waiting for an export to become free or +being immediately rejected. + +L now does not generate fully random +data within each block. Using perf we observed that the plugin was +spending 34% of the total time during benchmarks just doing this. You +can enable the old behaviour using C. + +L now checks if the file is read-only and +exports a read-only NBD connection in this case (Eric Blake). + +L has been tested with VDDK 7.0.2. + +=head2 Filters + +There is a new API for use by filters to manage "contexts". Instead +of the previous 1-1 relationship between filter connections and plugin +connections, filters can now open more than one context into the +backend from a single connection, or share contexts between +connections (Eric Blake). + +New L which allows you to add multi-conn +support to plugins which don't support it (although the emulation is +expensive), or change whether multi-conn is advertised to clients +(Eric Blake). + +L now ignores flush/FUA requests (which are not +useful for a temporary overlay). The filter now implements extents +and efficient trimming. Fine-grained locking is used around shared +structures, greatly improving parallel performance. Added support for +multi-conn. + +L advertises multi-conn when possible +(Eric Blake). + +nbdkit-cache-filter and nbdkit-cow-filter can now handle arbitrary +sized disks, instead of rounding the disk size down. + +L supports parallel requests (Eric Blake). + +L supports multi-conn (Eric Blake). + +L no longer supports multi-conn. The filter is +single-threaded so it does not matter, but it was not safe. Fix trim, +zero and flush support (Eric Blake). + +L fixes multi-conn support (Eric Blake). + +L and L now both support +multi-conn (Eric Blake). + +=head2 Language bindings + +L supports the following new features: +C and C methods. C +binding. + +L updated for newer Rust compiler versions +(Alan Somers). + +L now uses and requires golang modules. +Golang E 1.13 must be used. + +=head2 API + +New C<.cleanup> callback for plugins and filters. This is called +shortly before C<.unload>, but unlike C<.unload> it is guaranteed that +no plugin or filter code has been dlclosed (Eric Blake). + +New C is a helper function for filters which can +be used to read all extents from a plugin covering a region. + +=begin comment + +=head2 Bug fixes + +=head2 Documentation + +=end comment + +=head2 Tests + +Old plugins that we use for testing were rebuilt so they no longer +depend on libselinux (thanks Thomas Weißschuh). + +L can still be built even if ssh-keygen is +unavailable for testing it (thanks Thomas Weißschuh). + +Improve F to avoid crashes during testing. + +Test coverage on FreeBSD has been improved, fewer tests should skip +unnecessarily. + +=head2 Build + +nbdkit and plugins can now be built with I<-fvisibility=hidden>, which +allows the compiler to make some optimizations. + +Add a dependency so nbdkit is relinked if the linker script +(F) changes (Eric Blake). + +xorriso is now preferred over genisoimage or mkisofs (see +L). + +It is now possible to compile nbdkit with clang with warnings enabled. +Several warnings have been suppressed or fixed. + +C and C are only enabled when running +the tests, not when running nbdkit from the build directory. This +makes it easier to do benchmarks. + +C implemented on OpenBSD. + +=head2 Internals + +When fuzzing nbdkit we now recommend using the S> flag (which +disables threads). This improves the fuzz-stability of nbdkit. + +=head1 SEE ALSO + +L. + +=head1 AUTHORS + +Authors of nbdkit 1.26: + +=over 4 + +=item * + +Alan Somers + +=item * + +Eric Blake + +=item * + +Michael Ablassmeier + +=item * + +Richard W.M. Jones + +=item * + +Timm Bäder + +=back + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/docs/nbdkit-release-notes-1.28.pod b/docs/nbdkit-release-notes-1.28.pod new file mode 100644 index 0000000..338d44b --- /dev/null +++ b/docs/nbdkit-release-notes-1.28.pod @@ -0,0 +1,164 @@ +=head1 NAME + +nbdkit-release-notes-1.28 - release notes for nbdkit 1.28 + +=head1 DESCRIPTION + +These are the release notes for nbdkit stable release 1.28. +This describes the major changes since 1.26. + +nbdkit 1.28.0 was released on B<23 September 2021>. + +=head2 Security + +=head3 CVE-2021-3716 reset structured replies on starttls + +nbdkit was vulnerable to injected plaintext when upgrading to a secure +connection. For the full announcement see +L +(Eric Blake). + +All past security issues and information about how to report new ones +can be found in L. + +=head2 Plugins + +L has new CNNE:> and +CNNE:> prefixes for little and big endian words. Also the +plugin tries much harder to optimize expressions. The test suite has +been greatly expanded to catch potential regressions. + +L now allows you to reserve free space (Nolan +Leake). + +L no longer references SHA1 host keys as part of +the effort to remove insecure algorithms (Daniel Berrangé). + +L reports C and C based on +what the version of VDDK supports. New debug flag I<-D vddk.stats=1> +prints the amount of time spent in VDDK calls on exit which can be +useful for profiling performance. + +=head2 Filters + +L and L no longer break +up large read requests into page-sized requests. In addition the +default block size for both filters is now 64K. Both changes greatly +improve performance. + +L has a new C parameter +allowing callers to enable and disable the cache-on-read feature at +runtime. Also there is a new C parameter +letting you select the block size at runtime (thanks Martin +Kletzander). + +L has a new C parameter which works +similarly to the corresponding cache filter feature. The new +C parameter lets you select the block size at runtime. + +L has less verbose debugging. To restore the +old debug output use I<-D cow.verbose=1> + +L has new C and C +parameters to inject delays when clients connect and disconnect. +Delay filter parameters are now parsed more accurately (thanks Ming +Xie). + +=head2 Language bindings + +The OCaml bindings now call C when unloading the +plugin. This causes C handlers to run correctly, +closes file descriptors, releases dependent shared libraries and frees +memory. Valgrind on OCaml plugins should not show any false positives +about leaked memory. + +OCaml and Python bindings may now use the C<.cleanup> method. + +References to Python 2 in L have been removed. + +=head2 Server + +Fix captive nbdkit C<$uri> variable so when TLS is used the URI is +constructed with the C prefix. Additionally add a new variable +C<$tls> which can be used by the subprocess to tell if TLS is enabled. + +Debug messages are now printed atomically. This means that debug +messages are no longer broken up across multiple lines if there are +other processes writing to stderr at the same time (which often +happened when using captive nbdkit). + +Enhanced valgrind support (F<./configure --enable-valgrind>) can now +be enabled safely and with no performance impact even in production +builds (Eric Blake). + +=head2 API + +Plugins or filters using C now don't hang if the +client closes the socket abruptly (thanks Ming Xie). + +=head2 Bug fixes + +L and L using +allocator=malloc no longer crash because of memory corruption in some +corner cases (only seen on s390x, but could happen on other +architectures). Meanwhile C no longer crashes when +zeroing unallocated space. + +=begin comment + +=head2 Documentation + +=end comment + +=head2 Tests + +Tests now use the new C feature, replacing +C on glibc E 2.34 (thanks Eric Blake, +Siddhesh Poyarekar). + +=head2 Build + +F now uses spaces consistently, and has been +modernized to support the latest autotools (Eric Blake). + +F has been unified (almost) with the copy in libnbd. + +Continue fuzzing using AFL++. Updated the fuzzing documentation. + +=begin comment + +=head2 Internals + +=end comment + +=head1 SEE ALSO + +L. + +=head1 AUTHORS + +Authors of nbdkit 1.28: + +=begin comment + +git shortlog -s v1.26.0.. + +=end comment + +=over 4 + +=item Daniel P. Berrangé + +=item Eric Blake + +=item Martin Kletzander + +=item Nolan Leake + +=item Richard W.M. Jones + +=back + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/docs/nbdkit-release-notes-1.30.pod b/docs/nbdkit-release-notes-1.30.pod new file mode 100644 index 0000000..f95534e --- /dev/null +++ b/docs/nbdkit-release-notes-1.30.pod @@ -0,0 +1,222 @@ +=head1 NAME + +nbdkit-release-notes-1.30 - release notes for nbdkit 1.30 + +=head1 DESCRIPTION + +These are the release notes for nbdkit stable release 1.30. +This describes the major changes since 1.28. + +nbdkit 1.30.0 was released on B<24 February 2022>. + +=head2 Security + +There were no security issues found. All past security issues and +information about how to report new ones can be found in +L. + +=head2 Plugins + +B has been removed. It was deprecated in +1.26 and scheduled for removal in this release. If you were using +this plugin, use L instead. + +L has several changes: + +=over 4 + +=item * + +This plugin can now create (as well as reading and writing) local VMDK +files. See the new C option and the various C +options. + +=item * + +Read and write is now implemented using the VDDK Async functions, +which improves performance. The full nbdkit parallel thread model is +supported. + +=item * + +VDDK E 6.5 (released Nov 2016) is now the minimum required +version. + +=item * + +Stats collected when using I<-D vddk.stats=1> have been extended to +include number of calls and bytes transferred. + +=item * + +I<--dump-plugin> output now includes the VDDK major version and +information about each VDDK API that is implemented by the library. + +=item * + +A new example F is provided to help with +automating connections to remote ESXi virtual machines. + +=back + +L adds support for choosing TLS/SSL versions +and ciphers and TLS 1.3 cipher versions (Przemyslaw Czarnowski). + +L now implements C for writes so +that the Linux page cache is not destroyed when writing huge files. + +L now implements the C<.cleanup> callback. Also +we document how to use this plugin to implement OCaml plugin scripts. + +L I<--dump-plugin> option now prints +C when the platform supports C. + +=head2 Filters + +New L, which is similar to +L but only retries a single failing request. + +New L lets you add write-protection over +regions of a plugin. + +New L lets you adjust or set the +block size constraints and policy of underlying plugins. See L +below. + +L now permits the COW block size to be set as +small as 4096 bytes. + +Debug messages in L are now easier to read +because they no longer all have an C prefix (Eric Blake). + +=head2 Language bindings + +For L the minimum +version of OCaml is now 4.03 (instead of 4.02.2 previously). Various +source-level incompatible changes were made to OCaml plugins in this +release. Please consult the new documentation and example if writing +plugins in OCaml. + +OCaml plugins now support C. + +Several fixes to the handling of integers in Python plugins (Nir +Soffer). + +New Python example which simulates request errors (Nir Soffer). + +=head2 Server + +The server no longer requests the C hint when opening a +server socket. This improves handling of IPv6. In a related change, +the I<-i> (I<--ipaddr>) option now works as intended, and new I<-4> +and I<-6> options have been added to restrict the listening socket to +IPv4 or IPv6 addresses (Laszlo Ersek). + +=head2 API + +There is a new C<.block_size> callback for plugins and filters. +nbdkit uses this to export block size constraints to clients, +specifically the minimum, preferred and maximum block size that +clients should use. + +As well as regular C plugins, L, +L, L, +L and L support block +size constraints. L reexports block size +constraints from the proxied NBD server. L now +advertises a minimum 512 byte block size. + +L, L, +L and L adjust block size +constraints from plugins (Eric Blake). + +L can also use the block size hints from +the plugin instead of needing manual adjustment on the command line. +L logs block size constraints (Eric Blake). + +L can be used to add block size +constraints to plugins which don't support it, or adjust constraints, +or set the error policy. + +=head2 Bug fixes + +L (and others), using +C was broken. This was especially +evident on non-Linux or on Linux with 64K pages (eg. POWER). It +should now work correctly. + +=begin comment + +=head2 Documentation + +=end comment + +=head2 Tests + +C<./configure --disable-libguestfs-tests> can now be used to disable +tests which need libguestfs, without disabling +L. + +We now use L instead of L to create the ext4 +test image. On armv7 this allows the test suite to run much more +quickly. + +The time taken to run the test suite has been reduced significantly. + +=head2 Build + +Multiple fixes to the Windows (MinGW) build. The test suite should +now pass fully if you have the version of Wine with the unofficial +C patch. + +The top level F source directory has been renamed to +F. This prevents problems when setting C<$PATH> to +the source directory and trying to run bash. + +=head2 Internals + +The performance of the internal vector library has been improved +greatly and overflow is now handled correctly (Nir Soffer, Laszlo +Ersek and Eric Blake). + +New "nbdkit-string.h" header file which defines a common string type +(based on vector). Existing places which defined a string based on +vector have been updated to use it. + +C and C macros can be nested (thanks Eric Blake). + +=head1 SEE ALSO + +L. + +=head1 AUTHORS + +Authors of nbdkit 1.30: + +=begin comment + +git shortlog -s v1.28.0.. + +=end comment + +=over 4 + +=item Alan Somers + +=item Eric Blake + +=item Hilko Bengen + +=item Laszlo Ersek + +=item Nir Soffer + +=item Przemyslaw Czarnowski + +=item Richard W.M. Jones + +=back + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/docs/nbdkit-release-notes-1.32.pod b/docs/nbdkit-release-notes-1.32.pod new file mode 100644 index 0000000..b378fd1 --- /dev/null +++ b/docs/nbdkit-release-notes-1.32.pod @@ -0,0 +1,191 @@ +=head1 NAME + +nbdkit-release-notes-1.32 - release notes for nbdkit 1.32 + +=head1 DESCRIPTION + +These are the release notes for nbdkit stable release 1.32. +This describes the major changes since 1.30. + +nbdkit 1.32.0 was released on B<1 August 2022>. + +=head2 Security + +There were no security issues found. All past security issues and +information about how to report new ones can be found in +L. + +=head2 Plugins + +L has new C, C +and C parameters to allow remote files to be created. + +L was largely rewritten and should have better +performance and compatibility. It also supports +splitting/concatenating multiple S3 objects into one virtual disk. +(Nikolaus Rath) + +=head2 Filters + +New L allows you to open, read and write LUKSv1 +disk images. It is compatible with qemu and dm-crypt. + +New L which simply scans across the disk +issuing prefetches. + +L has been completely rewritten so now it +uses prefetching from a parallel thread. The old readahead filter was +deprecated, but if you are using it you should carefully read the new +documentation because it may require changes. + +L now summarises block size and alignment of +requests (Nikolaus Rath). + +L now handles parallel writes without +losing writes because of overlapping read-modify-write cycles. If you +are using the blocksize filter it is recommended to upgrade. (Eric +Blake) + +L has a new C parameter allowing +the bucket capacity to be adjusted, which helps with smoothing out +large, lumpy client requests. + +=head2 Language bindings + +Add C binding for Python (Nikolaus Rath). + +Compatibility with OCaml 4.14. + +Compatibility with Perl 5.36. + +=head2 Server + +Add macOS (Darwin) support. See the relevant section in the top level +F file. + +kTLS should now work (transparently) when available in the kernel and +GnuTLS. Use of kTLS will be indicated in debug output. (Daiki Ueno, +František Krenželok) + +=begin comment + +=head2 API + +=end comment + +=head2 Bug fixes + +L now handles inline scripts correctly on +non-glibc platforms (Martin Kletzander). + +Catch the case where nbdkit ends up linked to OpenSSL (because of a +transient dependency through GnuTLS) which broke +L. For more details see +L. + +Fix memory leak in L which would lead to +large amounts of memory being leaked if your plugin implemented +C or C callbacks (Eric Blake). + +The L cookie/header scripts feature now +generates an error properly if the shell script fails. + +Fix further "phone home" messages in L (thanks +Ming Xie). + +Improve error message from L when the +thumbprint parameter is wrong (Laszlo Ersek). + +Fix C and C in filters. +These could cause assertion failures before. (Eric Blake) + +Fix L test if dependencies are missing +(thanks Jim Fehlig). + +Fix a bounds error in L. + +The server will now fail and exit early if the I<--tls-verify-peer> +option is used on platforms which do not support it. Previously it +would only fail when a client connected using TLS. + +Various bugs found by Coverity were analysed and fixed (Eric Blake). + +=head2 Documentation + +Document how to write plugins and filters in C++. This has always +been possible, but was never documented before. + +Document how to run nbdkit from inetd or xinetd superservers. + +Fix how verbatim paragraphs in the documentation are rendered in HTML. + +Document how to use nbdkit + TLS with L. + +=head2 Tests + +Various enhancements to fuzzing including supporting AFL++, AFL++ +clang-LTO. Add C<./configure --disable-linker-script> which is needed +to use ASAN, and document how to use ASAN when fuzzing. + +Improve runtime of linuxdisk test (Eric Blake). + +Add interoperability tests with L, the Linux kernel +client, including TLS support. + +=head2 Build + +Add GitLab continuous integration (CI) at +L and many miscellaneous +build fixes (Martin Kletzander). + +There are now C and C defined +under F and used consistently throughout the code. + +Microsoft Visual Studio Code formatting settings are available (in +F<.vscode/>) (Nikolaus Rath). + +Remove F. It is now available as a separate +project: L + +C macro added to simplify static array sizing (thanks +Laszlo Ersek). + +=begin comment + +=head2 Internals + +=end comment + +=head1 SEE ALSO + +L. + +=head1 AUTHORS + +Authors of nbdkit 1.32: + +=begin comment + +git shortlog -s v1.30.0.. + +=end comment + +=over 4 + +=item Alan Somers + +=item Eric Blake + +=item Laszlo Ersek + +=item Martin Kletzander + +=item Nikolaus Rath + +=item Richard W.M. Jones + +=back + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/docs/nbdkit-release-notes-1.34.pod b/docs/nbdkit-release-notes-1.34.pod new file mode 100644 index 0000000..e062b5b --- /dev/null +++ b/docs/nbdkit-release-notes-1.34.pod @@ -0,0 +1,184 @@ +=head1 NAME + +nbdkit-release-notes-1.34 - release notes for nbdkit 1.34 + +=head1 DESCRIPTION + +These are the release notes for nbdkit stable release 1.34. +This describes the major changes since 1.32. + +nbdkit 1.34.0 was released on B<14 April 2023>. + +=head2 Security + +Various sanity checks were added to L so it can +handle untrusted disk images. + +TLS support was hardened against a Man-in-the-Middle attacker +injecting unknown NBD options before STARTTLS (Eric Blake). + +Fix rare assertion failure (denial of service) which can be triggered +by clients hanging up early (Eric Blake). + +All past security issues and information about how to report new ones +can be found in L. + +=head2 Plugins + +New L allows you to easily consume and +automate the L high +performance storage library. This allows you to (amongst other +things) access local vhost-user and VFIO devices (thanks Alberto Faria +and Stefan Hajnoczi). + +L has new C and C parameters +allowing a file or directory to be passed from a parent process +through a file descriptor. + +Several enhancements were made to L, +concentrating on improved performance and functionality: + +=over 4 + +=item * + +Multi-conn is now enabled for read-only connections (thanks Eric +Blake). + +=item * + +Instead of using one libcurl handle per NBD client, we now use a +common pool of handles, which improves performance. + +=item * + +Fix the C parameter (Michal Orzel). + +=item * + +We now use the new L feature of libcurl (if +available) instead of hard-coding the list of protocols into the +plugin. + +=item * + +Support was added for forcing C, S + +=back + +L now supports VDDK 8 (thanks Ming Xie, Alice +Frosi). + +L was ported to macOS (Eric Blake). + +=head2 Filters + +L has a new +C to force a disconnection if a client +attempts a write larger than a certain threshold (Eric Blake). + +L can now retry plugin open (Eric Blake). + +=head2 Language bindings + +L now rejects extra parameters to +C and C functions (Eric Blake). + +Tracebacks from Python plugins should now include the full method name +(Eric Blake). + +L status codes have changed in this release, +although in a way that will normally be backwards compatible with +older plugins. Two new status codes are reserved for shutdown server +and disconnect client. Check the manual page for details. (Eric +Blake) + +=head2 Server + +C now reports C so you +can tell if the optional L +functionality is enabled on the platform. + +Debug messages from filters and plugins are now picked out in bold, +making them easier to read amongst other nbdkit debug messages. + +=head2 API + +New C API which allows a plugin or filter to drop +the connection to the current client (Eric Blake). + +=head2 Bug fixes + +Fix a deadlock in L (Piotr Dobrowolski). + +Fix the error message in L when the +F file is not readable (thanks Jonathon Jongsma). + +=head2 Documentation + +The I<--help> output of plugins is now consistent with the manual +pages, and extra tests were added to ensure it stays this way. + +=head2 Tests + +Multiple CI improvements, particularly for Alpine Linux and macOS +(Eric Blake). + +=head2 Build + +Most C<./configure>-time features can now be both enabled and disabled +using I<--with->feature and I<--without->feature (Arsen Arsenović). + +Multiple VPATH build problems fixed (Eric Blake). + +=head2 Internals + +Use I instead of I in test +certificates and suggest its use in documentation (thanks Daniel +Berrangé). + +Source files reformatted to use E 80 columns (Laszlo Ersek). + +=head1 SEE ALSO + +L. + +=head1 AUTHORS + +Authors of nbdkit 1.34: + +=begin comment + +git shortlog -s v1.32.0.. + +=end comment + +=over 4 + +=item Alan Somers + +=item Arsen Arsenović + +=item Daniel P. Berrangé + +=item Eric Blake + +=item Laszlo Ersek + +=item Michal Orzel + +=item Nikolaus Rath + +=item Nir Soffer + +=item Piotr Dobrowolski + +=item Richard W.M. Jones + +=item Thomas Weißschuh + +=back + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/docs/nbdkit-release-notes-1.36.pod b/docs/nbdkit-release-notes-1.36.pod new file mode 100644 index 0000000..e999ece --- /dev/null +++ b/docs/nbdkit-release-notes-1.36.pod @@ -0,0 +1,180 @@ +=head1 NAME + +nbdkit-release-notes-1.36 - release notes for nbdkit 1.36 + +=head1 DESCRIPTION + +These are the release notes for nbdkit stable release 1.36. +This describes the major changes since 1.34. + +nbdkit 1.36.0 was released on B<27 September 2023>. + +=head2 Security + +No security issues were identified in this release. + +All past security issues and information about how to report new ones +can be found in L. + +=head2 Plugins + +New L which creates a fully allocated disk +containing all 0xff (all ones), or another byte of your choice. + +L now uses a curl "multi" interface. This +enables much better performance, and also allows the curl plugin to +handle requests in parallel. The curl plugin now falls back to making +a C request to get the size of the remote file for certain +servers which do not support C requests. This plugin adds new +options: C (force IPv4 or IPv6), C (force a +particular IP address), I<-D curl.times=1> (print detailed timing +stats), and I<-D curl.verbose.ids=1> (display connection and transfer +IDs). + +L now uses a read-write lock to protect +internal structures, resulting in improved performance for mostly read +workloads. + +L now has more optimizations. + +L now supports 4k sector sizes on Windows +(Brian Carnes). + +=head2 Filters + +New L adds random but consistent data +corruption to the underlying plugin. + +New L which can decode qcow2 files (but not +write to them). + +L can now filter by client SELinux label. + +L now supports 4k sector sizes (Brian +Carnes). + +L allows the C operation to +be retried. + +L adds new C parameter which can be +used to ensure the filter does not read indefinite amounts of input +when opening the tar file. + +Filters can now append their own output to nbdkit I<--dump-plugin> +output. + +=head2 Language bindings + +Rust bindings add support for C, C, +C, C, C, +C and C. The C +method can now return an error; note this is not backwards compatible +and requires a small source code change to Rust plugins. (Thanks Alan +Somers) + +L now supports OCaml 5. + +OCaml bindings add support for C, C, +C and C. + +L now supports Perl 5.38. + +Shell script plugins (L) may now ignore stdin in +their C method, whereas previously it was required to read and +discard stdin along error paths (thanks Eric Blake). + +=head2 Server + +When using the I<--run> option, the default is now to use a private +Unix domain socket (as if I<-U -> was specified), whereas in nbdkit +E 1.34 the default was to open a TCP port. The new default +reflects the most common and safest way to use the I<--run> option. +You can find out if nbdkit has the new behaviour by checking +S> and looking for C +in the output. + +Debug strings containing control codes and other non-printable +characters are now escaped properly. + +New flag I<-D nbdkit.environ=1> can be used to dump the server +environment in debug output. + +=head2 API + +New C function which can be used to parse +probabilities in various formats, like C<"10%"> or C<"1:10">. + +New C function which returns the +security context (usually SELinux label) of the client. + +=head2 Bug fixes + +Fix long-standing double-free in L when the +client closes the connection during negotiation (thanks Eric Blake). + +nbdkit-file-plugin now has improved error messages when you try to +open a file with an empty name (C<"">). + +=head2 Documentation + +Miscellaneous documentation improvements for Windows (Brian Carnes). + +Fuzzing instructions updated for Clang 17, AFL++ 4.08c. + +=head2 Tests + +Ongoing CI maintenance and fixes (Laszlo Ersek, Eric Blake). + +Many fixes in the test suite for MinGW and Wine. + +Several internal consistency checks were added to the test suite, to +ensure, for example, that we always use C when the test +uses the nbdkit I<--run> option. + +=head2 Build + +Optionally C can be used (instead of C) for faster +decompression in various places. + +No longer link with msvcrt on Windows. + +C is a build requirement. It was implicitly required before +(because it is needed by the C<./configure> script generated by +autoconf), but now the dependency is explicit (Eric Blake). + +=head2 Internals + +C has a new I<--replace> parameter which makes it easier +to use C-substitutions in documentation. + +=head1 SEE ALSO + +L. + +=head1 AUTHORS + +Authors of nbdkit 1.36: + +=begin comment + +git shortlog -s v1.34.0.. + +=end comment + +=over 4 + +=item Alan Somers + +=item Brian Carnes + +=item Eric Blake + +=item Laszlo Ersek + +=item Richard W.M. Jones + +=back + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/docs/nbdkit-release-notes-1.4.pod b/docs/nbdkit-release-notes-1.4.pod new file mode 100644 index 0000000..2b34aa4 --- /dev/null +++ b/docs/nbdkit-release-notes-1.4.pod @@ -0,0 +1,107 @@ +=head1 NAME + +nbdkit-release-notes-1.4 - release notes for nbdkit 1.4 + +=head1 DESCRIPTION + +These are the release notes for nbdkit stable release 1.4. +This describes the major changes since 1.2. + +nbdkit 1.4.0 was released on 6th July 2018. + +=head2 New features + +=over 4 + +=item * + +You can write plugins in Tcl, see +L. + +=item * + +Other new plugins: +nbdkit-ext2-plugin, +L, +L. + +=item * + +New filters: +L, +L, +L, +L. + +=item * + +Bash tab completion of nbdkit commands. + +=item * + +TLS Pre-Shared Keys (PSK) authentication. + +=item * + +We now default to the newstyle protocol, use -o to select oldstyle. + +=item * + +On-demand ramping of thread pool. + +=item * + +TRIM support in the file plugin. + +=item * + +Reworked error handling. + +=item * + +New C, C methods and better handling of FUA. + +=item * + +New C function. + +=item * + +C rewritten. + +=item * + +Better handling of shutdown path to ensure plugins can do long cleanups. + +=item * + +New C variables. + +=item * + +Regression test for IPv6 connections. + +=item * + +Of course numerous smaller bug fixes and improvements. + +=back + +=head2 Acknowledgements + +Thanks in particular to Eric Blake and Pino Toscano. + +=head1 SEE ALSO + +L, +L. + +=head1 AUTHORS + +Eric Blake + +Richard W.M. Jones + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/docs/nbdkit-release-notes-1.6.pod b/docs/nbdkit-release-notes-1.6.pod new file mode 100644 index 0000000..9d5b79e --- /dev/null +++ b/docs/nbdkit-release-notes-1.6.pod @@ -0,0 +1,112 @@ +=head1 NAME + +nbdkit-release-notes-1.6 - release notes for nbdkit 1.6 + +=head1 DESCRIPTION + +These are the release notes for nbdkit stable release 1.6. +This describes the major changes since 1.4. + +nbdkit 1.6.0 was released on 28th August 2018. + +=head2 New features + +=over 4 + +=item * + +You can now write plugins in the Lua scripting language, see +L. + +=item * + +nbdkit and common plugins are now "63 bit clean": the maximum disk +size supported is 2⁶³-1 bytes, and the core server and plugins now +have additional tests to check this works, even on 32 bit machines. + +=item * + +Multiple improvements to the L to make zeroing +and trimming perform better, work correctly with block devices, and +work on older Linux kernels [Nir Soffer, Eric Blake]. + +=item * + +New L generates a simple, fixed test pattern +for testing nbdkit filters and NBD clients. + +=item * + +New L can: truncate or extend the size of +plugins, or round up or down the size to next multiple of a power of +2. Useful for NBD clients like qemu which can only handle NBD sizes +which are a multiple of 512 bytes. + +=item * + +New L which can be used to inject errors into +the protocol for testing how clients can handle and recover from +errors. + +=item * + +New L allows you to specify (small) disk images +directly on the command line. + +=item * + +Enhanced error reporting in the Python plugin so full tracebacks +from errors are now displayed instead of being lost as before. + +=item * + +C now supported, so we can return errors when negotiating +the export name. + +=item * + +Support for logging error messages to syslog. + +=item * + +nbdkit can now be compiled with Clang (as well as GCC). + +=item * + +nbdkit can now be compiled on FreeBSD. + +=item * + +L is compiled unconditionally. You no longer +need to install the proprietary VDDK to compile it. + +=item * + +Debug messages now include the name of the filter when invoked from +a filter context. + +=item * + +Debug flags (I<-D> option) provides lightweight debugging for plugin +authors. + +=back + +=head2 Acknowledgements + +Thanks to all who contributed, especially Nir Soffer and Eric Blake. + +=head1 SEE ALSO + +L, +L. + +=head1 AUTHORS + +Eric Blake + +Richard W.M. Jones + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/docs/nbdkit-release-notes-1.8.pod b/docs/nbdkit-release-notes-1.8.pod new file mode 100644 index 0000000..645249b --- /dev/null +++ b/docs/nbdkit-release-notes-1.8.pod @@ -0,0 +1,118 @@ +=head1 NAME + +nbdkit-release-notes-1.8 - release notes for nbdkit 1.8 + +=head1 DESCRIPTION + +These are the release notes for nbdkit stable release 1.8. +This describes the major changes since 1.6. + +nbdkit 1.8.0 was released on 12th November 2018. + +=head2 New features + +=over 4 + +=item * + +New plugin: L for running shell scripts and other +external programs. See: +L + +=item * + +New plugin: L which creates a +partitioned disk from a list of partitions in files. + +=item * + +New plugin: L which creates an ISO (CD-ROM) +image on the fly from a directory of files. See: +L + +=item * + +New plugin: L which creates a virtual +FAT-formatted floppy disk from a directory of files. +L + +=item * + +Magic config key allows simpler invocation of many plugins, eg: + + nbdkit file file=foo + +becomes: + + nbdkit file foo + +=item * + +L: Add F script to generate data +parameters. + +=item * + +L Use C<<< >> to inline a file. + +=item * + +L: Use S> to enable extra +debug information. + +=item * + +tests: Use a helper function to refactor and simplify most tests. + +=item * + +L: Can handle E 128 GPT partitions. + +=item * + +nbdkit can be compiled on the Haiku operating system +(François Revol). + +=item * + +New C API for parsing boolean parameters +(Eric Blake). + +=item * + +L: Add C +(Eric Blake). + +=item * + +L: New C and C calls. + +=item * + +Analyze code under AddressSanitizer and ThreadSanitizer and fix bugs +(Eric Blake). + +=item * + +Analyze code under Coverity and fix bugs. + +=item * + +Tests now run more quickly. + +=back + +=head1 SEE ALSO + +L, +L. + +=head1 AUTHORS + +Eric Blake + +Richard W.M. Jones + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/docs/nbdkit-security.pod b/docs/nbdkit-security.pod new file mode 100644 index 0000000..07d803e --- /dev/null +++ b/docs/nbdkit-security.pod @@ -0,0 +1,48 @@ +=head1 NAME + +nbdkit-security - information about past security issues in nbdkit + +=head1 DESCRIPTION + +This page details past security issues found in nbdkit. + +For how to report new security issues, see the C file in the +top level source directory, also available online here: +L + +=head2 CVE-2019-14850 +denial of service due to premature opening of back-end connection + +See the full announcement and links to mitigation, tests and fixes +here: +https://www.redhat.com/archives/libguestfs/2019-September/msg00084.html + +=head2 CVE-2019-14851 +assertion failure by issuing commands in the wrong order + +This CVE was caused by the fix to the previous issue. + +See the full announcement and links to mitigation, tests and fixes +here: +https://www.redhat.com/archives/libguestfs/2019-September/msg00272.html + +=head2 CVE-2021-3716 +structured read denial of service attack against starttls + +See the full announcement and links to mitigation, tests and fixes +here: +https://www.redhat.com/archives/libguestfs/2021-August/msg00083.html + +=head1 SEE ALSO + +L. + +=head1 AUTHORS + +Eric Blake + +Richard W.M. Jones + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/docs/nbdkit-service.pod b/docs/nbdkit-service.pod new file mode 100644 index 0000000..130172e --- /dev/null +++ b/docs/nbdkit-service.pod @@ -0,0 +1,187 @@ +=head1 NAME + +nbdkit-service - running nbdkit as a service, and systemd socket activation + +=head1 DESCRIPTION + +Most people start nbdkit from the command line or run it from another +program (see L. It is also possible to run nbdkit +as a standalone service, which is what this page describes. + +=head1 SOCKET ACTIVATION + +nbdkit supports socket activation (sometimes called systemd socket +activation). This is a simple protocol where instead of nbdkit itself +opening the listening socket(s), the parent process (typically +systemd) passes in pre-opened file descriptors. Socket activation +lets you serve infrequent NBD requests using a superserver without +needing nbdkit to be running the whole time. + +Socket activation is triggered when both the C and +C environment variables are set. In this mode using +I<-i>, I<-p>, I<--run>, I<-s> or I<-U> flags on the command line is +illegal and will cause an error. Also in this mode nbdkit does not +fork into the background (ie. I<-f> is implied). + +=head2 Using socket activation with systemd + +To use nbdkit with socket activation from systemd, create a unit file +ending in C<.socket> (eg. F) +containing: + + [Unit] + Description=NBDKit Network Block Device server + + [Socket] + ListenStream=10809 + + [Install] + WantedBy=sockets.target + +There are various formats for the C key. See +L for more information. + +Also create a service unit (eg. F) +containing: + + [Service] + ExecStart=/usr/sbin/nbdkit file /path/to/serve + +For more information on systemd and socket activation, see +L + +=head1 INETD AND XINETD + +You can run nbdkit from L or L. For inetd use: + + nbd stream tcp nowait root /usr/sbin/nbdkit nbdkit -s file /tmp/disk.img + +For xinetd create a file F containing: + + service nbd + { + socket_type = stream + wait = no + user = root + server = /usr/sbin/nbdkit + server_args = -s file /tmp/disk.img + } + +=head1 LOGGING + +Error messages from nbdkit can be sent to standard error +(I<--log=stderr>), or to the system log (I<--log=syslog>), or can be +discarded completely (I<--log=null>, not recommended for normal use). + +The default, if I<--log> is not specified on the command line, is to +send error messages to stderr, unless nbdkit forks into the background +in which case they are sent to syslog. + +In detail: + +=over 4 + +=item Messages go to standard error (stderr): + +When running from the command line in the foreground. + +When using systemd socket activation. + +Using I<--log=stderr> forces all messages to go to standard error. + +=item Messages go to the system log (syslog): + +When running from the command line, forked into the background. + +Using I<--log=syslog> forces all messages to go to the system log. + +=back + +Debug messages (I<-v>/I<--verbose>) always go to standard error and +are never sent to the system log. + +=head1 AF_VSOCK + +On Linux nbdkit supports the C address family / protocol. +This allows you to serve NBD devices into virtual machines without +using a regular network connection. + +B that this is different from the usual case where you present +NBD as a virtual block device to a guest (which the guest sees as +something like a SATA or virtio-scsi disk). With C the +virtual machine sees a raw NBD socket which it can connect to by +opening an C connection. Only libnbd supports C +NBD client connections at the time of writing (2019). For more about +this protocol, see L + +=head2 AF_VSOCK example + +To set up an C server, use for example: + + nbdkit --vsock [--port PORT] memory 1G + +The optional I<-p>/I<--port> argument is used to change the +C port number. These port numbers exist in a different +namespace from TCP/IP port numbers. Also unlike TCP, the port numbers +are 32 bit. The default port is 10809. + +The guest that wishes to access nbdkit must be configured for +virtio-vsock. On the qemu command line use: + + qemu ... -device vhost-vsock-pci,id=vhost-vsock-pci0 + +For libvirt add this element to the C<<< >>> section: + + + +If you see the error C then you may +have to unload the VMCI transport on the host: + + modprobe -r vmw_vsock_vmci_transport + +Once nbdkit and the guest are running, from inside the guest you can +connect to nbdkit on the host using libnbd: + + nbdsh -c 'h.connect_vsock(2, 10809)' -c 'print(h.get_size())' + +=head1 ENVIRONMENT VARIABLES + +=over 4 + +=item C + +=item C + +If present in the environment when nbdkit starts up, these trigger +L. + +=back + +=head1 SEE ALSO + +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L. + +=head1 AUTHORS + +Eric Blake + +Richard W.M. Jones + +Pino Toscano + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/docs/nbdkit-tls.pod b/docs/nbdkit-tls.pod new file mode 100644 index 0000000..591386f --- /dev/null +++ b/docs/nbdkit-tls.pod @@ -0,0 +1,435 @@ +=head1 NAME + +nbdkit-tls - authentication and encryption of NBD connections +(sometimes called "SSL") + +=head1 SYNOPSIS + + nbdkit [--tls=off|on|require] + [--tls-certificates=/path/to/certificates] + [--tls-psk=/path/to/pskfile] + [--tls-verify-peer] + PLUGIN [...] + +=head1 DESCRIPTION + +TLS (authentication and encryption, sometimes incorrectly called +"SSL") is supported if nbdkit was compiled with GnuTLS. This allows +the server to verify that the client is allowed access, and to encrypt +the contents of the protocol in transit over the network. + +TLS can be disabled or enabled by specifying either I<--tls=off> or +I<--tls=on>. With I<--tls=off>, if a client tries to use TLS to +connect, it will be rejected by the server (in other words, as if the +server doesn't support TLS). + +I<--tls=on> means that the client may choose to connect either with or +without TLS. + +I<--tls=require> enables TLS B rejects all non-TLS connection +attempts. This prevents downgrade attacks where a malicious proxy +pretends not to support TLS in order to force either the client or +server to communicate in plaintext. + +=head2 Example + +If certificates have been set up correctly then you should be able to +start a TLS server by doing: + + nbdkit --tls=require memory 1G + +and connect to it by doing: + + nbdinfo nbds://localhost + +If certificates are in a non-standard directory and you have +S 1.10>: + + nbdkit --tls=require --tls-certificates=/certs memory 1G + nbdinfo nbds://localhost?tls-certificates=/certs + +=head2 TLS with X.509 certificates + +When nbdkit starts up, it loads TLS certificates from some built-in +paths, or from the directory specified by the I<--tls-certificates> +option. + +In this directory, nbdkit expects to find several files: + +=over 4 + +=item F + +The Certificate Authority certificate. + +=item F + +The server certificate. + +=item F + +The server private key. + +=item F + +(Optional) The certificate revocation list. + +=back + +=head3 Setting up the Certificate Authority + +This step only needs to be done once per organization. It may be that +your organization already has a CA. + + $ certtool --generate-privkey > ca-key.pem + $ chmod 0600 ca-key.pem + +The F file is the CA private key and is I +sensitive data. With possession of this key, anyone can create +certificates pretending to be your organization! + +To create the CA certificate file: + + $ cat > ca.info < server-key.pem + $ chmod 0600 server-key.pem + +The server key file is sensitive. Setting the mode to C<0600> helps +to prevent other users on the same machine from reading it. + +The common name (C below) field must be the fully qualified +hostname that the client connects to. However most clients and +servers including nbdkit support the Subject Alternative Name +extension (S) which uses the C and C +fields and deprecates C. + + $ cat > server.info < You don't need to create client certificates unless you want +to check and limit which clients can connect to nbdkit. B unless you specify the +I<--tls-verify-peer> option on the command line. There are other +methods for limiting access to nbdkit including +L. + +For each client you should generate a private key and a client +certificate: + + $ certtool --generate-privkey > client-key.pem + $ chmod 0600 client-key.pem + +The client key file is sensitive. + +The client DNS name (C below) is the client's name that nbdkit +sees and checks. + + $ cat > client.info < need to be present anywhere on the +nbdkit host. You don't need to copy them into nbdkit's TLS +certificates directory. The security comes from the fact that the +client must present a client certificate signed by the Certificate +Authority, and nbdkit can check this because it has the F +file. + +To enable checking of client certificates, specify the +I<--tls-verify-peer> option on the command line. Clients which don't +present a valid certificate (eg. not signed, incorrect signature) are +denied. Also denied are clients which present a valid certificate +signed by another CA. Also denied are clients with certificates added +to the certificate revocation list (F). + +=head2 Connecting nbd-client to nbdkit with TLS certificates + +With the TLS certificates files generated above in the current +directory (C<.>) you can use: + + nbdkit --tls=require --tls-certificates=. --tls-verify-peer memory 1G + + nbd-client /dev/nbd0 \ + -cacertfile ca-cert.pem \ + -certfile client-cert.pem \ + -keyfile client-key.pem + +I<--tls-verify-peer> is only required if you want to check the client +certificate. If you want to allow any client to connect then you can +omit it. + +=head2 TLS with Pre-Shared Keys (PSK) + +As a simpler alternative to TLS certificates, you may use pre-shared +keys to authenticate clients. + +Create a PSK file containing one or more C pairs. It is +easiest to use L for this: + + mkdir -m 0700 /tmp/keys + psktool -u alice -p /tmp/keys/keys.psk + +The PSK file contains the hex-encoded random keys in plaintext. Any +client which can read this file will be able to connect to the server. + +Use the nbdkit I<--tls-psk> option to start the server: + + nbdkit --tls=require --tls-psk=/tmp/keys/keys.psk file disk.img + +This option overrides X.509 certificate authentication. + +Clients must supply one of the usernames in the PSK file and the +corresponding key in order to connect. + +An example of connecting using L using an NBD URI is: + + nbdinfo 'nbds://alice@localhost?tls-psk-file=/tmp/keys/keys.psk' + +An example of connecting using L is: + + qemu-img info \ + --object tls-creds-psk,id=tls0,dir=/tmp/keys,username=alice,endpoint=client \ + --image-opts \ + file.driver=nbd,file.host=localhost,file.port=10809,file.tls-creds=tls0,file.export=/ + +=head2 Default TLS behaviour + +If nbdkit was compiled without GnuTLS support, then TLS is disabled +and TLS connections will be rejected (as if I<--tls=off> was specified +on the command line). Also it is impossible to turn on TLS in this +scenario. You can tell if nbdkit was compiled without GnuTLS support +because C will contain C. + +If TLS certificates cannot be loaded either from the built-in path or +from the directory specified by I<--tls-certificates>, then TLS +defaults to disabled. Turning TLS on will give a warning +(I<--tls=on>) or error (I<--tls=require>) about the missing +certificates. + +If TLS certificates can be loaded from the built-in path or from the +I<--tls-certificates> directory, then TLS will by default be enabled +(like I<--tls=on>), but it is not required. Clients can choose +whether or not to use TLS and whether or not to present certificates. + +TLS client certificates are I checked by default unless you +specify I<--tls-verify-peer>. + +If the I<--tls-psk> option is used then TLS is enabled (but I +required). To ensure that all clients are authorized you must use +I<--tls=require>. + +Each of these defaults is insecure to some extent (including +I<--tls=on> which could be subject to a downgrade attack). If you +expect TLS then it is best to specify I<--tls=require>, and if you +want to check client certificates, additionally use the +I<--tls-verify-peer> option. + +=head2 Controlling TLS fallback to plaintext + +When I<--tls=on> is used, the connection can fall back to plaintext. +You can use L to provide safe fallback +content to plaintext connections. With this filter the underlying +plugin content is only served on secure connections. + +Alternatively a plugin may wish to serve different content depending +on whether the client is using TLS. The function C +can be used during the C<.open> callback for that purpose. + +=head2 NBD URIs for TLS + +Tools such L, L and L (from +L) allow you to use C or C URIs to +connect to nbdkit servers using TLS. + +The syntax is fully documented in the NBD URI specification: +L. +This section contains an outline. You can also find further examples +in L. + +=over 4 + +=item Bexample.com + +Connect over TCP with TLS, to C port 10809. If the +server does not support TLS then this will fail. + +=item BSOCKET + +As above, but connect over a Unix domain socket called F. + +=item BSOCKETB<&tls-certificates=>DIR + +As above, but specify the directory F containing TLS certificates +(used by the client to verify the server, and to present client +authentication to the server). Note this requires S 1.10>. + +=item BSOCKETB<&tls-psk-file=>FILENAME + +As above, but use TLS with Pre-Shared Keys (PSK), stored in the +secrets file F. + +=item BaliceB<@/?socket=>SOCKETB<&tls-psk-file=>FILENAME + +As above, but use C as the username. + +=back + +=head2 Default location of certificates + +Without I<--tls-certificates> nbdkit and libnbd look in several +locations for certificates. + +If nbdkit is started as a non-root user (note this does not include +use of the I<-u> or I<-g> options), nbdkit looks in each of these +paths in turn: + + $HOME/.pki/nbdkit/ + $HOME/.config/pki/nbdkit/ + +If nbdkit is started as root: + + $sysconfdir/pki/nbdkit/ + +where $sysconfdir is set when nbdkit is compiled, usually F. +(Use C and look at the +C setting to get the actual directory built +into the binary.) + +In libnbd the paths are different. For non-root: + + $HOME/.pki/libnbd/ + $HOME/.config/pki/libnbd/ + +For root: + + $sysconfdir/pki/libnbd/ + +In nbdkit you can override these directories by using +I<--tls-certificates=/path/to/certificates>. + +In libnbd you can use L. +In S 1.10> you can append +C<&tls-certificates=/path/to/certificates> to URIs. + +=head2 Choice of TLS algorithms + +TLS has a bewildering choice of algorithms that can be used. To +enable you to choose a default set of algorithms, there is a configure +setting I<--with-tls-priority>. This defaults to C which, to +quote the GnuTLS documentation: + +=over 4 + +"C means all C ciphersuites. The 256-bit ciphers are +included as a fallback only. The ciphers are sorted by security +margin." + +=back + +You could also set the TLS priority so that it can be configured from +a file at runtime: + + ./configure --with-tls-priority=@SYSTEM + +means use the policy from F. + + ./configure --with-tls-priority=@NBDKIT,SYSTEM + +means use the policy from +F and fall back to +F if the first file does not exist. + +More information can be found in L. + +=head2 Debugging TLS connections + +Encrypted connections makes snooping on network traffic with Wireshark +impossible, by design. + +The TLS library used by nbdkit, called gnutls, supports the +C standard: +L + +Before running nbdkit set the environment variable to point to a log +file (note it will append to the file if it already exists): + + SSLKEYLOGFILE=/tmp/keylog nbdkit [...] + +In Wireshark go to Edit → Preferences → Protocols → TLS and set +S<(Pre)-Master-Secret log filename> to the log file name. Wireshark +should be able to see the unencrypted traffic. For further +information read: +L + +=head1 SEE ALSO + +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L. + +=head1 AUTHORS + +Eric Blake + +Richard W.M. Jones + +Pino Toscano + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/docs/nbdkit.pod b/docs/nbdkit.pod new file mode 100644 index 0000000..2732a28 --- /dev/null +++ b/docs/nbdkit.pod @@ -0,0 +1,804 @@ +=head1 NAME + +nbdkit - toolkit for creating Network Block Device (NBD) servers + +=head1 SYNOPSIS + +__SYNOPSIS__ + +=head1 DESCRIPTION + +Network Block Device (NBD) is a network protocol for accessing block +devices over the network. Block devices are hard disks and things +that behave like hard disks such as disk images and virtual machines. + +nbdkit is both a toolkit for creating NBD servers from +“unconventional” sources, and the name of an NBD server. nbdkit ships +with many plugins for performing common tasks like serving local +files. + +=head2 Plugins and filters + +nbdkit is different from other NBD servers because you can easily +create new Network Block Device sources by writing a few glue +functions, possibly in C, or perhaps in a high level language like +Perl or Python. The liberal licensing of nbdkit is meant to allow you +to link nbdkit with proprietary libraries or to include nbdkit in +proprietary code. + +If you want to write your own nbdkit plugin you should read +L. + +nbdkit also has a concept of filters which can be layered on top of +plugins. Several filters are provided with nbdkit and if you want to +write your own you should read L. + +=head1 EXAMPLES + +=head2 Basic file serving + +=over 4 + +=item * + +Serve file F on port 10809 using L, +and connect to it using L: + + nbdkit file disk.img + guestfish --rw --format=raw -a nbd://localhost + +=item * + +Serve file F on port 10809, requiring clients to use +encrypted (TLS) connections: + + nbdkit --tls=require file disk.img + +=back + +=head2 Other nbdkit plugins + +=over 4 + +=item * + +Create a small disk containing test patterns using +L: + + nbdkit data ' ( 0x55 0xAA )*2048 ' + +=item * + +Forward an NBD connection to a remote server over HTTPS or SSH using +L or L: + + nbdkit -r curl https://example.com/disk.img + +=for paragraph + + nbdkit ssh host=example.com /var/tmp/disk.img + +=item * + +Create a sparse 1 terabyte RAM disk using L +and use it as a loop device (L): + + nbdkit memory 1T + nbd-client localhost /dev/nbd0 + +=item * + +Create a floppy disk image containing files from a local directory +using L: + + nbdkit floppy dir/ + +=back + +=head2 Combining plugins and filters + +=over 4 + +=item * + +Serve only the first partition from compressed disk image +F, combining L, +L and L. + + nbdkit --filter=partition --filter=xz file disk.img.xz partition=1 + +To understand this command line: + + plugin name and plugin parameter + │ + ┌───────┴──────┐ + │ │ + nbdkit --filter=partition --filter=xz file disk.img.xz partition=1 + │ │ │ + └──────────────┴────┬─────────────────────┘ + │ + filters and filter parameter + +=item * + +Create a scratch, empty nbdkit device and inject errors and delays, +for testing clients, using L, +L and L: + + nbdkit --filter=error --filter=delay memory 100M \ + error-rate=10% rdelay=1 wdelay=1 + +=back + +=head2 Writing plugins in shell script + +=over 4 + +=item * + +Write a simple, custom plugin in shell script using +L: + + nbdkit sh - <<'EOF' + case "$1" in + get_size) echo 1M ;; + pread) dd if=/dev/zero count=$3 iflag=count_bytes ;; + *) exit 2 ;; + esac + EOF + +=item * + +The same example as above can be written entirely on the command line +using L: + + nbdkit eval get_size='echo 1M' \ + pread='dd if=/dev/zero count=$3 iflag=count_bytes' + +=back + +=head2 Display information + +Display information about nbdkit or a specific plugin: + + nbdkit --help + nbdkit --version + nbdkit --dump-config + nbdkit example1 --help + nbdkit example1 --dump-plugin + +=head1 GLOBAL OPTIONS + +=over 4 + +=item B<--help> + +Display brief command line usage information and exit. + +=item B<-4> + +=item B<--ipv4-only> + +=item B<-6> + +=item B<--ipv6-only> + +When a non-numeric argument is passed to the I<-i> option (such as a +Fully Qualified Domain Name, or a host name from C), +restrict the name resolution to IPv4 or IPv6 addresses. + +When the I<-i> option is omitted, listen on only the IPv4 or IPv6 +address of all interfaces (C<0.0.0.0> or C<::>, respectively). + +When both I<-4> and I<-6> options are present on the command line, the +last one takes effect. + +=item B<-D> PLUGIN.FLAG=N + +=item B<-D> FILTER.FLAG=N + +=item B<--debug> PLUGIN.FLAG=N + +=item B<--debug> FILTER.FLAG=N + +Set the plugin or filter Debug Flag called C to the integer +value C. See L. + +=item B<-D> nbdkit.FLAG=N + +=item B<--debug> nbdkit.FLAG=N + +(nbdkit E 1.18) + +Set the nbdkit server Debug Flag called C to the integer value +C. See L below. + +=item B<--dump-config> + +Dump out the compile-time configuration values and exit. +See L. + +=item B<--dump-plugin> + +Dump out information about the plugin and exit. +See L. + +=item B<--exit-with-parent> + +If the parent process exits, we exit. This can be used to avoid +complicated cleanup or orphaned nbdkit processes. There are some +important caveats with this, see L. + +An alternative to this is L. + +This option implies I<--foreground>. + +=item B<-e> EXPORTNAME + +=item B<--export=>EXPORTNAME + +=item B<--export-name=>EXPORTNAME + +=item B<--exportname=>EXPORTNAME + +Set a preferred exportname to expose in the shell environment created +during I<--run>. The use of this option without I<--run> has no +effect. This option does I change what nbdkit advertises as a +server, but can aid in writing a captive client that wants to access +particular content from a plugin that differentiates content based on +the client's choice of export name. + +If not set, the I<--run> environment is set to access the default +exportname C<""> (empty string). + +=item B<--filter=>FILTER + +Add a filter before the plugin. This option may be given one or more +times to stack filters in front of the plugin. They are processed in +the order they appear on the command line. See L and +L. + +=item B<-f> + +=item B<--foreground> + +=item B<--no-fork> + +I fork into the background. + +=item B<-g> GROUP + +=item B<--group=>GROUP + +Change group to C after starting up. A group name or numeric +group ID can be used. + +The server needs sufficient permissions to be able to do this. +Normally this would mean starting the server up as root. + +See also I<-u>. + +=item B<-i> IPADDR + +=item B<--ip-addr=>IPADDR + +=item B<--ipaddr=>IPADDR + +Listen on the specified interface. The default is to listen on all +interfaces. See also I<-4>, I<-6>, and I<-p>. + +=item B<--log=stderr> + +=item B<--log=syslog> + +=item B<--log=null> + +Send error messages to standard error (I<--log=stderr>), or to the +system log (I<--log=syslog>), or discard them completely +(I<--log=null>, not recommended for normal use). + +The default is to send error messages to stderr, unless nbdkit +forks into the background in which case they are sent to syslog. + +For more details see L. + +=item B<--mask-handshake=>MASK + +This option can be used to mask off particular global features which +are advertised during new-style handshake (defaulting to all supported +bits set). See L. + +=item B<-n> + +=item B<--new-style> + +=item B<--newstyle> + +Use the newstyle NBD protocol. This is the default in nbdkit +E 1.3. In earlier versions the default was oldstyle. +See L. + +=item B<--no-sr> + +Do not advertise structured replies. A client must request structured +replies to take advantage of block status and potential sparse reads; +however, as structured reads are not a mandatory part of the newstyle +NBD protocol, this option can be used to debug client fallbacks for +dealing with older servers. See L. + +=item B<-o> + +=item B<--old-style> + +=item B<--oldstyle> + +Use the oldstyle NBD protocol. This I the default in nbdkit +E 1.2, but now the default is newstyle. Note this is incompatible +with newer features such as export names and TLS. +See L. + +=item B<-P> PIDFILE + +=item B<--pid-file=>PIDFILE + +=item B<--pidfile=>PIDFILE + +Write C (containing the process ID of the server) after +nbdkit becomes ready to accept connections. + +If the file already exists, it is overwritten. nbdkit I +delete the file when it exits. + +=item B<-p> PORT + +=item B<--port=>PORT + +Change the TCP/IP port number on which nbdkit serves requests. +The default is C<10809>. See also I<-i>. + +=item B<-r> + +=item B<--read-only> + +=item B<--readonly> + +The export will be read-only. If a client writes, then it will get an +error. + +Note that some plugins inherently don't support writes. With those +plugins the I<-r> option is added implicitly. + +L can be placed over read-only plugins to +provide copy-on-write (or "snapshot") functionality. If you are using +qemu as a client then it also supports snapshots. + +=item B<--run> 'COMMAND ARGS ...' + +Run nbdkit as a captive subprocess of the command. When the command +exits, nbdkit is killed. See L. + +Note that the command is executed by F. On some platforms +like Debian this might not be a full-featured shell. + +This option implies I<--foreground>. + +In nbdkit E 1.34 you normally had to add I<-U ->, otherwise nbdkit +would use a TCP/IP port which was not what you wanted. In nbdkit +E 1.36, using I<--run> implies I<-U ->. If you want the old +behaviour of nbdkit then you must use the I<--port> option explicitly. + +=item B<--selinux-label=>SOCKET-LABEL + +Apply the SELinux label C to the nbdkit listening +socket. + +The common — perhaps only — use of this option is to allow libvirt +guests which are using SELinux and sVirt confinement to access nbdkit +Unix domain sockets. The example below shows how to do this. Note +that the socket and filesystem labels are different. + + nbdkit -U /tmp/sock --selinux-label=system_u:object_r:svirt_socket_t:s0 ... + chcon system_u:object_r:svirt_image_t:s0 /tmp/sock + +=item B<-s> + +=item B<--single> + +=item B<--stdin> + +Don't fork. Handle a single NBD connection on stdin/stdout. After +stdin closes, the server exits. + +You can use this option to run nbdkit from inetd or similar +superservers; or just for testing; or if you want to run nbdkit in a +non-conventional way. Note that if you want to run nbdkit from +systemd, then it may be better to use +L instead of this option. + +This option implies I<--foreground>. + +=item B<--swap> + +(nbdkit E 1.18) + +Specifies that the NBD device will be used as swap space loop mounted +on the same machine which is running nbdkit. To avoid deadlocks this +locks the whole nbdkit process into memory using L. This +may require additional permissions, such as starting the server as +root or raising the C (L I<-l>) limit on +the process. + +=item B<-t> THREADS + +=item B<--threads=>THREADS + +Set the number of threads to be used per connection, which in turn +controls the number of outstanding requests that can be processed at +once. Only matters for plugins with thread_model=parallel (where it +defaults to 16). To force serialized behavior (useful if the client +is not prepared for out-of-order responses), set this to 1. + +=item B<--tls=off> + +=item B<--tls=on> + +=item B<--tls=require> + +Disable, enable or require TLS (authentication and encryption +support). See L. + +=item B<--tls-certificates=>/path/to/certificates + +Set the path to the TLS certificates directory. If not specified, +some built-in paths are checked. See L for more +details. + +=item B<--tls-psk=>/path/to/pskfile + +Set the path to the pre-shared keys (PSK) file. If used, this +overrides certificate authentication. There is no built-in path. See +L for more details. + +=item B<--tls-verify-peer> + +Enables TLS client certificate verification. The default is I to +check the client's certificate. + +=item B<-U> SOCKET + +=item B<--unix=>SOCKET + +=item B<-U -> + +=item B<--unix -> + +Accept connections on the Unix domain socket C (which is a +path). + +nbdkit creates this socket, but it will probably have incorrect +permissions (too permissive). If it is a problem that some +unauthorized user could connect to this socket between the time that +nbdkit starts up and the authorized user connects, then put the socket +into a directory that has restrictive permissions. + +nbdkit does B delete the socket file when it exits. The caller +should delete the socket file after use (else if you try to start +nbdkit up again you will get an C
error). + +If the socket name is I<-> then nbdkit generates a randomly named +private socket. This is implied by the I<--run> option. See also +L. + +=item B<-u> USER + +=item B<--user=>USER + +Change user to C after starting up. A user name or numeric user +ID can be used. + +The server needs sufficient permissions to be able to do this. +Normally this would mean starting the server up as root. + +See also I<-g>. + +=item B<-v> + +=item B<--verbose> + +Enable verbose messages. + +It's a good idea to use I<-f> as well so the process does not fork +into the background (but not required). + +=item B<-V> + +=item B<--version> + +Print the version number of nbdkit and exit. + +The I<--dump-config> option provides separate major and minor numbers +and may be easier to parse from shell scripts. + +=item B<--vsock> + +(nbdkit E 1.16) + +Use the AF_VSOCK protocol (instead of TCP/IP). You must use this in +conjunction with I<-p>/I<--port>. See L. + +=back + +=head1 PLUGIN NAME + +You can give the full path to the plugin, like this: + + nbdkit $libdir/nbdkit/plugins/nbdkit-file-plugin.so [...] + +but it is usually more convenient to use this equivalent syntax: + + nbdkit file [...] + +C<$libdir> is set at compile time. To print it out, do: + + nbdkit --dump-config + +=head1 PLUGIN CONFIGURATION + +After specifying the plugin name you can (optionally, it depends +on the plugin) give plugin configuration on the command line in +the form of C. For example: + + nbdkit file file=disk.img + +To list all the options supported by a plugin, do: + + nbdkit --help file + +To dump information about a plugin, do: + + nbdkit file --dump-plugin + +=head2 Magic parameters + +Some plugins declare a special "magic config key". This is a key +which is assumed if no C part is present. For example: + + nbdkit file disk.img + +is assumed to be C because the file plugin declares +C as its magic config key. There can be ambiguity in the +parsing of magic config keys if the value might look like a +C. If there could be ambiguity then modify the value, +eg. by prefixing it with C<./> + +There is also a special exception for plugins which do not declare a +magic config key, but where the first plugin argument does not contain +an C<'='> character: it is assumed to be C. This is +used by scripting language plugins: + + nbdkit perl foo.pl [args...] + +has the same meaning as: + + nbdkit perl script=foo.pl [args...] + +=head2 Shebang scripts + +You can use C<#!> to run nbdkit plugins written in most scripting +languages. The file should be executable. For example: + + #!/usr/sbin/nbdkit perl + sub open { + # etc + } + +(see L for a full example). + +=head1 SERVER DEBUG FLAGS + +As well as enabling or disabling debugging in the server using +I<--verbose> you can control extra debugging in the server using the +S> flags listed in this section. Note these flags are +an internal implementation detail of the server and may be changed or +removed at any time in the future. + +=over 4 + +=item B<-D nbdkit.backend.controlpath=0> + +=item B<-D nbdkit.backend.controlpath=1> + +=item B<-D nbdkit.backend.datapath=0> + +=item B<-D nbdkit.backend.datapath=1> + +These flags control the verbosity of nbdkit backend debugging messages +(the ones which show every request processed by the server). The +default for both settings is C<1> (normal debugging) but you can set +them to C<0> to suppress these messages. + +S> is the more useful setting which +lets you suppress messages about pread, pwrite, zero, trim, +etc. commands. When transferring large amounts of data these messages +are numerous and not usually very interesting. + +S> suppresses the non-datapath +commands (config, open, close, can_write, etc.) + +=item B<-D nbdkit.environ=1> + +Print nbdkit's environment variables in the debug output at start up. +This is insecure because environment variables may contain both +sensitive and user-controlled information, so it should not be used +routinely. But it is useful for tracking down problems related to +environment variables. + +=item B<-D nbdkit.tls.log=>N + +Enable TLS logging. C can be in the range 0 (no logging) to 99. +See L. + +=item B<-D nbdkit.tls.session=1> + +Print additional information about the TLS session, such as the type +of authentication and encryption, and client certificate information. + +=back + +=head1 SIGNALS + +nbdkit responds to the following signals: + +=over 4 + +=item C + +=item C + +=item C + +The server exits cleanly. + +=item C + +This signal is ignored. + +=back + +=head1 ENVIRONMENT VARIABLES + +=over 4 + +=item C + +=item C + +If present in the environment when nbdkit starts up, these trigger +L. + +=back + +=head1 SEE ALSO + +=head2 Other topics + +L — Run nbdkit under another process and have it +reliably cleaned up. + +L — How to mount NBD filesystems on a client machine. + +L — Use nbdkit with the Linux kernel client to create +loop devices and loop mounts. + +L — How to probe for nbdkit configuration and plugins. + +L — Which parts of the NBD protocol nbdkit supports. + +L — Lists past security issues in nbdkit. + +L — Running nbdkit as a service, and systemd socket +activation. + +L — Authentication and encryption of NBD connections +(sometimes incorrectly called "SSL"). + +=head2 Plugins + +__PLUGIN_LINKS__. + +=head2 Filters + +__FILTER_LINKS__. + +=head2 For developers + +L, +L. + +=head2 Writing plugins in other programming languages + +__LANG_PLUGIN_LINKS__. + +=head2 Release notes for previous releases of nbdkit + +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L. + +=head2 NBD clients + +L, +L, +L, +L, +L, +L, +L, +L. + +=head2 nbdkit links + +L — Source code. + +=head2 Other NBD servers + +L, +L, +L, +L. + +=head2 Documentation for the NBD protocol + +L, +L. + +=head2 Similar protocols + +L, +L, +L. + +=head2 Other manual pages of interest + +L, +L, +L, +L. + +=head1 AUTHORS + +Eric Blake + +Laszlo Ersek + +Richard W.M. Jones + +Yann E. MORIN + +Nikolaus Rath + +François Revol + +Nir Soffer + +Alan Somers + +Pino Toscano + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/docs/synopsis.txt b/docs/synopsis.txt new file mode 100644 index 0000000..b1e154b --- /dev/null +++ b/docs/synopsis.txt @@ -0,0 +1,24 @@ +nbdkit [-4|--ipv4-only] [-6|--ipv6-only] + [-D|--debug PLUGIN|FILTER|nbdkit.FLAG=N] + [--exit-with-parent] [-e|--exportname EXPORTNAME] + [--filter=FILTER ...] [-f|--foreground] + [-g|--group GROUP] [-i|--ipaddr IPADDR] + [--log=stderr|syslog|null] [--mask-handshake=MASK] + [-n|--newstyle] [--no-sr] [-o|--oldstyle] + [-P|--pidfile PIDFILE] [-p|--port PORT] + [-r|--readonly] [--run 'COMMAND ARGS ...'] + [--selinux-label=LABEL] [-s|--single] [--swap] + [-t|--threads THREADS] [--tls=off|on|require] + [--tls-certificates=/path/to/certificates] + [--tls-psk=/path/to/pskfile] [--tls-verify-peer] + [-U|--unix SOCKET|-] [-u|--user USER] + [-v|--verbose] [--vsock] + PLUGIN [[KEY=]VALUE [KEY=VALUE [...]]] + +nbdkit --dump-config + +nbdkit PLUGIN --dump-plugin + +nbdkit --help + +nbdkit [-V|--version] diff --git a/filters/Makefile.am b/filters/Makefile.am new file mode 100644 index 0000000..9de4a47 --- /dev/null +++ b/filters/Makefile.am @@ -0,0 +1,36 @@ +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 $(top_srcdir)/common-rules.mk + +EXTRA_DIST = filters.syms + +SUBDIRS = $(filters) diff --git a/filters/Makefile.in b/filters/Makefile.in new file mode 100644 index 0000000..5c5384d --- /dev/null +++ b/filters/Makefile.in @@ -0,0 +1,807 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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@ +subdir = filters +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ocaml.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir distdir-am +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/common-rules.mk +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ +BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ +CARGO = @CARGO@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_PLUGIN_CC = @CC_PLUGIN_CC@ +CC_PLUGIN_CFLAGS = @CC_PLUGIN_CFLAGS@ +CERTTOOL = @CERTTOOL@ +CFLAGS = @CFLAGS@ +COM_ERR_CFLAGS = @COM_ERR_CFLAGS@ +COM_ERR_LIBS = @COM_ERR_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CUT = @CUT@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LDFLAGS = @DL_LDFLAGS@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXT2FS_CFLAGS = @EXT2FS_CFLAGS@ +EXT2FS_LIBS = @EXT2FS_LIBS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GENISOIMAGE = @GENISOIMAGE@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GOARCH = @GOARCH@ +GOLANG = @GOLANG@ +GOOS = @GOOS@ +GOROOT = @GOROOT@ +GREP = @GREP@ +IMPORT_LIBRARY_ON_WINDOWS = @IMPORT_LIBRARY_ON_WINDOWS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +ISOPROG = @ISOPROG@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBLKIO_CFLAGS = @LIBBLKIO_CFLAGS@ +LIBBLKIO_LIBS = @LIBBLKIO_LIBS@ +LIBGUESTFS_CFLAGS = @LIBGUESTFS_CFLAGS@ +LIBGUESTFS_LIBS = @LIBGUESTFS_LIBS@ +LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ +LIBLZMA_LIBS = @LIBLZMA_LIBS@ +LIBNBD_CFLAGS = @LIBNBD_CFLAGS@ +LIBNBD_LIBS = @LIBNBD_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSELINUX_CFLAGS = @LIBSELINUX_CFLAGS@ +LIBSELINUX_LIBS = @LIBSELINUX_LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTORRENT_CFLAGS = @LIBTORRENT_CFLAGS@ +LIBTORRENT_LIBS = @LIBTORRENT_LIBS@ +LIBVIRT_CFLAGS = @LIBVIRT_CFLAGS@ +LIBVIRT_LIBS = @LIBVIRT_LIBS@ +LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ +LIBZSTD_LIBS = @LIBZSTD_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LUA_CFLAGS = @LUA_CFLAGS@ +LUA_LIBS = @LUA_LIBS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MC = @MC@ +MKDIR_P = @MKDIR_P@ +MKISOFS = @MKISOFS@ +NBDKIT_VERSION_MAJOR = @NBDKIT_VERSION_MAJOR@ +NBDKIT_VERSION_MICRO = @NBDKIT_VERSION_MICRO@ +NBDKIT_VERSION_MINOR = @NBDKIT_VERSION_MINOR@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_ON_WINDOWS = @NO_UNDEFINED_ON_WINDOWS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OCAML = @OCAML@ +OCAMLBEST = @OCAMLBEST@ +OCAMLBUILD = @OCAMLBUILD@ +OCAMLC = @OCAMLC@ +OCAMLCDOTOPT = @OCAMLCDOTOPT@ +OCAMLDEP = @OCAMLDEP@ +OCAMLDOC = @OCAMLDOC@ +OCAMLLIB = @OCAMLLIB@ +OCAMLMKLIB = @OCAMLMKLIB@ +OCAMLMKTOP = @OCAMLMKTOP@ +OCAMLOPT = @OCAMLOPT@ +OCAMLOPTDOTOPT = @OCAMLOPTDOTOPT@ +OCAMLOPTFLAGS = @OCAMLOPTFLAGS@ +OCAMLVERSION = @OCAMLVERSION@ +OCAML_MAJOR = @OCAML_MAJOR@ +OCAML_PLUGIN_LIBRARIES = @OCAML_PLUGIN_LIBRARIES@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PERL_ARCHLIB = @PERL_ARCHLIB@ +PERL_CFLAGS = @PERL_CFLAGS@ +PERL_LDOPTS = @PERL_LDOPTS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PODWRAPPER = @PODWRAPPER@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_CXX = @PTHREAD_CXX@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CFLAGS = @PYTHON_CFLAGS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +RUBY_CFLAGS = @RUBY_CFLAGS@ +RUBY_LIBS = @RUBY_LIBS@ +RUSTC = @RUSTC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOEXT = @SOEXT@ +SSH_CFLAGS = @SSH_CFLAGS@ +SSH_LIBS = @SSH_LIBS@ +STAT = @STAT@ +STRIP = @STRIP@ +TCL_CFLAGS = @TCL_CFLAGS@ +TCL_LIBS = @TCL_LIBS@ +TRUNCATE = @TRUNCATE@ +VALGRIND = @VALGRIND@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VERSION = @VERSION@ +WARNINGS_CFLAGS = @WARNINGS_CFLAGS@ +XORRISO = @XORRISO@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +ZLIB_NG_CFLAGS = @ZLIB_NG_CFLAGS@ +ZLIB_NG_LIBS = @ZLIB_NG_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DLLTOOL = @ac_ct_DLLTOOL@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_MC = @ac_ct_MC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bashcompdir = @bashcompdir@ +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@ +filters = @filters@ +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@ +lang_plugins = @lang_plugins@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +non_lang_plugins = @non_lang_plugins@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugins = @plugins@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +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@ + +# Convenient list terminator +NULL = +plugindir = $(libdir)/nbdkit/plugins +filterdir = $(libdir)/nbdkit/filters +CLEANFILES = *~ *.cmi *.cmx *.cmxa *.so *.dll +EXTRA_DIST = filters.syms +SUBDIRS = $(filters) +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common-rules.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign filters/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign filters/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; +$(top_srcdir)/common-rules.mk $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am clean clean-generic clean-libtool cscopelist-am ctags \ + ctags-am distclean distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# 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/filters/blocksize-policy/Makefile.am b/filters/blocksize-policy/Makefile.am new file mode 100644 index 0000000..7e8052e --- /dev/null +++ b/filters/blocksize-policy/Makefile.am @@ -0,0 +1,74 @@ +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 $(top_srcdir)/common-rules.mk + +EXTRA_DIST = nbdkit-blocksize-policy-filter.pod + +filter_LTLIBRARIES = nbdkit-blocksize-policy-filter.la + +nbdkit_blocksize_policy_filter_la_SOURCES = \ + policy.c \ + $(top_srcdir)/include/nbdkit-filter.h \ + $(NULL) + +nbdkit_blocksize_policy_filter_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/common/include \ + -I$(top_srcdir)/common/utils \ + $(NULL) +nbdkit_blocksize_policy_filter_la_CFLAGS = $(WARNINGS_CFLAGS) +nbdkit_blocksize_policy_filter_la_LDFLAGS = \ + -module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \ + $(NULL) +if USE_LINKER_SCRIPT +nbdkit_blocksize_policy_filter_la_LDFLAGS += \ + -Wl,--version-script=$(top_srcdir)/filters/filters.syms +endif +nbdkit_blocksize_policy_filter_la_LIBADD = \ + $(top_builddir)/common/utils/libutils.la \ + $(top_builddir)/common/replacements/libcompat.la \ + $(IMPORT_LIBRARY_ON_WINDOWS) \ + $(NULL) + +if HAVE_POD + +man_MANS = nbdkit-blocksize-policy-filter.1 +CLEANFILES += $(man_MANS) + +nbdkit-blocksize-policy-filter.1: nbdkit-blocksize-policy-filter.pod \ + $(top_builddir)/podwrapper.pl + $(PODWRAPPER) --section=1 --man $@ \ + --html $(top_builddir)/html/$@.html \ + $< + +endif HAVE_POD diff --git a/filters/blocksize-policy/Makefile.in b/filters/blocksize-policy/Makefile.in new file mode 100644 index 0000000..766a36c --- /dev/null +++ b/filters/blocksize-policy/Makefile.in @@ -0,0 +1,937 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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@ +@USE_LINKER_SCRIPT_TRUE@am__append_1 = \ +@USE_LINKER_SCRIPT_TRUE@ -Wl,--version-script=$(top_srcdir)/filters/filters.syms + +@HAVE_POD_TRUE@am__append_2 = $(man_MANS) +subdir = filters/blocksize-policy +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ocaml.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +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 = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(filterdir)" "$(DESTDIR)$(man1dir)" +LTLIBRARIES = $(filter_LTLIBRARIES) +am__DEPENDENCIES_1 = +nbdkit_blocksize_policy_filter_la_DEPENDENCIES = \ + $(top_builddir)/common/utils/libutils.la \ + $(top_builddir)/common/replacements/libcompat.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am__objects_1 = +am_nbdkit_blocksize_policy_filter_la_OBJECTS = \ + nbdkit_blocksize_policy_filter_la-policy.lo $(am__objects_1) +nbdkit_blocksize_policy_filter_la_OBJECTS = \ + $(am_nbdkit_blocksize_policy_filter_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +nbdkit_blocksize_policy_filter_la_LINK = $(LIBTOOL) $(AM_V_lt) \ + --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \ + $(CCLD) $(nbdkit_blocksize_policy_filter_la_CFLAGS) $(CFLAGS) \ + $(nbdkit_blocksize_policy_filter_la_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = \ + ./$(DEPDIR)/nbdkit_blocksize_policy_filter_la-policy.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(nbdkit_blocksize_policy_filter_la_SOURCES) +DIST_SOURCES = $(nbdkit_blocksize_policy_filter_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/common-rules.mk \ + $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ +BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ +CARGO = @CARGO@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_PLUGIN_CC = @CC_PLUGIN_CC@ +CC_PLUGIN_CFLAGS = @CC_PLUGIN_CFLAGS@ +CERTTOOL = @CERTTOOL@ +CFLAGS = @CFLAGS@ +COM_ERR_CFLAGS = @COM_ERR_CFLAGS@ +COM_ERR_LIBS = @COM_ERR_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CUT = @CUT@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LDFLAGS = @DL_LDFLAGS@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXT2FS_CFLAGS = @EXT2FS_CFLAGS@ +EXT2FS_LIBS = @EXT2FS_LIBS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GENISOIMAGE = @GENISOIMAGE@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GOARCH = @GOARCH@ +GOLANG = @GOLANG@ +GOOS = @GOOS@ +GOROOT = @GOROOT@ +GREP = @GREP@ +IMPORT_LIBRARY_ON_WINDOWS = @IMPORT_LIBRARY_ON_WINDOWS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +ISOPROG = @ISOPROG@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBLKIO_CFLAGS = @LIBBLKIO_CFLAGS@ +LIBBLKIO_LIBS = @LIBBLKIO_LIBS@ +LIBGUESTFS_CFLAGS = @LIBGUESTFS_CFLAGS@ +LIBGUESTFS_LIBS = @LIBGUESTFS_LIBS@ +LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ +LIBLZMA_LIBS = @LIBLZMA_LIBS@ +LIBNBD_CFLAGS = @LIBNBD_CFLAGS@ +LIBNBD_LIBS = @LIBNBD_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSELINUX_CFLAGS = @LIBSELINUX_CFLAGS@ +LIBSELINUX_LIBS = @LIBSELINUX_LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTORRENT_CFLAGS = @LIBTORRENT_CFLAGS@ +LIBTORRENT_LIBS = @LIBTORRENT_LIBS@ +LIBVIRT_CFLAGS = @LIBVIRT_CFLAGS@ +LIBVIRT_LIBS = @LIBVIRT_LIBS@ +LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ +LIBZSTD_LIBS = @LIBZSTD_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LUA_CFLAGS = @LUA_CFLAGS@ +LUA_LIBS = @LUA_LIBS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MC = @MC@ +MKDIR_P = @MKDIR_P@ +MKISOFS = @MKISOFS@ +NBDKIT_VERSION_MAJOR = @NBDKIT_VERSION_MAJOR@ +NBDKIT_VERSION_MICRO = @NBDKIT_VERSION_MICRO@ +NBDKIT_VERSION_MINOR = @NBDKIT_VERSION_MINOR@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_ON_WINDOWS = @NO_UNDEFINED_ON_WINDOWS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OCAML = @OCAML@ +OCAMLBEST = @OCAMLBEST@ +OCAMLBUILD = @OCAMLBUILD@ +OCAMLC = @OCAMLC@ +OCAMLCDOTOPT = @OCAMLCDOTOPT@ +OCAMLDEP = @OCAMLDEP@ +OCAMLDOC = @OCAMLDOC@ +OCAMLLIB = @OCAMLLIB@ +OCAMLMKLIB = @OCAMLMKLIB@ +OCAMLMKTOP = @OCAMLMKTOP@ +OCAMLOPT = @OCAMLOPT@ +OCAMLOPTDOTOPT = @OCAMLOPTDOTOPT@ +OCAMLOPTFLAGS = @OCAMLOPTFLAGS@ +OCAMLVERSION = @OCAMLVERSION@ +OCAML_MAJOR = @OCAML_MAJOR@ +OCAML_PLUGIN_LIBRARIES = @OCAML_PLUGIN_LIBRARIES@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PERL_ARCHLIB = @PERL_ARCHLIB@ +PERL_CFLAGS = @PERL_CFLAGS@ +PERL_LDOPTS = @PERL_LDOPTS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PODWRAPPER = @PODWRAPPER@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_CXX = @PTHREAD_CXX@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CFLAGS = @PYTHON_CFLAGS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +RUBY_CFLAGS = @RUBY_CFLAGS@ +RUBY_LIBS = @RUBY_LIBS@ +RUSTC = @RUSTC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOEXT = @SOEXT@ +SSH_CFLAGS = @SSH_CFLAGS@ +SSH_LIBS = @SSH_LIBS@ +STAT = @STAT@ +STRIP = @STRIP@ +TCL_CFLAGS = @TCL_CFLAGS@ +TCL_LIBS = @TCL_LIBS@ +TRUNCATE = @TRUNCATE@ +VALGRIND = @VALGRIND@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VERSION = @VERSION@ +WARNINGS_CFLAGS = @WARNINGS_CFLAGS@ +XORRISO = @XORRISO@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +ZLIB_NG_CFLAGS = @ZLIB_NG_CFLAGS@ +ZLIB_NG_LIBS = @ZLIB_NG_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DLLTOOL = @ac_ct_DLLTOOL@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_MC = @ac_ct_MC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bashcompdir = @bashcompdir@ +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@ +filters = @filters@ +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@ +lang_plugins = @lang_plugins@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +non_lang_plugins = @non_lang_plugins@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugins = @plugins@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +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@ + +# Convenient list terminator +NULL = +plugindir = $(libdir)/nbdkit/plugins +filterdir = $(libdir)/nbdkit/filters +CLEANFILES = *~ *.cmi *.cmx *.cmxa *.so *.dll $(am__append_2) +EXTRA_DIST = nbdkit-blocksize-policy-filter.pod +filter_LTLIBRARIES = nbdkit-blocksize-policy-filter.la +nbdkit_blocksize_policy_filter_la_SOURCES = \ + policy.c \ + $(top_srcdir)/include/nbdkit-filter.h \ + $(NULL) + +nbdkit_blocksize_policy_filter_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/common/include \ + -I$(top_srcdir)/common/utils \ + $(NULL) + +nbdkit_blocksize_policy_filter_la_CFLAGS = $(WARNINGS_CFLAGS) +nbdkit_blocksize_policy_filter_la_LDFLAGS = -module -avoid-version \ + -shared $(NO_UNDEFINED_ON_WINDOWS) $(NULL) $(am__append_1) +nbdkit_blocksize_policy_filter_la_LIBADD = \ + $(top_builddir)/common/utils/libutils.la \ + $(top_builddir)/common/replacements/libcompat.la \ + $(IMPORT_LIBRARY_ON_WINDOWS) \ + $(NULL) + +@HAVE_POD_TRUE@man_MANS = nbdkit-blocksize-policy-filter.1 +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common-rules.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign filters/blocksize-policy/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign filters/blocksize-policy/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; +$(top_srcdir)/common-rules.mk $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +install-filterLTLIBRARIES: $(filter_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(filter_LTLIBRARIES)'; test -n "$(filterdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(filterdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(filterdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(filterdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(filterdir)"; \ + } + +uninstall-filterLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(filter_LTLIBRARIES)'; test -n "$(filterdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(filterdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(filterdir)/$$f"; \ + done + +clean-filterLTLIBRARIES: + -test -z "$(filter_LTLIBRARIES)" || rm -f $(filter_LTLIBRARIES) + @list='$(filter_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +nbdkit-blocksize-policy-filter.la: $(nbdkit_blocksize_policy_filter_la_OBJECTS) $(nbdkit_blocksize_policy_filter_la_DEPENDENCIES) $(EXTRA_nbdkit_blocksize_policy_filter_la_DEPENDENCIES) + $(AM_V_CCLD)$(nbdkit_blocksize_policy_filter_la_LINK) -rpath $(filterdir) $(nbdkit_blocksize_policy_filter_la_OBJECTS) $(nbdkit_blocksize_policy_filter_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nbdkit_blocksize_policy_filter_la-policy.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +nbdkit_blocksize_policy_filter_la-policy.lo: policy.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_blocksize_policy_filter_la_CPPFLAGS) $(CPPFLAGS) $(nbdkit_blocksize_policy_filter_la_CFLAGS) $(CFLAGS) -MT nbdkit_blocksize_policy_filter_la-policy.lo -MD -MP -MF $(DEPDIR)/nbdkit_blocksize_policy_filter_la-policy.Tpo -c -o nbdkit_blocksize_policy_filter_la-policy.lo `test -f 'policy.c' || echo '$(srcdir)/'`policy.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nbdkit_blocksize_policy_filter_la-policy.Tpo $(DEPDIR)/nbdkit_blocksize_policy_filter_la-policy.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='policy.c' object='nbdkit_blocksize_policy_filter_la-policy.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_blocksize_policy_filter_la_CPPFLAGS) $(CPPFLAGS) $(nbdkit_blocksize_policy_filter_la_CFLAGS) $(CFLAGS) -c -o nbdkit_blocksize_policy_filter_la-policy.lo `test -f 'policy.c' || echo '$(srcdir)/'`policy.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(MANS) +installdirs: + for dir in "$(DESTDIR)$(filterdir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: 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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-filterLTLIBRARIES clean-generic clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/nbdkit_blocksize_policy_filter_la-policy.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-filterLTLIBRARIES install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/nbdkit_blocksize_policy_filter_la-policy.Plo + -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-filterLTLIBRARIES uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-filterLTLIBRARIES clean-generic clean-libtool \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-filterLTLIBRARIES \ + install-html install-html-am install-info install-info-am \ + install-man install-man1 install-pdf install-pdf-am 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 tags-am uninstall \ + uninstall-am uninstall-filterLTLIBRARIES uninstall-man \ + uninstall-man1 + +.PRECIOUS: Makefile + + +@HAVE_POD_TRUE@nbdkit-blocksize-policy-filter.1: nbdkit-blocksize-policy-filter.pod \ +@HAVE_POD_TRUE@ $(top_builddir)/podwrapper.pl +@HAVE_POD_TRUE@ $(PODWRAPPER) --section=1 --man $@ \ +@HAVE_POD_TRUE@ --html $(top_builddir)/html/$@.html \ +@HAVE_POD_TRUE@ $< + +# 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/filters/blocksize-policy/nbdkit-blocksize-policy-filter.pod b/filters/blocksize-policy/nbdkit-blocksize-policy-filter.pod new file mode 100644 index 0000000..8949c77 --- /dev/null +++ b/filters/blocksize-policy/nbdkit-blocksize-policy-filter.pod @@ -0,0 +1,158 @@ +=head1 NAME + +nbdkit-blocksize-policy-filter - set minimum, preferred and +maximum block size, and apply error policy + +=head1 SYNOPSIS + + nbdkit --filter=blocksize-policy PLUGIN + [blocksize-error-policy=allow|error] + [blocksize-minimum=N] + [blocksize-preferred=N] + [blocksize-maximum=N] + [blocksize-write-disconnect=N] + +=head1 DESCRIPTION + +C is an L filter that +can add block size constraints to plugins which don't already support +them. It can also enforce an error policy for badly behaved clients +which do not obey the block size constraints. + +For more information about block size constraints, see section +"Block size constraints" in +L. + +The simplest usage is to place this filter on top of any plugin which +does not advertise block size constraints, and set the +C, C and C +parameters with the desired constraints. For example: + + nbdkit --filter=blocksize-policy memory 1G \ + blocksize-preferred=32K + +would adjust L so that clients should +prefer 32K requests. You can query the NBD server advertised constraints +using L: + + $ nbdinfo nbd://localhost + [...] + block_size_minimum: 1 + block_size_preferred: 32768 + block_size_maximum: 4294967295 + +The second part of this filter is adjusting the error policy when +badly behaved clients do not obey the minimum or maximum request size. +Normally nbdkit permits these requests, leaving it up to the plugin +whether it rejects the request with an error or tries to process the +request (eg. trying to split an over-large request or doing a +read-modify-write for an unaligned write). With this filter you can +use C to reject these requests in the +filter with an EINVAL error. The plugin will not see them. + +Normally, nbdkit will accept write requests up to 64M in length, and +reply with a gracful error message rather than a hard disconnect for a +buffer up to twice that large. But many other servers (for example, +qemu-nbd) will give a hard disconnect for a write request larger than +32M. With this filter you can use C +to emulate the behavior of other servers. + +=head2 Combining with L + +A related filter is L. That filter can +split and combine requests for plugins that cannot handle requests +under or over a particular size. + +Both filters may be used together like this (note that the order of +the filters is important): + + nbdkit --filter=blocksize-policy \ + --filter=blocksize \ + PLUGIN ... \ + blocksize-error-policy=allow \ + blocksize-minimum=64K minblock=64K + +This says to advertise a minimum block size of 64K. Well-behaved +clients will obey this. Badly behaved clients will send requests +S 64K> which will be converted to slow 64K read-modify-write +cycles to the underlying plugin. In either case the plugin will only +see requests on 64K (or multiples of 64K) boundaries. + +=head1 PARAMETERS + +=over 4 + +=item B + +=item B + +If a client sends a request which is smaller than the permitted +minimum size or larger than the permitted maximum size, or not aligned +to the minimum size, C chooses what the filter +will do. The default (and also nbdkit's default) is C which +means pass the request through to the plugin. + +Use C to return an EINVAL error back to the client. The plugin +will not see the badly formed request in this case. + +=item BN + +(nbdkit E 1.34) + +If a client sends a write request which is larger than the specified +I (using the usual size modifiers like C<32M>), abruptly close +the connection. This can be used to emulate qemu's behavior of +disconnecting for write requests larger than 32M, rather than nbdkit's +default of keeping the connection alive for write requests up to 128M +(although nbdkit does not let the plugin see requests larger than +64M). The write disconnect size is independent of any advertised +maximum block size or its accompanying error policy. + +=item BN + +=item BN + +=item BN + +Advertise minimum, preferred and/or maximum block size to the client. +Well-behaved clients should obey these constraints. + +For each parameter, you can specify it as a size (using the usual +modifiers like C<4K>). + +If the parameter is omitted then either the constraint advertised by +the plugin itself is used, or a sensible default for plugins which do +not advertise block size constraints. + +=back + +=head1 FILES + +=over 4 + +=item F<$filterdir/nbdkit-blocksize-policy-filter.so> + +The filter. + +Use C to find the location of C<$filterdir>. + +=back + +=head1 VERSION + +C first appeared in nbdkit 1.30. + +=head1 SEE ALSO + +L, +L, +L, +L. + +=head1 AUTHORS + +Richard W.M. Jones + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/filters/blocksize-policy/policy.c b/filters/blocksize-policy/policy.c new file mode 100644 index 0000000..afeb724 --- /dev/null +++ b/filters/blocksize-policy/policy.c @@ -0,0 +1,398 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include +#include +#include +#include + +#include + +#include "ispowerof2.h" +#include "rounding.h" +#include "windows-compat.h" + +/* Block size constraints configured on the command line (0 = unset). */ +static uint32_t config_minimum; +static uint32_t config_preferred; +static uint32_t config_maximum; +static uint32_t config_disconnect; + +/* Error policy. */ +static enum { EP_ALLOW, EP_ERROR } error_policy = EP_ALLOW; + +static int +policy_config (nbdkit_next_config *next, nbdkit_backend *nxdata, + const char *key, const char *value) +{ + int64_t r; + + if (strcmp (key, "blocksize-error-policy") == 0) { + if (strcmp (value, "allow") == 0) + error_policy = EP_ALLOW; + else if (strcmp (value, "error") == 0) + error_policy = EP_ERROR; + else { + nbdkit_error ("unknown %s: %s", key, value); + return -1; + } + return 0; + } + else if (strcmp (key, "blocksize-minimum") == 0) { + r = nbdkit_parse_size (value); + if (r == -1 || r > UINT32_MAX) { + parse_error: + nbdkit_error ("%s: could not parse %s", key, value); + return -1; + } + config_minimum = r; + return 0; + } + else if (strcmp (key, "blocksize-preferred") == 0) { + r = nbdkit_parse_size (value); + if (r == -1 || r > UINT32_MAX) goto parse_error; + config_preferred = r; + return 0; + } + else if (strcmp (key, "blocksize-maximum") == 0) { + r = nbdkit_parse_size (value); + if (r == -1 || r > UINT32_MAX) goto parse_error; + config_maximum = r; + return 0; + } + else if (strcmp (key, "blocksize-write-disconnect") == 0) { + r = nbdkit_parse_size (value); + if (r == -1 || r > UINT32_MAX) goto parse_error; + config_disconnect = r; + return 0; + } + + return next (nxdata, key, value); +} + +static int +policy_config_complete (nbdkit_next_config_complete *next, + nbdkit_backend *nxdata) +{ + /* These checks roughly reflect the same checks made in + * server/plugins.c: plugin_block_size + */ + + if (config_minimum) { + if (! is_power_of_2 (config_minimum)) { + nbdkit_error ("blocksize-minimum must be a power of 2"); + return -1; + } + if (config_minimum > 65536) { + nbdkit_error ("blocksize-minimum must be <= 64K"); + return -1; + } + } + + if (config_preferred) { + if (! is_power_of_2 (config_preferred)) { + nbdkit_error ("blocksize-preferred must be a power of 2"); + return -1; + } + if (config_preferred < 512 || config_preferred > 32 * 1024 * 1024) { + nbdkit_error ("blocksize-preferred must be between 512 and 32M"); + return -1; + } + } + + if (config_minimum && config_maximum) { + if (config_maximum != (uint32_t)-1 && + (config_maximum % config_maximum) != 0) { + nbdkit_error ("blocksize-maximum must be -1 " + "or a multiple of blocksize-minimum"); + return -1; + } + } + + if (config_minimum && config_preferred) { + if (config_minimum > config_preferred) { + nbdkit_error ("blocksize-minimum must be <= blocksize-preferred"); + return -1; + } + } + + if (config_preferred && config_maximum) { + if (config_preferred > config_maximum) { + nbdkit_error ("blocksize-preferred must be <= blocksize-maximum"); + return -1; + } + } + + if (config_minimum && config_disconnect) { + if (config_disconnect <= config_minimum) { + nbdkit_error ("blocksize-write-disonnect must be larger than " + "blocksize-minimum"); + return -1; + } + } + + return next (nxdata); +} + +static int +policy_block_size (nbdkit_next *next, void *handle, + uint32_t *minimum, uint32_t *preferred, uint32_t *maximum) +{ + /* If the user has set all of the block size parameters then we + * don't need to ask the plugin, we can go ahead and advertise them. + */ + if (config_minimum && config_preferred && config_maximum) { + *minimum = config_minimum; + *preferred = config_preferred; + *maximum = config_maximum; + return 0; + } + + /* Otherwise, ask the plugin. */ + if (next->block_size (next, minimum, preferred, maximum) == -1) + return -1; + + /* If the user of this filter didn't configure anything, then return + * the plugin values (even if unset). + */ + if (!config_minimum && !config_preferred && !config_maximum) + return 0; + + /* Now we get to the awkward case where the user configured some + * values but not others. There's all kinds of room for things to + * go wrong here, so try to check for obvious user errors as best we + * can. + */ + if (*minimum == 0) { /* Plugin didn't set anything. */ + if (config_minimum) + *minimum = config_minimum; + else + *minimum = 1; + + if (config_preferred) + *preferred = config_preferred; + else + *preferred = 4096; + + if (config_maximum) + *maximum = config_maximum; + else if (config_disconnect) + *maximum = ROUND_DOWN (config_disconnect, *minimum); + else + *maximum = 0xffffffff; + } + else { /* Plugin set some values. */ + if (config_minimum) + *minimum = config_minimum; + + if (config_preferred) + *preferred = config_preferred; + + if (config_maximum) + *maximum = config_maximum; + } + + if (*minimum > *preferred || *preferred > *maximum) { + nbdkit_error ("computed block size values are invalid, minimum %" PRIu32 + " > preferred %" PRIu32 + " or preferred > maximum %" PRIu32, + *minimum, *preferred, *maximum); + return -1; + } + return 0; +} + +/* This function checks the error policy for all request functions + * below. + * + * The 'data' flag is true for pread and pwrite (where we check the + * maximum bound). We don't check maximum for non-data-carrying + * calls like zero. + * + * The NBD specification mandates EINVAL for block size constraint + * problems. + */ +static int +check_policy (nbdkit_next *next, void *handle, + const char *type, bool data, + uint32_t count, uint64_t offset, int *err) +{ + uint32_t minimum, preferred, maximum; + + if (error_policy == EP_ALLOW) + return 0; + + /* Get the current block size constraints. Note these are cached in + * the backend so if they've already been computed then this simply + * returns the cached values. The plugin is only asked once per + * connection. + */ + errno = 0; + if (policy_block_size (next, handle, + &minimum, &preferred, &maximum) == -1) { + *err = errno ? : EINVAL; + return -1; + } + + /* If there are no constraints, allow. */ + if (minimum == 0) + return 0; + + /* Check constraints. */ + if (count < minimum) { + *err = EINVAL; + nbdkit_error ("client %s request rejected: " + "count %" PRIu32 " is smaller than minimum size %" PRIu32, + type, count, minimum); + return -1; + } + if (data && count > maximum) { /* Only do this for pread/pwrite. */ + *err = EINVAL; + nbdkit_error ("client %s request rejected: " + "count %" PRIu32 " is larger than maximum size %" PRIu32, + type, count, maximum); + return -1; + } + if ((count % minimum) != 0) { + *err = EINVAL; + nbdkit_error ("client %s request rejected: " + "count %" PRIu32 " is not a multiple " + "of minimum size %" PRIu32, + type, count, minimum); + return -1; + } + if ((offset % minimum) != 0) { + *err = EINVAL; + nbdkit_error ("client %s request rejected: " + "offset %" PRIu64 " is not aligned to a multiple " + "of minimum size %" PRIu32, + type, offset, minimum); + return -1; + } + + return 0; +} + +static int +policy_pread (nbdkit_next *next, + void *handle, void *buf, uint32_t count, uint64_t offset, + uint32_t flags, int *err) +{ + if (check_policy (next, handle, "pread", true, count, offset, err) == -1) + return -1; + + return next->pread (next, buf, count, offset, flags, err); +} + +static int +policy_pwrite (nbdkit_next *next, + void *handle, const void *buf, uint32_t count, uint64_t offset, + uint32_t flags, int *err) +{ + if (config_disconnect && count > config_disconnect) { + nbdkit_error ("disconnecting client due to oversize write request"); + nbdkit_disconnect (true); + *err = ESHUTDOWN; + return -1; + } + + if (check_policy (next, handle, "pwrite", true, count, offset, err) == -1) + return -1; + + return next->pwrite (next, buf, count, offset, flags, err); +} + +static int +policy_zero (nbdkit_next *next, + void *handle, uint32_t count, uint64_t offset, uint32_t flags, + int *err) +{ + if (check_policy (next, handle, "zero", false, count, offset, err) == -1) + return -1; + + return next->zero (next, count, offset, flags, err); +} + +static int +policy_trim (nbdkit_next *next, + void *handle, uint32_t count, uint64_t offset, uint32_t flags, + int *err) +{ + if (check_policy (next, handle, "trim", false, count, offset, err) == -1) + return -1; + + return next->trim (next, count, offset, flags, err); +} + +static int +policy_cache (nbdkit_next *next, + void *handle, uint32_t count, uint64_t offset, + uint32_t flags, int *err) +{ + if (check_policy (next, handle, "cache", false, count, offset, err) == -1) + return -1; + + return next->cache (next, count, offset, flags, err); +} + +static int +policy_extents (nbdkit_next *next, + void *handle, uint32_t count, uint64_t offset, uint32_t flags, + struct nbdkit_extents *extents, int *err) +{ + if (check_policy (next, handle, "extents", false, count, offset, err) == -1) + return -1; + + return next->extents (next, count, offset, flags, extents, err); +} + +static struct nbdkit_filter filter = { + .name = "blocksize-policy", + .longname = "nbdkit blocksize policy filter", + .config = policy_config, + .config_complete = policy_config_complete, + + .block_size = policy_block_size, + + .pread = policy_pread, + .pwrite = policy_pwrite, + .zero = policy_zero, + .trim = policy_trim, + .cache = policy_cache, + .extents = policy_extents, +}; + +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/blocksize/Makefile.am b/filters/blocksize/Makefile.am new file mode 100644 index 0000000..b27dc31 --- /dev/null +++ b/filters/blocksize/Makefile.am @@ -0,0 +1,74 @@ +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 $(top_srcdir)/common-rules.mk + +EXTRA_DIST = nbdkit-blocksize-filter.pod + +filter_LTLIBRARIES = nbdkit-blocksize-filter.la + +nbdkit_blocksize_filter_la_SOURCES = \ + blocksize.c \ + $(top_srcdir)/include/nbdkit-filter.h \ + $(NULL) + +nbdkit_blocksize_filter_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/common/include \ + -I$(top_srcdir)/common/utils \ + $(NULL) +nbdkit_blocksize_filter_la_CFLAGS = $(WARNINGS_CFLAGS) +nbdkit_blocksize_filter_la_LDFLAGS = \ + -module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \ + $(NULL) +if USE_LINKER_SCRIPT +nbdkit_blocksize_filter_la_LDFLAGS += \ + -Wl,--version-script=$(top_srcdir)/filters/filters.syms +endif +nbdkit_blocksize_filter_la_LIBADD = \ + $(top_builddir)/common/utils/libutils.la \ + $(top_builddir)/common/replacements/libcompat.la \ + $(IMPORT_LIBRARY_ON_WINDOWS) \ + $(NULL) + +if HAVE_POD + +man_MANS = nbdkit-blocksize-filter.1 +CLEANFILES += $(man_MANS) + +nbdkit-blocksize-filter.1: nbdkit-blocksize-filter.pod \ + $(top_builddir)/podwrapper.pl + $(PODWRAPPER) --section=1 --man $@ \ + --html $(top_builddir)/html/$@.html \ + $< + +endif HAVE_POD diff --git a/filters/blocksize/Makefile.in b/filters/blocksize/Makefile.in new file mode 100644 index 0000000..12fb582 --- /dev/null +++ b/filters/blocksize/Makefile.in @@ -0,0 +1,937 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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@ +@USE_LINKER_SCRIPT_TRUE@am__append_1 = \ +@USE_LINKER_SCRIPT_TRUE@ -Wl,--version-script=$(top_srcdir)/filters/filters.syms + +@HAVE_POD_TRUE@am__append_2 = $(man_MANS) +subdir = filters/blocksize +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ocaml.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +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 = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(filterdir)" "$(DESTDIR)$(man1dir)" +LTLIBRARIES = $(filter_LTLIBRARIES) +am__DEPENDENCIES_1 = +nbdkit_blocksize_filter_la_DEPENDENCIES = \ + $(top_builddir)/common/utils/libutils.la \ + $(top_builddir)/common/replacements/libcompat.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am__objects_1 = +am_nbdkit_blocksize_filter_la_OBJECTS = \ + nbdkit_blocksize_filter_la-blocksize.lo $(am__objects_1) +nbdkit_blocksize_filter_la_OBJECTS = \ + $(am_nbdkit_blocksize_filter_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +nbdkit_blocksize_filter_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(nbdkit_blocksize_filter_la_CFLAGS) $(CFLAGS) \ + $(nbdkit_blocksize_filter_la_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = \ + ./$(DEPDIR)/nbdkit_blocksize_filter_la-blocksize.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(nbdkit_blocksize_filter_la_SOURCES) +DIST_SOURCES = $(nbdkit_blocksize_filter_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/common-rules.mk \ + $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ +BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ +CARGO = @CARGO@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_PLUGIN_CC = @CC_PLUGIN_CC@ +CC_PLUGIN_CFLAGS = @CC_PLUGIN_CFLAGS@ +CERTTOOL = @CERTTOOL@ +CFLAGS = @CFLAGS@ +COM_ERR_CFLAGS = @COM_ERR_CFLAGS@ +COM_ERR_LIBS = @COM_ERR_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CUT = @CUT@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LDFLAGS = @DL_LDFLAGS@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXT2FS_CFLAGS = @EXT2FS_CFLAGS@ +EXT2FS_LIBS = @EXT2FS_LIBS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GENISOIMAGE = @GENISOIMAGE@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GOARCH = @GOARCH@ +GOLANG = @GOLANG@ +GOOS = @GOOS@ +GOROOT = @GOROOT@ +GREP = @GREP@ +IMPORT_LIBRARY_ON_WINDOWS = @IMPORT_LIBRARY_ON_WINDOWS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +ISOPROG = @ISOPROG@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBLKIO_CFLAGS = @LIBBLKIO_CFLAGS@ +LIBBLKIO_LIBS = @LIBBLKIO_LIBS@ +LIBGUESTFS_CFLAGS = @LIBGUESTFS_CFLAGS@ +LIBGUESTFS_LIBS = @LIBGUESTFS_LIBS@ +LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ +LIBLZMA_LIBS = @LIBLZMA_LIBS@ +LIBNBD_CFLAGS = @LIBNBD_CFLAGS@ +LIBNBD_LIBS = @LIBNBD_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSELINUX_CFLAGS = @LIBSELINUX_CFLAGS@ +LIBSELINUX_LIBS = @LIBSELINUX_LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTORRENT_CFLAGS = @LIBTORRENT_CFLAGS@ +LIBTORRENT_LIBS = @LIBTORRENT_LIBS@ +LIBVIRT_CFLAGS = @LIBVIRT_CFLAGS@ +LIBVIRT_LIBS = @LIBVIRT_LIBS@ +LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ +LIBZSTD_LIBS = @LIBZSTD_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LUA_CFLAGS = @LUA_CFLAGS@ +LUA_LIBS = @LUA_LIBS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MC = @MC@ +MKDIR_P = @MKDIR_P@ +MKISOFS = @MKISOFS@ +NBDKIT_VERSION_MAJOR = @NBDKIT_VERSION_MAJOR@ +NBDKIT_VERSION_MICRO = @NBDKIT_VERSION_MICRO@ +NBDKIT_VERSION_MINOR = @NBDKIT_VERSION_MINOR@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_ON_WINDOWS = @NO_UNDEFINED_ON_WINDOWS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OCAML = @OCAML@ +OCAMLBEST = @OCAMLBEST@ +OCAMLBUILD = @OCAMLBUILD@ +OCAMLC = @OCAMLC@ +OCAMLCDOTOPT = @OCAMLCDOTOPT@ +OCAMLDEP = @OCAMLDEP@ +OCAMLDOC = @OCAMLDOC@ +OCAMLLIB = @OCAMLLIB@ +OCAMLMKLIB = @OCAMLMKLIB@ +OCAMLMKTOP = @OCAMLMKTOP@ +OCAMLOPT = @OCAMLOPT@ +OCAMLOPTDOTOPT = @OCAMLOPTDOTOPT@ +OCAMLOPTFLAGS = @OCAMLOPTFLAGS@ +OCAMLVERSION = @OCAMLVERSION@ +OCAML_MAJOR = @OCAML_MAJOR@ +OCAML_PLUGIN_LIBRARIES = @OCAML_PLUGIN_LIBRARIES@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PERL_ARCHLIB = @PERL_ARCHLIB@ +PERL_CFLAGS = @PERL_CFLAGS@ +PERL_LDOPTS = @PERL_LDOPTS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PODWRAPPER = @PODWRAPPER@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_CXX = @PTHREAD_CXX@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CFLAGS = @PYTHON_CFLAGS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +RUBY_CFLAGS = @RUBY_CFLAGS@ +RUBY_LIBS = @RUBY_LIBS@ +RUSTC = @RUSTC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOEXT = @SOEXT@ +SSH_CFLAGS = @SSH_CFLAGS@ +SSH_LIBS = @SSH_LIBS@ +STAT = @STAT@ +STRIP = @STRIP@ +TCL_CFLAGS = @TCL_CFLAGS@ +TCL_LIBS = @TCL_LIBS@ +TRUNCATE = @TRUNCATE@ +VALGRIND = @VALGRIND@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VERSION = @VERSION@ +WARNINGS_CFLAGS = @WARNINGS_CFLAGS@ +XORRISO = @XORRISO@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +ZLIB_NG_CFLAGS = @ZLIB_NG_CFLAGS@ +ZLIB_NG_LIBS = @ZLIB_NG_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DLLTOOL = @ac_ct_DLLTOOL@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_MC = @ac_ct_MC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bashcompdir = @bashcompdir@ +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@ +filters = @filters@ +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@ +lang_plugins = @lang_plugins@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +non_lang_plugins = @non_lang_plugins@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugins = @plugins@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +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@ + +# Convenient list terminator +NULL = +plugindir = $(libdir)/nbdkit/plugins +filterdir = $(libdir)/nbdkit/filters +CLEANFILES = *~ *.cmi *.cmx *.cmxa *.so *.dll $(am__append_2) +EXTRA_DIST = nbdkit-blocksize-filter.pod +filter_LTLIBRARIES = nbdkit-blocksize-filter.la +nbdkit_blocksize_filter_la_SOURCES = \ + blocksize.c \ + $(top_srcdir)/include/nbdkit-filter.h \ + $(NULL) + +nbdkit_blocksize_filter_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/common/include \ + -I$(top_srcdir)/common/utils \ + $(NULL) + +nbdkit_blocksize_filter_la_CFLAGS = $(WARNINGS_CFLAGS) +nbdkit_blocksize_filter_la_LDFLAGS = -module -avoid-version -shared \ + $(NO_UNDEFINED_ON_WINDOWS) $(NULL) $(am__append_1) +nbdkit_blocksize_filter_la_LIBADD = \ + $(top_builddir)/common/utils/libutils.la \ + $(top_builddir)/common/replacements/libcompat.la \ + $(IMPORT_LIBRARY_ON_WINDOWS) \ + $(NULL) + +@HAVE_POD_TRUE@man_MANS = nbdkit-blocksize-filter.1 +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common-rules.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign filters/blocksize/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign filters/blocksize/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; +$(top_srcdir)/common-rules.mk $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +install-filterLTLIBRARIES: $(filter_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(filter_LTLIBRARIES)'; test -n "$(filterdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(filterdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(filterdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(filterdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(filterdir)"; \ + } + +uninstall-filterLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(filter_LTLIBRARIES)'; test -n "$(filterdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(filterdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(filterdir)/$$f"; \ + done + +clean-filterLTLIBRARIES: + -test -z "$(filter_LTLIBRARIES)" || rm -f $(filter_LTLIBRARIES) + @list='$(filter_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +nbdkit-blocksize-filter.la: $(nbdkit_blocksize_filter_la_OBJECTS) $(nbdkit_blocksize_filter_la_DEPENDENCIES) $(EXTRA_nbdkit_blocksize_filter_la_DEPENDENCIES) + $(AM_V_CCLD)$(nbdkit_blocksize_filter_la_LINK) -rpath $(filterdir) $(nbdkit_blocksize_filter_la_OBJECTS) $(nbdkit_blocksize_filter_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nbdkit_blocksize_filter_la-blocksize.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +nbdkit_blocksize_filter_la-blocksize.lo: blocksize.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_blocksize_filter_la_CPPFLAGS) $(CPPFLAGS) $(nbdkit_blocksize_filter_la_CFLAGS) $(CFLAGS) -MT nbdkit_blocksize_filter_la-blocksize.lo -MD -MP -MF $(DEPDIR)/nbdkit_blocksize_filter_la-blocksize.Tpo -c -o nbdkit_blocksize_filter_la-blocksize.lo `test -f 'blocksize.c' || echo '$(srcdir)/'`blocksize.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nbdkit_blocksize_filter_la-blocksize.Tpo $(DEPDIR)/nbdkit_blocksize_filter_la-blocksize.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='blocksize.c' object='nbdkit_blocksize_filter_la-blocksize.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_blocksize_filter_la_CPPFLAGS) $(CPPFLAGS) $(nbdkit_blocksize_filter_la_CFLAGS) $(CFLAGS) -c -o nbdkit_blocksize_filter_la-blocksize.lo `test -f 'blocksize.c' || echo '$(srcdir)/'`blocksize.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(MANS) +installdirs: + for dir in "$(DESTDIR)$(filterdir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: 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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-filterLTLIBRARIES clean-generic clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/nbdkit_blocksize_filter_la-blocksize.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-filterLTLIBRARIES install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/nbdkit_blocksize_filter_la-blocksize.Plo + -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-filterLTLIBRARIES uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-filterLTLIBRARIES clean-generic clean-libtool \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-filterLTLIBRARIES \ + install-html install-html-am install-info install-info-am \ + install-man install-man1 install-pdf install-pdf-am 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 tags-am uninstall \ + uninstall-am uninstall-filterLTLIBRARIES uninstall-man \ + uninstall-man1 + +.PRECIOUS: Makefile + + +@HAVE_POD_TRUE@nbdkit-blocksize-filter.1: nbdkit-blocksize-filter.pod \ +@HAVE_POD_TRUE@ $(top_builddir)/podwrapper.pl +@HAVE_POD_TRUE@ $(PODWRAPPER) --section=1 --man $@ \ +@HAVE_POD_TRUE@ --html $(top_builddir)/html/$@.html \ +@HAVE_POD_TRUE@ $< + +# 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/filters/blocksize/blocksize.c b/filters/blocksize/blocksize.c new file mode 100644 index 0000000..09195ce --- /dev/null +++ b/filters/blocksize/blocksize.c @@ -0,0 +1,549 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "cleanup.h" +#include "ispowerof2.h" +#include "minmax.h" +#include "rounding.h" + +#define BLOCKSIZE_MIN_LIMIT (64U * 1024) + +/* Lock in order to handle overlapping requests safely. + * + * Grabbed for exclusive access (wrlock) when using the bounce buffer. + * + * Grabbed for shared access (rdlock) when doing aligned writes. + * These can happen in parallel with one another, but must not land in + * between the read and write of an unaligned RMW operation. + */ +static pthread_rwlock_t lock = PTHREAD_RWLOCK_INITIALIZER; + +/* A single bounce buffer for alignment purposes, guarded by the lock. + * Size it to the maximum we allow for minblock. + */ +static char bounce[BLOCKSIZE_MIN_LIMIT]; + +/* Globals set by .config */ +static unsigned int config_minblock; +static unsigned int config_maxdata; +static unsigned int config_maxlen; + +/* Per-handle values set during .prepare */ +struct blocksize_handle { + uint32_t minblock; + uint32_t maxdata; + uint32_t maxlen; +}; + +static int +blocksize_parse (const char *name, const char *s, unsigned int *v) +{ + int64_t size = nbdkit_parse_size (s); + + if (size < 0) + return -1; + if (!size) { + nbdkit_error ("parameter '%s' must be non-zero if specified", name); + return -1; + } + if (UINT_MAX < size) { + nbdkit_error ("parameter '%s' too large", name); + return -1; + } + *v = size; + return 0; +} + +/* Called for each key=value passed on the command line. */ +static int +blocksize_config (nbdkit_next_config *next, nbdkit_backend *nxdata, + const char *key, const char *value) +{ + + if (strcmp (key, "minblock") == 0) + return blocksize_parse (key, value, &config_minblock); + if (strcmp (key, "maxdata") == 0) + return blocksize_parse (key, value, &config_maxdata); + if (strcmp (key, "maxlen") == 0) + return blocksize_parse (key, value, &config_maxlen); + return next (nxdata, key, value); +} + +/* Check that limits are sane. */ +static int +blocksize_config_complete (nbdkit_next_config_complete *next, + nbdkit_backend *nxdata) +{ + if (config_minblock) { + if (!is_power_of_2 (config_minblock)) { + nbdkit_error ("minblock must be a power of 2"); + return -1; + } + if (config_minblock > BLOCKSIZE_MIN_LIMIT) { + nbdkit_error ("minblock must not exceed %u", BLOCKSIZE_MIN_LIMIT); + return -1; + } + } + + if (config_maxdata && config_minblock) { + if (config_maxdata & (config_minblock - 1)) { + nbdkit_error ("maxdata must be a multiple of %u", config_minblock); + return -1; + } + } + + if (config_maxlen && config_minblock) { + if (config_maxlen & (config_minblock - 1)) { + nbdkit_error ("maxlen must be a multiple of %u", config_minblock); + return -1; + } + } + + nbdkit_debug ("configured values minblock=%u maxdata=%u maxlen=%u", + config_minblock, config_maxdata, config_maxlen); + return next (nxdata); +} + +#define blocksize_config_help \ + "minblock= Minimum block size, power of 2 <= 64k (default 1).\n" \ + "maxdata= Maximum size for read/write (default 64M).\n" \ + "maxlen= Maximum size for trim/zero (default 4G-minblock)." + +static void * +blocksize_open (nbdkit_next_open *next, nbdkit_context *nxdata, + int readonly, const char *exportname, int is_tls) +{ + struct blocksize_handle *h; + + if (next (nxdata, readonly, exportname) == -1) + return NULL; + + h = malloc (sizeof *h); + if (h == NULL) { + nbdkit_error ("malloc: %m"); + return NULL; + } + + h->minblock = config_minblock; + h->maxdata = config_maxdata; + h->maxlen = config_maxlen; + return h; +} + +static int +blocksize_prepare (nbdkit_next *next, void *handle, + int readonly) +{ + struct blocksize_handle *h = handle; + uint32_t minimum, preferred, maximum; + + /* Here, minimum and maximum will clamp per-handle defaults not set + * by globals in .config; preferred has no impact until .block_size. + */ + if (next->block_size (next, &minimum, &preferred, &maximum) == -1) + return -1; + + h->minblock = MAX (MAX (h->minblock, 1), minimum); + + if (h->maxdata == 0) { + if (h->maxlen) + h->maxdata = MIN (h->maxlen, 64 * 1024 * 1024); + else + h->maxdata = 64 * 1024 * 1024; + } + if (maximum) + h->maxdata = MIN (h->maxdata, maximum); + h->maxdata = ROUND_DOWN (h->maxdata, h->minblock); + + if (h->maxlen == 0) + h->maxlen = -h->minblock; + else + h->maxlen = ROUND_DOWN (h->maxlen, h->minblock); + + nbdkit_debug ("handle values minblock=%u maxdata=%u maxlen=%u", + h->minblock, h->maxdata, h->maxlen); + return 0; +} + +/* Round size down to avoid issues at end of file. */ +static int64_t +blocksize_get_size (nbdkit_next *next, + void *handle) +{ + struct blocksize_handle *h = handle; + int64_t size = next->get_size (next); + + if (size == -1) + return -1; + return ROUND_DOWN (size, h->minblock); +} + +/* Block size constraints. + * + * This filter is a little unusual because it allows clients to send a + * wider range of request sizes than the underlying plugin allows. + * Therefore we advertise the widest possible minimum and maximum + * block size to clients. + */ +static int +blocksize_block_size (nbdkit_next *next, void *handle, + uint32_t *minimum, uint32_t *preferred, uint32_t *maximum) +{ + struct blocksize_handle *h = handle; + + /* Here we only need preferred; see also blocksize_prepare. */ + if (next->block_size (next, minimum, preferred, maximum) == -1) + return -1; + + *preferred = MAX (MAX (*preferred, 4096), h->minblock); + + *minimum = 1; + *maximum = 0xffffffff; + + nbdkit_debug ("advertising min=%" PRIu32 " pref=%" PRIu32 " max=%" PRIu32, + *minimum, *preferred, *maximum); + return 0; +} + +static int +blocksize_pread (nbdkit_next *next, + void *handle, void *b, uint32_t count, uint64_t offs, + uint32_t flags, int *err) +{ + struct blocksize_handle *h = handle; + char *buf = b; + uint32_t keep; + uint32_t drop; + + /* Unaligned head */ + if (offs & (h->minblock - 1)) { + ACQUIRE_WRLOCK_FOR_CURRENT_SCOPE (&lock); + drop = offs & (h->minblock - 1); + keep = MIN (h->minblock - drop, count); + if (next->pread (next, bounce, h->minblock, offs - drop, flags, err) == -1) + return -1; + memcpy (buf, bounce + drop, keep); + buf += keep; + offs += keep; + count -= keep; + } + + /* Aligned body */ + while (count >= h->minblock) { + keep = MIN (h->maxdata, ROUND_DOWN (count, h->minblock)); + if (next->pread (next, buf, keep, offs, flags, err) == -1) + return -1; + buf += keep; + offs += keep; + count -= keep; + } + + /* Unaligned tail */ + if (count) { + ACQUIRE_WRLOCK_FOR_CURRENT_SCOPE (&lock); + if (next->pread (next, bounce, h->minblock, offs, flags, err) == -1) + return -1; + memcpy (buf, bounce, count); + } + + return 0; +} + +static int +blocksize_pwrite (nbdkit_next *next, + void *handle, const void *b, uint32_t count, uint64_t offs, + uint32_t flags, int *err) +{ + struct blocksize_handle *h = handle; + const char *buf = b; + uint32_t keep; + uint32_t drop; + bool need_flush = false; + + if ((flags & NBDKIT_FLAG_FUA) && + next->can_fua (next) == NBDKIT_FUA_EMULATE) { + flags &= ~NBDKIT_FLAG_FUA; + need_flush = true; + } + + /* Unaligned head */ + if (offs & (h->minblock - 1)) { + ACQUIRE_WRLOCK_FOR_CURRENT_SCOPE (&lock); + drop = offs & (h->minblock - 1); + keep = MIN (h->minblock - drop, count); + if (next->pread (next, bounce, h->minblock, offs - drop, 0, err) == -1) + return -1; + memcpy (bounce + drop, buf, keep); + if (next->pwrite (next, bounce, h->minblock, offs - drop, flags, err) == -1) + return -1; + buf += keep; + offs += keep; + count -= keep; + } + + /* Aligned body */ + while (count >= h->minblock) { + ACQUIRE_RDLOCK_FOR_CURRENT_SCOPE (&lock); + keep = MIN (h->maxdata, ROUND_DOWN (count, h->minblock)); + if (next->pwrite (next, buf, keep, offs, flags, err) == -1) + return -1; + buf += keep; + offs += keep; + count -= keep; + } + + /* Unaligned tail */ + if (count) { + ACQUIRE_WRLOCK_FOR_CURRENT_SCOPE (&lock); + if (next->pread (next, bounce, h->minblock, offs, 0, err) == -1) + return -1; + memcpy (bounce, buf, count); + if (next->pwrite (next, bounce, h->minblock, offs, flags, err) == -1) + return -1; + } + + if (need_flush) + return next->flush (next, 0, err); + return 0; +} + +static int +blocksize_trim (nbdkit_next *next, + void *handle, uint32_t count, uint64_t offs, uint32_t flags, + int *err) +{ + struct blocksize_handle *h = handle; + uint32_t keep; + bool need_flush = false; + + if ((flags & NBDKIT_FLAG_FUA) && + next->can_fua (next) == NBDKIT_FUA_EMULATE) { + flags &= ~NBDKIT_FLAG_FUA; + need_flush = true; + } + + /* Ignore unaligned head */ + if (offs & (h->minblock - 1)) { + keep = MIN (h->minblock - (offs & (h->minblock - 1)), count); + offs += keep; + count -= keep; + } + + /* Ignore unaligned tail */ + count = ROUND_DOWN (count, h->minblock); + + /* Aligned body */ + while (count) { + ACQUIRE_RDLOCK_FOR_CURRENT_SCOPE (&lock); + keep = MIN (h->maxlen, count); + if (next->trim (next, keep, offs, flags, err) == -1) + return -1; + offs += keep; + count -= keep; + } + + if (need_flush) + return next->flush (next, 0, err); + return 0; +} + +static int +blocksize_zero (nbdkit_next *next, + void *handle, uint32_t count, uint64_t offs, uint32_t flags, + int *err) +{ + struct blocksize_handle *h = handle; + uint32_t keep; + uint32_t drop; + bool need_flush = false; + + if (flags & NBDKIT_FLAG_FAST_ZERO) { + /* If we have to split the transaction, an ENOTSUP fast failure in + * a later call would be unnecessarily delayed behind earlier + * calls; it's easier to just declare that anything that can't be + * done in one call to the plugin is not fast. + */ + if ((offs | count) & (h->minblock - 1) || count > h->maxlen) { + *err = ENOTSUP; + return -1; + } + } + + if ((flags & NBDKIT_FLAG_FUA) && + next->can_fua (next) == NBDKIT_FUA_EMULATE) { + flags &= ~NBDKIT_FLAG_FUA; + need_flush = true; + } + + /* Unaligned head */ + if (offs & (h->minblock - 1)) { + ACQUIRE_WRLOCK_FOR_CURRENT_SCOPE (&lock); + drop = offs & (h->minblock - 1); + keep = MIN (h->minblock - drop, count); + if (next->pread (next, bounce, h->minblock, offs - drop, 0, err) == -1) + return -1; + memset (bounce + drop, 0, keep); + if (next->pwrite (next, bounce, h->minblock, offs - drop, + flags & ~NBDKIT_FLAG_MAY_TRIM, err) == -1) + return -1; + offs += keep; + count -= keep; + } + + /* Aligned body */ + while (count >= h->minblock) { + ACQUIRE_RDLOCK_FOR_CURRENT_SCOPE (&lock); + keep = MIN (h->maxlen, ROUND_DOWN (count, h->minblock)); + if (next->zero (next, keep, offs, flags, err) == -1) + return -1; + offs += keep; + count -= keep; + } + + /* Unaligned tail */ + if (count) { + ACQUIRE_WRLOCK_FOR_CURRENT_SCOPE (&lock); + if (next->pread (next, bounce, h->minblock, offs, 0, err) == -1) + return -1; + memset (bounce, 0, count); + if (next->pwrite (next, bounce, h->minblock, offs, + flags & ~NBDKIT_FLAG_MAY_TRIM, err) == -1) + return -1; + } + + if (need_flush) + return next->flush (next, 0, err); + return 0; +} + +static int +blocksize_extents (nbdkit_next *next, + void *handle, uint32_t count, uint64_t offset, + uint32_t flags, struct nbdkit_extents *extents, int *err) +{ + /* Ask the plugin for blocksize-aligned data. Copying that into the + * callers' extents will then take care of truncating unaligned + * ends. Also we only need to ask for maxlen of data, because it's + * fine to return less than the full count as long as we're making + * progress. + */ + struct blocksize_handle *h = handle; + CLEANUP_EXTENTS_FREE struct nbdkit_extents *extents2 = NULL; + size_t i; + struct nbdkit_extent e; + + extents2 = nbdkit_extents_new (ROUND_DOWN (offset, h->minblock), + ROUND_UP (offset + count, h->minblock)); + if (extents2 == NULL) { + *err = errno; + return -1; + } + + if (nbdkit_extents_aligned (next, MIN (ROUND_UP (count, h->minblock), + h->maxlen), + ROUND_DOWN (offset, h->minblock), flags, + h->minblock, extents2, err) == -1) + return -1; + + for (i = 0; i < nbdkit_extents_count (extents2); ++i) { + e = nbdkit_get_extent (extents2, i); + if (nbdkit_add_extent (extents, e.offset, e.length, e.type) == -1) { + *err = errno; + return -1; + } + } + return 0; +} + +static int +blocksize_cache (nbdkit_next *next, + void *handle, uint32_t count, uint64_t offs, uint32_t flags, + int *err) +{ + struct blocksize_handle *h = handle; + uint32_t limit; + uint64_t remaining = count; /* Rounding out could exceed 32 bits */ + + /* Unaligned head */ + limit = offs & (h->minblock - 1); + remaining += limit; + offs -= limit; + + /* Unaligned tail */ + remaining = ROUND_UP (remaining, h->minblock); + + /* Aligned body */ + while (remaining) { + limit = MIN (h->maxdata, remaining); + if (next->cache (next, limit, offs, flags, err) == -1) + return -1; + offs += limit; + remaining -= limit; + } + + return 0; +} + +static struct nbdkit_filter filter = { + .name = "blocksize", + .longname = "nbdkit blocksize filter", + .config = blocksize_config, + .config_complete = blocksize_config_complete, + .config_help = blocksize_config_help, + .open = blocksize_open, + .prepare = blocksize_prepare, + .close = free, + .get_size = blocksize_get_size, + .block_size = blocksize_block_size, + .pread = blocksize_pread, + .pwrite = blocksize_pwrite, + .trim = blocksize_trim, + .zero = blocksize_zero, + .extents = blocksize_extents, + .cache = blocksize_cache, +}; + +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/blocksize/nbdkit-blocksize-filter.pod b/filters/blocksize/nbdkit-blocksize-filter.pod new file mode 100644 index 0000000..60aeff6 --- /dev/null +++ b/filters/blocksize/nbdkit-blocksize-filter.pod @@ -0,0 +1,130 @@ +=head1 NAME + +nbdkit-blocksize-filter - nbdkit blocksize filter + +=head1 SYNOPSIS + + nbdkit --filter=blocksize plugin [minblock=SIZE] [maxdata=SIZE] \ + [maxlen=SIZE] [plugin-args...] + +=head1 DESCRIPTION + +C is a filter that ensures various block size +limits are met on transactions presented to the plugin. The NBD +protocol permits clients to send requests with a granularity as small +as 1 byte or as large as nearly 4 gigabytes, although it suggests that +portable clients should align requests to 512 bytes and not exceed 32 +megabytes without prior coordination with the server. + +Meanwhile, some plugins require requests to be aligned to 512-byte +multiples, or may enforce a maximum transaction size to bound the time +or memory resources spent by any one command (note that nbdkit itself +refuses a read or write larger than 64 megabytes, while many other NBD +servers limit things to 32 megabytes). The blocksize filter can be +used to modify the client requests to meet the plugin restrictions. + +This filter can be combined with L +to advertise different block sizes to the client. + +=head1 PARAMETERS + +The nbdkit-blocksize-filter accepts the following parameters. + +=over 4 + +=item BSIZE + +The minimum block size and alignment to pass to the plugin. This must +be a power of two, and no larger than 64k. If omitted, this defaults +to the minimum block size of the underlying plugin, or 1 if the plugin +did not report a minimum block size. The filter rounds up +read requests to alignment boundaries, performs read-modify-write +cycles for any unaligned head or tail of a write or zero request, and +silently ignores any unaligned head or tail of a trim request. The +filter also truncates the plugin size down to an aligned value (as it +cannot safely operate on the unaligned tail). If you need to round +the image size up instead to access the last few bytes, combine this +filter with L. + +This parameter understands the suffix 'k' for 1024. + +=item BSIZE + +The maximum block size for any single transaction with data (read and +write). If omitted, this defaults to the minimum of 64 megabytes (that +is, the nbdkit maximum) or any maximum reported by the underlying plugin. +This need not be a power of two, but must be an +integer multiple of C. The filter fragments any larger +client request into multiple plugin requests. + +This parameter understands the suffixes 'k', 'M', and 'G' for powers +of 1024. + +=item BSIZE + +The maximum length for any single transaction without data (trim, zero, +cache or extents). If omitted, this defaults to 0xffffffff rounded down to +C alignment (that is, the inherent 32-bit limit of the NBD +protocol). This need not be a power of two, but must be an integer +multiple of C, and should be at least as large as +C. The filter fragments any larger client request into +multiple plugin requests. + +This parameter understands the suffixes 'k', 'M', and 'G' for powers +of 1024. + +=back + +=head1 EXAMPLES + +Allow an arbitrary client to use the VDDK plugin (which is limited to +512-byte blocks), without having to fix the client to avoid sending +unaligned requests: + + nbdkit --filter=blocksize vddk minblock=512 file=/absolute/path/to/file.vmdk + +Allow an arbitrary client tuned to nbdkit's 64 megabyte sizing to +connect to a remote server that insists on 32 megabyte sizing, via the +nbd plugin: + + nbdkit --filter=blocksize nbd maxdata=32M socket=/path/to/socket + +Serve a file as if it were a block device that insists on 4k +alignment, while still allowing access to any unaligned bytes at the +end of the file: + + nbdkit --filter=blocksize --filter=truncate file /path/to/file \ + minblock=4k round-up=4k + +=head1 FILES + +=over 4 + +=item F<$filterdir/nbdkit-blocksize-filter.so> + +The filter. + +Use C to find the location of C<$filterdir>. + +=back + +=head1 VERSION + +C first appeared in nbdkit 1.4. + +=head1 SEE ALSO + +L, +L, +L, +L, +L, +L. + +=head1 AUTHORS + +Eric Blake + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/filters/cache/Makefile.am b/filters/cache/Makefile.am new file mode 100644 index 0000000..76bbfac --- /dev/null +++ b/filters/cache/Makefile.am @@ -0,0 +1,87 @@ +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 $(top_srcdir)/common-rules.mk + +EXTRA_DIST = nbdkit-cache-filter.pod + +# Requires hole-punching and other OS specific features which make +# this an effort to port to Windows. +if !IS_WINDOWS + +filter_LTLIBRARIES = nbdkit-cache-filter.la + +nbdkit_cache_filter_la_SOURCES = \ + blk.c \ + blk.h \ + cache.c \ + cache.h \ + lru.c \ + lru.h \ + reclaim.c \ + reclaim.h \ + $(top_srcdir)/include/nbdkit-filter.h \ + $(NULL) + +nbdkit_cache_filter_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/common/bitmap \ + -I$(top_srcdir)/common/include \ + -I$(top_srcdir)/common/utils \ + $(NULL) +nbdkit_cache_filter_la_CFLAGS = $(WARNINGS_CFLAGS) +nbdkit_cache_filter_la_LDFLAGS = \ + -module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \ + $(NULL) +if USE_LINKER_SCRIPT +nbdkit_cache_filter_la_LDFLAGS += \ + -Wl,--version-script=$(top_srcdir)/filters/filters.syms +endif +nbdkit_cache_filter_la_LIBADD = \ + $(top_builddir)/common/bitmap/libbitmap.la \ + $(top_builddir)/common/utils/libutils.la \ + $(IMPORT_LIBRARY_ON_WINDOWS) \ + $(NULL) + +if HAVE_POD + +man_MANS = nbdkit-cache-filter.1 +CLEANFILES += $(man_MANS) + +nbdkit-cache-filter.1: nbdkit-cache-filter.pod \ + $(top_builddir)/podwrapper.pl + $(PODWRAPPER) --section=1 --man $@ \ + --html $(top_builddir)/html/$@.html \ + $< + +endif HAVE_POD +endif !IS_WINDOWS diff --git a/filters/cache/Makefile.in b/filters/cache/Makefile.in new file mode 100644 index 0000000..fb6eb92 --- /dev/null +++ b/filters/cache/Makefile.in @@ -0,0 +1,990 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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@ +@IS_WINDOWS_FALSE@@USE_LINKER_SCRIPT_TRUE@am__append_1 = \ +@IS_WINDOWS_FALSE@@USE_LINKER_SCRIPT_TRUE@ -Wl,--version-script=$(top_srcdir)/filters/filters.syms + +@HAVE_POD_TRUE@@IS_WINDOWS_FALSE@am__append_2 = $(man_MANS) +subdir = filters/cache +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ocaml.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +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 = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(filterdir)" "$(DESTDIR)$(man1dir)" +LTLIBRARIES = $(filter_LTLIBRARIES) +am__DEPENDENCIES_1 = +@IS_WINDOWS_FALSE@nbdkit_cache_filter_la_DEPENDENCIES = \ +@IS_WINDOWS_FALSE@ $(top_builddir)/common/bitmap/libbitmap.la \ +@IS_WINDOWS_FALSE@ $(top_builddir)/common/utils/libutils.la \ +@IS_WINDOWS_FALSE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am__nbdkit_cache_filter_la_SOURCES_DIST = blk.c blk.h cache.c cache.h \ + lru.c lru.h reclaim.c reclaim.h \ + $(top_srcdir)/include/nbdkit-filter.h +am__objects_1 = +@IS_WINDOWS_FALSE@am_nbdkit_cache_filter_la_OBJECTS = \ +@IS_WINDOWS_FALSE@ nbdkit_cache_filter_la-blk.lo \ +@IS_WINDOWS_FALSE@ nbdkit_cache_filter_la-cache.lo \ +@IS_WINDOWS_FALSE@ nbdkit_cache_filter_la-lru.lo \ +@IS_WINDOWS_FALSE@ nbdkit_cache_filter_la-reclaim.lo \ +@IS_WINDOWS_FALSE@ $(am__objects_1) +nbdkit_cache_filter_la_OBJECTS = $(am_nbdkit_cache_filter_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +nbdkit_cache_filter_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(nbdkit_cache_filter_la_CFLAGS) $(CFLAGS) \ + $(nbdkit_cache_filter_la_LDFLAGS) $(LDFLAGS) -o $@ +@IS_WINDOWS_FALSE@am_nbdkit_cache_filter_la_rpath = -rpath \ +@IS_WINDOWS_FALSE@ $(filterdir) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/nbdkit_cache_filter_la-blk.Plo \ + ./$(DEPDIR)/nbdkit_cache_filter_la-cache.Plo \ + ./$(DEPDIR)/nbdkit_cache_filter_la-lru.Plo \ + ./$(DEPDIR)/nbdkit_cache_filter_la-reclaim.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(nbdkit_cache_filter_la_SOURCES) +DIST_SOURCES = $(am__nbdkit_cache_filter_la_SOURCES_DIST) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/common-rules.mk \ + $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ +BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ +CARGO = @CARGO@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_PLUGIN_CC = @CC_PLUGIN_CC@ +CC_PLUGIN_CFLAGS = @CC_PLUGIN_CFLAGS@ +CERTTOOL = @CERTTOOL@ +CFLAGS = @CFLAGS@ +COM_ERR_CFLAGS = @COM_ERR_CFLAGS@ +COM_ERR_LIBS = @COM_ERR_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CUT = @CUT@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LDFLAGS = @DL_LDFLAGS@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXT2FS_CFLAGS = @EXT2FS_CFLAGS@ +EXT2FS_LIBS = @EXT2FS_LIBS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GENISOIMAGE = @GENISOIMAGE@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GOARCH = @GOARCH@ +GOLANG = @GOLANG@ +GOOS = @GOOS@ +GOROOT = @GOROOT@ +GREP = @GREP@ +IMPORT_LIBRARY_ON_WINDOWS = @IMPORT_LIBRARY_ON_WINDOWS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +ISOPROG = @ISOPROG@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBLKIO_CFLAGS = @LIBBLKIO_CFLAGS@ +LIBBLKIO_LIBS = @LIBBLKIO_LIBS@ +LIBGUESTFS_CFLAGS = @LIBGUESTFS_CFLAGS@ +LIBGUESTFS_LIBS = @LIBGUESTFS_LIBS@ +LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ +LIBLZMA_LIBS = @LIBLZMA_LIBS@ +LIBNBD_CFLAGS = @LIBNBD_CFLAGS@ +LIBNBD_LIBS = @LIBNBD_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSELINUX_CFLAGS = @LIBSELINUX_CFLAGS@ +LIBSELINUX_LIBS = @LIBSELINUX_LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTORRENT_CFLAGS = @LIBTORRENT_CFLAGS@ +LIBTORRENT_LIBS = @LIBTORRENT_LIBS@ +LIBVIRT_CFLAGS = @LIBVIRT_CFLAGS@ +LIBVIRT_LIBS = @LIBVIRT_LIBS@ +LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ +LIBZSTD_LIBS = @LIBZSTD_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LUA_CFLAGS = @LUA_CFLAGS@ +LUA_LIBS = @LUA_LIBS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MC = @MC@ +MKDIR_P = @MKDIR_P@ +MKISOFS = @MKISOFS@ +NBDKIT_VERSION_MAJOR = @NBDKIT_VERSION_MAJOR@ +NBDKIT_VERSION_MICRO = @NBDKIT_VERSION_MICRO@ +NBDKIT_VERSION_MINOR = @NBDKIT_VERSION_MINOR@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_ON_WINDOWS = @NO_UNDEFINED_ON_WINDOWS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OCAML = @OCAML@ +OCAMLBEST = @OCAMLBEST@ +OCAMLBUILD = @OCAMLBUILD@ +OCAMLC = @OCAMLC@ +OCAMLCDOTOPT = @OCAMLCDOTOPT@ +OCAMLDEP = @OCAMLDEP@ +OCAMLDOC = @OCAMLDOC@ +OCAMLLIB = @OCAMLLIB@ +OCAMLMKLIB = @OCAMLMKLIB@ +OCAMLMKTOP = @OCAMLMKTOP@ +OCAMLOPT = @OCAMLOPT@ +OCAMLOPTDOTOPT = @OCAMLOPTDOTOPT@ +OCAMLOPTFLAGS = @OCAMLOPTFLAGS@ +OCAMLVERSION = @OCAMLVERSION@ +OCAML_MAJOR = @OCAML_MAJOR@ +OCAML_PLUGIN_LIBRARIES = @OCAML_PLUGIN_LIBRARIES@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PERL_ARCHLIB = @PERL_ARCHLIB@ +PERL_CFLAGS = @PERL_CFLAGS@ +PERL_LDOPTS = @PERL_LDOPTS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PODWRAPPER = @PODWRAPPER@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_CXX = @PTHREAD_CXX@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CFLAGS = @PYTHON_CFLAGS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +RUBY_CFLAGS = @RUBY_CFLAGS@ +RUBY_LIBS = @RUBY_LIBS@ +RUSTC = @RUSTC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOEXT = @SOEXT@ +SSH_CFLAGS = @SSH_CFLAGS@ +SSH_LIBS = @SSH_LIBS@ +STAT = @STAT@ +STRIP = @STRIP@ +TCL_CFLAGS = @TCL_CFLAGS@ +TCL_LIBS = @TCL_LIBS@ +TRUNCATE = @TRUNCATE@ +VALGRIND = @VALGRIND@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VERSION = @VERSION@ +WARNINGS_CFLAGS = @WARNINGS_CFLAGS@ +XORRISO = @XORRISO@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +ZLIB_NG_CFLAGS = @ZLIB_NG_CFLAGS@ +ZLIB_NG_LIBS = @ZLIB_NG_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DLLTOOL = @ac_ct_DLLTOOL@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_MC = @ac_ct_MC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bashcompdir = @bashcompdir@ +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@ +filters = @filters@ +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@ +lang_plugins = @lang_plugins@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +non_lang_plugins = @non_lang_plugins@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugins = @plugins@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +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@ + +# Convenient list terminator +NULL = +plugindir = $(libdir)/nbdkit/plugins +filterdir = $(libdir)/nbdkit/filters +CLEANFILES = *~ *.cmi *.cmx *.cmxa *.so *.dll $(am__append_2) +EXTRA_DIST = nbdkit-cache-filter.pod + +# Requires hole-punching and other OS specific features which make +# this an effort to port to Windows. +@IS_WINDOWS_FALSE@filter_LTLIBRARIES = nbdkit-cache-filter.la +@IS_WINDOWS_FALSE@nbdkit_cache_filter_la_SOURCES = \ +@IS_WINDOWS_FALSE@ blk.c \ +@IS_WINDOWS_FALSE@ blk.h \ +@IS_WINDOWS_FALSE@ cache.c \ +@IS_WINDOWS_FALSE@ cache.h \ +@IS_WINDOWS_FALSE@ lru.c \ +@IS_WINDOWS_FALSE@ lru.h \ +@IS_WINDOWS_FALSE@ reclaim.c \ +@IS_WINDOWS_FALSE@ reclaim.h \ +@IS_WINDOWS_FALSE@ $(top_srcdir)/include/nbdkit-filter.h \ +@IS_WINDOWS_FALSE@ $(NULL) + +@IS_WINDOWS_FALSE@nbdkit_cache_filter_la_CPPFLAGS = \ +@IS_WINDOWS_FALSE@ -I$(top_srcdir)/include \ +@IS_WINDOWS_FALSE@ -I$(top_builddir)/include \ +@IS_WINDOWS_FALSE@ -I$(top_srcdir)/common/bitmap \ +@IS_WINDOWS_FALSE@ -I$(top_srcdir)/common/include \ +@IS_WINDOWS_FALSE@ -I$(top_srcdir)/common/utils \ +@IS_WINDOWS_FALSE@ $(NULL) + +@IS_WINDOWS_FALSE@nbdkit_cache_filter_la_CFLAGS = $(WARNINGS_CFLAGS) +@IS_WINDOWS_FALSE@nbdkit_cache_filter_la_LDFLAGS = -module \ +@IS_WINDOWS_FALSE@ -avoid-version -shared \ +@IS_WINDOWS_FALSE@ $(NO_UNDEFINED_ON_WINDOWS) $(NULL) \ +@IS_WINDOWS_FALSE@ $(am__append_1) +@IS_WINDOWS_FALSE@nbdkit_cache_filter_la_LIBADD = \ +@IS_WINDOWS_FALSE@ $(top_builddir)/common/bitmap/libbitmap.la \ +@IS_WINDOWS_FALSE@ $(top_builddir)/common/utils/libutils.la \ +@IS_WINDOWS_FALSE@ $(IMPORT_LIBRARY_ON_WINDOWS) \ +@IS_WINDOWS_FALSE@ $(NULL) + +@HAVE_POD_TRUE@@IS_WINDOWS_FALSE@man_MANS = nbdkit-cache-filter.1 +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common-rules.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign filters/cache/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign filters/cache/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; +$(top_srcdir)/common-rules.mk $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +install-filterLTLIBRARIES: $(filter_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(filter_LTLIBRARIES)'; test -n "$(filterdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(filterdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(filterdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(filterdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(filterdir)"; \ + } + +uninstall-filterLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(filter_LTLIBRARIES)'; test -n "$(filterdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(filterdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(filterdir)/$$f"; \ + done + +clean-filterLTLIBRARIES: + -test -z "$(filter_LTLIBRARIES)" || rm -f $(filter_LTLIBRARIES) + @list='$(filter_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +nbdkit-cache-filter.la: $(nbdkit_cache_filter_la_OBJECTS) $(nbdkit_cache_filter_la_DEPENDENCIES) $(EXTRA_nbdkit_cache_filter_la_DEPENDENCIES) + $(AM_V_CCLD)$(nbdkit_cache_filter_la_LINK) $(am_nbdkit_cache_filter_la_rpath) $(nbdkit_cache_filter_la_OBJECTS) $(nbdkit_cache_filter_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nbdkit_cache_filter_la-blk.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nbdkit_cache_filter_la-cache.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nbdkit_cache_filter_la-lru.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nbdkit_cache_filter_la-reclaim.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +nbdkit_cache_filter_la-blk.lo: blk.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_cache_filter_la_CPPFLAGS) $(CPPFLAGS) $(nbdkit_cache_filter_la_CFLAGS) $(CFLAGS) -MT nbdkit_cache_filter_la-blk.lo -MD -MP -MF $(DEPDIR)/nbdkit_cache_filter_la-blk.Tpo -c -o nbdkit_cache_filter_la-blk.lo `test -f 'blk.c' || echo '$(srcdir)/'`blk.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nbdkit_cache_filter_la-blk.Tpo $(DEPDIR)/nbdkit_cache_filter_la-blk.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='blk.c' object='nbdkit_cache_filter_la-blk.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_cache_filter_la_CPPFLAGS) $(CPPFLAGS) $(nbdkit_cache_filter_la_CFLAGS) $(CFLAGS) -c -o nbdkit_cache_filter_la-blk.lo `test -f 'blk.c' || echo '$(srcdir)/'`blk.c + +nbdkit_cache_filter_la-cache.lo: cache.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_cache_filter_la_CPPFLAGS) $(CPPFLAGS) $(nbdkit_cache_filter_la_CFLAGS) $(CFLAGS) -MT nbdkit_cache_filter_la-cache.lo -MD -MP -MF $(DEPDIR)/nbdkit_cache_filter_la-cache.Tpo -c -o nbdkit_cache_filter_la-cache.lo `test -f 'cache.c' || echo '$(srcdir)/'`cache.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nbdkit_cache_filter_la-cache.Tpo $(DEPDIR)/nbdkit_cache_filter_la-cache.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache.c' object='nbdkit_cache_filter_la-cache.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_cache_filter_la_CPPFLAGS) $(CPPFLAGS) $(nbdkit_cache_filter_la_CFLAGS) $(CFLAGS) -c -o nbdkit_cache_filter_la-cache.lo `test -f 'cache.c' || echo '$(srcdir)/'`cache.c + +nbdkit_cache_filter_la-lru.lo: lru.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_cache_filter_la_CPPFLAGS) $(CPPFLAGS) $(nbdkit_cache_filter_la_CFLAGS) $(CFLAGS) -MT nbdkit_cache_filter_la-lru.lo -MD -MP -MF $(DEPDIR)/nbdkit_cache_filter_la-lru.Tpo -c -o nbdkit_cache_filter_la-lru.lo `test -f 'lru.c' || echo '$(srcdir)/'`lru.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nbdkit_cache_filter_la-lru.Tpo $(DEPDIR)/nbdkit_cache_filter_la-lru.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='lru.c' object='nbdkit_cache_filter_la-lru.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_cache_filter_la_CPPFLAGS) $(CPPFLAGS) $(nbdkit_cache_filter_la_CFLAGS) $(CFLAGS) -c -o nbdkit_cache_filter_la-lru.lo `test -f 'lru.c' || echo '$(srcdir)/'`lru.c + +nbdkit_cache_filter_la-reclaim.lo: reclaim.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_cache_filter_la_CPPFLAGS) $(CPPFLAGS) $(nbdkit_cache_filter_la_CFLAGS) $(CFLAGS) -MT nbdkit_cache_filter_la-reclaim.lo -MD -MP -MF $(DEPDIR)/nbdkit_cache_filter_la-reclaim.Tpo -c -o nbdkit_cache_filter_la-reclaim.lo `test -f 'reclaim.c' || echo '$(srcdir)/'`reclaim.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nbdkit_cache_filter_la-reclaim.Tpo $(DEPDIR)/nbdkit_cache_filter_la-reclaim.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='reclaim.c' object='nbdkit_cache_filter_la-reclaim.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_cache_filter_la_CPPFLAGS) $(CPPFLAGS) $(nbdkit_cache_filter_la_CFLAGS) $(CFLAGS) -c -o nbdkit_cache_filter_la-reclaim.lo `test -f 'reclaim.c' || echo '$(srcdir)/'`reclaim.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(MANS) +installdirs: + for dir in "$(DESTDIR)$(filterdir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: 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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-filterLTLIBRARIES clean-generic clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/nbdkit_cache_filter_la-blk.Plo + -rm -f ./$(DEPDIR)/nbdkit_cache_filter_la-cache.Plo + -rm -f ./$(DEPDIR)/nbdkit_cache_filter_la-lru.Plo + -rm -f ./$(DEPDIR)/nbdkit_cache_filter_la-reclaim.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-filterLTLIBRARIES install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/nbdkit_cache_filter_la-blk.Plo + -rm -f ./$(DEPDIR)/nbdkit_cache_filter_la-cache.Plo + -rm -f ./$(DEPDIR)/nbdkit_cache_filter_la-lru.Plo + -rm -f ./$(DEPDIR)/nbdkit_cache_filter_la-reclaim.Plo + -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-filterLTLIBRARIES uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-filterLTLIBRARIES clean-generic clean-libtool \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-filterLTLIBRARIES \ + install-html install-html-am install-info install-info-am \ + install-man install-man1 install-pdf install-pdf-am 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 tags-am uninstall \ + uninstall-am uninstall-filterLTLIBRARIES uninstall-man \ + uninstall-man1 + +.PRECIOUS: Makefile + + +@HAVE_POD_TRUE@@IS_WINDOWS_FALSE@nbdkit-cache-filter.1: nbdkit-cache-filter.pod \ +@HAVE_POD_TRUE@@IS_WINDOWS_FALSE@ $(top_builddir)/podwrapper.pl +@HAVE_POD_TRUE@@IS_WINDOWS_FALSE@ $(PODWRAPPER) --section=1 --man $@ \ +@HAVE_POD_TRUE@@IS_WINDOWS_FALSE@ --html $(top_builddir)/html/$@.html \ +@HAVE_POD_TRUE@@IS_WINDOWS_FALSE@ $< + +# 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/filters/cache/blk.c b/filters/cache/blk.c new file mode 100644 index 0000000..ba2c41b --- /dev/null +++ b/filters/cache/blk.c @@ -0,0 +1,451 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +/* These are the block operations. They always read or write a single + * whole block of size ‘blksize’. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_SYS_STATVFS_H +#include +#endif + +#include + +#include "bitmap.h" +#include "minmax.h" +#include "rounding.h" +#include "utils.h" + +#include "cache.h" +#include "blk.h" +#include "lru.h" +#include "reclaim.h" + +/* The cache. */ +static int fd = -1; + +/* Bitmap. There are two bits per block which are updated as we read, + * write back or write through blocks. + * + * 00 = not in cache + * 01 = block cached and clean + * 10 = + * 11 = block cached and dirty + * + * Future enhancement: + * + * We need to cache information about holes, ie. blocks which read as + * zeroes but are not explicitly stored in the cache. This + * information could be set when clients call cache_zero (and defer + * calling plugin->zero until flush). The information could also + * interact with extents, so when plugin->extents returns information + * that a hole exists we can record this information in the cache and + * not have to query the plugin a second time (especially useful for + * VDDK where querying extents is slow, and for qemu which [in 2019] + * repeatedly requests the same information with REQ_ONE set). + */ +static struct bitmap bm; + +enum bm_entry { + BLOCK_NOT_CACHED = 0, /* assumed to be zero by reclaim code */ + BLOCK_CLEAN = 1, + BLOCK_DIRTY = 3, +}; + +static const char * +state_to_string (enum bm_entry state) +{ + switch (state) { + case BLOCK_NOT_CACHED: return "not cached"; + case BLOCK_CLEAN: return "clean"; + case BLOCK_DIRTY: return "dirty"; + default: abort (); + } +} + +/* Extra debugging (-D cache.verbose=1). */ +NBDKIT_DLL_PUBLIC int cache_debug_verbose = 0; + +int +blk_init (void) +{ + const char *tmpdir; + size_t len; + char *template; + struct statvfs statvfs; + + tmpdir = getenv ("TMPDIR"); + if (!tmpdir) + tmpdir = LARGE_TMPDIR; + + nbdkit_debug ("cache: temporary directory for cache: %s", tmpdir); + + len = strlen (tmpdir) + 8; + template = alloca (len); + snprintf (template, len, "%s/XXXXXX", tmpdir); + +#ifdef HAVE_MKOSTEMP + fd = mkostemp (template, O_CLOEXEC); +#else + /* Not atomic, but this is only invoked during .load, so the race + * won't affect any plugin actions trying to fork + */ + fd = mkstemp (template); + if (fd >= 0) { + fd = set_cloexec (fd); + if (fd < 0) { + int e = errno; + unlink (template); + errno = e; + } + } +#endif + if (fd == -1) { + nbdkit_error ("mkostemp: %s: %m", tmpdir); + return -1; + } + + unlink (template); + + /* Choose the block size. + * + * A 4K block size means that we need 64 MB of memory to store the + * bitmaps for a 1 TB underlying image. However to support + * hole-punching (for reclaiming) we need the block size to be at + * least as large as the filesystem block size. + */ + if (fstatvfs (fd, &statvfs) == -1) { + nbdkit_error ("fstatvfs: %s: %m", tmpdir); + return -1; + } + blksize = MAX (min_block_size, statvfs.f_bsize); + nbdkit_debug ("cache: block size: %u", blksize); + + bitmap_init (&bm, blksize, 2 /* bits per block */); + + lru_init (); + + return 0; +} + +void +blk_free (void) +{ + if (fd >= 0) + close (fd); + + bitmap_free (&bm); + + lru_free (); +} + +/* Because blk_set_size is called before the other blk_* functions + * this should be set to the true size before we need it. + */ +static uint64_t size = 0; + +int +blk_set_size (uint64_t new_size) +{ + size = new_size; + + if (bitmap_resize (&bm, size) == -1) + return -1; + + if (ftruncate (fd, ROUND_UP (size, blksize)) == -1) { + nbdkit_error ("ftruncate: %m"); + return -1; + } + + if (lru_set_size (size) == -1) + return -1; + + return 0; +} + +static int +_blk_read_multiple (nbdkit_next *next, + uint64_t blknum, uint64_t nrblocks, + uint8_t *block, int *err) +{ + off_t offset = blknum * blksize; + bool not_cached = + bitmap_get_blk (&bm, blknum, BLOCK_NOT_CACHED) == BLOCK_NOT_CACHED; + uint64_t b, runblocks; + + assert (nrblocks > 0); + + if (cache_debug_verbose) + nbdkit_debug ("cache: blk_read_multiple block %" PRIu64 + " (offset %" PRIu64 ") is %s", + blknum, (uint64_t) offset, + not_cached ? "not cached" : "cached"); + + /* Find out how many of the following blocks form a "run" with the + * same cached/not-cached state. We can process that many blocks in + * one go. + */ + for (b = 1, runblocks = 1; b < nrblocks; ++b, ++runblocks) { + bool s = + bitmap_get_blk (&bm, blknum + b, BLOCK_NOT_CACHED) == BLOCK_NOT_CACHED; + if (not_cached != s) + break; + } + + if (not_cached) { /* Read underlying plugin. */ + unsigned n, tail = 0; + + assert (blksize * runblocks <= UINT_MAX); + n = blksize * runblocks; + + if (offset + n > size) { + tail = offset + n - size; + n -= tail; + } + + if (next->pread (next, block, n, offset, 0, err) == -1) + return -1; + + /* Normally we're reading whole blocks, but at the very end of the + * file we might read a partial block. Deal with that case by + * zeroing the tail. + */ + memset (block + n, 0, tail); + + /* If cache-on-read, copy the blocks to the cache. */ + if (cache_on_read ()) { + if (cache_debug_verbose) + nbdkit_debug ("cache: cache-on-read block %" PRIu64 + " (offset %" PRIu64 ")", + blknum, (uint64_t) offset); + + if (full_pwrite (fd, block, blksize * runblocks, offset) == -1) { + *err = errno; + nbdkit_error ("pwrite: %m"); + return -1; + } + for (b = 0; b < runblocks; ++b) { + bitmap_set_blk (&bm, blknum + b, BLOCK_CLEAN); + lru_set_recently_accessed (blknum + b); + } + } + } + else { /* Read cache. */ + if (full_pread (fd, block, blksize * runblocks, offset) == -1) { + *err = errno; + nbdkit_error ("pread: %m"); + return -1; + } + for (b = 0; b < runblocks; ++b) + lru_set_recently_accessed (blknum + b); + } + + /* If all done, return. */ + if (runblocks == nrblocks) + return 0; + + /* Recurse to read remaining blocks. */ + return _blk_read_multiple (next, + blknum + runblocks, + nrblocks - runblocks, + block + blksize * runblocks, + err); +} + +int +blk_read_multiple (nbdkit_next *next, + uint64_t blknum, uint64_t nrblocks, + uint8_t *block, int *err) +{ + reclaim (fd, &bm); + return _blk_read_multiple (next, blknum, nrblocks, block, err); +} + +int +blk_read (nbdkit_next *next, + uint64_t blknum, uint8_t *block, int *err) +{ + return blk_read_multiple (next, blknum, 1, block, err); +} + +int +blk_cache (nbdkit_next *next, + uint64_t blknum, uint8_t *block, int *err) +{ + off_t offset = blknum * blksize; + enum bm_entry state = bitmap_get_blk (&bm, blknum, BLOCK_NOT_CACHED); + + reclaim (fd, &bm); + + if (cache_debug_verbose) + nbdkit_debug ("cache: blk_cache block %" PRIu64 + " (offset %" PRIu64 ") is %s", + blknum, (uint64_t) offset, + state_to_string (state)); + + if (state == BLOCK_NOT_CACHED) { + /* Read underlying plugin, copy to cache regardless of cache-on-read. */ + unsigned n = blksize, tail = 0; + + if (offset + n > size) { + tail = offset + n - size; + n -= tail; + } + + if (next->pread (next, block, n, offset, 0, err) == -1) + return -1; + + /* Normally we're reading whole blocks, but at the very end of the + * file we might read a partial block. Deal with that case by + * zeroing the tail. + */ + memset (block + n, 0, tail); + + if (cache_debug_verbose) + nbdkit_debug ("cache: cache block %" PRIu64 " (offset %" PRIu64 ")", + blknum, (uint64_t) offset); + + if (full_pwrite (fd, block, blksize, offset) == -1) { + *err = errno; + nbdkit_error ("pwrite: %m"); + return -1; + } + bitmap_set_blk (&bm, blknum, BLOCK_CLEAN); + lru_set_recently_accessed (blknum); + } + else { +#if HAVE_POSIX_FADVISE + int r = posix_fadvise (fd, offset, blksize, POSIX_FADV_WILLNEED); + if (r) { + errno = r; + nbdkit_error ("posix_fadvise: %m"); + return -1; + } +#endif + lru_set_recently_accessed (blknum); + } + return 0; +} + +int +blk_writethrough (nbdkit_next *next, + uint64_t blknum, const uint8_t *block, uint32_t flags, + int *err) +{ + off_t offset = blknum * blksize; + unsigned n = blksize, tail = 0; + + if (offset + n > size) { + tail = offset + n - size; + n -= tail; + } + + reclaim (fd, &bm); + + if (cache_debug_verbose) + nbdkit_debug ("cache: writethrough block %" PRIu64 " (offset %" PRIu64 ")", + blknum, (uint64_t) offset); + + if (full_pwrite (fd, block, blksize, offset) == -1) { + *err = errno; + nbdkit_error ("pwrite: %m"); + return -1; + } + + if (next->pwrite (next, block, n, offset, flags, err) == -1) + return -1; + + bitmap_set_blk (&bm, blknum, BLOCK_CLEAN); + lru_set_recently_accessed (blknum); + + return 0; +} + +int +blk_write (nbdkit_next *next, + uint64_t blknum, const uint8_t *block, uint32_t flags, + int *err) +{ + off_t offset; + + if (cache_mode == CACHE_MODE_WRITETHROUGH || + (cache_mode == CACHE_MODE_WRITEBACK && (flags & NBDKIT_FLAG_FUA))) + return blk_writethrough (next, blknum, block, flags, err); + + offset = blknum * blksize; + + reclaim (fd, &bm); + + if (cache_debug_verbose) + nbdkit_debug ("cache: writeback block %" PRIu64 " (offset %" PRIu64 ")", + blknum, (uint64_t) offset); + + if (full_pwrite (fd, block, blksize, offset) == -1) { + *err = errno; + nbdkit_error ("pwrite: %m"); + return -1; + } + bitmap_set_blk (&bm, blknum, BLOCK_DIRTY); + lru_set_recently_accessed (blknum); + + return 0; +} + +int +for_each_dirty_block (block_callback f, void *vp) +{ + uint64_t blknum; + enum bm_entry state; + + bitmap_for (&bm, blknum) { + state = bitmap_get_blk (&bm, blknum, BLOCK_NOT_CACHED); + if (state == BLOCK_DIRTY) { + if (f (blknum, vp) == -1) + return -1; + } + } + + return 0; +} diff --git a/filters/cache/blk.h b/filters/cache/blk.h new file mode 100644 index 0000000..06b11a0 --- /dev/null +++ b/filters/cache/blk.h @@ -0,0 +1,93 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_BLK_H +#define NBDKIT_BLK_H + +/* Initialize the cache and bitmap. */ +extern int blk_init (void); + +/* Close the cache, free the bitmap. */ +extern void blk_free (void); + +/*---------------------------------------------------------------------- + * ** NOTE ** + * + * An exclusive lock must be held when you call any function below + * this line. + */ + +/* Allocate or resize the cache file and bitmap. */ +extern int blk_set_size (uint64_t new_size); + +/* Read a single block from the cache or plugin. If cache_on_read is set, + * also ensure it is cached. */ +extern int blk_read (nbdkit_next *next, + uint64_t blknum, uint8_t *block, int *err) + __attribute__ ((__nonnull__ (1, 3, 4))); + +/* As above, but read multiple blocks. */ +extern int blk_read_multiple (nbdkit_next *next, + uint64_t blknum, uint64_t nrblocks, + uint8_t *block, int *err) + __attribute__ ((__nonnull__ (1, 4, 5))); + +/* If a single block is not cached, copy it from the plugin. */ +extern int blk_cache (nbdkit_next *next, + uint64_t blknum, uint8_t *block, int *err) + __attribute__ ((__nonnull__ (1, 3, 4))); + +/* Write to the cache and the plugin. */ +extern int blk_writethrough (nbdkit_next *next, + uint64_t blknum, const uint8_t *block, + uint32_t flags, int *err) + __attribute__ ((__nonnull__ (1, 3, 5))); + +/* Write a whole block. + * + * If the cache is in writethrough mode, or the FUA flag is set, then + * this calls blk_writethrough above which will write both to the + * cache and through to the underlying device. + * + * Otherwise it will only write to the cache. + */ +extern int blk_write (nbdkit_next *next, + uint64_t blknum, const uint8_t *block, + uint32_t flags, int *err) + __attribute__ ((__nonnull__ (1, 3, 5))); + +/* Iterates over each dirty block in the cache. */ +typedef int (*block_callback) (uint64_t blknum, void *vp); +extern int for_each_dirty_block (block_callback f, void *vp) + __attribute__ ((__nonnull__ (1))); + +#endif /* NBDKIT_BLK_H */ diff --git a/filters/cache/cache.c b/filters/cache/cache.c new file mode 100644 index 0000000..b548606 --- /dev/null +++ b/filters/cache/cache.c @@ -0,0 +1,754 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_SYS_IOCTL_H +#include +#endif + +#include + +#ifdef HAVE_ALLOCA_H +#include +#endif + +#include + +#include "cleanup.h" + +#include "cache.h" +#include "blk.h" +#include "reclaim.h" +#include "isaligned.h" +#include "ispowerof2.h" +#include "minmax.h" +#include "rounding.h" + +/* In order to handle parallel requests safely, this lock must be held + * when calling any blk_* functions. + */ +static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; + +unsigned blksize; /* actual block size (picked by blk.c) */ +unsigned min_block_size = 65536; +enum cache_mode cache_mode = CACHE_MODE_WRITEBACK; +int64_t max_size = -1; +unsigned hi_thresh = 95, lo_thresh = 80; +enum cor_mode cor_mode = COR_OFF; +const char *cor_path; + +static int cache_flush (nbdkit_next *next, void *handle, uint32_t flags, + int *err); + +static void +cache_unload (void) +{ + blk_free (); +} + +static int +cache_config (nbdkit_next_config *next, nbdkit_backend *nxdata, + const char *key, const char *value) +{ + if (strcmp (key, "cache") == 0) { + if (strcmp (value, "writeback") == 0) { + cache_mode = CACHE_MODE_WRITEBACK; + return 0; + } + else if (strcmp (value, "writethrough") == 0) { + cache_mode = CACHE_MODE_WRITETHROUGH; + return 0; + } + else if (strcmp (value, "unsafe") == 0) { + cache_mode = CACHE_MODE_UNSAFE; + return 0; + } + else { + nbdkit_error ("invalid cache parameter, should be " + "writeback|writethrough|unsafe"); + return -1; + } + } + else if (strcmp (key, "cache-min-block-size") == 0) { + int64_t r; + + r = nbdkit_parse_size (value); + if (r == -1) + return -1; + if (r < 4096 || !is_power_of_2 (r) || r > UINT_MAX) { + nbdkit_error ("cache-min-block-size is not a power of 2, or is too small " + "or too large"); + return -1; + } + min_block_size = r; + return 0; + } +#ifdef HAVE_CACHE_RECLAIM + else if (strcmp (key, "cache-max-size") == 0) { + int64_t r; + + r = nbdkit_parse_size (value); + if (r == -1) + return -1; + /* We set a lower limit for the cache size just to keep out of + * trouble. + */ + if (r < 1024*1024) { + nbdkit_error ("cache-max-size is too small"); + return -1; + } + max_size = r; + return 0; + } + else if (strcmp (key, "cache-high-threshold") == 0) { + if (nbdkit_parse_unsigned ("cache-high-threshold", + value, &hi_thresh) == -1) + return -1; + if (hi_thresh == 0) { + nbdkit_error ("cache-high-threshold must be greater than zero"); + return -1; + } + return 0; + } + else if (strcmp (key, "cache-low-threshold") == 0) { + if (nbdkit_parse_unsigned ("cache-low-threshold", + value, &lo_thresh) == -1) + return -1; + if (lo_thresh == 0) { + nbdkit_error ("cache-low-threshold must be greater than zero"); + return -1; + } + return 0; + } +#else /* !HAVE_CACHE_RECLAIM */ + else if (strcmp (key, "cache-max-size") == 0 || + strcmp (key, "cache-high-threshold") == 0 || + strcmp (key, "cache-low-threshold") == 0) { + nbdkit_error ("this platform does not support cache reclaim"); + return -1; + } +#endif /* !HAVE_CACHE_RECLAIM */ + else if (strcmp (key, "cache-on-read") == 0) { + if (value[0] == '/') { + cor_path = value; + cor_mode = COR_PATH; + } + else { + int r = nbdkit_parse_bool (value); + if (r == -1) + return -1; + cor_mode = r ? COR_ON : COR_OFF; + } + return 0; + } + else { + return next (nxdata, key, value); + } +} + +#define cache_config_help_common \ + "cache=MODE Set cache MODE, one of writeback (default),\n" \ + " writethrough, or unsafe.\n" \ + "cache-on-read=BOOL|/PATH Set to true to cache on reads (default false).\n" +#ifndef HAVE_CACHE_RECLAIM +#define cache_config_help cache_config_help_common +#else +#define cache_config_help cache_config_help_common \ + "cache-max-size=SIZE Set maximum space used by cache.\n" \ + "cache-high-threshold=PCT Percentage of max size where reclaim begins.\n" \ + "cache-low-threshold=PCT Percentage of max size where reclaim ends.\n" +#endif + +/* Decide if cache-on-read is currently on or off. */ +bool +cache_on_read (void) +{ + switch (cor_mode) { + case COR_ON: return true; + case COR_OFF: return false; + case COR_PATH: return access (cor_path, F_OK) == 0; + default: abort (); + } +} + +static int +cache_config_complete (nbdkit_next_config_complete *next, + nbdkit_backend *nxdata) +{ + /* If cache-max-size was set then check the thresholds. */ + if (max_size != -1) { + if (lo_thresh >= hi_thresh) { + nbdkit_error ("cache-low-threshold must be " + "less than cache-high-threshold"); + return -1; + } + } + + return next (nxdata); +} + +static int +cache_get_ready (int thread_model) +{ + if (blk_init () == -1) + return -1; + + return 0; +} + +/* Get the file size, set the cache size. */ +static int64_t +cache_get_size (nbdkit_next *next, + void *handle) +{ + int64_t size; + int r; + + size = next->get_size (next); + if (size == -1) + return -1; + + nbdkit_debug ("cache: underlying file size: %" PRIi64, size); + + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock); + r = blk_set_size (size); + if (r == -1) + return -1; + + return size; +} + +/* Block size constraints. */ +static int +cache_block_size (nbdkit_next *next, void *handle, + uint32_t *minimum, uint32_t *preferred, uint32_t *maximum) +{ + if (next->block_size (next, minimum, preferred, maximum) == -1) + return -1; + + if (*minimum == 0) { /* No constraints set by the plugin. */ + *minimum = 1; + *preferred = blksize; + *maximum = 0xffffffff; + } + else { + if (*maximum >= blksize) + *preferred = MAX (*preferred, blksize); + } + + return 0; +} + +/* Force an early call to cache_get_size because we have to set the + * backing file size and bitmap size before any other read or write + * calls. + */ +static int +cache_prepare (nbdkit_next *next, + void *handle, int readonly) +{ + int64_t r; + + r = cache_get_size (next, handle); + if (r < 0) + return -1; + return 0; +} + +/* Override the plugin's .can_cache, because we are caching here instead */ +static int +cache_can_cache (nbdkit_next *next, void *handle) +{ + return NBDKIT_CACHE_NATIVE; +} + +/* Override the plugin's .can_fast_zero, because our .zero is not fast */ +static int +cache_can_fast_zero (nbdkit_next *next, + void *handle) +{ + /* It is better to advertise support even when we always reject fast + * zero attempts. + */ + return 1; +} + +/* Override the plugin's .can_flush, if we are cache=unsafe */ +static int +cache_can_flush (nbdkit_next *next, + void *handle) +{ + if (cache_mode == CACHE_MODE_UNSAFE) + return 1; + return next->can_flush (next); +} + + +/* Override the plugin's .can_fua, if we are cache=unsafe */ +static int +cache_can_fua (nbdkit_next *next, + void *handle) +{ + if (cache_mode == CACHE_MODE_UNSAFE) + return NBDKIT_FUA_NATIVE; + return next->can_fua (next); +} + +/* Override the plugin's .can_multi_conn, if we are not cache=writethrough */ +static int +cache_can_multi_conn (nbdkit_next *next, + void *handle) +{ + /* For CACHE_MODE_UNSAFE, we always advertise a no-op flush because + * our local cache access is consistent between connections, and we + * don't care about persisting the data to the underlying plugin. + * + * For CACHE_MODE_WRITEBACK, things are more subtle: we only write + * to the plugin during NBD_CMD_FLUSH, at which point that one + * connection writes back ALL cached blocks regardless of which + * connection originally wrote them, so a client can be assured that + * blocks from all connections have reached the plugin's permanent + * storage with only one connection having to send a flush. + * + * But for CACHE_MODE_WRITETHROUGH, we are at the mercy of the + * plugin; data written by connection A is not guaranteed to be made + * persistent by a flush from connection B unless the plugin itself + * supports multi-conn. + */ + if (cache_mode != CACHE_MODE_WRITETHROUGH) + return 1; + return next->can_multi_conn (next); +} + +/* Read data. */ +static int +cache_pread (nbdkit_next *next, + void *handle, void *buf, uint32_t count, uint64_t offset, + uint32_t flags, int *err) +{ + CLEANUP_FREE uint8_t *block = NULL; + uint64_t blknum, blkoffs, nrblocks; + int r; + + assert (!flags); + if (!IS_ALIGNED (count | offset, blksize)) { + block = malloc (blksize); + if (block == NULL) { + *err = errno; + nbdkit_error ("malloc: %m"); + return -1; + } + } + + blknum = offset / blksize; /* block number */ + blkoffs = offset % blksize; /* offset within the block */ + + /* Unaligned head */ + if (blkoffs) { + uint64_t n = MIN (blksize - blkoffs, count); + + assert (block); + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock); + r = blk_read (next, blknum, block, err); + if (r == -1) + return -1; + + memcpy (buf, &block[blkoffs], n); + + buf += n; + count -= n; + offset += n; + blknum++; + } + + /* Aligned body */ + nrblocks = count / blksize; + if (nrblocks > 0) { + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock); + r = blk_read_multiple (next, blknum, nrblocks, buf, err); + if (r == -1) + return -1; + + buf += nrblocks * blksize; + count -= nrblocks * blksize; + offset += nrblocks * blksize; + blknum += nrblocks; + } + + /* Unaligned tail */ + if (count) { + assert (block); + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock); + r = blk_read (next, blknum, block, err); + if (r == -1) + return -1; + + memcpy (buf, block, count); + } + + return 0; +} + +/* Write data. */ +static int +cache_pwrite (nbdkit_next *next, + void *handle, const void *buf, uint32_t count, uint64_t offset, + uint32_t flags, int *err) +{ + CLEANUP_FREE uint8_t *block = NULL; + uint64_t blknum, blkoffs; + int r; + bool need_flush = false; + + if (!IS_ALIGNED (count | offset, blksize)) { + block = malloc (blksize); + if (block == NULL) { + *err = errno; + nbdkit_error ("malloc: %m"); + return -1; + } + } + + if ((flags & NBDKIT_FLAG_FUA) && + (cache_mode == CACHE_MODE_UNSAFE || + next->can_fua (next) == NBDKIT_FUA_EMULATE)) { + flags &= ~NBDKIT_FLAG_FUA; + need_flush = true; + } + + blknum = offset / blksize; /* block number */ + blkoffs = offset % blksize; /* offset within the block */ + + /* Unaligned head */ + if (blkoffs) { + uint64_t n = MIN (blksize - blkoffs, count); + + /* Do a read-modify-write operation on the current block. + * Hold the lock over the whole operation. + */ + assert (block); + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock); + r = blk_read (next, blknum, block, err); + if (r != -1) { + memcpy (&block[blkoffs], buf, n); + r = blk_write (next, blknum, block, flags, err); + } + if (r == -1) + return -1; + + buf += n; + count -= n; + offset += n; + blknum++; + } + + /* Aligned body */ + while (count >= blksize) { + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock); + r = blk_write (next, blknum, buf, flags, err); + if (r == -1) + return -1; + + buf += blksize; + count -= blksize; + offset += blksize; + blknum++; + } + + /* Unaligned tail */ + if (count) { + assert (block); + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock); + r = blk_read (next, blknum, block, err); + if (r != -1) { + memcpy (block, buf, count); + r = blk_write (next, blknum, block, flags, err); + } + if (r == -1) + return -1; + } + + if (need_flush) + return cache_flush (next, handle, 0, err); + return 0; +} + +/* Zero data. */ +static int +cache_zero (nbdkit_next *next, + void *handle, uint32_t count, uint64_t offset, uint32_t flags, + int *err) +{ + CLEANUP_FREE uint8_t *block = NULL; + uint64_t blknum, blkoffs; + int r; + bool need_flush = false; + + /* We are purposefully avoiding next->zero, so a zero request is + * never faster than plain writes. + */ + if (flags & NBDKIT_FLAG_FAST_ZERO) { + *err = ENOTSUP; + return -1; + } + + block = malloc (blksize); + if (block == NULL) { + *err = errno; + nbdkit_error ("malloc: %m"); + return -1; + } + + flags &= ~NBDKIT_FLAG_MAY_TRIM; + if ((flags & NBDKIT_FLAG_FUA) && + (cache_mode == CACHE_MODE_UNSAFE || + next->can_fua (next) == NBDKIT_FUA_EMULATE)) { + flags &= ~NBDKIT_FLAG_FUA; + need_flush = true; + } + + blknum = offset / blksize; /* block number */ + blkoffs = offset % blksize; /* offset within the block */ + + /* Unaligned head */ + if (blkoffs) { + uint64_t n = MIN (blksize - blkoffs, count); + + /* Do a read-modify-write operation on the current block. + * Hold the lock over the whole operation. + */ + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock); + r = blk_read (next, blknum, block, err); + if (r != -1) { + memset (&block[blkoffs], 0, n); + r = blk_write (next, blknum, block, flags, err); + } + if (r == -1) + return -1; + + count -= n; + offset += n; + blknum++; + } + + /* Aligned body */ + if (count >= blksize) + memset (block, 0, blksize); + while (count >=blksize) { + /* Intentional that we do not use next->zero */ + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock); + r = blk_write (next, blknum, block, flags, err); + if (r == -1) + return -1; + + count -= blksize; + offset += blksize; + blknum++; + } + + /* Unaligned tail */ + if (count) { + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock); + r = blk_read (next, blknum, block, err); + if (r != -1) { + memset (block, 0, count); + r = blk_write (next, blknum, block, flags, err); + } + if (r == -1) + return -1; + } + + if (need_flush) + return cache_flush (next, handle, 0, err); + return 0; +} + +/* Flush: Go through all the dirty blocks, flushing them to disk. */ +struct flush_data { + uint8_t *block; /* bounce buffer */ + unsigned errors; /* count of errors seen */ + int first_errno; /* first errno seen */ + nbdkit_next *next; +}; + +static int flush_dirty_block (uint64_t blknum, void *); + +static int +cache_flush (nbdkit_next *next, void *handle, + uint32_t flags, int *err) +{ + CLEANUP_FREE uint8_t *block = NULL; + struct flush_data data = + { .errors = 0, .first_errno = 0, .next = next }; + int tmp; + + if (cache_mode == CACHE_MODE_UNSAFE) + return 0; + + assert (!flags); + + /* Allocate the bounce buffer. */ + block = malloc (blksize); + if (block == NULL) { + *err = errno; + nbdkit_error ("malloc: %m"); + return -1; + } + data.block = block; + + /* In theory if cache_mode == CACHE_MODE_WRITETHROUGH then there + * should be no dirty blocks. However we go through the cache here + * to be sure. Also we still need to issue the flush to the + * underlying storage. + */ + { + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock); + for_each_dirty_block (flush_dirty_block, &data); + } + + /* Now issue a flush request to the underlying storage. */ + if (next->flush (next, 0, data.errors ? &tmp : &data.first_errno) == -1) + data.errors++; + + if (data.errors > 0) { + *err = data.first_errno; + return -1; + } + return 0; +} + +static int +flush_dirty_block (uint64_t blknum, void *datav) +{ + struct flush_data *data = datav; + int tmp; + + /* Perform a read + writethrough which will read from the + * cache and write it through to the underlying storage. + */ + if (blk_read (data->next, blknum, data->block, + data->errors ? &tmp : &data->first_errno) == -1) + goto err; + if (blk_writethrough (data->next, blknum, data->block, 0, + data->errors ? &tmp : &data->first_errno) == -1) + goto err; + + return 0; + + err: + nbdkit_error ("cache: flush of block %" PRIu64 " failed", blknum); + data->errors++; + return 0; /* continue scanning and flushing. */ +} + +/* Cache data. */ +static int +cache_cache (nbdkit_next *next, + void *handle, uint32_t count, uint64_t offset, + uint32_t flags, int *err) +{ + CLEANUP_FREE uint8_t *block = NULL; + uint64_t blknum, blkoffs; + int r; + uint64_t remaining = count; /* Rounding out could exceed 32 bits */ + + assert (!flags); + block = malloc (blksize); + if (block == NULL) { + *err = errno; + nbdkit_error ("malloc: %m"); + return -1; + } + + blknum = offset / blksize; /* block number */ + blkoffs = offset % blksize; /* offset within the block */ + + /* Unaligned head */ + remaining += blkoffs; + offset -= blkoffs; + + /* Unaligned tail */ + remaining = ROUND_UP (remaining, blksize); + + /* Aligned body */ + while (remaining) { + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock); + r = blk_cache (next, blknum, block, err); + if (r == -1) + return -1; + + remaining -= blksize; + offset += blksize; + blknum++; + } + + return 0; +} + +static struct nbdkit_filter filter = { + .name = "cache", + .longname = "nbdkit caching filter", + .unload = cache_unload, + .config = cache_config, + .config_complete = cache_config_complete, + .config_help = cache_config_help, + .get_ready = cache_get_ready, + .prepare = cache_prepare, + .get_size = cache_get_size, + .block_size = cache_block_size, + .can_cache = cache_can_cache, + .can_fast_zero = cache_can_fast_zero, + .can_flush = cache_can_flush, + .can_fua = cache_can_fua, + .can_multi_conn = cache_can_multi_conn, + .pread = cache_pread, + .pwrite = cache_pwrite, + .zero = cache_zero, + .flush = cache_flush, + .cache = cache_cache, +}; + +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/cache/cache.h b/filters/cache/cache.h new file mode 100644 index 0000000..a89236d --- /dev/null +++ b/filters/cache/cache.h @@ -0,0 +1,64 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_CACHE_H +#define NBDKIT_CACHE_H + +#include + +/* Caching mode. */ +extern enum cache_mode { + CACHE_MODE_WRITEBACK, + CACHE_MODE_WRITETHROUGH, + CACHE_MODE_UNSAFE, +} cache_mode; + +/* Size of a block in the cache. */ +extern unsigned blksize; + +/* Minimum block size (cache-min-block-size parameter). */ +extern unsigned min_block_size; + +/* Maximum size of the cache and high/low thresholds. */ +extern int64_t max_size; +extern unsigned hi_thresh, lo_thresh; + +/* Cache on read mode. */ +extern enum cor_mode { + COR_OFF, + COR_ON, + COR_PATH, +} cor_mode; +extern const char *cor_path; +extern bool cache_on_read (void); + +#endif /* NBDKIT_CACHE_H */ diff --git a/filters/cache/lru.c b/filters/cache/lru.c new file mode 100644 index 0000000..943eb27 --- /dev/null +++ b/filters/cache/lru.c @@ -0,0 +1,160 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +/* These are the block operations. They always read or write a single + * whole block of size ‘blksize’. + */ + +#include + +#include +#include +#include +#include +#include + +#include + +#include "bitmap.h" +#include "minmax.h" + +#include "cache.h" +#include "blk.h" +#include "lru.h" + +/* LRU bitmaps. These bitmaps implement a simple, fast LRU structure. + * + * bm[0] + * ┌───────────────────────┐ + * │ X XX X XXX │ c0 bits set + * └───────────────────────┘ + * bm[1] + * ┌───────────────────────┐ + * │ X XX X X │ c1 bits set + * └───────────────────────┘ + * + * The LRU structure keeps track of the [approx] last N distinct + * blocks which have been most recently accessed. It can answer in + * O(1) time the question: “Is a particular block in or not in the N + * distinct blocks most recently accessed?” + * + * To do this we keep two bitmaps. + * + * When a new block is accessed, we set the corresponding bit in bm[0] + * and increment c0 (c0 counts the number of bits set in bm[0]). If + * c0 == N/2 then we move bm[1] <- bm[0], clear bm[0] and set c0 <- 0. + * + * To check if a block has been accessed within the previous N + * distinct accesses, we simply have to check both bitmaps. If it is + * not in either bitmap, then it's old and a candidate to be + * reclaimed. + * + * You'll note that in fact we only keep track of between N/2 and N + * recently accessed blocks because the same block can appear in both + * bitmaps. bm[1] is a last chance to hold on to blocks which are + * soon to be reclaimed. We could make the estimate more accurate by + * having more bitmaps, but as this is only a heuristic we choose to + * keep the implementation simple and memory usage low instead. + */ +static struct bitmap bm[2]; +static unsigned c0 = 0, c1 = 0; +static unsigned N = 100; + +void +lru_init (void) +{ + bitmap_init (&bm[0], blksize, 1 /* bits per block */); + bitmap_init (&bm[1], blksize, 1 /* bits per block */); +} + +void +lru_free (void) +{ + bitmap_free (&bm[0]); + bitmap_free (&bm[1]); +} + +int +lru_set_size (uint64_t new_size) +{ + if (bitmap_resize (&bm[0], new_size) == -1) + return -1; + if (bitmap_resize (&bm[1], new_size) == -1) + return -1; + + if (max_size != -1) + /* Make the threshold about 1/4 the maximum size of the cache. */ + N = MAX (max_size / blksize / 4, 100); + else + N = MAX (new_size / blksize / 4, 100); + + return 0; +} + +void +lru_set_recently_accessed (uint64_t blknum) +{ + /* If the block is already set in the first bitmap, don't need to do + * anything. + */ + if (bitmap_get_blk (&bm[0], blknum, false)) + return; + + bitmap_set_blk (&bm[0], blknum, true); + c0++; + + /* If we've reached N/2 then we need to swap over the bitmaps. Note + * the purpose of swapping here is to ensure that we do not have to + * copy the dynamically allocated bm->bitmap field (the pointers are + * swapped instead). The bm[0].bitmap field is immediately zeroed + * after the swap. + */ + if (c0 >= N/2) { + struct bitmap tmp; + + tmp = bm[0]; + bm[0] = bm[1]; + bm[1] = tmp; + c1 = c0; + + bitmap_clear (&bm[0]); + c0 = 0; + } +} + +bool +lru_has_been_recently_accessed (uint64_t blknum) +{ + return + bitmap_get_blk (&bm[0], blknum, false) || + bitmap_get_blk (&bm[1], blknum, false); +} diff --git a/filters/cache/lru.h b/filters/cache/lru.h new file mode 100644 index 0000000..890717c --- /dev/null +++ b/filters/cache/lru.h @@ -0,0 +1,53 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_LRU_H +#define NBDKIT_LRU_H + +#include + +/* Initialize LRU. */ +extern void lru_init (void); + +/* Free the LRU. */ +extern void lru_free (void); + +/* Notify LRU that the virtual size has changed. */ +extern int lru_set_size (uint64_t new_size); + +/* Mark a block as recently accessed in the LRU structure. */ +extern void lru_set_recently_accessed (uint64_t blknum); + +/* Check if a block has been recently accessed. */ +extern bool lru_has_been_recently_accessed (uint64_t blknum); + +#endif /* NBDKIT_LRU_H */ diff --git a/filters/cache/nbdkit-cache-filter.pod b/filters/cache/nbdkit-cache-filter.pod new file mode 100644 index 0000000..75b4665 --- /dev/null +++ b/filters/cache/nbdkit-cache-filter.pod @@ -0,0 +1,195 @@ +=head1 NAME + +nbdkit-cache-filter - nbdkit caching filter + +=head1 SYNOPSIS + + nbdkit --filter=cache plugin [plugin-args...] + [cache=writeback|writethrough|unsafe] + [cache-min-block-size=SIZE] + [cache-max-size=SIZE] + [cache-high-threshold=N] + [cache-low-threshold=N] + [cache-on-read=true|false|/PATH] + +=head1 DESCRIPTION + +C is a filter that adds caching on top of a +plugin. This is useful if a plugin is slow or expensive to use, +because nbdkit will try to minimize requests to the plugin by caching +previous requests. + +Note that many NBD I are able to do caching, and because the +caching happens on the client side it will usually be more effective +than caching inside the server. This filter can be used if the client +does not have effective caching, or (with C) to defeat +flush requests from the client (which is unsafe and can cause data +loss, as the name suggests). + +This filter only caches image contents. To cache image metadata, use +L between this filter and the plugin. +To accelerate sequential reads, use L or +L on top of this filter. + +=head1 PARAMETERS + +=over 4 + +=item B + +Store writes in the cache. They are not written to the plugin unless +an explicit flush is done by the client. + +This is the default caching mode, and is safe if your client issues +flush requests correctly (which is true for modern Linux and other +well-written NBD clients). + +=item B + +Always force writes through to the plugin. + +This makes the cache less effective, but is necessary if your client +does not issue correct flush requests. + +=item B + +Ignore flush requests. Never write to the plugin unless the cache +grows too large. + +This is dangerous and can cause data loss, but this may be acceptable +if you only use it for testing or with data that you don't care about +or can cheaply reconstruct. + +=item BSIZE + +Set the minimum block size used by the cache. This must be a power of +2 and E 4096. + +The default is 64K, or the block size of the filesystem which contains +the temporary file storing the cache (whichever is larger). + +=item BSIZE + +=item BN + +=item BN + +(nbdkit E 1.10) + +Limit the size of the cache to C. See L below. + +=item B + +(nbdkit E 1.10) + +Cache read requests as well as write and cache requests. Any time a +block is read from the plugin, it is saved in the cache (if there is +sufficient space) so the same data can be served more quickly later. + +Note that if the underlying data served by the plugin can be modified +by some other means (eg. something else can write to a file which is +being served by L), this option will cause +nbdkit to serve stale data because reads won't always go through to +the plugin. + +=item B + +Do not cache read requests (this is the default). + +=item B + +(nbdkit E 1.28) + +When F (which must be an absolute path) exists, this behaves +like C, and when it does not exist like +C. This allows you to control the cache-on-read +behaviour while nbdkit is running. + +=back + +=head1 CACHE MAXIMUM SIZE + +By default the cache can grow to any size (although not larger than +the virtual size of the underlying plugin) and you have to ensure +there is sufficient space in C<$TMPDIR> for it. + +Using the parameters C, C and +C you can limit the maximum size of the cache. + +This requires kernel and filesystem support (for L +C), so it may not work on all platforms. + +Some examples: + +=over 4 + +=item C + +The cache is limited to around 1 gigabyte. + +=item C + +Once the cache size reaches 972M (95% of 1G), blocks are reclaimed +from the cache until the size is reduced to 819M (80% of 1G). + +=back + +The way this works is once the size of the cache exceeds +S ✕ the high threshold>, the filter works to reduce the size +of the cache until it is less than S ✕ the low threshold>. +Once the size is below the low threshold, no more reclaim work is done +until the size exceeds the high threshold again. + +The default thresholds are high 95% and low 80%. You must set +S<0 E low E high>. The thresholds are expressed as integer +percentages of C. + +Least recently used blocks are discarded first. + +=head1 ENVIRONMENT VARIABLES + +=over 4 + +=item C + +The cache is stored in a temporary file located in F by +default. You can override this location by setting the C +environment variable before starting nbdkit. + +=back + +=head1 FILES + +=over 4 + +=item F<$filterdir/nbdkit-cache-filter.so> + +The filter. + +Use C to find the location of C<$filterdir>. + +=back + +=head1 VERSION + +C first appeared in nbdkit 1.2. + +=head1 SEE ALSO + +L, +L, +L, +L, +L, +L, +L. + +=head1 AUTHORS + +Eric Blake + +Richard W.M. Jones + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/filters/cache/reclaim.c b/filters/cache/reclaim.c new file mode 100644 index 0000000..6c6f76d --- /dev/null +++ b/filters/cache/reclaim.c @@ -0,0 +1,206 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "bitmap.h" + +#include "cache.h" +#include "reclaim.h" +#include "lru.h" + +#ifndef HAVE_CACHE_RECLAIM + +void +reclaim (int fd, struct bitmap *bm) +{ + /* nothing */ +} + +#else /* HAVE_CACHE_RECLAIM */ + +/* If we are currently reclaiming blocks from the cache. + * + * The state machine starts in the NOT_RECLAIMING state. When the + * size of the cache exceeds the high threshold, we move to + * RECLAIMING_LRU. Once we have exhausted all LRU blocks, we move to + * RECLAIMING_ANY (reclaiming any blocks). + * + * If at any time the size of the cache goes below the low threshold + * we move back to the NOT_RECLAIMING state. + * + * A possible future enhancement is to add an extra state between LRU + * and ANY which reclaims blocks from lru.c:bm[1]. + * + * reclaim_blk is the last block that we looked at. + */ +enum reclaim_state { + NOT_RECLAIMING = 0, + RECLAIMING_LRU = 1, + RECLAIMING_ANY = 2, +}; + +static enum reclaim_state reclaiming = NOT_RECLAIMING; +static int64_t reclaim_blk; + +static void reclaim_one (int fd, struct bitmap *bm); +static void reclaim_lru (int fd, struct bitmap *bm); +static void reclaim_any (int fd, struct bitmap *bm); +static void reclaim_block (int fd, struct bitmap *bm); + +void +reclaim (int fd, struct bitmap *bm) +{ + struct stat statbuf; + uint64_t cache_allocated; + + /* If the user didn't set cache-max-size, do nothing. */ + if (max_size == -1) return; + + /* Check the allocated size of the cache. */ + if (fstat (fd, &statbuf) == -1) { + nbdkit_debug ("cache: fstat: %m"); + return; + } + cache_allocated = statbuf.st_blocks * UINT64_C (512); + + if (reclaiming) { + /* Keep reclaiming until the cache size drops below the low threshold. */ + if (cache_allocated < max_size * lo_thresh / 100) { + nbdkit_debug ("cache: stop reclaiming"); + reclaiming = NOT_RECLAIMING; + return; + } + } + else { + if (cache_allocated < max_size * hi_thresh / 100) + return; + + /* Start reclaiming if the cache size goes over the high threshold. */ + nbdkit_debug ("cache: start reclaiming"); + reclaiming = RECLAIMING_LRU; + } + + /* Reclaim up to 2 cache blocks. */ + reclaim_one (fd, bm); + reclaim_one (fd, bm); +} + +/* Reclaim a single cache block. */ +static void +reclaim_one (int fd, struct bitmap *bm) +{ + assert (reclaiming); + + if (reclaiming == RECLAIMING_LRU) + reclaim_lru (fd, bm); + else + reclaim_any (fd, bm); +} + +static void +reclaim_lru (int fd, struct bitmap *bm) +{ + int64_t old_reclaim_blk; + + /* Find the next block in the cache. */ + reclaim_blk = bitmap_next (bm, reclaim_blk+1); + old_reclaim_blk = reclaim_blk; + + /* Search for an LRU block after this one. */ + do { + if (! lru_has_been_recently_accessed (reclaim_blk)) { + reclaim_block (fd, bm); + return; + } + + reclaim_blk = bitmap_next (bm, reclaim_blk+1); + if (reclaim_blk == -1) /* wrap around */ + reclaim_blk = bitmap_next (bm, 0); + } while (reclaim_blk >= 0 && old_reclaim_blk != reclaim_blk); + + if (old_reclaim_blk == reclaim_blk) { + /* Run out of LRU blocks, so start reclaiming any block in the cache. */ + nbdkit_debug ("cache: reclaiming any blocks"); + reclaiming = RECLAIMING_ANY; + reclaim_any (fd, bm); + } +} + +static void +reclaim_any (int fd, struct bitmap *bm) +{ + /* Find the next block in the cache. */ + reclaim_blk = bitmap_next (bm, reclaim_blk+1); + if (reclaim_blk == -1) /* wrap around */ + reclaim_blk = bitmap_next (bm, 0); + + reclaim_block (fd, bm); +} + +static void +reclaim_block (int fd, struct bitmap *bm) +{ + if (reclaim_blk == -1) { + nbdkit_debug ("cache: run out of blocks to reclaim!"); + return; + } + + nbdkit_debug ("cache: reclaiming block %" PRIu64, reclaim_blk); +#ifdef FALLOC_FL_PUNCH_HOLE + if (fallocate (fd, FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE, + reclaim_blk * blksize, blksize) == -1) { + nbdkit_error ("cache: reclaiming cache blocks: " + "fallocate: FALLOC_FL_PUNCH_HOLE: %m"); + return; + } +#else +#error "no implementation for punching holes" +#endif + + bitmap_set_blk (bm, reclaim_blk, 0); +} + +#endif /* HAVE_CACHE_RECLAIM */ diff --git a/filters/cache/reclaim.h b/filters/cache/reclaim.h new file mode 100644 index 0000000..3ae2ccb --- /dev/null +++ b/filters/cache/reclaim.h @@ -0,0 +1,52 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_RECLAIM_H +#define NBDKIT_RECLAIM_H + +#include "bitmap.h" + +/* Do we support reclaiming cache blocks? */ +#ifdef FALLOC_FL_PUNCH_HOLE +#define HAVE_CACHE_RECLAIM 1 +#else +#undef HAVE_CACHE_RECLAIM +#endif + +/* Check if we need to reclaim blocks, and if so reclaim up to two + * blocks. + * + * Note this must be called with the blk lock held. + */ +extern void reclaim (int fd, struct bitmap *bm); + +#endif /* NBDKIT_RECLAIM_H */ diff --git a/filters/cacheextents/Makefile.am b/filters/cacheextents/Makefile.am new file mode 100644 index 0000000..26ac664 --- /dev/null +++ b/filters/cacheextents/Makefile.am @@ -0,0 +1,74 @@ +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 $(top_srcdir)/common-rules.mk + +EXTRA_DIST = nbdkit-cacheextents-filter.pod + +filter_LTLIBRARIES = nbdkit-cacheextents-filter.la + +nbdkit_cacheextents_filter_la_SOURCES = \ + cacheextents.c \ + $(top_srcdir)/include/nbdkit-filter.h \ + $(NULL) + +nbdkit_cacheextents_filter_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/common/include \ + -I$(top_srcdir)/common/utils \ + $(NULL) +nbdkit_cacheextents_filter_la_CFLAGS = $(WARNINGS_CFLAGS) +nbdkit_cacheextents_filter_la_LDFLAGS = \ + -module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \ + $(NULL) +if USE_LINKER_SCRIPT +nbdkit_cacheextents_filter_la_LDFLAGS += \ + -Wl,--version-script=$(top_srcdir)/filters/filters.syms +endif +nbdkit_cacheextents_filter_la_LIBADD = \ + $(top_builddir)/common/utils/libutils.la \ + $(top_builddir)/common/replacements/libcompat.la \ + $(IMPORT_LIBRARY_ON_WINDOWS) \ + $(NULL) + +if HAVE_POD + +man_MANS = nbdkit-cacheextents-filter.1 +CLEANFILES += $(man_MANS) + +nbdkit-cacheextents-filter.1: nbdkit-cacheextents-filter.pod \ + $(top_builddir)/podwrapper.pl + $(PODWRAPPER) --section=1 --man $@ \ + --html $(top_builddir)/html/$@.html \ + $< + +endif HAVE_POD diff --git a/filters/cacheextents/Makefile.in b/filters/cacheextents/Makefile.in new file mode 100644 index 0000000..781abb7 --- /dev/null +++ b/filters/cacheextents/Makefile.in @@ -0,0 +1,937 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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@ +@USE_LINKER_SCRIPT_TRUE@am__append_1 = \ +@USE_LINKER_SCRIPT_TRUE@ -Wl,--version-script=$(top_srcdir)/filters/filters.syms + +@HAVE_POD_TRUE@am__append_2 = $(man_MANS) +subdir = filters/cacheextents +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ocaml.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +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 = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(filterdir)" "$(DESTDIR)$(man1dir)" +LTLIBRARIES = $(filter_LTLIBRARIES) +am__DEPENDENCIES_1 = +nbdkit_cacheextents_filter_la_DEPENDENCIES = \ + $(top_builddir)/common/utils/libutils.la \ + $(top_builddir)/common/replacements/libcompat.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am__objects_1 = +am_nbdkit_cacheextents_filter_la_OBJECTS = \ + nbdkit_cacheextents_filter_la-cacheextents.lo $(am__objects_1) +nbdkit_cacheextents_filter_la_OBJECTS = \ + $(am_nbdkit_cacheextents_filter_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +nbdkit_cacheextents_filter_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(nbdkit_cacheextents_filter_la_CFLAGS) $(CFLAGS) \ + $(nbdkit_cacheextents_filter_la_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = \ + ./$(DEPDIR)/nbdkit_cacheextents_filter_la-cacheextents.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(nbdkit_cacheextents_filter_la_SOURCES) +DIST_SOURCES = $(nbdkit_cacheextents_filter_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/common-rules.mk \ + $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ +BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ +CARGO = @CARGO@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_PLUGIN_CC = @CC_PLUGIN_CC@ +CC_PLUGIN_CFLAGS = @CC_PLUGIN_CFLAGS@ +CERTTOOL = @CERTTOOL@ +CFLAGS = @CFLAGS@ +COM_ERR_CFLAGS = @COM_ERR_CFLAGS@ +COM_ERR_LIBS = @COM_ERR_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CUT = @CUT@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LDFLAGS = @DL_LDFLAGS@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXT2FS_CFLAGS = @EXT2FS_CFLAGS@ +EXT2FS_LIBS = @EXT2FS_LIBS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GENISOIMAGE = @GENISOIMAGE@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GOARCH = @GOARCH@ +GOLANG = @GOLANG@ +GOOS = @GOOS@ +GOROOT = @GOROOT@ +GREP = @GREP@ +IMPORT_LIBRARY_ON_WINDOWS = @IMPORT_LIBRARY_ON_WINDOWS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +ISOPROG = @ISOPROG@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBLKIO_CFLAGS = @LIBBLKIO_CFLAGS@ +LIBBLKIO_LIBS = @LIBBLKIO_LIBS@ +LIBGUESTFS_CFLAGS = @LIBGUESTFS_CFLAGS@ +LIBGUESTFS_LIBS = @LIBGUESTFS_LIBS@ +LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ +LIBLZMA_LIBS = @LIBLZMA_LIBS@ +LIBNBD_CFLAGS = @LIBNBD_CFLAGS@ +LIBNBD_LIBS = @LIBNBD_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSELINUX_CFLAGS = @LIBSELINUX_CFLAGS@ +LIBSELINUX_LIBS = @LIBSELINUX_LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTORRENT_CFLAGS = @LIBTORRENT_CFLAGS@ +LIBTORRENT_LIBS = @LIBTORRENT_LIBS@ +LIBVIRT_CFLAGS = @LIBVIRT_CFLAGS@ +LIBVIRT_LIBS = @LIBVIRT_LIBS@ +LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ +LIBZSTD_LIBS = @LIBZSTD_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LUA_CFLAGS = @LUA_CFLAGS@ +LUA_LIBS = @LUA_LIBS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MC = @MC@ +MKDIR_P = @MKDIR_P@ +MKISOFS = @MKISOFS@ +NBDKIT_VERSION_MAJOR = @NBDKIT_VERSION_MAJOR@ +NBDKIT_VERSION_MICRO = @NBDKIT_VERSION_MICRO@ +NBDKIT_VERSION_MINOR = @NBDKIT_VERSION_MINOR@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_ON_WINDOWS = @NO_UNDEFINED_ON_WINDOWS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OCAML = @OCAML@ +OCAMLBEST = @OCAMLBEST@ +OCAMLBUILD = @OCAMLBUILD@ +OCAMLC = @OCAMLC@ +OCAMLCDOTOPT = @OCAMLCDOTOPT@ +OCAMLDEP = @OCAMLDEP@ +OCAMLDOC = @OCAMLDOC@ +OCAMLLIB = @OCAMLLIB@ +OCAMLMKLIB = @OCAMLMKLIB@ +OCAMLMKTOP = @OCAMLMKTOP@ +OCAMLOPT = @OCAMLOPT@ +OCAMLOPTDOTOPT = @OCAMLOPTDOTOPT@ +OCAMLOPTFLAGS = @OCAMLOPTFLAGS@ +OCAMLVERSION = @OCAMLVERSION@ +OCAML_MAJOR = @OCAML_MAJOR@ +OCAML_PLUGIN_LIBRARIES = @OCAML_PLUGIN_LIBRARIES@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PERL_ARCHLIB = @PERL_ARCHLIB@ +PERL_CFLAGS = @PERL_CFLAGS@ +PERL_LDOPTS = @PERL_LDOPTS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PODWRAPPER = @PODWRAPPER@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_CXX = @PTHREAD_CXX@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CFLAGS = @PYTHON_CFLAGS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +RUBY_CFLAGS = @RUBY_CFLAGS@ +RUBY_LIBS = @RUBY_LIBS@ +RUSTC = @RUSTC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOEXT = @SOEXT@ +SSH_CFLAGS = @SSH_CFLAGS@ +SSH_LIBS = @SSH_LIBS@ +STAT = @STAT@ +STRIP = @STRIP@ +TCL_CFLAGS = @TCL_CFLAGS@ +TCL_LIBS = @TCL_LIBS@ +TRUNCATE = @TRUNCATE@ +VALGRIND = @VALGRIND@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VERSION = @VERSION@ +WARNINGS_CFLAGS = @WARNINGS_CFLAGS@ +XORRISO = @XORRISO@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +ZLIB_NG_CFLAGS = @ZLIB_NG_CFLAGS@ +ZLIB_NG_LIBS = @ZLIB_NG_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DLLTOOL = @ac_ct_DLLTOOL@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_MC = @ac_ct_MC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bashcompdir = @bashcompdir@ +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@ +filters = @filters@ +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@ +lang_plugins = @lang_plugins@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +non_lang_plugins = @non_lang_plugins@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugins = @plugins@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +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@ + +# Convenient list terminator +NULL = +plugindir = $(libdir)/nbdkit/plugins +filterdir = $(libdir)/nbdkit/filters +CLEANFILES = *~ *.cmi *.cmx *.cmxa *.so *.dll $(am__append_2) +EXTRA_DIST = nbdkit-cacheextents-filter.pod +filter_LTLIBRARIES = nbdkit-cacheextents-filter.la +nbdkit_cacheextents_filter_la_SOURCES = \ + cacheextents.c \ + $(top_srcdir)/include/nbdkit-filter.h \ + $(NULL) + +nbdkit_cacheextents_filter_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/common/include \ + -I$(top_srcdir)/common/utils \ + $(NULL) + +nbdkit_cacheextents_filter_la_CFLAGS = $(WARNINGS_CFLAGS) +nbdkit_cacheextents_filter_la_LDFLAGS = -module -avoid-version -shared \ + $(NO_UNDEFINED_ON_WINDOWS) $(NULL) $(am__append_1) +nbdkit_cacheextents_filter_la_LIBADD = \ + $(top_builddir)/common/utils/libutils.la \ + $(top_builddir)/common/replacements/libcompat.la \ + $(IMPORT_LIBRARY_ON_WINDOWS) \ + $(NULL) + +@HAVE_POD_TRUE@man_MANS = nbdkit-cacheextents-filter.1 +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common-rules.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign filters/cacheextents/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign filters/cacheextents/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; +$(top_srcdir)/common-rules.mk $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +install-filterLTLIBRARIES: $(filter_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(filter_LTLIBRARIES)'; test -n "$(filterdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(filterdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(filterdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(filterdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(filterdir)"; \ + } + +uninstall-filterLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(filter_LTLIBRARIES)'; test -n "$(filterdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(filterdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(filterdir)/$$f"; \ + done + +clean-filterLTLIBRARIES: + -test -z "$(filter_LTLIBRARIES)" || rm -f $(filter_LTLIBRARIES) + @list='$(filter_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +nbdkit-cacheextents-filter.la: $(nbdkit_cacheextents_filter_la_OBJECTS) $(nbdkit_cacheextents_filter_la_DEPENDENCIES) $(EXTRA_nbdkit_cacheextents_filter_la_DEPENDENCIES) + $(AM_V_CCLD)$(nbdkit_cacheextents_filter_la_LINK) -rpath $(filterdir) $(nbdkit_cacheextents_filter_la_OBJECTS) $(nbdkit_cacheextents_filter_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nbdkit_cacheextents_filter_la-cacheextents.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +nbdkit_cacheextents_filter_la-cacheextents.lo: cacheextents.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_cacheextents_filter_la_CPPFLAGS) $(CPPFLAGS) $(nbdkit_cacheextents_filter_la_CFLAGS) $(CFLAGS) -MT nbdkit_cacheextents_filter_la-cacheextents.lo -MD -MP -MF $(DEPDIR)/nbdkit_cacheextents_filter_la-cacheextents.Tpo -c -o nbdkit_cacheextents_filter_la-cacheextents.lo `test -f 'cacheextents.c' || echo '$(srcdir)/'`cacheextents.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nbdkit_cacheextents_filter_la-cacheextents.Tpo $(DEPDIR)/nbdkit_cacheextents_filter_la-cacheextents.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cacheextents.c' object='nbdkit_cacheextents_filter_la-cacheextents.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_cacheextents_filter_la_CPPFLAGS) $(CPPFLAGS) $(nbdkit_cacheextents_filter_la_CFLAGS) $(CFLAGS) -c -o nbdkit_cacheextents_filter_la-cacheextents.lo `test -f 'cacheextents.c' || echo '$(srcdir)/'`cacheextents.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(MANS) +installdirs: + for dir in "$(DESTDIR)$(filterdir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: 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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-filterLTLIBRARIES clean-generic clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/nbdkit_cacheextents_filter_la-cacheextents.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-filterLTLIBRARIES install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/nbdkit_cacheextents_filter_la-cacheextents.Plo + -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-filterLTLIBRARIES uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-filterLTLIBRARIES clean-generic clean-libtool \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-filterLTLIBRARIES \ + install-html install-html-am install-info install-info-am \ + install-man install-man1 install-pdf install-pdf-am 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 tags-am uninstall \ + uninstall-am uninstall-filterLTLIBRARIES uninstall-man \ + uninstall-man1 + +.PRECIOUS: Makefile + + +@HAVE_POD_TRUE@nbdkit-cacheextents-filter.1: nbdkit-cacheextents-filter.pod \ +@HAVE_POD_TRUE@ $(top_builddir)/podwrapper.pl +@HAVE_POD_TRUE@ $(PODWRAPPER) --section=1 --man $@ \ +@HAVE_POD_TRUE@ --html $(top_builddir)/html/$@.html \ +@HAVE_POD_TRUE@ $< + +# 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/filters/cacheextents/cacheextents.c b/filters/cacheextents/cacheextents.c new file mode 100644 index 0000000..71f73c4 --- /dev/null +++ b/filters/cacheextents/cacheextents.c @@ -0,0 +1,212 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include "cleanup.h" + +/* -D cacheextents.cache=1: Debug cache operations. */ +NBDKIT_DLL_PUBLIC int cacheextents_debug_cache = 0; + +/* This lock protects the global state. */ +static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; + +/* Cached extents from the last extents () call and its start and end + * for the sake of simplicity. + */ +struct nbdkit_extents *cache_extents; +static uint64_t cache_start; +static uint64_t cache_end; + +static void +cacheextents_unload (void) +{ + nbdkit_extents_free (cache_extents); +} + +static int +cacheextents_add (struct nbdkit_extents *extents, int *err) +{ + size_t i = 0; + + for (i = 0; i < nbdkit_extents_count (cache_extents); i++) { + struct nbdkit_extent ex = nbdkit_get_extent (cache_extents, i); + if (nbdkit_add_extent (extents, ex.offset, ex.length, ex.type) == -1) { + *err = errno; + return -1; + } + } + + return 0; +} + +static int +fill (struct nbdkit_extents *extents, int *err) +{ + size_t i = 0; + size_t count = nbdkit_extents_count (extents); + struct nbdkit_extent first = nbdkit_get_extent (extents, 0); + struct nbdkit_extent last = nbdkit_get_extent (extents, count - 1); + + nbdkit_extents_free (cache_extents); + cache_start = first.offset; + cache_end = last.offset + last.length; + cache_extents = nbdkit_extents_new (cache_start, cache_end); + + if (!cache_extents) + return -1; + + for (i = 0; i < count; i++) { + struct nbdkit_extent ex = nbdkit_get_extent (extents, i); + + if (cacheextents_debug_cache) + nbdkit_debug ("cacheextents: updating cache with:" + " offset=%" PRIu64 + " length=%" PRIu64 + " type=%x", + ex.offset, ex.length, ex.type); + + if (nbdkit_add_extent (cache_extents, ex.offset, ex.length, + ex.type) == -1) { + *err = errno; + nbdkit_extents_free (cache_extents); + cache_extents = NULL; + return -1; + } + } + + return 0; +} + +static int +cacheextents_extents (nbdkit_next *next, + void *handle, uint32_t count, uint64_t offset, + uint32_t flags, + struct nbdkit_extents *extents, + int *err) +{ + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock); + + if (cacheextents_debug_cache) + nbdkit_debug ("cacheextents:" + " cache_start=%" PRIu64 + " cache_end=%" PRIu64 + " cache_extents=%p", + cache_start, cache_end, cache_extents); + + if (cache_extents && + offset >= cache_start && offset < cache_end) { + if (cacheextents_debug_cache) + nbdkit_debug ("cacheextents: returning from cache"); + return cacheextents_add (extents, err); + } + + if (cacheextents_debug_cache) + nbdkit_debug ("cacheextents: cache miss"); + + /* Clear REQ_ONE to ask the plugin for as much information as it is + * willing to return (the plugin may still truncate if it is too + * costly to provide everything). + */ + flags &= ~(NBDKIT_FLAG_REQ_ONE); + if (next->extents (next, count, offset, flags, extents, err) == -1) + return -1; + + return fill (extents, err); +} + +/* Any changes to the data needs to clean the cache. + * + * Similar to the readahead filter this could be more intelligent, but + * there would be very little benefit. + */ + +static void +kill_cacheextents (void) +{ + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock); + nbdkit_extents_free (cache_extents); + cache_extents = NULL; +} + +static int +cacheextents_pwrite (nbdkit_next *next, + void *handle, + const void *buf, uint32_t count, uint64_t offset, + uint32_t flags, int *err) +{ + kill_cacheextents (); + return next->pwrite (next, buf, count, offset, flags, err); +} + +static int +cacheextents_trim (nbdkit_next *next, + void *handle, + uint32_t count, uint64_t offset, uint32_t flags, + int *err) +{ + kill_cacheextents (); + return next->trim (next, count, offset, flags, err); +} + +static int +cacheextents_zero (nbdkit_next *next, + void *handle, + uint32_t count, uint64_t offset, uint32_t flags, + int *err) +{ + kill_cacheextents (); + return next->zero (next, count, offset, flags, err); +} + +static struct nbdkit_filter filter = { + .name = "cacheextents", + .longname = "nbdkit cacheextents filter", + .unload = cacheextents_unload, + .pwrite = cacheextents_pwrite, + .trim = cacheextents_trim, + .zero = cacheextents_zero, + .extents = cacheextents_extents, +}; + +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/cacheextents/nbdkit-cacheextents-filter.pod b/filters/cacheextents/nbdkit-cacheextents-filter.pod new file mode 100644 index 0000000..a2b2aa5 --- /dev/null +++ b/filters/cacheextents/nbdkit-cacheextents-filter.pod @@ -0,0 +1,68 @@ +=head1 NAME + +nbdkit-cacheextents-filter - cache extents + +=head1 SYNOPSIS + + nbdkit --filter=cacheextents plugin + +=head1 DESCRIPTION + +C is a filter that caches the result of last +extents() call. + +A common use for this filter is to improve performance when using a +client performing a linear pass over the entire image while asking for +only one extent at a time (such as S>), but where +the plugin can provide multiple extents for the same high latency as a +single extent (such as L). For example: + + nbdkit --filter=cacheextents --run 'qemu-img map $nbd' vddk ... + +For files with big extents (when it is unlikely for one extents() call +to return multiple different extents) this does not slow down the +access. + +This filter only caches image metadata; to also cache image contents, +place this filter between L and the plugin. + +=head1 PARAMETERS + +There are no parameters specific to nbdkit-cacheextents-filter. Any +parameters are passed through to and processed by the underlying +plugin in the normal way. + +=head1 FILES + +=over 4 + +=item F<$filterdir/nbdkit-cacheextents-filter.so> + +The filter. + +Use C to find the location of C<$filterdir>. + +=back + +=head1 VERSION + +C first appeared in nbdkit 1.14. + +=head1 SEE ALSO + +L, +L, +L, +L, +L, +L, +L, +L. + +=head1 AUTHORS + +Martin Kletzander + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/filters/checkwrite/Makefile.am b/filters/checkwrite/Makefile.am new file mode 100644 index 0000000..288196c --- /dev/null +++ b/filters/checkwrite/Makefile.am @@ -0,0 +1,74 @@ +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 $(top_srcdir)/common-rules.mk + +EXTRA_DIST = nbdkit-checkwrite-filter.pod + +filter_LTLIBRARIES = nbdkit-checkwrite-filter.la + +nbdkit_checkwrite_filter_la_SOURCES = \ + checkwrite.c \ + $(top_srcdir)/include/nbdkit-filter.h \ + $(NULL) + +nbdkit_checkwrite_filter_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/common/include \ + -I$(top_srcdir)/common/utils \ + $(NULL) +nbdkit_checkwrite_filter_la_CFLAGS = $(WARNINGS_CFLAGS) +nbdkit_checkwrite_filter_la_LDFLAGS = \ + -module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \ + $(NULL) +if USE_LINKER_SCRIPT +nbdkit_checkwrite_filter_la_LDFLAGS += \ + -Wl,--version-script=$(top_srcdir)/filters/filters.syms +endif +nbdkit_checkwrite_filter_la_LIBADD = \ + $(top_builddir)/common/utils/libutils.la \ + $(top_builddir)/common/replacements/libcompat.la \ + $(IMPORT_LIBRARY_ON_WINDOWS) \ + $(NULL) + +if HAVE_POD + +man_MANS = nbdkit-checkwrite-filter.1 +CLEANFILES += $(man_MANS) + +nbdkit-checkwrite-filter.1: nbdkit-checkwrite-filter.pod \ + $(top_builddir)/podwrapper.pl + $(PODWRAPPER) --section=1 --man $@ \ + --html $(top_builddir)/html/$@.html \ + $< + +endif HAVE_POD diff --git a/filters/checkwrite/Makefile.in b/filters/checkwrite/Makefile.in new file mode 100644 index 0000000..83d3ddc --- /dev/null +++ b/filters/checkwrite/Makefile.in @@ -0,0 +1,937 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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@ +@USE_LINKER_SCRIPT_TRUE@am__append_1 = \ +@USE_LINKER_SCRIPT_TRUE@ -Wl,--version-script=$(top_srcdir)/filters/filters.syms + +@HAVE_POD_TRUE@am__append_2 = $(man_MANS) +subdir = filters/checkwrite +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ocaml.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +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 = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(filterdir)" "$(DESTDIR)$(man1dir)" +LTLIBRARIES = $(filter_LTLIBRARIES) +am__DEPENDENCIES_1 = +nbdkit_checkwrite_filter_la_DEPENDENCIES = \ + $(top_builddir)/common/utils/libutils.la \ + $(top_builddir)/common/replacements/libcompat.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am__objects_1 = +am_nbdkit_checkwrite_filter_la_OBJECTS = \ + nbdkit_checkwrite_filter_la-checkwrite.lo $(am__objects_1) +nbdkit_checkwrite_filter_la_OBJECTS = \ + $(am_nbdkit_checkwrite_filter_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +nbdkit_checkwrite_filter_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(nbdkit_checkwrite_filter_la_CFLAGS) $(CFLAGS) \ + $(nbdkit_checkwrite_filter_la_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = \ + ./$(DEPDIR)/nbdkit_checkwrite_filter_la-checkwrite.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(nbdkit_checkwrite_filter_la_SOURCES) +DIST_SOURCES = $(nbdkit_checkwrite_filter_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/common-rules.mk \ + $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ +BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ +CARGO = @CARGO@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_PLUGIN_CC = @CC_PLUGIN_CC@ +CC_PLUGIN_CFLAGS = @CC_PLUGIN_CFLAGS@ +CERTTOOL = @CERTTOOL@ +CFLAGS = @CFLAGS@ +COM_ERR_CFLAGS = @COM_ERR_CFLAGS@ +COM_ERR_LIBS = @COM_ERR_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CUT = @CUT@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LDFLAGS = @DL_LDFLAGS@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXT2FS_CFLAGS = @EXT2FS_CFLAGS@ +EXT2FS_LIBS = @EXT2FS_LIBS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GENISOIMAGE = @GENISOIMAGE@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GOARCH = @GOARCH@ +GOLANG = @GOLANG@ +GOOS = @GOOS@ +GOROOT = @GOROOT@ +GREP = @GREP@ +IMPORT_LIBRARY_ON_WINDOWS = @IMPORT_LIBRARY_ON_WINDOWS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +ISOPROG = @ISOPROG@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBLKIO_CFLAGS = @LIBBLKIO_CFLAGS@ +LIBBLKIO_LIBS = @LIBBLKIO_LIBS@ +LIBGUESTFS_CFLAGS = @LIBGUESTFS_CFLAGS@ +LIBGUESTFS_LIBS = @LIBGUESTFS_LIBS@ +LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ +LIBLZMA_LIBS = @LIBLZMA_LIBS@ +LIBNBD_CFLAGS = @LIBNBD_CFLAGS@ +LIBNBD_LIBS = @LIBNBD_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSELINUX_CFLAGS = @LIBSELINUX_CFLAGS@ +LIBSELINUX_LIBS = @LIBSELINUX_LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTORRENT_CFLAGS = @LIBTORRENT_CFLAGS@ +LIBTORRENT_LIBS = @LIBTORRENT_LIBS@ +LIBVIRT_CFLAGS = @LIBVIRT_CFLAGS@ +LIBVIRT_LIBS = @LIBVIRT_LIBS@ +LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ +LIBZSTD_LIBS = @LIBZSTD_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LUA_CFLAGS = @LUA_CFLAGS@ +LUA_LIBS = @LUA_LIBS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MC = @MC@ +MKDIR_P = @MKDIR_P@ +MKISOFS = @MKISOFS@ +NBDKIT_VERSION_MAJOR = @NBDKIT_VERSION_MAJOR@ +NBDKIT_VERSION_MICRO = @NBDKIT_VERSION_MICRO@ +NBDKIT_VERSION_MINOR = @NBDKIT_VERSION_MINOR@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_ON_WINDOWS = @NO_UNDEFINED_ON_WINDOWS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OCAML = @OCAML@ +OCAMLBEST = @OCAMLBEST@ +OCAMLBUILD = @OCAMLBUILD@ +OCAMLC = @OCAMLC@ +OCAMLCDOTOPT = @OCAMLCDOTOPT@ +OCAMLDEP = @OCAMLDEP@ +OCAMLDOC = @OCAMLDOC@ +OCAMLLIB = @OCAMLLIB@ +OCAMLMKLIB = @OCAMLMKLIB@ +OCAMLMKTOP = @OCAMLMKTOP@ +OCAMLOPT = @OCAMLOPT@ +OCAMLOPTDOTOPT = @OCAMLOPTDOTOPT@ +OCAMLOPTFLAGS = @OCAMLOPTFLAGS@ +OCAMLVERSION = @OCAMLVERSION@ +OCAML_MAJOR = @OCAML_MAJOR@ +OCAML_PLUGIN_LIBRARIES = @OCAML_PLUGIN_LIBRARIES@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PERL_ARCHLIB = @PERL_ARCHLIB@ +PERL_CFLAGS = @PERL_CFLAGS@ +PERL_LDOPTS = @PERL_LDOPTS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PODWRAPPER = @PODWRAPPER@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_CXX = @PTHREAD_CXX@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CFLAGS = @PYTHON_CFLAGS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +RUBY_CFLAGS = @RUBY_CFLAGS@ +RUBY_LIBS = @RUBY_LIBS@ +RUSTC = @RUSTC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOEXT = @SOEXT@ +SSH_CFLAGS = @SSH_CFLAGS@ +SSH_LIBS = @SSH_LIBS@ +STAT = @STAT@ +STRIP = @STRIP@ +TCL_CFLAGS = @TCL_CFLAGS@ +TCL_LIBS = @TCL_LIBS@ +TRUNCATE = @TRUNCATE@ +VALGRIND = @VALGRIND@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VERSION = @VERSION@ +WARNINGS_CFLAGS = @WARNINGS_CFLAGS@ +XORRISO = @XORRISO@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +ZLIB_NG_CFLAGS = @ZLIB_NG_CFLAGS@ +ZLIB_NG_LIBS = @ZLIB_NG_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DLLTOOL = @ac_ct_DLLTOOL@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_MC = @ac_ct_MC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bashcompdir = @bashcompdir@ +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@ +filters = @filters@ +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@ +lang_plugins = @lang_plugins@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +non_lang_plugins = @non_lang_plugins@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugins = @plugins@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +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@ + +# Convenient list terminator +NULL = +plugindir = $(libdir)/nbdkit/plugins +filterdir = $(libdir)/nbdkit/filters +CLEANFILES = *~ *.cmi *.cmx *.cmxa *.so *.dll $(am__append_2) +EXTRA_DIST = nbdkit-checkwrite-filter.pod +filter_LTLIBRARIES = nbdkit-checkwrite-filter.la +nbdkit_checkwrite_filter_la_SOURCES = \ + checkwrite.c \ + $(top_srcdir)/include/nbdkit-filter.h \ + $(NULL) + +nbdkit_checkwrite_filter_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/common/include \ + -I$(top_srcdir)/common/utils \ + $(NULL) + +nbdkit_checkwrite_filter_la_CFLAGS = $(WARNINGS_CFLAGS) +nbdkit_checkwrite_filter_la_LDFLAGS = -module -avoid-version -shared \ + $(NO_UNDEFINED_ON_WINDOWS) $(NULL) $(am__append_1) +nbdkit_checkwrite_filter_la_LIBADD = \ + $(top_builddir)/common/utils/libutils.la \ + $(top_builddir)/common/replacements/libcompat.la \ + $(IMPORT_LIBRARY_ON_WINDOWS) \ + $(NULL) + +@HAVE_POD_TRUE@man_MANS = nbdkit-checkwrite-filter.1 +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common-rules.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign filters/checkwrite/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign filters/checkwrite/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; +$(top_srcdir)/common-rules.mk $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +install-filterLTLIBRARIES: $(filter_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(filter_LTLIBRARIES)'; test -n "$(filterdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(filterdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(filterdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(filterdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(filterdir)"; \ + } + +uninstall-filterLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(filter_LTLIBRARIES)'; test -n "$(filterdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(filterdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(filterdir)/$$f"; \ + done + +clean-filterLTLIBRARIES: + -test -z "$(filter_LTLIBRARIES)" || rm -f $(filter_LTLIBRARIES) + @list='$(filter_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +nbdkit-checkwrite-filter.la: $(nbdkit_checkwrite_filter_la_OBJECTS) $(nbdkit_checkwrite_filter_la_DEPENDENCIES) $(EXTRA_nbdkit_checkwrite_filter_la_DEPENDENCIES) + $(AM_V_CCLD)$(nbdkit_checkwrite_filter_la_LINK) -rpath $(filterdir) $(nbdkit_checkwrite_filter_la_OBJECTS) $(nbdkit_checkwrite_filter_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nbdkit_checkwrite_filter_la-checkwrite.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +nbdkit_checkwrite_filter_la-checkwrite.lo: checkwrite.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_checkwrite_filter_la_CPPFLAGS) $(CPPFLAGS) $(nbdkit_checkwrite_filter_la_CFLAGS) $(CFLAGS) -MT nbdkit_checkwrite_filter_la-checkwrite.lo -MD -MP -MF $(DEPDIR)/nbdkit_checkwrite_filter_la-checkwrite.Tpo -c -o nbdkit_checkwrite_filter_la-checkwrite.lo `test -f 'checkwrite.c' || echo '$(srcdir)/'`checkwrite.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nbdkit_checkwrite_filter_la-checkwrite.Tpo $(DEPDIR)/nbdkit_checkwrite_filter_la-checkwrite.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='checkwrite.c' object='nbdkit_checkwrite_filter_la-checkwrite.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_checkwrite_filter_la_CPPFLAGS) $(CPPFLAGS) $(nbdkit_checkwrite_filter_la_CFLAGS) $(CFLAGS) -c -o nbdkit_checkwrite_filter_la-checkwrite.lo `test -f 'checkwrite.c' || echo '$(srcdir)/'`checkwrite.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(MANS) +installdirs: + for dir in "$(DESTDIR)$(filterdir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: 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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-filterLTLIBRARIES clean-generic clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/nbdkit_checkwrite_filter_la-checkwrite.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-filterLTLIBRARIES install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/nbdkit_checkwrite_filter_la-checkwrite.Plo + -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-filterLTLIBRARIES uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-filterLTLIBRARIES clean-generic clean-libtool \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-filterLTLIBRARIES \ + install-html install-html-am install-info install-info-am \ + install-man install-man1 install-pdf install-pdf-am 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 tags-am uninstall \ + uninstall-am uninstall-filterLTLIBRARIES uninstall-man \ + uninstall-man1 + +.PRECIOUS: Makefile + + +@HAVE_POD_TRUE@nbdkit-checkwrite-filter.1: nbdkit-checkwrite-filter.pod \ +@HAVE_POD_TRUE@ $(top_builddir)/podwrapper.pl +@HAVE_POD_TRUE@ $(PODWRAPPER) --section=1 --man $@ \ +@HAVE_POD_TRUE@ --html $(top_builddir)/html/$@.html \ +@HAVE_POD_TRUE@ $< + +# 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/filters/checkwrite/checkwrite.c b/filters/checkwrite/checkwrite.c new file mode 100644 index 0000000..294681b --- /dev/null +++ b/filters/checkwrite/checkwrite.c @@ -0,0 +1,275 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include +#include + +#include + +#include "cleanup.h" +#include "iszero.h" +#include "minmax.h" + +static void * +checkwrite_open (nbdkit_next_open *next, nbdkit_context *nxdata, + int readonly, const char *exportname, int is_tls) +{ + /* Ignore readonly flag passed in, open the plugin readonly. */ + if (next (nxdata, 1, exportname) == -1) + return NULL; + return NBDKIT_HANDLE_NOT_NEEDED; +} + +/* Whatever the underlying plugin can or can't do, we can do all the + * write-like operations. + */ +static int +checkwrite_can_write (nbdkit_next *next, + void *handle) +{ + return 1; +} + +static int +checkwrite_can_flush (nbdkit_next *next, + void *handle) +{ + return 1; +} + +static int +checkwrite_can_fua (nbdkit_next *next, + void *handle) +{ + return NBDKIT_FUA_NATIVE; +} + +static int +checkwrite_can_trim (nbdkit_next *next, + void *handle) +{ + return 1; +} + +static int +checkwrite_can_zero (nbdkit_next *next, + void *handle) +{ + return NBDKIT_ZERO_NATIVE; +} + +static int +checkwrite_can_fast_zero (nbdkit_next *next, + void *handle) +{ + /* It is better to advertise support, even if we always reject fast + * zero attempts when the plugin lacks .can_extents. + */ + return 1; +} + +static int +checkwrite_can_multi_conn (nbdkit_next *next, + void *handle) +{ + return 1; +} + +static inline int +data_does_not_match (int *err) +{ + *err = EIO; + nbdkit_error ("data written does not match expected"); + return -1; +} + +/* Provide write-like operations which perform the additional checks. */ +static int +checkwrite_pwrite (nbdkit_next *next, + void *handle, + const void *buf, uint32_t count, uint64_t offset, + uint32_t flags, int *err) +{ + CLEANUP_FREE char *expected; + + expected = malloc (count); + if (expected == NULL) { + *err = errno; + nbdkit_error ("malloc: %m"); + return -1; + } + + /* Read underlying plugin data into the buffer. */ + if (next->pread (next, expected, count, offset, 0, err) == -1) + return -1; + + /* If data written doesn't match data expected, inject EIO. */ + if (memcmp (buf, expected, count) != 0) + return data_does_not_match (err); + + return 0; +} + +static int +checkwrite_flush (nbdkit_next *next, + void *handle, uint32_t flags, int *err) +{ + /* Does nothing, we just have to support it. */ + return 0; +} + +#define MAX_REQUEST_SIZE (64 * 1024 * 1024) /* XXX */ + +/* Trim and zero are effectively the same operation for this plugin. + * We have to check that the underlying plugin contains all zeroes. + * + * Note we don't check that the extents exactly match since a valid + * copying operation is to either add sparseness (qemu-img convert -S) + * or create a fully allocated target (nbdcopy --allocated). + */ +static int +checkwrite_trim_zero (nbdkit_next *next, + void *handle, uint32_t count, uint64_t offset, + uint32_t flags, int *err) +{ + /* If the plugin supports extents, speed this up by using them. */ + if (next->can_extents (next)) { + size_t i, n; + CLEANUP_EXTENTS_FREE struct nbdkit_extents *exts = + nbdkit_extents_full (next, count, offset, 0, err); + if (exts == NULL) + return -1; + + n = nbdkit_extents_count (exts); + for (i = 0; i < n && count > 0; ++i) { + const struct nbdkit_extent e = nbdkit_get_extent (exts, i); + const uint64_t next_extent_offset = e.offset + e.length; + + /* Anything that reads back as zero is good. */ + if ((e.type & NBDKIT_EXTENT_ZERO) != 0) { + const uint64_t zerolen = MIN (count, next_extent_offset - offset); + + offset += zerolen; + count -= zerolen; + continue; + } + + /* Otherwise we have to read the underlying data and check. */ + if (flags & NBDKIT_FLAG_FAST_ZERO) { + *err = ENOTSUP; + return -1; + } + while (offset < next_extent_offset && count > 0) { + size_t buflen = MIN (MAX_REQUEST_SIZE, count); + buflen = MIN (buflen, next_extent_offset - offset); + + CLEANUP_FREE char *buf = malloc (buflen); + if (buf == NULL) { + *err = errno; + nbdkit_error ("malloc: %m"); + return -1; + } + + if (next->pread (next, buf, buflen, offset, 0, err) == -1) + return -1; + if (! is_zero (buf, buflen)) + return data_does_not_match (err); + + count -= buflen; + offset += buflen; + } + } /* for extent */ + + /* Assert that the loop above has actually checked the whole + * region. If this fires then it could be because + * nbdkit_extents_full isn't returning a full range of extents for + * the whole region ... or maybe the loop above is wrong. + */ + assert (count == 0); + } + + /* Otherwise the plugin does not support extents, so do this the + * slow way. + */ + else { + CLEANUP_FREE char *buf; + + if (flags & NBDKIT_FLAG_FAST_ZERO) { + *err = ENOTSUP; + return -1; + } + buf = malloc (MIN (MAX_REQUEST_SIZE, count)); + if (buf == NULL) { + *err = errno; + nbdkit_error ("malloc: %m"); + return -1; + } + + while (count > 0) { + uint32_t n = MIN (MAX_REQUEST_SIZE, count); + + if (next->pread (next, buf, n, offset, 0, err) == -1) + return -1; + if (! is_zero (buf, n)) + return data_does_not_match (err); + count -= n; + offset += n; + } + } + + return 0; +} + +static struct nbdkit_filter filter = { + .name = "checkwrite", + .longname = "nbdkit checkwrite filter", + + .open = checkwrite_open, + .can_write = checkwrite_can_write, + .can_flush = checkwrite_can_flush, + .can_fua = checkwrite_can_fua, + .can_trim = checkwrite_can_trim, + .can_zero = checkwrite_can_zero, + .can_fast_zero = checkwrite_can_fast_zero, + .can_multi_conn = checkwrite_can_multi_conn, + + .pwrite = checkwrite_pwrite, + .flush = checkwrite_flush, + .trim = checkwrite_trim_zero, + .zero = checkwrite_trim_zero, +}; + +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/checkwrite/nbdkit-checkwrite-filter.pod b/filters/checkwrite/nbdkit-checkwrite-filter.pod new file mode 100644 index 0000000..6855d79 --- /dev/null +++ b/filters/checkwrite/nbdkit-checkwrite-filter.pod @@ -0,0 +1,94 @@ +=head1 NAME + +nbdkit-checkwrite-filter - check writes match contents of plugin + +=head1 SYNOPSIS + + nbdkit --filter=checkwrite PLUGIN + +=head1 DESCRIPTION + +C is an nbdkit filter that turns write +operations into checks that what is written matches the existing +content of the plugin. If the content matches then the write +operation succeeds (doing nothing). If not then the write operation +fails returning EIO Input/output error. + +The purpose of this filter is to test copying tools as described +below. + +The underlying plugin is opened read-only and is never written to. +All write-like operations are covered by this filter, such as trimming +and zeroing. This filter tests the logical equivalence of the writes, +ignoring differences in sparseness. + +=head2 Using this filter to test copying tools + +You can check that a copying tool is copying data correctly by +creating an nbdkit instance containing some test data, overlaying this +filter, and copying from and to nbdkit at the same time: + + nbdkit --filter=checkwrite data "@32768 1" \ + --run 'nbdcopy "$uri" "$uri"' + +=for paragraph + + nbdkit --filter=checkwrite file disk.img \ + --run 'nbdcopy "$uri" "$uri"' + +=for paragraph + + nbdkit --filter=checkwrite linuxdisk testdir/ \ + --run 'qemu-img convert -n "$uri" "$uri"' + +If the copying program is buggy then you will see EIO errors and (if +the copying program also handles errors correctly) it should exit with +an error. + +=head2 Other plugins for testing NBD tools + +If you are doing this kind of testing you will also want to look at +L and L. +These plugins already have this behaviour built in to them (because it +is more efficient to build it into the plugin) — you do B need to +use this filter with those plugins. This filter is useful for testing +with arbitrary plugins. + +=head1 PARAMETERS + +There are no parameters specific to this filter. Parameters are +passed through to the underlying plugin. + +=head1 FILES + +=over 4 + +=item F<$filterdir/nbdkit-checkwrite-filter.so> + +The filter. + +Use C to find the location of C<$filterdir>. + +=back + +=head1 VERSION + +C first appeared in nbdkit 1.24. + +=head1 SEE ALSO + +L, +L, +L, +L, +L, +L, +L. + +=head1 AUTHORS + +Richard W.M. Jones + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/filters/cow/Makefile.am b/filters/cow/Makefile.am new file mode 100644 index 0000000..bd4c421 --- /dev/null +++ b/filters/cow/Makefile.am @@ -0,0 +1,80 @@ +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 $(top_srcdir)/common-rules.mk + +EXTRA_DIST = nbdkit-cow-filter.pod + +filter_LTLIBRARIES = nbdkit-cow-filter.la + +nbdkit_cow_filter_la_SOURCES = \ + blk.c \ + blk.h \ + cow.c \ + cow.h \ + $(top_srcdir)/include/nbdkit-filter.h \ + $(NULL) + +nbdkit_cow_filter_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/common/bitmap \ + -I$(top_srcdir)/common/include \ + -I$(top_srcdir)/common/replacements \ + -I$(top_srcdir)/common/utils \ + $(NULL) +nbdkit_cow_filter_la_CFLAGS = $(WARNINGS_CFLAGS) +nbdkit_cow_filter_la_LDFLAGS = \ + -module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \ + $(NULL) +if USE_LINKER_SCRIPT +nbdkit_cow_filter_la_LDFLAGS += \ + -Wl,--version-script=$(top_srcdir)/filters/filters.syms +endif +nbdkit_cow_filter_la_LIBADD = \ + $(top_builddir)/common/bitmap/libbitmap.la \ + $(top_builddir)/common/utils/libutils.la \ + $(top_builddir)/common/replacements/libcompat.la \ + $(IMPORT_LIBRARY_ON_WINDOWS) \ + $(NULL) + +if HAVE_POD + +man_MANS = nbdkit-cow-filter.1 +CLEANFILES += $(man_MANS) + +nbdkit-cow-filter.1: nbdkit-cow-filter.pod \ + $(top_builddir)/podwrapper.pl + $(PODWRAPPER) --section=1 --man $@ \ + --html $(top_builddir)/html/$@.html \ + $< + +endif HAVE_POD diff --git a/filters/cow/Makefile.in b/filters/cow/Makefile.in new file mode 100644 index 0000000..f951704 --- /dev/null +++ b/filters/cow/Makefile.in @@ -0,0 +1,953 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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@ +@USE_LINKER_SCRIPT_TRUE@am__append_1 = \ +@USE_LINKER_SCRIPT_TRUE@ -Wl,--version-script=$(top_srcdir)/filters/filters.syms + +@HAVE_POD_TRUE@am__append_2 = $(man_MANS) +subdir = filters/cow +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ocaml.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +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 = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(filterdir)" "$(DESTDIR)$(man1dir)" +LTLIBRARIES = $(filter_LTLIBRARIES) +am__DEPENDENCIES_1 = +nbdkit_cow_filter_la_DEPENDENCIES = \ + $(top_builddir)/common/bitmap/libbitmap.la \ + $(top_builddir)/common/utils/libutils.la \ + $(top_builddir)/common/replacements/libcompat.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am__objects_1 = +am_nbdkit_cow_filter_la_OBJECTS = nbdkit_cow_filter_la-blk.lo \ + nbdkit_cow_filter_la-cow.lo $(am__objects_1) +nbdkit_cow_filter_la_OBJECTS = $(am_nbdkit_cow_filter_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +nbdkit_cow_filter_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(nbdkit_cow_filter_la_CFLAGS) $(CFLAGS) \ + $(nbdkit_cow_filter_la_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/nbdkit_cow_filter_la-blk.Plo \ + ./$(DEPDIR)/nbdkit_cow_filter_la-cow.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(nbdkit_cow_filter_la_SOURCES) +DIST_SOURCES = $(nbdkit_cow_filter_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/common-rules.mk \ + $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ +BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ +CARGO = @CARGO@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_PLUGIN_CC = @CC_PLUGIN_CC@ +CC_PLUGIN_CFLAGS = @CC_PLUGIN_CFLAGS@ +CERTTOOL = @CERTTOOL@ +CFLAGS = @CFLAGS@ +COM_ERR_CFLAGS = @COM_ERR_CFLAGS@ +COM_ERR_LIBS = @COM_ERR_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CUT = @CUT@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LDFLAGS = @DL_LDFLAGS@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXT2FS_CFLAGS = @EXT2FS_CFLAGS@ +EXT2FS_LIBS = @EXT2FS_LIBS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GENISOIMAGE = @GENISOIMAGE@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GOARCH = @GOARCH@ +GOLANG = @GOLANG@ +GOOS = @GOOS@ +GOROOT = @GOROOT@ +GREP = @GREP@ +IMPORT_LIBRARY_ON_WINDOWS = @IMPORT_LIBRARY_ON_WINDOWS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +ISOPROG = @ISOPROG@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBLKIO_CFLAGS = @LIBBLKIO_CFLAGS@ +LIBBLKIO_LIBS = @LIBBLKIO_LIBS@ +LIBGUESTFS_CFLAGS = @LIBGUESTFS_CFLAGS@ +LIBGUESTFS_LIBS = @LIBGUESTFS_LIBS@ +LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ +LIBLZMA_LIBS = @LIBLZMA_LIBS@ +LIBNBD_CFLAGS = @LIBNBD_CFLAGS@ +LIBNBD_LIBS = @LIBNBD_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSELINUX_CFLAGS = @LIBSELINUX_CFLAGS@ +LIBSELINUX_LIBS = @LIBSELINUX_LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTORRENT_CFLAGS = @LIBTORRENT_CFLAGS@ +LIBTORRENT_LIBS = @LIBTORRENT_LIBS@ +LIBVIRT_CFLAGS = @LIBVIRT_CFLAGS@ +LIBVIRT_LIBS = @LIBVIRT_LIBS@ +LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ +LIBZSTD_LIBS = @LIBZSTD_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LUA_CFLAGS = @LUA_CFLAGS@ +LUA_LIBS = @LUA_LIBS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MC = @MC@ +MKDIR_P = @MKDIR_P@ +MKISOFS = @MKISOFS@ +NBDKIT_VERSION_MAJOR = @NBDKIT_VERSION_MAJOR@ +NBDKIT_VERSION_MICRO = @NBDKIT_VERSION_MICRO@ +NBDKIT_VERSION_MINOR = @NBDKIT_VERSION_MINOR@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_ON_WINDOWS = @NO_UNDEFINED_ON_WINDOWS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OCAML = @OCAML@ +OCAMLBEST = @OCAMLBEST@ +OCAMLBUILD = @OCAMLBUILD@ +OCAMLC = @OCAMLC@ +OCAMLCDOTOPT = @OCAMLCDOTOPT@ +OCAMLDEP = @OCAMLDEP@ +OCAMLDOC = @OCAMLDOC@ +OCAMLLIB = @OCAMLLIB@ +OCAMLMKLIB = @OCAMLMKLIB@ +OCAMLMKTOP = @OCAMLMKTOP@ +OCAMLOPT = @OCAMLOPT@ +OCAMLOPTDOTOPT = @OCAMLOPTDOTOPT@ +OCAMLOPTFLAGS = @OCAMLOPTFLAGS@ +OCAMLVERSION = @OCAMLVERSION@ +OCAML_MAJOR = @OCAML_MAJOR@ +OCAML_PLUGIN_LIBRARIES = @OCAML_PLUGIN_LIBRARIES@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PERL_ARCHLIB = @PERL_ARCHLIB@ +PERL_CFLAGS = @PERL_CFLAGS@ +PERL_LDOPTS = @PERL_LDOPTS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PODWRAPPER = @PODWRAPPER@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_CXX = @PTHREAD_CXX@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CFLAGS = @PYTHON_CFLAGS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +RUBY_CFLAGS = @RUBY_CFLAGS@ +RUBY_LIBS = @RUBY_LIBS@ +RUSTC = @RUSTC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOEXT = @SOEXT@ +SSH_CFLAGS = @SSH_CFLAGS@ +SSH_LIBS = @SSH_LIBS@ +STAT = @STAT@ +STRIP = @STRIP@ +TCL_CFLAGS = @TCL_CFLAGS@ +TCL_LIBS = @TCL_LIBS@ +TRUNCATE = @TRUNCATE@ +VALGRIND = @VALGRIND@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VERSION = @VERSION@ +WARNINGS_CFLAGS = @WARNINGS_CFLAGS@ +XORRISO = @XORRISO@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +ZLIB_NG_CFLAGS = @ZLIB_NG_CFLAGS@ +ZLIB_NG_LIBS = @ZLIB_NG_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DLLTOOL = @ac_ct_DLLTOOL@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_MC = @ac_ct_MC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bashcompdir = @bashcompdir@ +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@ +filters = @filters@ +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@ +lang_plugins = @lang_plugins@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +non_lang_plugins = @non_lang_plugins@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugins = @plugins@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +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@ + +# Convenient list terminator +NULL = +plugindir = $(libdir)/nbdkit/plugins +filterdir = $(libdir)/nbdkit/filters +CLEANFILES = *~ *.cmi *.cmx *.cmxa *.so *.dll $(am__append_2) +EXTRA_DIST = nbdkit-cow-filter.pod +filter_LTLIBRARIES = nbdkit-cow-filter.la +nbdkit_cow_filter_la_SOURCES = \ + blk.c \ + blk.h \ + cow.c \ + cow.h \ + $(top_srcdir)/include/nbdkit-filter.h \ + $(NULL) + +nbdkit_cow_filter_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/common/bitmap \ + -I$(top_srcdir)/common/include \ + -I$(top_srcdir)/common/replacements \ + -I$(top_srcdir)/common/utils \ + $(NULL) + +nbdkit_cow_filter_la_CFLAGS = $(WARNINGS_CFLAGS) +nbdkit_cow_filter_la_LDFLAGS = -module -avoid-version -shared \ + $(NO_UNDEFINED_ON_WINDOWS) $(NULL) $(am__append_1) +nbdkit_cow_filter_la_LIBADD = \ + $(top_builddir)/common/bitmap/libbitmap.la \ + $(top_builddir)/common/utils/libutils.la \ + $(top_builddir)/common/replacements/libcompat.la \ + $(IMPORT_LIBRARY_ON_WINDOWS) \ + $(NULL) + +@HAVE_POD_TRUE@man_MANS = nbdkit-cow-filter.1 +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common-rules.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign filters/cow/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign filters/cow/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; +$(top_srcdir)/common-rules.mk $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +install-filterLTLIBRARIES: $(filter_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(filter_LTLIBRARIES)'; test -n "$(filterdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(filterdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(filterdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(filterdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(filterdir)"; \ + } + +uninstall-filterLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(filter_LTLIBRARIES)'; test -n "$(filterdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(filterdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(filterdir)/$$f"; \ + done + +clean-filterLTLIBRARIES: + -test -z "$(filter_LTLIBRARIES)" || rm -f $(filter_LTLIBRARIES) + @list='$(filter_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +nbdkit-cow-filter.la: $(nbdkit_cow_filter_la_OBJECTS) $(nbdkit_cow_filter_la_DEPENDENCIES) $(EXTRA_nbdkit_cow_filter_la_DEPENDENCIES) + $(AM_V_CCLD)$(nbdkit_cow_filter_la_LINK) -rpath $(filterdir) $(nbdkit_cow_filter_la_OBJECTS) $(nbdkit_cow_filter_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nbdkit_cow_filter_la-blk.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nbdkit_cow_filter_la-cow.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +nbdkit_cow_filter_la-blk.lo: blk.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_cow_filter_la_CPPFLAGS) $(CPPFLAGS) $(nbdkit_cow_filter_la_CFLAGS) $(CFLAGS) -MT nbdkit_cow_filter_la-blk.lo -MD -MP -MF $(DEPDIR)/nbdkit_cow_filter_la-blk.Tpo -c -o nbdkit_cow_filter_la-blk.lo `test -f 'blk.c' || echo '$(srcdir)/'`blk.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nbdkit_cow_filter_la-blk.Tpo $(DEPDIR)/nbdkit_cow_filter_la-blk.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='blk.c' object='nbdkit_cow_filter_la-blk.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_cow_filter_la_CPPFLAGS) $(CPPFLAGS) $(nbdkit_cow_filter_la_CFLAGS) $(CFLAGS) -c -o nbdkit_cow_filter_la-blk.lo `test -f 'blk.c' || echo '$(srcdir)/'`blk.c + +nbdkit_cow_filter_la-cow.lo: cow.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_cow_filter_la_CPPFLAGS) $(CPPFLAGS) $(nbdkit_cow_filter_la_CFLAGS) $(CFLAGS) -MT nbdkit_cow_filter_la-cow.lo -MD -MP -MF $(DEPDIR)/nbdkit_cow_filter_la-cow.Tpo -c -o nbdkit_cow_filter_la-cow.lo `test -f 'cow.c' || echo '$(srcdir)/'`cow.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nbdkit_cow_filter_la-cow.Tpo $(DEPDIR)/nbdkit_cow_filter_la-cow.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cow.c' object='nbdkit_cow_filter_la-cow.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_cow_filter_la_CPPFLAGS) $(CPPFLAGS) $(nbdkit_cow_filter_la_CFLAGS) $(CFLAGS) -c -o nbdkit_cow_filter_la-cow.lo `test -f 'cow.c' || echo '$(srcdir)/'`cow.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(MANS) +installdirs: + for dir in "$(DESTDIR)$(filterdir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: 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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-filterLTLIBRARIES clean-generic clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/nbdkit_cow_filter_la-blk.Plo + -rm -f ./$(DEPDIR)/nbdkit_cow_filter_la-cow.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-filterLTLIBRARIES install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/nbdkit_cow_filter_la-blk.Plo + -rm -f ./$(DEPDIR)/nbdkit_cow_filter_la-cow.Plo + -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-filterLTLIBRARIES uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-filterLTLIBRARIES clean-generic clean-libtool \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-filterLTLIBRARIES \ + install-html install-html-am install-info install-info-am \ + install-man install-man1 install-pdf install-pdf-am 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 tags-am uninstall \ + uninstall-am uninstall-filterLTLIBRARIES uninstall-man \ + uninstall-man1 + +.PRECIOUS: Makefile + + +@HAVE_POD_TRUE@nbdkit-cow-filter.1: nbdkit-cow-filter.pod \ +@HAVE_POD_TRUE@ $(top_builddir)/podwrapper.pl +@HAVE_POD_TRUE@ $(PODWRAPPER) --section=1 --man $@ \ +@HAVE_POD_TRUE@ --html $(top_builddir)/html/$@.html \ +@HAVE_POD_TRUE@ $< + +# 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/filters/cow/blk.c b/filters/cow/blk.c new file mode 100644 index 0000000..d41f62d --- /dev/null +++ b/filters/cow/blk.c @@ -0,0 +1,424 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +/* Notes on the design and implementation of this filter: + * + * The filter works by creating a large, sparse temporary file, the + * same size as the underlying device. Being sparse, initially this + * takes up no space. + * + * We confine all pread/pwrite operations to the filesystem block + * size. The blk_* functions below only work on whole filesystem + * block boundaries. A smaller-than-block-size pwrite will turn into + * a read-modify-write of a whole block. We also assume that the + * plugin returns the same immutable data for each pread call we make, + * and optimize on this basis. + * + * A 2-bit per block bitmap is maintained in memory recording if each + * block in the temporary file is: + * + * 00 = not allocated in the overlay (read through to the plugin) + * 01 = allocated in the overlay + * 10 = + * 11 = trimmed in the overlay + * + * When reading a block we first check the bitmap to see if that file + * block is allocated, trimmed or not. If allocated, we return it + * from the temporary file. Trimmed returns zeroes. If not allocated + * we issue a pread to the underlying plugin. + * + * When writing a block we unconditionally write the data to the + * temporary file, setting the bit in the bitmap. (Writing zeroes is + * handled the same way.) + * + * When trimming we set the trimmed flag in the bitmap for whole + * blocks, and handle the unaligned portions like writing zeroes + * above. We could punch holes in the overlay as an optimization, but + * for simplicity we do not do that yet. + * + * Since the overlay is a deleted temporary file, we can ignore FUA + * and flush commands. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_ALLOCA_H +#include +#endif + +#include + +#include + +#include "bitmap.h" +#include "cleanup.h" +#include "fdatasync.h" +#include "rounding.h" +#include "pread.h" +#include "pwrite.h" +#include "utils.h" + +#include "cow.h" +#include "blk.h" + +/* The temporary overlay. */ +static int fd = -1; + +/* This lock protects the bitmap from parallel access. */ +static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; + +/* Bitmap. */ +static struct bitmap bm; + +enum bm_entry { + BLOCK_NOT_ALLOCATED = 0, + BLOCK_ALLOCATED = 1, + BLOCK_TRIMMED = 3, +}; + +static const char * +state_to_string (enum bm_entry state) +{ + switch (state) { + case BLOCK_NOT_ALLOCATED: return "not allocated"; + case BLOCK_ALLOCATED: return "allocated"; + case BLOCK_TRIMMED: return "trimmed"; + default: abort (); + } +} + +/* Extra debugging (-D cow.verbose=1). */ +NBDKIT_DLL_PUBLIC int cow_debug_verbose = 0; + +int +blk_init (void) +{ + const char *tmpdir; + size_t len; + char *template; + + bitmap_init (&bm, blksize, 2 /* bits per block */); + + tmpdir = getenv ("TMPDIR"); + if (!tmpdir) + tmpdir = LARGE_TMPDIR; + + nbdkit_debug ("cow: temporary directory for overlay: %s", tmpdir); + + len = strlen (tmpdir) + 8; + template = alloca (len); + snprintf (template, len, "%s/XXXXXX", tmpdir); + +#ifdef HAVE_MKOSTEMP + fd = mkostemp (template, O_CLOEXEC); +#else + /* Not atomic, but this is only invoked during .load, so the race + * won't affect any plugin actions trying to fork + */ + fd = mkstemp (template); + if (fd >= 0) { + fd = set_cloexec (fd); + if (fd < 0) { + int e = errno; + unlink (template); + errno = e; + } + } +#endif + if (fd == -1) { + nbdkit_error ("mkostemp: %s: %m", tmpdir); + return -1; + } + + unlink (template); + return 0; +} + +void +blk_free (void) +{ + if (fd >= 0) + close (fd); + + bitmap_free (&bm); +} + +/* Because blk_set_size is called before the other blk_* functions + * this should be set to the true size before we need it. + */ +static uint64_t size = 0; + +/* Allocate or resize the overlay file and bitmap. */ +int +blk_set_size (uint64_t new_size) +{ + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock); + + size = new_size; + + if (bitmap_resize (&bm, size) == -1) + return -1; + + if (ftruncate (fd, ROUND_UP (size, blksize)) == -1) { + nbdkit_error ("ftruncate: %m"); + return -1; + } + + return 0; +} + +/* This is a bit of a hack since usually this information is hidden in + * the blk module. However it is needed when calculating extents. + */ +void +blk_status (uint64_t blknum, bool *present, bool *trimmed) +{ + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock); + enum bm_entry state = bitmap_get_blk (&bm, blknum, BLOCK_NOT_ALLOCATED); + + *present = state != BLOCK_NOT_ALLOCATED; + *trimmed = state == BLOCK_TRIMMED; +} + +/* These are the block operations. They always read or write whole + * blocks of size ‘blksize’. + */ +int +blk_read_multiple (nbdkit_next *next, + uint64_t blknum, uint64_t nrblocks, + uint8_t *block, bool cow_on_read, int *err) +{ + off_t offset = blknum * blksize; + enum bm_entry state; + uint64_t b, runblocks; + + /* Find out how many of the following blocks form a "run" with the + * same state. We can process that many blocks in one go. + * + * About the locking: The state might be modified from another + * thread - for example another thread might write + * (BLOCK_NOT_ALLOCATED -> BLOCK_ALLOCATED) while we are reading + * from the plugin, returning the old data. However a read issued + * after the write returns should always return the correct data. + */ + { + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock); + state = bitmap_get_blk (&bm, blknum, BLOCK_NOT_ALLOCATED); + + for (b = 1, runblocks = 1; b < nrblocks; ++b, ++runblocks) { + enum bm_entry s = bitmap_get_blk (&bm, blknum + b, BLOCK_NOT_ALLOCATED); + if (state != s) + break; + } + } + + if (cow_debug_verbose) + nbdkit_debug ("cow: blk_read_multiple block %" PRIu64 + " (offset %" PRIu64 ") run of length %" PRIu64 + " is %s", + blknum, (uint64_t) offset, runblocks, + state_to_string (state)); + + if (state == BLOCK_NOT_ALLOCATED) { /* Read underlying plugin. */ + unsigned n, tail = 0; + + assert (blksize * runblocks <= UINT_MAX); + n = blksize * runblocks; + + if (offset + n > size) { + tail = offset + n - size; + n -= tail; + } + + if (next->pread (next, block, n, offset, 0, err) == -1) + return -1; + + /* Normally we're reading whole blocks, but at the very end of the + * file we might read a partial block. Deal with that case by + * zeroing the tail. + */ + memset (block + n, 0, tail); + + /* If cow-on-read is true then copy the blocks to the cache and + * set them as allocated. + */ + if (cow_on_read) { + if (cow_debug_verbose) + nbdkit_debug ("cow: cow-on-read saving %" PRIu64 " blocks " + "at offset %" PRIu64 " into the cache", + runblocks, offset); + + if (full_pwrite (fd, block, blksize * runblocks, offset) == -1) { + *err = errno; + nbdkit_error ("pwrite: %m"); + return -1; + } + for (b = 0; b < runblocks; ++b) + bitmap_set_blk (&bm, blknum+b, BLOCK_ALLOCATED); + } + } + else if (state == BLOCK_ALLOCATED) { /* Read overlay. */ + if (full_pread (fd, block, blksize * runblocks, offset) == -1) { + *err = errno; + nbdkit_error ("pread: %m"); + return -1; + } + } + else /* state == BLOCK_TRIMMED */ { + memset (block, 0, blksize * runblocks); + } + + /* If all done, return. */ + if (runblocks == nrblocks) + return 0; + + /* Recurse to read remaining blocks. */ + return blk_read_multiple (next, + blknum + runblocks, + nrblocks - runblocks, + block + blksize * runblocks, + cow_on_read, err); +} + +int +blk_read (nbdkit_next *next, + uint64_t blknum, uint8_t *block, bool cow_on_read, int *err) +{ + return blk_read_multiple (next, blknum, 1, block, cow_on_read, err); +} + +int +blk_cache (nbdkit_next *next, + uint64_t blknum, uint8_t *block, enum cache_mode mode, int *err) +{ + /* XXX Could make this lock more fine-grained with some thought. */ + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock); + off_t offset = blknum * blksize; + enum bm_entry state = bitmap_get_blk (&bm, blknum, BLOCK_NOT_ALLOCATED); + unsigned n = blksize, tail = 0; + + if (offset + n > size) { + tail = offset + n - size; + n -= tail; + } + + if (cow_debug_verbose) + nbdkit_debug ("cow: blk_cache block %" PRIu64 " (offset %" PRIu64 ") is %s", + blknum, (uint64_t) offset, state_to_string (state)); + + if (state == BLOCK_ALLOCATED) { +#if HAVE_POSIX_FADVISE + int r = posix_fadvise (fd, offset, blksize, POSIX_FADV_WILLNEED); + if (r) { + errno = r; + nbdkit_error ("posix_fadvise: %m"); + return -1; + } +#endif + return 0; + } + if (state == BLOCK_TRIMMED) + return 0; + if (mode == BLK_CACHE_IGNORE) + return 0; + if (mode == BLK_CACHE_PASSTHROUGH) + return next->cache (next, n, offset, 0, err); + + if (next->pread (next, block, n, offset, 0, err) == -1) + return -1; + /* Normally we're reading whole blocks, but at the very end of the + * file we might read a partial block. Deal with that case by + * zeroing the tail. + */ + memset (block + n, 0, tail); + + if (mode == BLK_CACHE_COW) { + if (full_pwrite (fd, block, blksize, offset) == -1) { + *err = errno; + nbdkit_error ("pwrite: %m"); + return -1; + } + bitmap_set_blk (&bm, blknum, BLOCK_ALLOCATED); + } + return 0; +} + +int +blk_write (uint64_t blknum, const uint8_t *block, int *err) +{ + off_t offset = blknum * blksize; + + if (cow_debug_verbose) + nbdkit_debug ("cow: blk_write block %" PRIu64 " (offset %" PRIu64 ")", + blknum, (uint64_t) offset); + + if (full_pwrite (fd, block, blksize, offset) == -1) { + *err = errno; + nbdkit_error ("pwrite: %m"); + return -1; + } + + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock); + bitmap_set_blk (&bm, blknum, BLOCK_ALLOCATED); + + return 0; +} + +int +blk_trim (uint64_t blknum, int *err) +{ + off_t offset = blknum * blksize; + + if (cow_debug_verbose) + nbdkit_debug ("cow: blk_trim block %" PRIu64 " (offset %" PRIu64 ")", + blknum, (uint64_t) offset); + + /* XXX As an optimization we could punch a whole in the overlay + * here. However it's not trivial since blksize is unrelated to the + * overlay filesystem block size. + */ + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock); + bitmap_set_blk (&bm, blknum, BLOCK_TRIMMED); + return 0; +} diff --git a/filters/cow/blk.h b/filters/cow/blk.h new file mode 100644 index 0000000..be3eb9e --- /dev/null +++ b/filters/cow/blk.h @@ -0,0 +1,83 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_BLK_H +#define NBDKIT_BLK_H + +/* Initialize the overlay and bitmap. */ +extern int blk_init (void); + +/* Close the overlay, free the bitmap. */ +extern void blk_free (void); + +/* Allocate or resize the overlay and bitmap. */ +extern int blk_set_size (uint64_t new_size); + +/* Returns the status of the block in the overlay. */ +extern void blk_status (uint64_t blknum, bool *present, bool *trimmed); + +/* Read a single block from the overlay or plugin. */ +extern int blk_read (nbdkit_next *next, + uint64_t blknum, uint8_t *block, + bool cow_on_read, int *err) + __attribute__ ((__nonnull__ (1, 3, 5))); + +/* Read multiple blocks from the overlay or plugin. */ +extern int blk_read_multiple (nbdkit_next *next, + uint64_t blknum, uint64_t nrblocks, + uint8_t *block, + bool cow_on_read, int *err) + __attribute__ ((__nonnull__ (1, 4, 6))); + +/* Cache mode for blocks not already in overlay */ +enum cache_mode { + BLK_CACHE_IGNORE, /* Do nothing */ + BLK_CACHE_PASSTHROUGH, /* Make cache request to plugin */ + BLK_CACHE_READ, /* Make ignored read request to plugin */ + BLK_CACHE_COW, /* Make read request to plugin, and write to overlay */ +}; + +/* Cache a single block from the plugin. */ +extern int blk_cache (nbdkit_next *next, + uint64_t blknum, uint8_t *block, enum cache_mode, + int *err) + __attribute__ ((__nonnull__ (1, 3, 5))); + +/* Write a single block. */ +extern int blk_write (uint64_t blknum, const uint8_t *block, int *err) + __attribute__ ((__nonnull__ (2, 3))); + +/* Trim a single block. */ +extern int blk_trim (uint64_t blknum, int *err) + __attribute__ ((__nonnull__ (2))); + +#endif /* NBDKIT_BLK_H */ diff --git a/filters/cow/cow.c b/filters/cow/cow.c new file mode 100644 index 0000000..4526bbf --- /dev/null +++ b/filters/cow/cow.c @@ -0,0 +1,804 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include "cleanup.h" +#include "isaligned.h" +#include "ispowerof2.h" +#include "minmax.h" +#include "rounding.h" + +#include "cow.h" +#include "blk.h" + +/* Read-modify-write requests are serialized through this global lock. + * This is only used for unaligned requests which should be + * infrequent. + */ +static pthread_mutex_t rmw_lock = PTHREAD_MUTEX_INITIALIZER; + +unsigned blksize = 65536; /* block size */ + +static bool cow_on_cache; + +/* Cache on read ("cow-on-read") mode. */ +extern enum cor_mode { + COR_OFF, + COR_ON, + COR_PATH, +} cor_mode; +enum cor_mode cor_mode = COR_OFF; +const char *cor_path; + +static void +cow_unload (void) +{ + blk_free (); +} + +static int +cow_config (nbdkit_next_config *next, nbdkit_backend *nxdata, + const char *key, const char *value) +{ + if (strcmp (key, "cow-block-size") == 0) { + int64_t r = nbdkit_parse_size (value); + if (r == -1) + return -1; + if (r < 4096 || r > UINT_MAX || !is_power_of_2 (r)) { + nbdkit_error ("cow-block-size is out of range (4096..2G) " + "or not a power of 2"); + return -1; + } + blksize = r; + return 0; + } + else if (strcmp (key, "cow-on-cache") == 0) { + int r; + + r = nbdkit_parse_bool (value); + if (r == -1) + return -1; + cow_on_cache = r; + return 0; + } + else if (strcmp (key, "cow-on-read") == 0) { + if (value[0] == '/') { + cor_path = value; + cor_mode = COR_PATH; + } + else { + int r = nbdkit_parse_bool (value); + if (r == -1) + return -1; + cor_mode = r ? COR_ON : COR_OFF; + } + return 0; + } + else { + return next (nxdata, key, value); + } +} + +#define cow_config_help \ + "cow-block-size= Set COW block size.\n" \ + "cow-on-cache= Copy cache (prefetch) requests to the overlay.\n" \ + "cow-on-read=|/PATH Copy read requests to the overlay." + +static int +cow_get_ready (int thread_model) +{ + if (blk_init () == -1) + return -1; + + return 0; +} + +/* Decide if cow-on-read is currently on or off. */ +bool +cow_on_read (void) +{ + switch (cor_mode) { + case COR_ON: return true; + case COR_OFF: return false; + case COR_PATH: return access (cor_path, F_OK) == 0; + default: abort (); + } +} + +static void * +cow_open (nbdkit_next_open *next, nbdkit_context *nxdata, + int readonly, const char *exportname, int is_tls) +{ + /* Always pass readonly=1 to the underlying plugin. */ + if (next (nxdata, 1, exportname) == -1) + return NULL; + + return NBDKIT_HANDLE_NOT_NEEDED; +} + +/* Get the file size, set the cache size. */ +static int64_t +cow_get_size (nbdkit_next *next, + void *handle) +{ + int64_t size; + int r; + + size = next->get_size (next); + if (size == -1) + return -1; + + nbdkit_debug ("cow: underlying file size: %" PRIi64, size); + + r = blk_set_size (size); + if (r == -1) + return -1; + + return size; +} + +/* Block size constraints. */ +static int +cow_block_size (nbdkit_next *next, void *handle, + uint32_t *minimum, uint32_t *preferred, uint32_t *maximum) +{ + if (next->block_size (next, minimum, preferred, maximum) == -1) + return -1; + + if (*minimum == 0) { /* No constraints set by the plugin. */ + *minimum = 1; + *preferred = blksize; + *maximum = 0xffffffff; + } + else { + if (*maximum >= blksize) + *preferred = MAX (*preferred, blksize); + } + + return 0; +} + +/* Force an early call to cow_get_size because we have to set the + * backing file size and bitmap size before any other read or write + * calls. + */ +static int +cow_prepare (nbdkit_next *next, + void *handle, int readonly) +{ + int64_t r; + + r = cow_get_size (next, handle); + return r >= 0 ? 0 : -1; +} + +static int +cow_can_write (nbdkit_next *next, void *handle) +{ + return 1; +} + +static int +cow_can_trim (nbdkit_next *next, void *handle) +{ + return 1; +} + +static int +cow_can_extents (nbdkit_next *next, void *handle) +{ + return 1; +} + +static int +cow_can_flush (nbdkit_next *next, void *handle) +{ + return 1; +} + +static int +cow_can_fua (nbdkit_next *next, void *handle) +{ + return NBDKIT_FUA_NATIVE; +} + +static int +cow_can_cache (nbdkit_next *next, void *handle) +{ + /* Cache next->can_cache now, so later calls to next->cache + * don't fail, even though we override the answer here. + */ + int r = next->can_cache (next); + if (r == -1) + return -1; + return NBDKIT_CACHE_NATIVE; +} + +static int +cow_can_multi_conn (nbdkit_next *next, + void *handle) +{ + /* Our cache is consistent between connections. */ + return 1; +} + +/* Override the plugin's .can_fast_zero, because our .zero is not fast */ +static int +cow_can_fast_zero (nbdkit_next *next, + void *handle) +{ + /* It is better to advertise support even when we always reject fast + * zero attempts. + */ + return 1; +} + +static int cow_flush (nbdkit_next *next, void *handle, uint32_t flags, + int *err); + +/* Read data. */ +static int +cow_pread (nbdkit_next *next, + void *handle, void *buf, uint32_t count, uint64_t offset, + uint32_t flags, int *err) +{ + CLEANUP_FREE uint8_t *block = NULL; + uint64_t blknum, blkoffs, nrblocks; + int r; + + if (!IS_ALIGNED (count | offset, blksize)) { + block = malloc (blksize); + if (block == NULL) { + *err = errno; + nbdkit_error ("malloc: %m"); + return -1; + } + } + + blknum = offset / blksize; /* block number */ + blkoffs = offset % blksize; /* offset within the block */ + + /* Unaligned head */ + if (blkoffs) { + uint64_t n = MIN (blksize - blkoffs, count); + + assert (block); + r = blk_read (next, blknum, block, cow_on_read (), err); + if (r == -1) + return -1; + + memcpy (buf, &block[blkoffs], n); + + buf += n; + count -= n; + offset += n; + blknum++; + } + + /* Aligned body */ + nrblocks = count / blksize; + if (nrblocks > 0) { + r = blk_read_multiple (next, blknum, nrblocks, buf, cow_on_read (), err); + if (r == -1) + return -1; + + buf += nrblocks * blksize; + count -= nrblocks * blksize; + offset += nrblocks * blksize; + blknum += nrblocks; + } + + /* Unaligned tail */ + if (count) { + assert (block); + r = blk_read (next, blknum, block, cow_on_read (), err); + if (r == -1) + return -1; + + memcpy (buf, block, count); + } + + return 0; +} + +/* Write data. */ +static int +cow_pwrite (nbdkit_next *next, + void *handle, const void *buf, uint32_t count, uint64_t offset, + uint32_t flags, int *err) +{ + CLEANUP_FREE uint8_t *block = NULL; + uint64_t blknum, blkoffs; + int r; + + if (!IS_ALIGNED (count | offset, blksize)) { + block = malloc (blksize); + if (block == NULL) { + *err = errno; + nbdkit_error ("malloc: %m"); + return -1; + } + } + + blknum = offset / blksize; /* block number */ + blkoffs = offset % blksize; /* offset within the block */ + + /* Unaligned head */ + if (blkoffs) { + uint64_t n = MIN (blksize - blkoffs, count); + + /* Do a read-modify-write operation on the current block. + * Hold the rmw_lock over the whole operation. + */ + assert (block); + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&rmw_lock); + r = blk_read (next, blknum, block, cow_on_read (), err); + if (r != -1) { + memcpy (&block[blkoffs], buf, n); + r = blk_write (blknum, block, err); + } + if (r == -1) + return -1; + + buf += n; + count -= n; + offset += n; + blknum++; + } + + /* Aligned body */ + while (count >= blksize) { + r = blk_write (blknum, buf, err); + if (r == -1) + return -1; + + buf += blksize; + count -= blksize; + offset += blksize; + blknum++; + } + + /* Unaligned tail */ + if (count) { + assert (block); + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&rmw_lock); + r = blk_read (next, blknum, block, cow_on_read (), err); + if (r != -1) { + memcpy (block, buf, count); + r = blk_write (blknum, block, err); + } + if (r == -1) + return -1; + } + + /* flags & NBDKIT_FLAG_FUA is deliberately ignored. */ + + return 0; +} + +/* Zero data. */ +static int +cow_zero (nbdkit_next *next, + void *handle, uint32_t count, uint64_t offset, uint32_t flags, + int *err) +{ + CLEANUP_FREE uint8_t *block = NULL; + uint64_t blknum, blkoffs; + int r; + + /* We are purposefully avoiding next->zero, so a zero request is + * never faster than plain writes. + */ + if (flags & NBDKIT_FLAG_FAST_ZERO) { + *err = ENOTSUP; + return -1; + } + + block = malloc (blksize); + if (block == NULL) { + *err = errno; + nbdkit_error ("malloc: %m"); + return -1; + } + + blknum = offset / blksize; /* block number */ + blkoffs = offset % blksize; /* offset within the block */ + + /* Unaligned head */ + if (blkoffs) { + uint64_t n = MIN (blksize - blkoffs, count); + + /* Do a read-modify-write operation on the current block. + * Hold the rmw_lock over the whole operation. + */ + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&rmw_lock); + r = blk_read (next, blknum, block, cow_on_read (), err); + if (r != -1) { + memset (&block[blkoffs], 0, n); + r = blk_write (blknum, block, err); + } + if (r == -1) + return -1; + + count -= n; + offset += n; + blknum++; + } + + /* Aligned body */ + if (count >= blksize) + memset (block, 0, blksize); + while (count >= blksize) { + /* XXX There is the possibility of optimizing this: since this loop is + * writing a whole, aligned block, we should use FALLOC_FL_ZERO_RANGE. + */ + r = blk_write (blknum, block, err); + if (r == -1) + return -1; + + count -= blksize; + offset += blksize; + blknum++; + } + + /* Unaligned tail */ + if (count) { + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&rmw_lock); + r = blk_read (next, blknum, block, cow_on_read (), err); + if (r != -1) { + memset (block, 0, count); + r = blk_write (blknum, block, err); + } + if (r == -1) + return -1; + } + + /* flags & NBDKIT_FLAG_FUA is deliberately ignored. */ + + return 0; +} + +/* Trim data. */ +static int +cow_trim (nbdkit_next *next, + void *handle, uint32_t count, uint64_t offset, uint32_t flags, + int *err) +{ + CLEANUP_FREE uint8_t *block = NULL; + uint64_t blknum, blkoffs; + int r; + + if (!IS_ALIGNED (count | offset, blksize)) { + block = malloc (blksize); + if (block == NULL) { + *err = errno; + nbdkit_error ("malloc: %m"); + return -1; + } + } + + blknum = offset / blksize; /* block number */ + blkoffs = offset % blksize; /* offset within the block */ + + /* Unaligned head */ + if (blkoffs) { + uint64_t n = MIN (blksize - blkoffs, count); + + /* Do a read-modify-write operation on the current block. + * Hold the lock over the whole operation. + */ + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&rmw_lock); + r = blk_read (next, blknum, block, cow_on_read (), err); + if (r != -1) { + memset (&block[blkoffs], 0, n); + r = blk_write (blknum, block, err); + } + if (r == -1) + return -1; + + count -= n; + offset += n; + blknum++; + } + + /* Aligned body */ + while (count >= blksize) { + r = blk_trim (blknum, err); + if (r == -1) + return -1; + + count -= blksize; + offset += blksize; + blknum++; + } + + /* Unaligned tail */ + if (count) { + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&rmw_lock); + r = blk_read (next, blknum, block, cow_on_read (), err); + if (r != -1) { + memset (block, 0, count); + r = blk_write (blknum, block, err); + } + if (r == -1) + return -1; + } + + /* flags & NBDKIT_FLAG_FUA is deliberately ignored. */ + + return 0; +} + +static int +cow_flush (nbdkit_next *next, void *handle, + uint32_t flags, int *err) +{ + /* Deliberately ignored. */ + return 0; +} + +static int +cow_cache (nbdkit_next *next, + void *handle, uint32_t count, uint64_t offset, + uint32_t flags, int *err) +{ + CLEANUP_FREE uint8_t *block = NULL; + uint64_t blknum, blkoffs; + int r; + uint64_t remaining = count; /* Rounding out could exceed 32 bits */ + enum cache_mode mode; + + switch (next->can_cache (next)) { + case NBDKIT_CACHE_NONE: + mode = BLK_CACHE_IGNORE; + break; + case NBDKIT_CACHE_EMULATE: + mode = BLK_CACHE_READ; + break; + case NBDKIT_CACHE_NATIVE: + mode = BLK_CACHE_PASSTHROUGH; + break; + default: + abort (); /* Guaranteed thanks to early caching */ + } + if (cow_on_cache) + mode = BLK_CACHE_COW; + + assert (!flags); + block = malloc (blksize); + if (block == NULL) { + *err = errno; + nbdkit_error ("malloc: %m"); + return -1; + } + + blknum = offset / blksize; /* block number */ + blkoffs = offset % blksize; /* offset within the block */ + + /* Unaligned head */ + remaining += blkoffs; + offset -= blkoffs; + + /* Unaligned tail */ + remaining = ROUND_UP (remaining, blksize); + + /* Aligned body */ + while (remaining) { + r = blk_cache (next, blknum, block, mode, err); + if (r == -1) + return -1; + + remaining -= blksize; + offset += blksize; + blknum++; + } + + return 0; +} + +/* Extents. */ +static int +cow_extents (nbdkit_next *next, + void *handle, uint32_t count32, uint64_t offset, uint32_t flags, + struct nbdkit_extents *extents, int *err) +{ + const bool can_extents = next->can_extents (next); + const bool req_one = flags & NBDKIT_FLAG_REQ_ONE; + uint64_t count = count32; + uint64_t end; + uint64_t blknum; + + /* To make this easier, align the requested extents to whole blocks. + * Note that count is a 64 bit variable containing at most a 32 bit + * value so rounding up is safe here. + */ + end = offset + count; + offset = ROUND_DOWN (offset, blksize); + end = ROUND_UP (end, blksize); + count = end - offset; + blknum = offset / blksize; + + assert (IS_ALIGNED (offset, blksize)); + assert (IS_ALIGNED (count, blksize)); + assert (count > 0); /* We must make forward progress. */ + + while (count > 0) { + bool present, trimmed; + struct nbdkit_extent e; + + blk_status (blknum, &present, &trimmed); + + /* Present in the overlay. */ + if (present) { + e.offset = offset; + e.length = blksize; + + if (trimmed) + e.type = NBDKIT_EXTENT_HOLE|NBDKIT_EXTENT_ZERO; + else + e.type = 0; + + if (nbdkit_add_extent (extents, e.offset, e.length, e.type) == -1) { + *err = errno; + return -1; + } + + blknum++; + offset += blksize; + count -= blksize; + } + + /* Not present in the overlay, but we can ask the plugin. */ + else if (can_extents) { + uint64_t range_offset = offset; + uint32_t range_count = 0; + size_t i; + int64_t size; + + /* Asking the plugin for a single block of extents is not + * efficient for some plugins (eg. VDDK) so ask for as much data + * as we can. + */ + for (;;) { + /* nbdkit_extents_full cannot read more than a 32 bit range + * (range_count), but count is a 64 bit quantity, so don't + * overflow range_count here. + */ + if (range_count >= UINT32_MAX - blksize + 1) break; + + blknum++; + offset += blksize; + count -= blksize; + range_count += blksize; + + if (count == 0) break; + blk_status (blknum, &present, &trimmed); + if (present) break; + } + + /* Don't ask for extent data beyond the end of the plugin. */ + size = next->get_size (next); + if (size == -1) + return -1; + + if (range_offset + range_count > size) { + unsigned tail = range_offset + range_count - size; + range_count -= tail; + } + + CLEANUP_EXTENTS_FREE struct nbdkit_extents *extents2 = + nbdkit_extents_full (next, range_count, range_offset, flags, err); + if (extents2 == NULL) + return -1; + + for (i = 0; i < nbdkit_extents_count (extents2); ++i) { + e = nbdkit_get_extent (extents2, i); + if (nbdkit_add_extent (extents, e.offset, e.length, e.type) == -1) { + *err = errno; + return -1; + } + } + } + + /* Otherwise assume the block is non-sparse. */ + else { + e.offset = offset; + e.length = blksize; + e.type = 0; + + if (nbdkit_add_extent (extents, e.offset, e.length, e.type) == -1) { + *err = errno; + return -1; + } + + blknum++; + offset += blksize; + count -= blksize; + } + + /* If the caller only wanted the first extent, and we've managed + * to add at least one extent to the list, then we can drop out + * now. (Note calling nbdkit_add_extent above does not mean the + * extent got added since it might be before the first offset.) + */ + if (req_one && nbdkit_extents_count (extents) > 0) + break; + } + + return 0; +} + +static struct nbdkit_filter filter = { + .name = "cow", + .longname = "nbdkit copy-on-write (COW) filter", + .unload = cow_unload, + .open = cow_open, + .config = cow_config, + .config_help = cow_config_help, + .get_ready = cow_get_ready, + .prepare = cow_prepare, + .get_size = cow_get_size, + .block_size = cow_block_size, + .can_write = cow_can_write, + .can_flush = cow_can_flush, + .can_trim = cow_can_trim, + .can_extents = cow_can_extents, + .can_fua = cow_can_fua, + .can_cache = cow_can_cache, + .can_fast_zero = cow_can_fast_zero, + .can_multi_conn = cow_can_multi_conn, + .pread = cow_pread, + .pwrite = cow_pwrite, + .zero = cow_zero, + .trim = cow_trim, + .flush = cow_flush, + .cache = cow_cache, + .extents = cow_extents, +}; + +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/cow/cow.h b/filters/cow/cow.h new file mode 100644 index 0000000..c89cccd --- /dev/null +++ b/filters/cow/cow.h @@ -0,0 +1,39 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + */ + +#ifndef NBDKIT_COW_H +#define NBDKIT_COW_H + +/* Size of a block in the cache. */ +extern unsigned blksize; + +#endif /* NBDKIT_COW_H */ diff --git a/filters/cow/nbdkit-cow-filter.pod b/filters/cow/nbdkit-cow-filter.pod new file mode 100644 index 0000000..1fd91c0 --- /dev/null +++ b/filters/cow/nbdkit-cow-filter.pod @@ -0,0 +1,181 @@ +=head1 NAME + +nbdkit-cow-filter - nbdkit copy-on-write (COW) filter + +=head1 SYNOPSIS + + nbdkit --filter=cow plugin [plugin-args...] + [cow-block-size=N] + [cow-on-cache=false|true] + [cow-on-read=false|true|/PATH] + +=head1 DESCRIPTION + +C is a filter that makes a temporary writable copy +on top of a plugin. It can also be used to enable writes for plugins +which are read-only. + +The underlying plugin is opened read-only. This filter does not pass +any writes or write-like operations (like trim and zero) through to +the underlying plugin. + +B +If you want to save changes, either copy out the whole disk using a +tool like L, or use the method described in L +below to create a diff. + +Limitations of the filter include: + +=over 4 + +=item * + +The underlying file/device must not be resized. + +=item * + +The underlying plugin must behave “normally”, meaning that it must +serve the same data to each client. + +=back + +=head1 PARAMETERS + +=over 4 + +=item BN + +Set the block size used by the filter. This has to be a power of two +and the minimum block size is 4K. The maximum block size depends on +the plugin, but a block size larger than a few megabytes is not +usually a good idea. + +The default is 64K. + +=item B + +Do not save data from cache (prefetch) requests in the overlay. This +leaves the overlay as small as possible. This is the default. + +=item B + +When the client issues a cache (prefetch) request, preemptively save +the data from the plugin into the overlay. + +=item B + +Do not save data from read requests in the overlay. This leaves the +overlay as small as possible. This is the default. + +=item B + +When the client issues a read request, copy the data into the overlay +so that the same data can be served more quickly later. + +=item B + +When F (which must be an absolute path) exists, this behaves +like C, and when it does not exist like +C. This allows you to control the C +behaviour while nbdkit is running. + +=back + +=head1 EXAMPLES + +=head2 nbdkit --filter=cow file disk.img + +Serve the file F, allowing writes, but do not save any +changes into the file. + +=head2 nbdkit --filter=cow --filter=xz file disk.xz cow-on-read=true + +L only supports read access, but you can provide +temporary write access by using the command above. Because xz +decompression is slow, using C causes reads to be +cached as well as writes, improving performance at the expense of +using more temporary space. Note that writes are thrown away when +nbdkit exits and do not get saved into the file. + +=head1 NOTES + +=head2 Creating a diff with qemu-img + +Although nbdkit-cow-filter itself cannot save the differences, it is +possible to do this using an obscure feature of L. +B. + +Run nbdkit: + + nbdkit --filter=cow file disk.img + +and then connect with a client and make whatever changes you need. +At the end, disconnect the client. + +Run these C commands to construct a qcow2 file containing +the differences: + + qemu-img create -F raw -b nbd:localhost -f qcow2 diff.qcow2 + qemu-img rebase -F raw -b disk.img -f qcow2 diff.qcow2 + +F now contains the differences between the base +(F) and the changes stored in nbdkit-cow-filter. C +can now be killed. + +=head2 Compared to nbd-server -c option + +All connections to the nbdkit instance see the same view of the disk. +This is different from L I<-c> option where each +connection sees its own copy-on-write overlay and simply disconnecting +the client throws that away. It also allows us to create diffs as +above. + +=head1 ENVIRONMENT VARIABLES + +=over 4 + +=item C + +The copy-on-write changes are stored in a temporary file located in +F by default. You can override this location by setting the +C environment variable before starting nbdkit. + +=back + +=head1 FILES + +=over 4 + +=item F<$filterdir/nbdkit-cow-filter.so> + +The filter. + +Use C to find the location of C<$filterdir>. + +=back + +=head1 VERSION + +C first appeared in nbdkit 1.2. + +=head1 SEE ALSO + +L, +L, +L, +L, +L, +L, +L, +L. + +=head1 AUTHORS + +Eric Blake + +Richard W.M. Jones + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/filters/ddrescue/Makefile.am b/filters/ddrescue/Makefile.am new file mode 100644 index 0000000..d1dc66c --- /dev/null +++ b/filters/ddrescue/Makefile.am @@ -0,0 +1,81 @@ +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 $(top_srcdir)/common-rules.mk + +EXTRA_DIST = \ + nbdkit-ddrescue-filter.pod \ + $(NULL) + +filter_LTLIBRARIES = nbdkit-ddrescue-filter.la + +nbdkit_ddrescue_filter_la_SOURCES = \ + ddrescue.c \ + $(top_srcdir)/include/nbdkit-filter.h \ + $(NULL) + +nbdkit_ddrescue_filter_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/common/include \ + -I$(top_srcdir)/common/replacements \ + -I$(top_srcdir)/common/utils \ + $(NULL) +nbdkit_ddrescue_filter_la_CFLAGS = \ + $(WARNINGS_CFLAGS) \ + $(GNUTLS_CFLAGS) \ + $(NULL) +nbdkit_ddrescue_filter_la_LDFLAGS = \ + -module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \ + $(NULL) +if USE_LINKER_SCRIPT +nbdkit_ddrescue_filter_la_LDFLAGS += \ + -Wl,--version-script=$(top_srcdir)/filters/filters.syms +endif +nbdkit_ddrescue_filter_la_LIBADD = \ + $(top_builddir)/common/utils/libutils.la \ + $(top_builddir)/common/replacements/libcompat.la \ + $(IMPORT_LIBRARY_ON_WINDOWS) \ + $(GNUTLS_LIBS) \ + $(NULL) + +if HAVE_POD + +man_MANS = nbdkit-ddrescue-filter.1 +CLEANFILES += $(man_MANS) + +nbdkit-ddrescue-filter.1: nbdkit-ddrescue-filter.pod \ + $(top_builddir)/podwrapper.pl + $(PODWRAPPER) --section=1 --man $@ \ + --html $(top_builddir)/html/$@.html \ + $< + +endif HAVE_POD diff --git a/filters/ddrescue/Makefile.in b/filters/ddrescue/Makefile.in new file mode 100644 index 0000000..5ce9e82 --- /dev/null +++ b/filters/ddrescue/Makefile.in @@ -0,0 +1,947 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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@ +@USE_LINKER_SCRIPT_TRUE@am__append_1 = \ +@USE_LINKER_SCRIPT_TRUE@ -Wl,--version-script=$(top_srcdir)/filters/filters.syms + +@HAVE_POD_TRUE@am__append_2 = $(man_MANS) +subdir = filters/ddrescue +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ocaml.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +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 = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(filterdir)" "$(DESTDIR)$(man1dir)" +LTLIBRARIES = $(filter_LTLIBRARIES) +am__DEPENDENCIES_1 = +nbdkit_ddrescue_filter_la_DEPENDENCIES = \ + $(top_builddir)/common/utils/libutils.la \ + $(top_builddir)/common/replacements/libcompat.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +am__objects_1 = +am_nbdkit_ddrescue_filter_la_OBJECTS = \ + nbdkit_ddrescue_filter_la-ddrescue.lo $(am__objects_1) +nbdkit_ddrescue_filter_la_OBJECTS = \ + $(am_nbdkit_ddrescue_filter_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +nbdkit_ddrescue_filter_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(nbdkit_ddrescue_filter_la_CFLAGS) $(CFLAGS) \ + $(nbdkit_ddrescue_filter_la_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = \ + ./$(DEPDIR)/nbdkit_ddrescue_filter_la-ddrescue.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(nbdkit_ddrescue_filter_la_SOURCES) +DIST_SOURCES = $(nbdkit_ddrescue_filter_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/common-rules.mk \ + $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ +BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ +CARGO = @CARGO@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_PLUGIN_CC = @CC_PLUGIN_CC@ +CC_PLUGIN_CFLAGS = @CC_PLUGIN_CFLAGS@ +CERTTOOL = @CERTTOOL@ +CFLAGS = @CFLAGS@ +COM_ERR_CFLAGS = @COM_ERR_CFLAGS@ +COM_ERR_LIBS = @COM_ERR_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CUT = @CUT@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LDFLAGS = @DL_LDFLAGS@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXT2FS_CFLAGS = @EXT2FS_CFLAGS@ +EXT2FS_LIBS = @EXT2FS_LIBS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GENISOIMAGE = @GENISOIMAGE@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GOARCH = @GOARCH@ +GOLANG = @GOLANG@ +GOOS = @GOOS@ +GOROOT = @GOROOT@ +GREP = @GREP@ +IMPORT_LIBRARY_ON_WINDOWS = @IMPORT_LIBRARY_ON_WINDOWS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +ISOPROG = @ISOPROG@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBLKIO_CFLAGS = @LIBBLKIO_CFLAGS@ +LIBBLKIO_LIBS = @LIBBLKIO_LIBS@ +LIBGUESTFS_CFLAGS = @LIBGUESTFS_CFLAGS@ +LIBGUESTFS_LIBS = @LIBGUESTFS_LIBS@ +LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ +LIBLZMA_LIBS = @LIBLZMA_LIBS@ +LIBNBD_CFLAGS = @LIBNBD_CFLAGS@ +LIBNBD_LIBS = @LIBNBD_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSELINUX_CFLAGS = @LIBSELINUX_CFLAGS@ +LIBSELINUX_LIBS = @LIBSELINUX_LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTORRENT_CFLAGS = @LIBTORRENT_CFLAGS@ +LIBTORRENT_LIBS = @LIBTORRENT_LIBS@ +LIBVIRT_CFLAGS = @LIBVIRT_CFLAGS@ +LIBVIRT_LIBS = @LIBVIRT_LIBS@ +LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ +LIBZSTD_LIBS = @LIBZSTD_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LUA_CFLAGS = @LUA_CFLAGS@ +LUA_LIBS = @LUA_LIBS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MC = @MC@ +MKDIR_P = @MKDIR_P@ +MKISOFS = @MKISOFS@ +NBDKIT_VERSION_MAJOR = @NBDKIT_VERSION_MAJOR@ +NBDKIT_VERSION_MICRO = @NBDKIT_VERSION_MICRO@ +NBDKIT_VERSION_MINOR = @NBDKIT_VERSION_MINOR@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_ON_WINDOWS = @NO_UNDEFINED_ON_WINDOWS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OCAML = @OCAML@ +OCAMLBEST = @OCAMLBEST@ +OCAMLBUILD = @OCAMLBUILD@ +OCAMLC = @OCAMLC@ +OCAMLCDOTOPT = @OCAMLCDOTOPT@ +OCAMLDEP = @OCAMLDEP@ +OCAMLDOC = @OCAMLDOC@ +OCAMLLIB = @OCAMLLIB@ +OCAMLMKLIB = @OCAMLMKLIB@ +OCAMLMKTOP = @OCAMLMKTOP@ +OCAMLOPT = @OCAMLOPT@ +OCAMLOPTDOTOPT = @OCAMLOPTDOTOPT@ +OCAMLOPTFLAGS = @OCAMLOPTFLAGS@ +OCAMLVERSION = @OCAMLVERSION@ +OCAML_MAJOR = @OCAML_MAJOR@ +OCAML_PLUGIN_LIBRARIES = @OCAML_PLUGIN_LIBRARIES@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PERL_ARCHLIB = @PERL_ARCHLIB@ +PERL_CFLAGS = @PERL_CFLAGS@ +PERL_LDOPTS = @PERL_LDOPTS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PODWRAPPER = @PODWRAPPER@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_CXX = @PTHREAD_CXX@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CFLAGS = @PYTHON_CFLAGS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +RUBY_CFLAGS = @RUBY_CFLAGS@ +RUBY_LIBS = @RUBY_LIBS@ +RUSTC = @RUSTC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOEXT = @SOEXT@ +SSH_CFLAGS = @SSH_CFLAGS@ +SSH_LIBS = @SSH_LIBS@ +STAT = @STAT@ +STRIP = @STRIP@ +TCL_CFLAGS = @TCL_CFLAGS@ +TCL_LIBS = @TCL_LIBS@ +TRUNCATE = @TRUNCATE@ +VALGRIND = @VALGRIND@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VERSION = @VERSION@ +WARNINGS_CFLAGS = @WARNINGS_CFLAGS@ +XORRISO = @XORRISO@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +ZLIB_NG_CFLAGS = @ZLIB_NG_CFLAGS@ +ZLIB_NG_LIBS = @ZLIB_NG_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DLLTOOL = @ac_ct_DLLTOOL@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_MC = @ac_ct_MC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bashcompdir = @bashcompdir@ +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@ +filters = @filters@ +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@ +lang_plugins = @lang_plugins@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +non_lang_plugins = @non_lang_plugins@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugins = @plugins@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +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@ + +# Convenient list terminator +NULL = +plugindir = $(libdir)/nbdkit/plugins +filterdir = $(libdir)/nbdkit/filters +CLEANFILES = *~ *.cmi *.cmx *.cmxa *.so *.dll $(am__append_2) +EXTRA_DIST = \ + nbdkit-ddrescue-filter.pod \ + $(NULL) + +filter_LTLIBRARIES = nbdkit-ddrescue-filter.la +nbdkit_ddrescue_filter_la_SOURCES = \ + ddrescue.c \ + $(top_srcdir)/include/nbdkit-filter.h \ + $(NULL) + +nbdkit_ddrescue_filter_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/common/include \ + -I$(top_srcdir)/common/replacements \ + -I$(top_srcdir)/common/utils \ + $(NULL) + +nbdkit_ddrescue_filter_la_CFLAGS = \ + $(WARNINGS_CFLAGS) \ + $(GNUTLS_CFLAGS) \ + $(NULL) + +nbdkit_ddrescue_filter_la_LDFLAGS = -module -avoid-version -shared \ + $(NO_UNDEFINED_ON_WINDOWS) $(NULL) $(am__append_1) +nbdkit_ddrescue_filter_la_LIBADD = \ + $(top_builddir)/common/utils/libutils.la \ + $(top_builddir)/common/replacements/libcompat.la \ + $(IMPORT_LIBRARY_ON_WINDOWS) \ + $(GNUTLS_LIBS) \ + $(NULL) + +@HAVE_POD_TRUE@man_MANS = nbdkit-ddrescue-filter.1 +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common-rules.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign filters/ddrescue/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign filters/ddrescue/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; +$(top_srcdir)/common-rules.mk $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +install-filterLTLIBRARIES: $(filter_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(filter_LTLIBRARIES)'; test -n "$(filterdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(filterdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(filterdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(filterdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(filterdir)"; \ + } + +uninstall-filterLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(filter_LTLIBRARIES)'; test -n "$(filterdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(filterdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(filterdir)/$$f"; \ + done + +clean-filterLTLIBRARIES: + -test -z "$(filter_LTLIBRARIES)" || rm -f $(filter_LTLIBRARIES) + @list='$(filter_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +nbdkit-ddrescue-filter.la: $(nbdkit_ddrescue_filter_la_OBJECTS) $(nbdkit_ddrescue_filter_la_DEPENDENCIES) $(EXTRA_nbdkit_ddrescue_filter_la_DEPENDENCIES) + $(AM_V_CCLD)$(nbdkit_ddrescue_filter_la_LINK) -rpath $(filterdir) $(nbdkit_ddrescue_filter_la_OBJECTS) $(nbdkit_ddrescue_filter_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nbdkit_ddrescue_filter_la-ddrescue.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +nbdkit_ddrescue_filter_la-ddrescue.lo: ddrescue.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_ddrescue_filter_la_CPPFLAGS) $(CPPFLAGS) $(nbdkit_ddrescue_filter_la_CFLAGS) $(CFLAGS) -MT nbdkit_ddrescue_filter_la-ddrescue.lo -MD -MP -MF $(DEPDIR)/nbdkit_ddrescue_filter_la-ddrescue.Tpo -c -o nbdkit_ddrescue_filter_la-ddrescue.lo `test -f 'ddrescue.c' || echo '$(srcdir)/'`ddrescue.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nbdkit_ddrescue_filter_la-ddrescue.Tpo $(DEPDIR)/nbdkit_ddrescue_filter_la-ddrescue.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ddrescue.c' object='nbdkit_ddrescue_filter_la-ddrescue.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_ddrescue_filter_la_CPPFLAGS) $(CPPFLAGS) $(nbdkit_ddrescue_filter_la_CFLAGS) $(CFLAGS) -c -o nbdkit_ddrescue_filter_la-ddrescue.lo `test -f 'ddrescue.c' || echo '$(srcdir)/'`ddrescue.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(MANS) +installdirs: + for dir in "$(DESTDIR)$(filterdir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: 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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-filterLTLIBRARIES clean-generic clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/nbdkit_ddrescue_filter_la-ddrescue.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-filterLTLIBRARIES install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/nbdkit_ddrescue_filter_la-ddrescue.Plo + -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-filterLTLIBRARIES uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-filterLTLIBRARIES clean-generic clean-libtool \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-filterLTLIBRARIES \ + install-html install-html-am install-info install-info-am \ + install-man install-man1 install-pdf install-pdf-am 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 tags-am uninstall \ + uninstall-am uninstall-filterLTLIBRARIES uninstall-man \ + uninstall-man1 + +.PRECIOUS: Makefile + + +@HAVE_POD_TRUE@nbdkit-ddrescue-filter.1: nbdkit-ddrescue-filter.pod \ +@HAVE_POD_TRUE@ $(top_builddir)/podwrapper.pl +@HAVE_POD_TRUE@ $(PODWRAPPER) --section=1 --man $@ \ +@HAVE_POD_TRUE@ --html $(top_builddir)/html/$@.html \ +@HAVE_POD_TRUE@ $< + +# 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/filters/ddrescue/ddrescue.c b/filters/ddrescue/ddrescue.c new file mode 100644 index 0000000..081f567 --- /dev/null +++ b/filters/ddrescue/ddrescue.c @@ -0,0 +1,211 @@ +/* nbdkit + * Copyright (C) 2018-2020 François Revol. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include +#include +#include + +#include + +#include + +#include "cleanup.h" +#include "getline.h" +#include "vector.h" + +struct range { + int64_t start; + int64_t end; + int64_t size; + char status; +}; +DEFINE_VECTOR_TYPE (ranges, struct range); + +struct mapfile { + int ranges_count; + ranges ranges; +}; + +static struct mapfile map = { 0, empty_vector }; + +static int +parse_mapfile (const char *filename) +{ + FILE *fp = NULL; + CLEANUP_FREE char *line = NULL; + size_t linelen = 0; + ssize_t len; + int ret = -1; + int status_seen = 0; + + fp = fopen (filename, "r"); + if (!fp) { + nbdkit_error ("%s: ddrescue: fopen: %m", filename); + goto out; + } + + while ((len = getline (&line, &linelen, fp)) != -1) { + int64_t offset, length; + char status; + + if (len > 0 && line[len-1] == '\n') { + line[len-1] = '\0'; + len--; + } + + if (len > 0 && line[0] == '#') + continue; + + if (len > 0 && !status_seen) { + /* status line, ignore it for now */ + status_seen = 1; + nbdkit_debug ("%s: skipping status line: '%s'", filename, line); + continue; + } + + if (sscanf (line, "%" SCNi64 "\t%" SCNi64 "\t%c", + &offset, &length, &status) == 3) { + if (offset < 0) { + nbdkit_error ("block offset must not be negative"); + return -1; + } + if (length < 0) { + nbdkit_error ("block length must not be negative"); + return -1; + } + if (status == '+') { + struct range new_range = { .start = offset, .end = offset + length - 1, + .size = length, .status = status }; + + if (ranges_append (&map.ranges, new_range) == -1) { + nbdkit_error ("%s: ddrescue: realloc: %m", filename); + goto out; + } + } + + nbdkit_debug ("%s: range: 0x%" PRIx64 " 0x%" PRIx64 " '%c'", + filename, offset, length, status); + } + } + + ret = 0; + + out: + if (fp) + fclose (fp); + return ret; +} + +/* On unload, free the mapfile data. */ +static void +ddrescue_unload (void) +{ + free (map.ranges.ptr); +} + +static int +ddrescue_config (nbdkit_next_config *next, nbdkit_backend *nxdata, + const char *key, const char *value) +{ + if (strcmp (key, "ddrescue-mapfile") == 0) { + if (parse_mapfile (value) == -1) + return -1; + return 0; + } + + else + return next (nxdata, key, value); +} + +#define ddrescue_config_help \ + "ddrescue-mapfile=... Specify ddrescue mapfile to use" + +/* We need this because otherwise the layer below can_write is called + * and that might return true (eg. if the plugin has a pwrite method + * at all), resulting in writes being passed through to the layer + * below. + */ +static int +ddrescue_can_write (nbdkit_next *next, + void *handle) +{ + return 0; +} + +static int +ddrescue_can_cache (nbdkit_next *next, + void *handle) +{ + return 0; +} + +/* Read data. */ +static int +ddrescue_pread (nbdkit_next *next, + void *handle, void *buf, uint32_t count, uint64_t offset, + uint32_t flags, int *err) +{ + size_t i; + + for (i = 0; i < map.ranges.len; i++) { + if (map.ranges.ptr[i].status != '+') + continue; + if (offset >= map.ranges.ptr[i].start && offset <= map.ranges.ptr[i].end) { + if (offset + count - 1 <= map.ranges.ptr[i].end) { + /* entirely contained within this range */ + return next->pread (next, buf, count, offset, flags, err); + } + } + } + /* read was not fully covered */ + nbdkit_debug ("ddrescue: pread: range: 0x%" PRIx64 " 0x%" PRIx32 + " failing with EIO", offset, count); + *err = EIO; + return -1; +} + +static struct nbdkit_filter filter = { + .name = "ddrescue", + .longname = "nbdkit ddrescue mapfile filter", + .unload = ddrescue_unload, + .config = ddrescue_config, + .config_help = ddrescue_config_help, + .can_write = ddrescue_can_write, + .can_cache = ddrescue_can_cache, + .pread = ddrescue_pread, +}; + +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/ddrescue/nbdkit-ddrescue-filter.pod b/filters/ddrescue/nbdkit-ddrescue-filter.pod new file mode 100644 index 0000000..eadd392 --- /dev/null +++ b/filters/ddrescue/nbdkit-ddrescue-filter.pod @@ -0,0 +1,78 @@ +=head1 NAME + +nbdkit-ddrescue-filter - nbdkit filter for serving from ddrescue dump + +=head1 SYNOPSIS + + nbdkit --filter=ddrescue plugin [plugin-args...] + ddrescue-mapfile=file.map + +=for paragraph + + nbdkit --filter=ddrescue file file=file.img ddrescue-mapfile=file.map + [plugin-args...] + +=head1 DESCRIPTION + +C is a filter for L which overlays +bad blocks according to a GNU L mapfile. This is mainly useful +for testing disk images recovered with ddrescue, to detect which files +or filesystem structures are impacted, or attempting fsck on them. + +Note that the current implementation is read-only. + +=head1 EXAMPLES + +=over 4 + +=item Expose a rescued disk image with detected bad sectors: + + nbdkit --filter=ddrescue file file=disk.img ddrescue-mapfile=disk.map + +The above command serves the disk image disk.img and maps the bad +sectors listed in disk.img so that read attempts on them do not return +a valid block full of zeroes. + +=back + +=head1 PARAMETERS + +The C parameter must point to a valid GNU ddrescue +mapfile. + +=head1 DATA FORMAT + +The file pointed to by the C parameter should +conform to the format of a GNU L mapfile. + +=head1 FILES + +=over 4 + +=item F<$filterdir/nbdkit-ddrescue-filter.so> + +The filter. + +Use C to find the location of C<$filterdir>. + +=back + +=head1 VERSION + +C first appeared in nbdkit 1.22. + +=head1 SEE ALSO + +L, +L, +L, +L, +L. + +=head1 AUTHORS + +François Revol + +=head1 COPYRIGHT + +Copyright (C) 2020 François Revol diff --git a/filters/delay/Makefile.am b/filters/delay/Makefile.am new file mode 100644 index 0000000..3a27185 --- /dev/null +++ b/filters/delay/Makefile.am @@ -0,0 +1,70 @@ +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 $(top_srcdir)/common-rules.mk + +EXTRA_DIST = nbdkit-delay-filter.pod + +filter_LTLIBRARIES = nbdkit-delay-filter.la + +nbdkit_delay_filter_la_SOURCES = \ + delay.c \ + $(top_srcdir)/include/nbdkit-filter.h \ + $(NULL) + +nbdkit_delay_filter_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + $(NULL) +nbdkit_delay_filter_la_CFLAGS = $(WARNINGS_CFLAGS) +nbdkit_delay_filter_la_LIBADD = \ + $(IMPORT_LIBRARY_ON_WINDOWS) \ + $(NULL) +nbdkit_delay_filter_la_LDFLAGS = \ + -module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \ + $(NULL) +if USE_LINKER_SCRIPT +nbdkit_delay_filter_la_LDFLAGS += \ + -Wl,--version-script=$(top_srcdir)/filters/filters.syms +endif + +if HAVE_POD + +man_MANS = nbdkit-delay-filter.1 +CLEANFILES += $(man_MANS) + +nbdkit-delay-filter.1: nbdkit-delay-filter.pod \ + $(top_builddir)/podwrapper.pl + $(PODWRAPPER) --section=1 --man $@ \ + --html $(top_builddir)/html/$@.html \ + $< + +endif HAVE_POD diff --git a/filters/delay/Makefile.in b/filters/delay/Makefile.in new file mode 100644 index 0000000..204d6ee --- /dev/null +++ b/filters/delay/Makefile.in @@ -0,0 +1,929 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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@ +@USE_LINKER_SCRIPT_TRUE@am__append_1 = \ +@USE_LINKER_SCRIPT_TRUE@ -Wl,--version-script=$(top_srcdir)/filters/filters.syms + +@HAVE_POD_TRUE@am__append_2 = $(man_MANS) +subdir = filters/delay +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ocaml.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +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 = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(filterdir)" "$(DESTDIR)$(man1dir)" +LTLIBRARIES = $(filter_LTLIBRARIES) +am__DEPENDENCIES_1 = +nbdkit_delay_filter_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +am__objects_1 = +am_nbdkit_delay_filter_la_OBJECTS = nbdkit_delay_filter_la-delay.lo \ + $(am__objects_1) +nbdkit_delay_filter_la_OBJECTS = $(am_nbdkit_delay_filter_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +nbdkit_delay_filter_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(nbdkit_delay_filter_la_CFLAGS) $(CFLAGS) \ + $(nbdkit_delay_filter_la_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/nbdkit_delay_filter_la-delay.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(nbdkit_delay_filter_la_SOURCES) +DIST_SOURCES = $(nbdkit_delay_filter_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/common-rules.mk \ + $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ +BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ +CARGO = @CARGO@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_PLUGIN_CC = @CC_PLUGIN_CC@ +CC_PLUGIN_CFLAGS = @CC_PLUGIN_CFLAGS@ +CERTTOOL = @CERTTOOL@ +CFLAGS = @CFLAGS@ +COM_ERR_CFLAGS = @COM_ERR_CFLAGS@ +COM_ERR_LIBS = @COM_ERR_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CUT = @CUT@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LDFLAGS = @DL_LDFLAGS@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXT2FS_CFLAGS = @EXT2FS_CFLAGS@ +EXT2FS_LIBS = @EXT2FS_LIBS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GENISOIMAGE = @GENISOIMAGE@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GOARCH = @GOARCH@ +GOLANG = @GOLANG@ +GOOS = @GOOS@ +GOROOT = @GOROOT@ +GREP = @GREP@ +IMPORT_LIBRARY_ON_WINDOWS = @IMPORT_LIBRARY_ON_WINDOWS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +ISOPROG = @ISOPROG@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBLKIO_CFLAGS = @LIBBLKIO_CFLAGS@ +LIBBLKIO_LIBS = @LIBBLKIO_LIBS@ +LIBGUESTFS_CFLAGS = @LIBGUESTFS_CFLAGS@ +LIBGUESTFS_LIBS = @LIBGUESTFS_LIBS@ +LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ +LIBLZMA_LIBS = @LIBLZMA_LIBS@ +LIBNBD_CFLAGS = @LIBNBD_CFLAGS@ +LIBNBD_LIBS = @LIBNBD_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSELINUX_CFLAGS = @LIBSELINUX_CFLAGS@ +LIBSELINUX_LIBS = @LIBSELINUX_LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTORRENT_CFLAGS = @LIBTORRENT_CFLAGS@ +LIBTORRENT_LIBS = @LIBTORRENT_LIBS@ +LIBVIRT_CFLAGS = @LIBVIRT_CFLAGS@ +LIBVIRT_LIBS = @LIBVIRT_LIBS@ +LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ +LIBZSTD_LIBS = @LIBZSTD_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LUA_CFLAGS = @LUA_CFLAGS@ +LUA_LIBS = @LUA_LIBS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MC = @MC@ +MKDIR_P = @MKDIR_P@ +MKISOFS = @MKISOFS@ +NBDKIT_VERSION_MAJOR = @NBDKIT_VERSION_MAJOR@ +NBDKIT_VERSION_MICRO = @NBDKIT_VERSION_MICRO@ +NBDKIT_VERSION_MINOR = @NBDKIT_VERSION_MINOR@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_ON_WINDOWS = @NO_UNDEFINED_ON_WINDOWS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OCAML = @OCAML@ +OCAMLBEST = @OCAMLBEST@ +OCAMLBUILD = @OCAMLBUILD@ +OCAMLC = @OCAMLC@ +OCAMLCDOTOPT = @OCAMLCDOTOPT@ +OCAMLDEP = @OCAMLDEP@ +OCAMLDOC = @OCAMLDOC@ +OCAMLLIB = @OCAMLLIB@ +OCAMLMKLIB = @OCAMLMKLIB@ +OCAMLMKTOP = @OCAMLMKTOP@ +OCAMLOPT = @OCAMLOPT@ +OCAMLOPTDOTOPT = @OCAMLOPTDOTOPT@ +OCAMLOPTFLAGS = @OCAMLOPTFLAGS@ +OCAMLVERSION = @OCAMLVERSION@ +OCAML_MAJOR = @OCAML_MAJOR@ +OCAML_PLUGIN_LIBRARIES = @OCAML_PLUGIN_LIBRARIES@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PERL_ARCHLIB = @PERL_ARCHLIB@ +PERL_CFLAGS = @PERL_CFLAGS@ +PERL_LDOPTS = @PERL_LDOPTS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PODWRAPPER = @PODWRAPPER@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_CXX = @PTHREAD_CXX@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CFLAGS = @PYTHON_CFLAGS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +RUBY_CFLAGS = @RUBY_CFLAGS@ +RUBY_LIBS = @RUBY_LIBS@ +RUSTC = @RUSTC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOEXT = @SOEXT@ +SSH_CFLAGS = @SSH_CFLAGS@ +SSH_LIBS = @SSH_LIBS@ +STAT = @STAT@ +STRIP = @STRIP@ +TCL_CFLAGS = @TCL_CFLAGS@ +TCL_LIBS = @TCL_LIBS@ +TRUNCATE = @TRUNCATE@ +VALGRIND = @VALGRIND@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VERSION = @VERSION@ +WARNINGS_CFLAGS = @WARNINGS_CFLAGS@ +XORRISO = @XORRISO@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +ZLIB_NG_CFLAGS = @ZLIB_NG_CFLAGS@ +ZLIB_NG_LIBS = @ZLIB_NG_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DLLTOOL = @ac_ct_DLLTOOL@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_MC = @ac_ct_MC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bashcompdir = @bashcompdir@ +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@ +filters = @filters@ +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@ +lang_plugins = @lang_plugins@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +non_lang_plugins = @non_lang_plugins@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugins = @plugins@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +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@ + +# Convenient list terminator +NULL = +plugindir = $(libdir)/nbdkit/plugins +filterdir = $(libdir)/nbdkit/filters +CLEANFILES = *~ *.cmi *.cmx *.cmxa *.so *.dll $(am__append_2) +EXTRA_DIST = nbdkit-delay-filter.pod +filter_LTLIBRARIES = nbdkit-delay-filter.la +nbdkit_delay_filter_la_SOURCES = \ + delay.c \ + $(top_srcdir)/include/nbdkit-filter.h \ + $(NULL) + +nbdkit_delay_filter_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + $(NULL) + +nbdkit_delay_filter_la_CFLAGS = $(WARNINGS_CFLAGS) +nbdkit_delay_filter_la_LIBADD = \ + $(IMPORT_LIBRARY_ON_WINDOWS) \ + $(NULL) + +nbdkit_delay_filter_la_LDFLAGS = -module -avoid-version -shared \ + $(NO_UNDEFINED_ON_WINDOWS) $(NULL) $(am__append_1) +@HAVE_POD_TRUE@man_MANS = nbdkit-delay-filter.1 +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common-rules.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign filters/delay/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign filters/delay/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; +$(top_srcdir)/common-rules.mk $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +install-filterLTLIBRARIES: $(filter_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(filter_LTLIBRARIES)'; test -n "$(filterdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(filterdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(filterdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(filterdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(filterdir)"; \ + } + +uninstall-filterLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(filter_LTLIBRARIES)'; test -n "$(filterdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(filterdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(filterdir)/$$f"; \ + done + +clean-filterLTLIBRARIES: + -test -z "$(filter_LTLIBRARIES)" || rm -f $(filter_LTLIBRARIES) + @list='$(filter_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +nbdkit-delay-filter.la: $(nbdkit_delay_filter_la_OBJECTS) $(nbdkit_delay_filter_la_DEPENDENCIES) $(EXTRA_nbdkit_delay_filter_la_DEPENDENCIES) + $(AM_V_CCLD)$(nbdkit_delay_filter_la_LINK) -rpath $(filterdir) $(nbdkit_delay_filter_la_OBJECTS) $(nbdkit_delay_filter_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nbdkit_delay_filter_la-delay.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +nbdkit_delay_filter_la-delay.lo: delay.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_delay_filter_la_CPPFLAGS) $(CPPFLAGS) $(nbdkit_delay_filter_la_CFLAGS) $(CFLAGS) -MT nbdkit_delay_filter_la-delay.lo -MD -MP -MF $(DEPDIR)/nbdkit_delay_filter_la-delay.Tpo -c -o nbdkit_delay_filter_la-delay.lo `test -f 'delay.c' || echo '$(srcdir)/'`delay.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nbdkit_delay_filter_la-delay.Tpo $(DEPDIR)/nbdkit_delay_filter_la-delay.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='delay.c' object='nbdkit_delay_filter_la-delay.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_delay_filter_la_CPPFLAGS) $(CPPFLAGS) $(nbdkit_delay_filter_la_CFLAGS) $(CFLAGS) -c -o nbdkit_delay_filter_la-delay.lo `test -f 'delay.c' || echo '$(srcdir)/'`delay.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(MANS) +installdirs: + for dir in "$(DESTDIR)$(filterdir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: 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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-filterLTLIBRARIES clean-generic clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/nbdkit_delay_filter_la-delay.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-filterLTLIBRARIES install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/nbdkit_delay_filter_la-delay.Plo + -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-filterLTLIBRARIES uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-filterLTLIBRARIES clean-generic clean-libtool \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-filterLTLIBRARIES \ + install-html install-html-am install-info install-info-am \ + install-man install-man1 install-pdf install-pdf-am 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 tags-am uninstall \ + uninstall-am uninstall-filterLTLIBRARIES uninstall-man \ + uninstall-man1 + +.PRECIOUS: Makefile + + +@HAVE_POD_TRUE@nbdkit-delay-filter.1: nbdkit-delay-filter.pod \ +@HAVE_POD_TRUE@ $(top_builddir)/podwrapper.pl +@HAVE_POD_TRUE@ $(PODWRAPPER) --section=1 --man $@ \ +@HAVE_POD_TRUE@ --html $(top_builddir)/html/$@.html \ +@HAVE_POD_TRUE@ $< + +# 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/filters/delay/delay.c b/filters/delay/delay.c new file mode 100644 index 0000000..57b812e --- /dev/null +++ b/filters/delay/delay.c @@ -0,0 +1,370 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +static unsigned delay_read_ms = 0; /* read delay (milliseconds) */ +static unsigned delay_write_ms = 0; /* write delay (milliseconds) */ +static unsigned delay_zero_ms = 0; /* zero delay (milliseconds) */ +static unsigned delay_trim_ms = 0; /* trim delay (milliseconds) */ +static unsigned delay_extents_ms = 0;/* extents delay (milliseconds) */ +static unsigned delay_cache_ms = 0; /* cache delay (milliseconds) */ +static unsigned delay_open_ms = 0; /* open delay (milliseconds) */ +static unsigned delay_close_ms = 0; /* close delay (milliseconds) */ + +static int delay_fast_zero = 1; /* whether delaying zero includes fast zero */ + +static int +parse_delay (const char *key, const char *value, unsigned *r) +{ + size_t len = strlen (value); + + if (len > 2 && strcmp (&value[len-2], "ms") == 0) { + /* We have to use sscanf here instead of nbdkit_parse_unsigned + * because that function will reject the "ms" suffix. + */ + if (sscanf (value, "%u", r) == 1) + return 0; + else { + nbdkit_error ("cannot parse %s in milliseconds parameter: %s", + key, value); + return -1; + } + } + else { + if (nbdkit_parse_unsigned (key, value, r) == -1) + return -1; + if (*r * UINT64_C (1000) > UINT_MAX) { + nbdkit_error ("seconds parameter %s is too large: %s", key, value); + return -1; + } + *r *= 1000; + return 0; + } +} + +static int +delay (unsigned ms, int *err) +{ + if (ms > 0 && nbdkit_nanosleep (ms / 1000, (ms % 1000) * 1000000) == -1) { + *err = errno; + return -1; + } + return 0; +} + +static int +read_delay (int *err) +{ + return delay (delay_read_ms, err); +} + +static int +write_delay (int *err) +{ + return delay (delay_write_ms, err); +} + +static int +zero_delay (int *err) +{ + return delay (delay_zero_ms, err); +} + +static int +trim_delay (int *err) +{ + return delay (delay_trim_ms, err); +} + +static int +extents_delay (int *err) +{ + return delay (delay_extents_ms, err); +} + +static int +cache_delay (int *err) +{ + return delay (delay_cache_ms, err); +} + +static int +open_delay (int *err) +{ + return delay (delay_open_ms, err); +} + +/* Called for each key=value passed on the command line. */ +static int +delay_config (nbdkit_next_config *next, nbdkit_backend *nxdata, + const char *key, const char *value) +{ + if (strcmp (key, "rdelay") == 0 || + strcmp (key, "delay-read") == 0 || + strcmp (key, "delay-reads") == 0) { + if (parse_delay (key, value, &delay_read_ms) == -1) + return -1; + return 0; + } + else if (strcmp (key, "wdelay") == 0) { + if (parse_delay (key, value, &delay_write_ms) == -1) + return -1; + /* Historically wdelay set all write-related delays. */ + delay_zero_ms = delay_trim_ms = delay_write_ms; + return 0; + } + else if (strcmp (key, "delay-write") == 0 || + strcmp (key, "delay-writes") == 0) { + if (parse_delay (key, value, &delay_write_ms) == -1) + return -1; + return 0; + } + else if (strcmp (key, "delay-zero") == 0 || + strcmp (key, "delay-zeroes") == 0) { + if (parse_delay (key, value, &delay_zero_ms) == -1) + return -1; + return 0; + } + else if (strcmp (key, "delay-trim") == 0 || + strcmp (key, "delay-trims") == 0 || + strcmp (key, "delay-discard") == 0 || + strcmp (key, "delay-discards") == 0) { + if (parse_delay (key, value, &delay_trim_ms) == -1) + return -1; + return 0; + } + else if (strcmp (key, "delay-extent") == 0 || + strcmp (key, "delay-extents") == 0) { + if (parse_delay (key, value, &delay_extents_ms) == -1) + return -1; + return 0; + } + else if (strcmp (key, "delay-cache") == 0) { + if (parse_delay (key, value, &delay_cache_ms) == -1) + return -1; + return 0; + } + else if (strcmp (key, "delay-fast-zero") == 0) { + delay_fast_zero = nbdkit_parse_bool (value); + if (delay_fast_zero < 0) + return -1; + return 0; + } + else if (strcmp (key, "delay-open") == 0) { + if (parse_delay (key, value, &delay_open_ms) == -1) + return -1; + return 0; + } + else if (strcmp (key, "delay-close") == 0) { + if (parse_delay (key, value, &delay_close_ms) == -1) + return -1; + return 0; + } + else + return next (nxdata, key, value); +} + +#define delay_config_help \ + "rdelay=[ms] Read delay in seconds/milliseconds.\n" \ + "delay-read=[ms] Read delay in seconds/milliseconds.\n" \ + "delay-write=[ms] Write delay in seconds/milliseconds.\n" \ + "delay-zero=[ms] Zero delay in seconds/milliseconds.\n" \ + "delay-trim=[ms] Trim delay in seconds/milliseconds.\n" \ + "delay-extents=[ms] Extents delay in seconds/milliseconds.\n" \ + "delay-cache=[ms] Cache delay in seconds/milliseconds.\n" \ + "wdelay=[ms] Write, zero and trim delay in secs/msecs.\n" \ + "delay-fast-zero= Delay fast zero requests (default true).\n" \ + "delay-open=[ms] Open delay in seconds/milliseconds.\n" \ + "delay-close=[ms] Close delay in seconds/milliseconds." + +/* Override the plugin's .can_fast_zero if needed */ +static int +delay_can_fast_zero (nbdkit_next *next, + void *handle) +{ + /* Advertise if we are handling fast zero requests locally */ + if (delay_zero_ms && !delay_fast_zero) + return 1; + return next->can_fast_zero (next); +} + +/* Open connection. */ +static void * +delay_open (nbdkit_next_open *next, nbdkit_context *nxdata, + int readonly, const char *exportname, int is_tls) +{ + int err; + + if (open_delay (&err) == -1) { + errno = err; + nbdkit_error ("delay: %m"); + return NULL; + } + + if (next (nxdata, readonly, exportname) == -1) + return NULL; + + return NBDKIT_HANDLE_NOT_NEEDED; +} + +/* Close connection. + * + * We cannot call nbdkit_nanosleep here because the socket may have + * been closed and that function will abort and return immediately. + * However we want to force a sleep (even if the server is shutting + * down) so use regular nanosleep instead. + * + * We cannot use the .close callback because that happens after the + * socket has closed, thus not delaying the client. By using + * .finalize we can delay well-behaved clients (those that use + * NBD_CMD_DISC). We cannot delay clients that drop the connection. + */ +static int +delay_finalize (nbdkit_next *next, void *handle) +{ + const unsigned ms = delay_close_ms; + + if (ms > 0) { + struct timespec ts; + + ts.tv_sec = ms / 1000; + ts.tv_nsec = (ms % 1000) * 1000000; + /* If nanosleep fails we don't really want to interrupt the chain + * of finalize calls through the other filters, so ignore any + * error here. + */ + nanosleep (&ts, NULL); + } + + return next->finalize (next); +} + +/* Read data. */ +static int +delay_pread (nbdkit_next *next, + void *handle, void *buf, uint32_t count, uint64_t offset, + uint32_t flags, int *err) +{ + if (read_delay (err) == -1) + return -1; + return next->pread (next, buf, count, offset, flags, err); +} + +/* Write data. */ +static int +delay_pwrite (nbdkit_next *next, + void *handle, + const void *buf, uint32_t count, uint64_t offset, uint32_t flags, + int *err) +{ + if (write_delay (err) == -1) + return -1; + return next->pwrite (next, buf, count, offset, flags, err); +} + +/* Zero data. */ +static int +delay_zero (nbdkit_next *next, + void *handle, uint32_t count, uint64_t offset, uint32_t flags, + int *err) +{ + if ((flags & NBDKIT_FLAG_FAST_ZERO) && delay_zero_ms && !delay_fast_zero) { + *err = ENOTSUP; + return -1; + } + if (zero_delay (err) == -1) + return -1; + return next->zero (next, count, offset, flags, err); +} + +/* Trim data. */ +static int +delay_trim (nbdkit_next *next, + void *handle, uint32_t count, uint64_t offset, + uint32_t flags, int *err) +{ + if (trim_delay (err) == -1) + return -1; + return next->trim (next, count, offset, flags, err); +} + +/* Extents. */ +static int +delay_extents (nbdkit_next *next, + void *handle, uint32_t count, uint64_t offset, uint32_t flags, + struct nbdkit_extents *extents, int *err) +{ + if (extents_delay (err) == -1) + return -1; + return next->extents (next, count, offset, flags, extents, err); +} + +/* Cache. */ +static int +delay_cache (nbdkit_next *next, + void *handle, uint32_t count, uint64_t offset, uint32_t flags, + int *err) +{ + if (cache_delay (err) == -1) + return -1; + return next->cache (next, count, offset, flags, err); +} + +static struct nbdkit_filter filter = { + .name = "delay", + .longname = "nbdkit delay filter", + .config = delay_config, + .config_help = delay_config_help, + .can_fast_zero = delay_can_fast_zero, + .open = delay_open, + .finalize = delay_finalize, + .pread = delay_pread, + .pwrite = delay_pwrite, + .zero = delay_zero, + .trim = delay_trim, + .extents = delay_extents, + .cache = delay_cache, +}; + +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/delay/nbdkit-delay-filter.pod b/filters/delay/nbdkit-delay-filter.pod new file mode 100644 index 0000000..825dbb2 --- /dev/null +++ b/filters/delay/nbdkit-delay-filter.pod @@ -0,0 +1,174 @@ +=head1 NAME + +nbdkit-delay-filter - nbdkit delay filter + +=head1 SYNOPSIS + + nbdkit --filter=delay plugin rdelay=SECS wdelay=SECS [plugin-args...] + +=for paragraph + + nbdkit --filter=delay plugin rdelay=NNms wdelay=NNms [plugin-args...] + +=for paragraph + + nbdkit --filter=delay plugin [plugin-args ...] + delay-read=(SECS|NNms) + delay-write=(SECS|NNms) + delay-zero=(SECS|NNms) + delay-trim=(SECS|NNms) + delay-extents=(SECS|NNms) + delay-cache=(SECS|NNms) + delay-fast-zero=BOOL + delay-open=(SECS|NNms) + delay-close=(SECS|NNms) + +=head1 DESCRIPTION + +C is a filter that delays read and write requests +by some seconds or milliseconds. This is used to simulate a slow or +remote server, or to test certain kinds of race conditions in Linux. +To limit server bandwidth use L instead. + +=head1 EXAMPLES + +Delays reads and writes by 100ms: + + nbdkit --filter=delay file disk.img rdelay=100ms wdelay=100ms + +Delay only zero operations by 1 second, nothing else is affected: + + nbdkit --filter=delay file disk.img delay-zero=1 + +=head1 PARAMETERS + +=over 4 + +=item BSECS + +=item BNNB + +=item BSECS + +=item BNNB + +Delay read operations by C seconds or C milliseconds. + +The two forms C and C work identically. + +=item BSECS + +=item BNNB + +Delay write operations by C seconds or C milliseconds. + +=item BSECS + +=item BNNB + +(nbdkit E 1.10) + +Delay zero operations by C seconds or C milliseconds. See +also B. + +=item BSECS + +=item BNNB + +(nbdkit E 1.10) + +Delay trim/discard operations by C seconds or C milliseconds. + +=item BSECS + +=item BNNB + +(nbdkit E 1.12) + +Delay block status (extents) operations by C seconds or C +milliseconds. + +=item BSECS + +=item BNNB + +(nbdkit E 1.14) + +Delay advisory cache operations by C seconds or C +milliseconds. + +=item BSECS + +=item BNNB + +Delay write, zero and trim operations by C seconds or C +milliseconds. + +=item BBOOL + +(nbdkit E 1.16) + +The NBD specification documents an extension called fast zero, in +which the client may request that a server should reply with +C as soon as possible if the zero operation offers no real +speedup over a corresponding write. By default, this parameter is +true, and fast zero requests are serviced by the plugin after the same +delay as any other zero request; but setting this parameter to false +instantly fails a fast zero response without waiting for or consulting +the plugin. + +=item BSECS + +=item BNNB + +(nbdkit E 1.28) + +Delay open (client connection) by C seconds or C +milliseconds. + +=item BSECS + +=item BNNB + +(nbdkit E 1.28) + +Delay close (client disconnection) by C seconds or C +milliseconds. This can also cause server shutdown to be delayed if +clients are connected at the time. This only affects clients that +gracefully disconnect (using C / libnbd function +L). Clients that abruptly disconnect from the server +cannot be delayed. + +=back + +=head1 FILES + +=over 4 + +=item F<$filterdir/nbdkit-delay-filter.so> + +The filter. + +Use C to find the location of C<$filterdir>. + +=back + +=head1 VERSION + +C first appeared in nbdkit 1.2, based on earlier +C and C options in L. + +=head1 SEE ALSO + +L, +L, +L, +L. + +=head1 AUTHORS + +Richard W.M. Jones + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/filters/error/Makefile.am b/filters/error/Makefile.am new file mode 100644 index 0000000..2a13728 --- /dev/null +++ b/filters/error/Makefile.am @@ -0,0 +1,74 @@ +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 $(top_srcdir)/common-rules.mk + +EXTRA_DIST = nbdkit-error-filter.pod + +filter_LTLIBRARIES = nbdkit-error-filter.la + +nbdkit_error_filter_la_SOURCES = \ + error.c \ + $(top_srcdir)/include/nbdkit-filter.h \ + $(NULL) + +nbdkit_error_filter_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/common/include \ + -I$(top_srcdir)/common/utils \ + $(NULL) +nbdkit_error_filter_la_CFLAGS = $(WARNINGS_CFLAGS) +nbdkit_error_filter_la_LDFLAGS = \ + -module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \ + $(NULL) +if USE_LINKER_SCRIPT +nbdkit_error_filter_la_LDFLAGS += \ + -Wl,--version-script=$(top_srcdir)/filters/filters.syms +endif +nbdkit_error_filter_la_LIBADD = \ + $(top_builddir)/common/utils/libutils.la \ + $(top_builddir)/common/replacements/libcompat.la \ + $(IMPORT_LIBRARY_ON_WINDOWS) \ + $(NULL) + +if HAVE_POD + +man_MANS = nbdkit-error-filter.1 +CLEANFILES += $(man_MANS) + +nbdkit-error-filter.1: nbdkit-error-filter.pod \ + $(top_builddir)/podwrapper.pl + $(PODWRAPPER) --section=1 --man $@ \ + --html $(top_builddir)/html/$@.html \ + $< + +endif HAVE_POD diff --git a/filters/error/Makefile.in b/filters/error/Makefile.in new file mode 100644 index 0000000..a746ca9 --- /dev/null +++ b/filters/error/Makefile.in @@ -0,0 +1,935 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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@ +@USE_LINKER_SCRIPT_TRUE@am__append_1 = \ +@USE_LINKER_SCRIPT_TRUE@ -Wl,--version-script=$(top_srcdir)/filters/filters.syms + +@HAVE_POD_TRUE@am__append_2 = $(man_MANS) +subdir = filters/error +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ocaml.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +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 = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(filterdir)" "$(DESTDIR)$(man1dir)" +LTLIBRARIES = $(filter_LTLIBRARIES) +am__DEPENDENCIES_1 = +nbdkit_error_filter_la_DEPENDENCIES = \ + $(top_builddir)/common/utils/libutils.la \ + $(top_builddir)/common/replacements/libcompat.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am__objects_1 = +am_nbdkit_error_filter_la_OBJECTS = nbdkit_error_filter_la-error.lo \ + $(am__objects_1) +nbdkit_error_filter_la_OBJECTS = $(am_nbdkit_error_filter_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +nbdkit_error_filter_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(nbdkit_error_filter_la_CFLAGS) $(CFLAGS) \ + $(nbdkit_error_filter_la_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/nbdkit_error_filter_la-error.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(nbdkit_error_filter_la_SOURCES) +DIST_SOURCES = $(nbdkit_error_filter_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/common-rules.mk \ + $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ +BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ +CARGO = @CARGO@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_PLUGIN_CC = @CC_PLUGIN_CC@ +CC_PLUGIN_CFLAGS = @CC_PLUGIN_CFLAGS@ +CERTTOOL = @CERTTOOL@ +CFLAGS = @CFLAGS@ +COM_ERR_CFLAGS = @COM_ERR_CFLAGS@ +COM_ERR_LIBS = @COM_ERR_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CUT = @CUT@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LDFLAGS = @DL_LDFLAGS@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXT2FS_CFLAGS = @EXT2FS_CFLAGS@ +EXT2FS_LIBS = @EXT2FS_LIBS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GENISOIMAGE = @GENISOIMAGE@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GOARCH = @GOARCH@ +GOLANG = @GOLANG@ +GOOS = @GOOS@ +GOROOT = @GOROOT@ +GREP = @GREP@ +IMPORT_LIBRARY_ON_WINDOWS = @IMPORT_LIBRARY_ON_WINDOWS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +ISOPROG = @ISOPROG@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBLKIO_CFLAGS = @LIBBLKIO_CFLAGS@ +LIBBLKIO_LIBS = @LIBBLKIO_LIBS@ +LIBGUESTFS_CFLAGS = @LIBGUESTFS_CFLAGS@ +LIBGUESTFS_LIBS = @LIBGUESTFS_LIBS@ +LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ +LIBLZMA_LIBS = @LIBLZMA_LIBS@ +LIBNBD_CFLAGS = @LIBNBD_CFLAGS@ +LIBNBD_LIBS = @LIBNBD_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSELINUX_CFLAGS = @LIBSELINUX_CFLAGS@ +LIBSELINUX_LIBS = @LIBSELINUX_LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTORRENT_CFLAGS = @LIBTORRENT_CFLAGS@ +LIBTORRENT_LIBS = @LIBTORRENT_LIBS@ +LIBVIRT_CFLAGS = @LIBVIRT_CFLAGS@ +LIBVIRT_LIBS = @LIBVIRT_LIBS@ +LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ +LIBZSTD_LIBS = @LIBZSTD_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LUA_CFLAGS = @LUA_CFLAGS@ +LUA_LIBS = @LUA_LIBS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MC = @MC@ +MKDIR_P = @MKDIR_P@ +MKISOFS = @MKISOFS@ +NBDKIT_VERSION_MAJOR = @NBDKIT_VERSION_MAJOR@ +NBDKIT_VERSION_MICRO = @NBDKIT_VERSION_MICRO@ +NBDKIT_VERSION_MINOR = @NBDKIT_VERSION_MINOR@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_ON_WINDOWS = @NO_UNDEFINED_ON_WINDOWS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OCAML = @OCAML@ +OCAMLBEST = @OCAMLBEST@ +OCAMLBUILD = @OCAMLBUILD@ +OCAMLC = @OCAMLC@ +OCAMLCDOTOPT = @OCAMLCDOTOPT@ +OCAMLDEP = @OCAMLDEP@ +OCAMLDOC = @OCAMLDOC@ +OCAMLLIB = @OCAMLLIB@ +OCAMLMKLIB = @OCAMLMKLIB@ +OCAMLMKTOP = @OCAMLMKTOP@ +OCAMLOPT = @OCAMLOPT@ +OCAMLOPTDOTOPT = @OCAMLOPTDOTOPT@ +OCAMLOPTFLAGS = @OCAMLOPTFLAGS@ +OCAMLVERSION = @OCAMLVERSION@ +OCAML_MAJOR = @OCAML_MAJOR@ +OCAML_PLUGIN_LIBRARIES = @OCAML_PLUGIN_LIBRARIES@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PERL_ARCHLIB = @PERL_ARCHLIB@ +PERL_CFLAGS = @PERL_CFLAGS@ +PERL_LDOPTS = @PERL_LDOPTS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PODWRAPPER = @PODWRAPPER@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_CXX = @PTHREAD_CXX@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CFLAGS = @PYTHON_CFLAGS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +RUBY_CFLAGS = @RUBY_CFLAGS@ +RUBY_LIBS = @RUBY_LIBS@ +RUSTC = @RUSTC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOEXT = @SOEXT@ +SSH_CFLAGS = @SSH_CFLAGS@ +SSH_LIBS = @SSH_LIBS@ +STAT = @STAT@ +STRIP = @STRIP@ +TCL_CFLAGS = @TCL_CFLAGS@ +TCL_LIBS = @TCL_LIBS@ +TRUNCATE = @TRUNCATE@ +VALGRIND = @VALGRIND@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VERSION = @VERSION@ +WARNINGS_CFLAGS = @WARNINGS_CFLAGS@ +XORRISO = @XORRISO@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +ZLIB_NG_CFLAGS = @ZLIB_NG_CFLAGS@ +ZLIB_NG_LIBS = @ZLIB_NG_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DLLTOOL = @ac_ct_DLLTOOL@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_MC = @ac_ct_MC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bashcompdir = @bashcompdir@ +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@ +filters = @filters@ +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@ +lang_plugins = @lang_plugins@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +non_lang_plugins = @non_lang_plugins@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugins = @plugins@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +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@ + +# Convenient list terminator +NULL = +plugindir = $(libdir)/nbdkit/plugins +filterdir = $(libdir)/nbdkit/filters +CLEANFILES = *~ *.cmi *.cmx *.cmxa *.so *.dll $(am__append_2) +EXTRA_DIST = nbdkit-error-filter.pod +filter_LTLIBRARIES = nbdkit-error-filter.la +nbdkit_error_filter_la_SOURCES = \ + error.c \ + $(top_srcdir)/include/nbdkit-filter.h \ + $(NULL) + +nbdkit_error_filter_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/common/include \ + -I$(top_srcdir)/common/utils \ + $(NULL) + +nbdkit_error_filter_la_CFLAGS = $(WARNINGS_CFLAGS) +nbdkit_error_filter_la_LDFLAGS = -module -avoid-version -shared \ + $(NO_UNDEFINED_ON_WINDOWS) $(NULL) $(am__append_1) +nbdkit_error_filter_la_LIBADD = \ + $(top_builddir)/common/utils/libutils.la \ + $(top_builddir)/common/replacements/libcompat.la \ + $(IMPORT_LIBRARY_ON_WINDOWS) \ + $(NULL) + +@HAVE_POD_TRUE@man_MANS = nbdkit-error-filter.1 +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common-rules.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign filters/error/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign filters/error/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; +$(top_srcdir)/common-rules.mk $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +install-filterLTLIBRARIES: $(filter_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(filter_LTLIBRARIES)'; test -n "$(filterdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(filterdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(filterdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(filterdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(filterdir)"; \ + } + +uninstall-filterLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(filter_LTLIBRARIES)'; test -n "$(filterdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(filterdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(filterdir)/$$f"; \ + done + +clean-filterLTLIBRARIES: + -test -z "$(filter_LTLIBRARIES)" || rm -f $(filter_LTLIBRARIES) + @list='$(filter_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +nbdkit-error-filter.la: $(nbdkit_error_filter_la_OBJECTS) $(nbdkit_error_filter_la_DEPENDENCIES) $(EXTRA_nbdkit_error_filter_la_DEPENDENCIES) + $(AM_V_CCLD)$(nbdkit_error_filter_la_LINK) -rpath $(filterdir) $(nbdkit_error_filter_la_OBJECTS) $(nbdkit_error_filter_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nbdkit_error_filter_la-error.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +nbdkit_error_filter_la-error.lo: error.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_error_filter_la_CPPFLAGS) $(CPPFLAGS) $(nbdkit_error_filter_la_CFLAGS) $(CFLAGS) -MT nbdkit_error_filter_la-error.lo -MD -MP -MF $(DEPDIR)/nbdkit_error_filter_la-error.Tpo -c -o nbdkit_error_filter_la-error.lo `test -f 'error.c' || echo '$(srcdir)/'`error.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nbdkit_error_filter_la-error.Tpo $(DEPDIR)/nbdkit_error_filter_la-error.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='error.c' object='nbdkit_error_filter_la-error.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_error_filter_la_CPPFLAGS) $(CPPFLAGS) $(nbdkit_error_filter_la_CFLAGS) $(CFLAGS) -c -o nbdkit_error_filter_la-error.lo `test -f 'error.c' || echo '$(srcdir)/'`error.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(MANS) +installdirs: + for dir in "$(DESTDIR)$(filterdir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: 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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-filterLTLIBRARIES clean-generic clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/nbdkit_error_filter_la-error.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-filterLTLIBRARIES install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/nbdkit_error_filter_la-error.Plo + -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-filterLTLIBRARIES uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-filterLTLIBRARIES clean-generic clean-libtool \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-filterLTLIBRARIES \ + install-html install-html-am install-info install-info-am \ + install-man install-man1 install-pdf install-pdf-am 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 tags-am uninstall \ + uninstall-am uninstall-filterLTLIBRARIES uninstall-man \ + uninstall-man1 + +.PRECIOUS: Makefile + + +@HAVE_POD_TRUE@nbdkit-error-filter.1: nbdkit-error-filter.pod \ +@HAVE_POD_TRUE@ $(top_builddir)/podwrapper.pl +@HAVE_POD_TRUE@ $(PODWRAPPER) --section=1 --man $@ \ +@HAVE_POD_TRUE@ --html $(top_builddir)/html/$@.html \ +@HAVE_POD_TRUE@ $< + +# 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/filters/error/error.c b/filters/error/error.c new file mode 100644 index 0000000..a8999a1 --- /dev/null +++ b/filters/error/error.c @@ -0,0 +1,379 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include "cleanup.h" +#include "random.h" +#include "windows-compat.h" + +struct error_settings { + int error; /* errno, eg. EIO */ + double rate; /* rate, 0.0 = never, 1.0 = always */ + char *file; /* error file, NULL = no file */ +}; + +#define ERROR_DEFAULT { .error = EIO, .rate = 0, .file = NULL } + +/* Settings for each type of request, read from the command line. */ +static struct error_settings pread_settings = ERROR_DEFAULT; +static struct error_settings pwrite_settings = ERROR_DEFAULT; +static struct error_settings trim_settings = ERROR_DEFAULT; +static struct error_settings zero_settings = ERROR_DEFAULT; +static struct error_settings extents_settings = ERROR_DEFAULT; +static struct error_settings cache_settings = ERROR_DEFAULT; + +/* Random state. + * This must only be accessed when holding the lock (except for load). + */ +static struct random_state random_state; +static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; + +static void +error_load (void) +{ + xsrandom (time (NULL), &random_state); +} + +static void +error_unload (void) +{ + free (pread_settings.file); + free (pwrite_settings.file); + free (trim_settings.file); + free (zero_settings.file); + free (extents_settings.file); + free (cache_settings.file); +} + +static const struct { const char *name; int error; } errors[] = { + { "EPERM", EPERM }, + { "EIO", EIO }, + { "ENOMEM", ENOMEM }, + { "EINVAL", EINVAL }, + { "ENOSPC", ENOSPC }, + { "ESHUTDOWN", ESHUTDOWN }, + { NULL } +}; + +static const char * +error_as_string (int error) +{ + size_t i; + + for (i = 0; errors[i].name != NULL; ++i) { + if (errors[i].error == error) + return errors[i].name; + } + abort (); +} + +static int +parse_error (const char *key, const char *value, int *retp) +{ + size_t i; + + for (i = 0; errors[i].name != NULL; ++i) { + if (strcmp (value, errors[i].name) == 0) { + *retp = errors[i].error; + return 0; + } + } + + nbdkit_error ("%s: unknown error name '%s'", key, value); + return -1; +} + +static int +parse_error_rate (const char *key, const char *value, double *retp) +{ + double d; + + if (nbdkit_parse_probability (key, value, &d) == -1) + return -1; + if (d > 1) { + nbdkit_error ("%s: rate out of range: '%s' parsed as %g", key, value, d); + return -1; + } + *retp = d; + return 0; +} + +/* Called for each key=value passed on the command line. */ +static int +error_config (nbdkit_next_config *next, nbdkit_backend *nxdata, + const char *key, const char *value) +{ + int i; + double d; + + if (strcmp (key, "error") == 0) { + if (parse_error (key, value, &i) == -1) + return -1; + pread_settings.error = pwrite_settings.error = + trim_settings.error = zero_settings.error = + extents_settings.error = cache_settings.error = i; + return 0; + } + else if (strcmp (key, "error-pread") == 0) + return parse_error (key, value, &pread_settings.error); + else if (strcmp (key, "error-pwrite") == 0) + return parse_error (key, value, &pwrite_settings.error); + else if (strcmp (key, "error-trim") == 0) + return parse_error (key, value, &trim_settings.error); + else if (strcmp (key, "error-zero") == 0) + return parse_error (key, value, &zero_settings.error); + else if (strcmp (key, "error-extents") == 0) + return parse_error (key, value, &extents_settings.error); + else if (strcmp (key, "error-cache") == 0) + return parse_error (key, value, &cache_settings.error); + + else if (strcmp (key, "error-rate") == 0) { + if (parse_error_rate (key, value, &d) == -1) + return -1; + pread_settings.rate = pwrite_settings.rate = + trim_settings.rate = zero_settings.rate = + extents_settings.rate = cache_settings.rate = d; + return 0; + } + else if (strcmp (key, "error-pread-rate") == 0) + return parse_error_rate (key, value, &pread_settings.rate); + else if (strcmp (key, "error-pwrite-rate") == 0) + return parse_error_rate (key, value, &pwrite_settings.rate); + else if (strcmp (key, "error-trim-rate") == 0) + return parse_error_rate (key, value, &trim_settings.rate); + else if (strcmp (key, "error-zero-rate") == 0) + return parse_error_rate (key, value, &zero_settings.rate); + else if (strcmp (key, "error-extents-rate") == 0) + return parse_error_rate (key, value, &extents_settings.rate); + else if (strcmp (key, "error-cache-rate") == 0) + return parse_error_rate (key, value, &cache_settings.rate); + + /* NB: We are using nbdkit_absolute_path here because the trigger + * file probably doesn't exist yet. + */ + else if (strcmp (key, "error-file") == 0) { + free (pread_settings.file); + pread_settings.file = nbdkit_absolute_path (value); + free (pwrite_settings.file); + pwrite_settings.file = nbdkit_absolute_path (value); + free (trim_settings.file); + trim_settings.file = nbdkit_absolute_path (value); + free (zero_settings.file); + zero_settings.file = nbdkit_absolute_path (value); + free (extents_settings.file); + extents_settings.file = nbdkit_absolute_path (value); + free (cache_settings.file); + cache_settings.file = nbdkit_absolute_path (value); + return 0; + } + else if (strcmp (key, "error-pread-file") == 0) { + free (pread_settings.file); + pread_settings.file = nbdkit_absolute_path (value); + return 0; + } + else if (strcmp (key, "error-pwrite-file") == 0) { + free (pwrite_settings.file); + pwrite_settings.file = nbdkit_absolute_path (value); + return 0; + } + else if (strcmp (key, "error-trim-file") == 0) { + free (trim_settings.file); + trim_settings.file = nbdkit_absolute_path (value); + return 0; + } + else if (strcmp (key, "error-zero-file") == 0) { + free (zero_settings.file); + zero_settings.file = nbdkit_absolute_path (value); + return 0; + } + else if (strcmp (key, "error-extents-file") == 0) { + free (extents_settings.file); + extents_settings.file = nbdkit_absolute_path (value); + return 0; + } + else if (strcmp (key, "error-cache-file") == 0) { + free (cache_settings.file); + cache_settings.file = nbdkit_absolute_path (value); + return 0; + } + + else + return next (nxdata, key, value); +} + +#define error_config_help \ + "error=EPERM|EIO|ENOMEM|EINVAL|ENOSPC|ESHUTDOWN\n" \ + " The error indication to return.\n" \ + "error-rate=0%..100%|0..1 Rate of errors to generate.\n" \ + "error-file=TRIGGER Set trigger filename.\n" \ + "error-pread*, error-pwrite*, error-trim*, error-zero*, error-extents*\n" \ + " Apply settings only to read/write/etc" + +/* This function injects a random error. */ +static bool +random_error (const struct error_settings *error_settings, + const char *fn, int *err) +{ + uint64_t rand; + + if (error_settings->rate <= 0) /* 0% = never inject */ + return false; + + /* Does the trigger file exist? */ + if (error_settings->file != NULL) { + if (access (error_settings->file, F_OK) == -1) + return false; + } + + if (error_settings->rate >= 1) /* 100% = always inject */ + goto inject; + + /* To avoid the question if (double)1.0 * UINT64_MAX is + * representable in a 64 bit integer, and because we don't need all + * this precision anyway, let's work in 32 bits. + */ + { + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock); + rand = xrandom (&random_state) & UINT32_MAX; + } + if (rand >= error_settings->rate * UINT32_MAX) + return false; + + inject: + *err = error_settings->error; + nbdkit_error ("injecting %s error into %s", error_as_string (*err), fn); + return true; +} + +/* Read data. */ +static int +error_pread (nbdkit_next *next, + void *handle, void *buf, uint32_t count, uint64_t offset, + uint32_t flags, int *err) +{ + if (random_error (&pread_settings, "pread", err)) + return -1; + + return next->pread (next, buf, count, offset, flags, err); +} + +/* Write data. */ +static int +error_pwrite (nbdkit_next *next, + void *handle, + const void *buf, uint32_t count, uint64_t offset, + uint32_t flags, int *err) +{ + if (random_error (&pwrite_settings, "pwrite", err)) + return -1; + + return next->pwrite (next, buf, count, offset, flags, err); +} + +/* Trim data. */ +static int +error_trim (nbdkit_next *next, + void *handle, uint32_t count, uint64_t offset, + uint32_t flags, int *err) +{ + if (random_error (&trim_settings, "trim", err)) + return -1; + + return next->trim (next, count, offset, flags, err); +} + +/* Zero data. */ +static int +error_zero (nbdkit_next *next, + void *handle, uint32_t count, uint64_t offset, + uint32_t flags, int *err) +{ + if (random_error (&zero_settings, "zero", err)) + return -1; + + return next->zero (next, count, offset, flags, err); +} + +/* Extents. */ +static int +error_extents (nbdkit_next *next, + void *handle, uint32_t count, uint64_t offset, + uint32_t flags, struct nbdkit_extents *extents, int *err) +{ + if (random_error (&extents_settings, "extents", err)) + return -1; + + return next->extents (next, count, offset, flags, extents, err); +} + +/* Extents. */ +static int +error_cache (nbdkit_next *next, + void *handle, uint32_t count, uint64_t offset, + uint32_t flags, int *err) +{ + if (random_error (&cache_settings, "cache", err)) + return -1; + + return next->cache (next, count, offset, flags, err); +} + +static struct nbdkit_filter filter = { + .name = "error-inject", + .longname = "nbdkit error injection filter", + .load = error_load, + .unload = error_unload, + .config = error_config, + .config_help = error_config_help, + .pread = error_pread, + .pwrite = error_pwrite, + .trim = error_trim, + .zero = error_zero, + .extents = error_extents, + .cache = error_cache, +}; + +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/error/nbdkit-error-filter.pod b/filters/error/nbdkit-error-filter.pod new file mode 100644 index 0000000..91af7f7 --- /dev/null +++ b/filters/error/nbdkit-error-filter.pod @@ -0,0 +1,181 @@ +=head1 NAME + +nbdkit-error-filter - inject errors for testing clients + +=head1 SYNOPSIS + + nbdkit --filter=error PLUGIN + [error=EPERM|EIO|ENOMEM|EINVAL|ENOSPC|ESHUTDOWN] + [error-rate=10%|0.1|1:10] + [error-file=/tmp/inject] + [error-pread=...] [error-pread-rate=...] [error-pread-file=...] + [error-pwrite=...] [error-pwrite-rate=...] [error-pwrite-file=...] + [error-trim=...] [error-trim-rate=...] [error-trim-file=...] + [error-zero=...] [error-zero-rate=...] [error-zero-file=...] + [error-extents=...] [error-extents-rate=...] [error-extents-file=...] + [error-cache=...] [error-cache-rate=...] [error-cache-file=...] + +=head1 DESCRIPTION + +C is an nbdkit filter that injects random errors +into replies from the server. This is used for testing that NBD +clients can handle errors. + +All parameters are optional, but you should usually specify one of the +C or C parameters, +B. + +L is a related filter that injects data +corruption instead of errors. + +=head1 EXAMPLES + +Inject a low rate of errors randomly into the connection: + + nbdkit --filter=error file disk.img error-rate=1% + +Reading, trimming, cache and extents (block status) requests will be +successful, but all writes and zeroing will return "No space left on +device": + + nbdkit --filter=error file disk.img \ + error=ENOSPC \ + error-pwrite-rate=100% \ + error-zero-rate=100% + +To make all connections fail hard 60 seconds after the server is +started, use: + + rm -f /tmp/inject + nbdkit --filter=error file disk.img \ + error-rate=100% \ + error-file=/tmp/inject + sleep 60; touch /tmp/inject + +=head1 PARAMETERS + +=over 4 + +=item B + +When a random error is injected, you can select which one from the +range of possible NBD errors (the NBD protocol only supports a limited +range of error codes). + +This parameter is optional and the default is C +("Input/output error"). + +=item BNB<%> + +=item B0..1 + +=item BNB<:>M + +The rate of injected errors per NBD request. This can be expressed as +a percentage between C<0%> and C<100%>, or as a probability between +C<0> and C<1>, or as a ratio like C<1:10>. If C<0%> or C<0> is used +then no errors are ever injected, and if C<100%> or C<1> is used then +all requests return errors. + +This parameter is optional and the default is C<0%>. +B + +=item BFILENAME + +Errors will only be injected when F exists. (Note you must +also specify the C). + +You can use this for fine-grained control over when to inject errors, +for example if you want to trigger an error at an exact moment during +a test, arrange for this file to be created at the appropriate time. +Or conversely to test error recovery in a client, create the file +initially, and then delete it to check the client can recover. + +This parameter is optional. + +=item B, B, B. + +Same as C, C and C but only apply the +settings to NBD pread requests. + +=item B, B, B. + +Same as C, C and C but only apply the +settings to NBD pwrite requests. + +=item B, B, B. + +Same as C, C and C but only apply the +settings to NBD trim requests. + +=item B, B, B. + +Same as C, C and C but only apply the +settings to NBD zero requests. + +=item B, B, B. + +(nbdkit E 1.12) + +Same as C, C and C but only apply the +settings to NBD block status requests to read extents. + +=item B, B, B. + +(nbdkit E 1.14) + +Same as C, C and C but only apply the +settings to NBD cache requests. + +=back + +=head1 NOTES + +=head2 Peculiar debug output + +If you are looking at the debugging output (using C) +references to the name of this filter show up as C<"error-inject:">, +and such lines indicate that the filter is not altering output, for +example: + + nbdkit: file.9: debug: error-inject: pread count=1024 offset=0 flags=0x0 + +Conversely, references to the string C<"error:"> occur when the +L API was used, including when this filter injects an +error, as in: + + nbdkit: file.4: error: injecting ENOSPC error into pwrite + +=head1 FILES + +=over 4 + +=item F<$filterdir/nbdkit-error-filter.so> + +The filter. + +Use C to find the location of C<$filterdir>. + +=back + +=head1 VERSION + +C first appeared in nbdkit 1.6. + +=head1 SEE ALSO + +L, +L, +L, +L, +L, +L, +L. + +=head1 AUTHORS + +Richard W.M. Jones + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/filters/evil/Makefile.am b/filters/evil/Makefile.am new file mode 100644 index 0000000..ac63374 --- /dev/null +++ b/filters/evil/Makefile.am @@ -0,0 +1,77 @@ +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 $(top_srcdir)/common-rules.mk + +EXTRA_DIST = nbdkit-evil-filter.pod + +# Relies on a Unix domain socket. +if !IS_WINDOWS + +filter_LTLIBRARIES = nbdkit-evil-filter.la + +nbdkit_evil_filter_la_SOURCES = \ + evil.c \ + $(top_srcdir)/include/nbdkit-filter.h \ + $(NULL) + +nbdkit_evil_filter_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/common/include \ + -I$(top_srcdir)/common/utils \ + $(NULL) +nbdkit_evil_filter_la_CFLAGS = $(WARNINGS_CFLAGS) +nbdkit_evil_filter_la_LIBADD = \ + $(top_builddir)/common/utils/libutils.la \ + $(IMPORT_LIBRARY_ON_WINDOWS) \ + $(NULL) +nbdkit_evil_filter_la_LDFLAGS = \ + -module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \ + $(NULL) +if USE_LINKER_SCRIPT +nbdkit_evil_filter_la_LDFLAGS += \ + -Wl,--version-script=$(top_srcdir)/filters/filters.syms +endif + +if HAVE_POD + +man_MANS = nbdkit-evil-filter.1 +CLEANFILES += $(man_MANS) + +nbdkit-evil-filter.1: nbdkit-evil-filter.pod \ + $(top_builddir)/podwrapper.pl + $(PODWRAPPER) --section=1 --man $@ \ + --html $(top_builddir)/html/$@.html \ + $< + +endif HAVE_POD +endif !IS_WINDOWS diff --git a/filters/evil/Makefile.in b/filters/evil/Makefile.in new file mode 100644 index 0000000..ae98107 --- /dev/null +++ b/filters/evil/Makefile.in @@ -0,0 +1,941 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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@ +@IS_WINDOWS_FALSE@@USE_LINKER_SCRIPT_TRUE@am__append_1 = \ +@IS_WINDOWS_FALSE@@USE_LINKER_SCRIPT_TRUE@ -Wl,--version-script=$(top_srcdir)/filters/filters.syms + +@HAVE_POD_TRUE@@IS_WINDOWS_FALSE@am__append_2 = $(man_MANS) +subdir = filters/evil +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ocaml.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +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 = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(filterdir)" "$(DESTDIR)$(man1dir)" +LTLIBRARIES = $(filter_LTLIBRARIES) +am__DEPENDENCIES_1 = +@IS_WINDOWS_FALSE@nbdkit_evil_filter_la_DEPENDENCIES = \ +@IS_WINDOWS_FALSE@ $(top_builddir)/common/utils/libutils.la \ +@IS_WINDOWS_FALSE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am__nbdkit_evil_filter_la_SOURCES_DIST = evil.c \ + $(top_srcdir)/include/nbdkit-filter.h +am__objects_1 = +@IS_WINDOWS_FALSE@am_nbdkit_evil_filter_la_OBJECTS = \ +@IS_WINDOWS_FALSE@ nbdkit_evil_filter_la-evil.lo \ +@IS_WINDOWS_FALSE@ $(am__objects_1) +nbdkit_evil_filter_la_OBJECTS = $(am_nbdkit_evil_filter_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +nbdkit_evil_filter_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(nbdkit_evil_filter_la_CFLAGS) $(CFLAGS) \ + $(nbdkit_evil_filter_la_LDFLAGS) $(LDFLAGS) -o $@ +@IS_WINDOWS_FALSE@am_nbdkit_evil_filter_la_rpath = -rpath $(filterdir) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/nbdkit_evil_filter_la-evil.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(nbdkit_evil_filter_la_SOURCES) +DIST_SOURCES = $(am__nbdkit_evil_filter_la_SOURCES_DIST) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/common-rules.mk \ + $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ +BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ +CARGO = @CARGO@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_PLUGIN_CC = @CC_PLUGIN_CC@ +CC_PLUGIN_CFLAGS = @CC_PLUGIN_CFLAGS@ +CERTTOOL = @CERTTOOL@ +CFLAGS = @CFLAGS@ +COM_ERR_CFLAGS = @COM_ERR_CFLAGS@ +COM_ERR_LIBS = @COM_ERR_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CUT = @CUT@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LDFLAGS = @DL_LDFLAGS@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXT2FS_CFLAGS = @EXT2FS_CFLAGS@ +EXT2FS_LIBS = @EXT2FS_LIBS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GENISOIMAGE = @GENISOIMAGE@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GOARCH = @GOARCH@ +GOLANG = @GOLANG@ +GOOS = @GOOS@ +GOROOT = @GOROOT@ +GREP = @GREP@ +IMPORT_LIBRARY_ON_WINDOWS = @IMPORT_LIBRARY_ON_WINDOWS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +ISOPROG = @ISOPROG@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBLKIO_CFLAGS = @LIBBLKIO_CFLAGS@ +LIBBLKIO_LIBS = @LIBBLKIO_LIBS@ +LIBGUESTFS_CFLAGS = @LIBGUESTFS_CFLAGS@ +LIBGUESTFS_LIBS = @LIBGUESTFS_LIBS@ +LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ +LIBLZMA_LIBS = @LIBLZMA_LIBS@ +LIBNBD_CFLAGS = @LIBNBD_CFLAGS@ +LIBNBD_LIBS = @LIBNBD_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSELINUX_CFLAGS = @LIBSELINUX_CFLAGS@ +LIBSELINUX_LIBS = @LIBSELINUX_LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTORRENT_CFLAGS = @LIBTORRENT_CFLAGS@ +LIBTORRENT_LIBS = @LIBTORRENT_LIBS@ +LIBVIRT_CFLAGS = @LIBVIRT_CFLAGS@ +LIBVIRT_LIBS = @LIBVIRT_LIBS@ +LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ +LIBZSTD_LIBS = @LIBZSTD_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LUA_CFLAGS = @LUA_CFLAGS@ +LUA_LIBS = @LUA_LIBS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MC = @MC@ +MKDIR_P = @MKDIR_P@ +MKISOFS = @MKISOFS@ +NBDKIT_VERSION_MAJOR = @NBDKIT_VERSION_MAJOR@ +NBDKIT_VERSION_MICRO = @NBDKIT_VERSION_MICRO@ +NBDKIT_VERSION_MINOR = @NBDKIT_VERSION_MINOR@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_ON_WINDOWS = @NO_UNDEFINED_ON_WINDOWS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OCAML = @OCAML@ +OCAMLBEST = @OCAMLBEST@ +OCAMLBUILD = @OCAMLBUILD@ +OCAMLC = @OCAMLC@ +OCAMLCDOTOPT = @OCAMLCDOTOPT@ +OCAMLDEP = @OCAMLDEP@ +OCAMLDOC = @OCAMLDOC@ +OCAMLLIB = @OCAMLLIB@ +OCAMLMKLIB = @OCAMLMKLIB@ +OCAMLMKTOP = @OCAMLMKTOP@ +OCAMLOPT = @OCAMLOPT@ +OCAMLOPTDOTOPT = @OCAMLOPTDOTOPT@ +OCAMLOPTFLAGS = @OCAMLOPTFLAGS@ +OCAMLVERSION = @OCAMLVERSION@ +OCAML_MAJOR = @OCAML_MAJOR@ +OCAML_PLUGIN_LIBRARIES = @OCAML_PLUGIN_LIBRARIES@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PERL_ARCHLIB = @PERL_ARCHLIB@ +PERL_CFLAGS = @PERL_CFLAGS@ +PERL_LDOPTS = @PERL_LDOPTS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PODWRAPPER = @PODWRAPPER@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_CXX = @PTHREAD_CXX@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CFLAGS = @PYTHON_CFLAGS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +RUBY_CFLAGS = @RUBY_CFLAGS@ +RUBY_LIBS = @RUBY_LIBS@ +RUSTC = @RUSTC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOEXT = @SOEXT@ +SSH_CFLAGS = @SSH_CFLAGS@ +SSH_LIBS = @SSH_LIBS@ +STAT = @STAT@ +STRIP = @STRIP@ +TCL_CFLAGS = @TCL_CFLAGS@ +TCL_LIBS = @TCL_LIBS@ +TRUNCATE = @TRUNCATE@ +VALGRIND = @VALGRIND@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VERSION = @VERSION@ +WARNINGS_CFLAGS = @WARNINGS_CFLAGS@ +XORRISO = @XORRISO@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +ZLIB_NG_CFLAGS = @ZLIB_NG_CFLAGS@ +ZLIB_NG_LIBS = @ZLIB_NG_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DLLTOOL = @ac_ct_DLLTOOL@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_MC = @ac_ct_MC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bashcompdir = @bashcompdir@ +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@ +filters = @filters@ +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@ +lang_plugins = @lang_plugins@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +non_lang_plugins = @non_lang_plugins@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugins = @plugins@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +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@ + +# Convenient list terminator +NULL = +plugindir = $(libdir)/nbdkit/plugins +filterdir = $(libdir)/nbdkit/filters +CLEANFILES = *~ *.cmi *.cmx *.cmxa *.so *.dll $(am__append_2) +EXTRA_DIST = nbdkit-evil-filter.pod + +# Relies on a Unix domain socket. +@IS_WINDOWS_FALSE@filter_LTLIBRARIES = nbdkit-evil-filter.la +@IS_WINDOWS_FALSE@nbdkit_evil_filter_la_SOURCES = \ +@IS_WINDOWS_FALSE@ evil.c \ +@IS_WINDOWS_FALSE@ $(top_srcdir)/include/nbdkit-filter.h \ +@IS_WINDOWS_FALSE@ $(NULL) + +@IS_WINDOWS_FALSE@nbdkit_evil_filter_la_CPPFLAGS = \ +@IS_WINDOWS_FALSE@ -I$(top_srcdir)/include \ +@IS_WINDOWS_FALSE@ -I$(top_builddir)/include \ +@IS_WINDOWS_FALSE@ -I$(top_srcdir)/common/include \ +@IS_WINDOWS_FALSE@ -I$(top_srcdir)/common/utils \ +@IS_WINDOWS_FALSE@ $(NULL) + +@IS_WINDOWS_FALSE@nbdkit_evil_filter_la_CFLAGS = $(WARNINGS_CFLAGS) +@IS_WINDOWS_FALSE@nbdkit_evil_filter_la_LIBADD = \ +@IS_WINDOWS_FALSE@ $(top_builddir)/common/utils/libutils.la \ +@IS_WINDOWS_FALSE@ $(IMPORT_LIBRARY_ON_WINDOWS) \ +@IS_WINDOWS_FALSE@ $(NULL) + +@IS_WINDOWS_FALSE@nbdkit_evil_filter_la_LDFLAGS = -module \ +@IS_WINDOWS_FALSE@ -avoid-version -shared \ +@IS_WINDOWS_FALSE@ $(NO_UNDEFINED_ON_WINDOWS) $(NULL) \ +@IS_WINDOWS_FALSE@ $(am__append_1) +@HAVE_POD_TRUE@@IS_WINDOWS_FALSE@man_MANS = nbdkit-evil-filter.1 +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common-rules.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign filters/evil/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign filters/evil/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; +$(top_srcdir)/common-rules.mk $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +install-filterLTLIBRARIES: $(filter_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(filter_LTLIBRARIES)'; test -n "$(filterdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(filterdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(filterdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(filterdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(filterdir)"; \ + } + +uninstall-filterLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(filter_LTLIBRARIES)'; test -n "$(filterdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(filterdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(filterdir)/$$f"; \ + done + +clean-filterLTLIBRARIES: + -test -z "$(filter_LTLIBRARIES)" || rm -f $(filter_LTLIBRARIES) + @list='$(filter_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +nbdkit-evil-filter.la: $(nbdkit_evil_filter_la_OBJECTS) $(nbdkit_evil_filter_la_DEPENDENCIES) $(EXTRA_nbdkit_evil_filter_la_DEPENDENCIES) + $(AM_V_CCLD)$(nbdkit_evil_filter_la_LINK) $(am_nbdkit_evil_filter_la_rpath) $(nbdkit_evil_filter_la_OBJECTS) $(nbdkit_evil_filter_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nbdkit_evil_filter_la-evil.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +nbdkit_evil_filter_la-evil.lo: evil.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_evil_filter_la_CPPFLAGS) $(CPPFLAGS) $(nbdkit_evil_filter_la_CFLAGS) $(CFLAGS) -MT nbdkit_evil_filter_la-evil.lo -MD -MP -MF $(DEPDIR)/nbdkit_evil_filter_la-evil.Tpo -c -o nbdkit_evil_filter_la-evil.lo `test -f 'evil.c' || echo '$(srcdir)/'`evil.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nbdkit_evil_filter_la-evil.Tpo $(DEPDIR)/nbdkit_evil_filter_la-evil.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='evil.c' object='nbdkit_evil_filter_la-evil.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_evil_filter_la_CPPFLAGS) $(CPPFLAGS) $(nbdkit_evil_filter_la_CFLAGS) $(CFLAGS) -c -o nbdkit_evil_filter_la-evil.lo `test -f 'evil.c' || echo '$(srcdir)/'`evil.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(MANS) +installdirs: + for dir in "$(DESTDIR)$(filterdir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: 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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-filterLTLIBRARIES clean-generic clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/nbdkit_evil_filter_la-evil.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-filterLTLIBRARIES install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/nbdkit_evil_filter_la-evil.Plo + -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-filterLTLIBRARIES uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-filterLTLIBRARIES clean-generic clean-libtool \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-filterLTLIBRARIES \ + install-html install-html-am install-info install-info-am \ + install-man install-man1 install-pdf install-pdf-am 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 tags-am uninstall \ + uninstall-am uninstall-filterLTLIBRARIES uninstall-man \ + uninstall-man1 + +.PRECIOUS: Makefile + + +@HAVE_POD_TRUE@@IS_WINDOWS_FALSE@nbdkit-evil-filter.1: nbdkit-evil-filter.pod \ +@HAVE_POD_TRUE@@IS_WINDOWS_FALSE@ $(top_builddir)/podwrapper.pl +@HAVE_POD_TRUE@@IS_WINDOWS_FALSE@ $(PODWRAPPER) --section=1 --man $@ \ +@HAVE_POD_TRUE@@IS_WINDOWS_FALSE@ --html $(top_builddir)/html/$@.html \ +@HAVE_POD_TRUE@@IS_WINDOWS_FALSE@ $< + +# 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/filters/evil/evil.c b/filters/evil/evil.c new file mode 100644 index 0000000..9993693 --- /dev/null +++ b/filters/evil/evil.c @@ -0,0 +1,427 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "minmax.h" +#include "ispowerof2.h" +#include "random.h" + +enum mode { + COSMIC_RAYS, + STUCK_BITS, + STUCK_WIRES, +}; +static const char *evil_mode_to_string (enum mode); + +static enum mode evil_mode = STUCK_BITS; +static double evil_probability = -1; /* default depends on mode */ +static double evil_stuck_probability = 1.0; +static uint32_t evil_seed; + +/* Probabilities < ε are treated as zero to avoid both divide by zero + * problems and potentially exploding values in calculations. + */ +#define EPSILON 1e-12 + +/* Probabilities > MAXP are treated as 100%. This is because our + * algorithm below can corrupt at most 1 bit per byte and doesn't make + * progress otherwise. + */ +#define MAXP (1.0/8.0) + +static void +evil_load (void) +{ + evil_seed = time (NULL); +} + +static int +evil_config (nbdkit_next_config *next, nbdkit_backend *nxdata, + const char *key, const char *value) +{ + if (strcmp (key, "evil") == 0 || strcmp (key, "evil-mode") == 0) { + if (strcmp (value, "cosmic-rays") == 0 || + strcmp (value, "cosmic") == 0) { + evil_mode = COSMIC_RAYS; + return 0; + } + else if (strcmp (value, "stuck-bits") == 0 || + strcmp (value, "stuck-bit") == 0 || + strcmp (value, "stuck") == 0) { + evil_mode = STUCK_BITS; + return 0; + } + else if (strcmp (value, "stuck-wires") == 0 || + strcmp (value, "stuck-wire") == 0) { + evil_mode = STUCK_WIRES; + return 0; + } + else { + nbdkit_error ("evil: unknown mode: %s", value); + return -1; + } + } + else if (strcmp (key, "evil-probability") == 0) { + if (nbdkit_parse_probability ("evil-probability", value, + &evil_probability) == -1) + return -1; + if (evil_probability > 1) { + nbdkit_error ("%s: probability out of range, should be [0..1]", key); + return -1; + } + return 0; + } + else if (strcmp (key, "evil-stuck-probability") == 0) { + if (nbdkit_parse_probability ("evil-stuck-probability", value, + &evil_stuck_probability) == -1) + return -1; + if (evil_stuck_probability > 1) { + nbdkit_error ("%s: probability out of range, should be [0..1]", key); + return -1; + } + return 0; + } + else if (strcmp (key, "evil-seed") == 0) { + if (nbdkit_parse_uint32_t ("evil-seed", value, &evil_seed) == -1) + return -1; + return 0; + } + else + return next (nxdata, key, value); +} + +static int +evil_config_complete (nbdkit_next_config_complete *next, + nbdkit_backend *nxdata) +{ + if (evil_probability < 0) { + /* Choose default probability based on the chosen mode. */ + switch (evil_mode) { + case COSMIC_RAYS: + case STUCK_BITS: + evil_probability = 1e-8; + break; + case STUCK_WIRES: + evil_probability = 1e-6; + } + } + + return next (nxdata); +} + +#define evil_config_help \ + "evil=cosmic-rays|stuck-bits|stuck-wires\n" \ + " Set the mode (default: cosmic-rays).\n" \ + "evil-probability=PROB Probability of flipped or stuck bit.\n" \ + "evil-seed=SEED Random number seed.\n" \ + "evil-stuck-probability=PROB Probability of stuck bit being stuck." + +/* This is the heart of the algorithm, the function which corrupts + * the buffer after reading it from the plugin. + * + * The observation is that if we have a block of (eg) size 10**6 bits + * and our probability of finding a corrupt bit is (eg) 1/10**4, then + * we expect approximately 100 bits in the block to be corrupted. + * + * For stuck bits we want the corrupted bits to be the same on each + * access, either relative to the backing disk (STUCK_BITS) or to the + * request (STUCK_WIRES). + * + * Instead of creating an expensive bitmap ahead of time covering the + * whole disk, we can use the random number generator with a fixed + * seed derived from the offset of the start of the block. We can + * then choose a random number uniformly in the range [0..2*(1/P)) (in + * the example [0..2*10**4)) as the distance to the next corrupt bit. + * We jump forwards, corrupt that bit, and repeat until we reach the + * end of the block. + * + * "Corrupted" in this case can mean flipped by cosmic rays or stuck, + * depending on the filter mode. + * + * On average this will choose the right number of bits in the block. + * (Although their distribution will be suboptimal. In a uniform + * distribution it should be possible for two corrupted bits to be + * greater than 2*(1/P) apart, but the above algorithm would not do + * this. Also this algorithm cannot corrupt two bits in the same + * byte. In practice this probably doesn't matter as long as P is + * small.) + * + * Note that "block" != "buffer", especially in the STUCK_BITS mode. + * We iterate over blocks as above, but only corrupt a bit when it + * happens to coincide with the buffer we have just read. + * + * We choose the block size adaptively so that at least 100 bits in + * the block will be corrupted. The block size must be a power of 2. + * The block size thus depends on the probability. + */ +enum corruption_type { FLIP, STUCK }; + +static uint64_t block_size; /* in bytes */ +static struct random_state state; /* only used for cosmic-rays */ + +static int +evil_thread_model (void) +{ + switch (evil_mode) { + case COSMIC_RAYS: + /* Because cosmic-rays uses the global random state we need to + * tighten the thread model. + */ + return NBDKIT_THREAD_MODEL_SERIALIZE_REQUESTS; + + case STUCK_BITS: + case STUCK_WIRES: + return NBDKIT_THREAD_MODEL_PARALLEL; + } + abort (); +} + +static int +evil_get_ready (int thread_model) +{ + switch (evil_mode) { + case COSMIC_RAYS: + xsrandom ((uint64_t) evil_seed, &state); + break; + + case STUCK_BITS: + case STUCK_WIRES: + ; + } + + /* Choose the block size based on the probability, so that at least + * 100 bits are expected to be corrupted in the block. Block size + * must be a power of 2. + * + * Example: P = 1e-4 + * => ideal block_size = 100 / 1e-4 = 1e6 (bits) = 1e6 / 8 (bytes) + * => next power of 2 block_size = 131072 = 2**17 + * => expected bits per block = ~104 + */ + if (evil_probability < EPSILON || evil_probability > MAXP) + block_size = 1024*1024; /* unused so value doesn't matter */ + else + block_size = next_power_of_2 ((uint64_t) (100. / evil_probability) / 8); + + nbdkit_debug ("evil: mode: %s, P: %lg, seed: %" PRIu32, + evil_mode_to_string (evil_mode), + evil_probability, evil_seed); + nbdkit_debug ("evil: block_size: %" PRIu64 " (2**%d)", + block_size, log_2_bits (block_size)); + nbdkit_debug ("evil: expected bits per block: %g", + 8 * block_size * evil_probability); + + return 0; +} + +static void corrupt_all_bits (uint8_t *buf, uint32_t count, + struct random_state *rs, + enum corruption_type ct); +static uint8_t corrupt_one_bit (uint8_t byte, unsigned bit, + uint64_t rand, enum corruption_type ct); + +static void +corrupt_buffer (uint8_t *buf, uint32_t count, uint64_t offset_in_block, + struct random_state *rs, enum corruption_type ct) +{ + /* No corruption, and avoids a divide by zero below. */ + if (evil_probability < EPSILON) return; + + /* 100% corruption, avoids lack of progress in the loop below. */ + if (evil_probability > MAXP) { + corrupt_all_bits (buf, count, rs, ct); + return; + } + + uint64_t offs, intvl, i, randnum; + const uint64_t invp2 = (uint64_t) (2.0 / evil_probability); + + assert ((offset_in_block & ~(block_size-1)) == 0); + + /* Iterate over the whole block from the start. */ + for (offs = 0; offs < offset_in_block + count; ) { + /* Choose the length of the interval to the next corrupted bit, by + * picking a random number in [0..2*(1/P)]. + * + * Remember this is in bits! + */ + intvl = xrandom (rs) % invp2; + + /* Consume one more random state. We may or may not use this. + * But we need to always consume two random states per iteration + * to make the output predictable. + */ + randnum = xrandom (rs); + + /* Adjust offs to that byte. */ + offs += intvl / 8; + + /* If we have gone past the end of buffer, stop. */ + if (offs >= offset_in_block + count) break; + + /* If the current offs lies within the buffer, corrupt a bit. */ + if (offs >= offset_in_block) { + i = offs - offset_in_block; + assert (i < count); + buf[i] = corrupt_one_bit (buf[i], intvl & 7, randnum, ct); + } + } +} + +static void +corrupt_all_bits (uint8_t *buf, uint32_t count, + struct random_state *rs, enum corruption_type ct) +{ + size_t i; + unsigned bit; + uint8_t b; + uint64_t randnum; + + /* This is used when MAXP < P <= 100%. We treat it the same as 100% + * and corrupt all bits. + */ + for (i = 0; i < count; ++i) { + b = buf[i]; + for (bit = 0; bit < 8; ++bit) { + randnum = xrandom (rs); + b = corrupt_one_bit (b, bit, randnum, ct); + } + buf[i] = b; + } +} + +static uint8_t +corrupt_one_bit (uint8_t byte, unsigned bit, + uint64_t randnum, enum corruption_type ct) +{ + const unsigned mask = 1 << bit; + + switch (ct) { + case FLIP: + byte ^= mask; + break; + case STUCK: + randnum &= 0xffffffff; + if (evil_stuck_probability * 0x100000000 > randnum) { + if (randnum & 1) /* stuck high or low? */ + byte |= mask; + else + byte &= ~mask; + } + } + return byte; +} + +/* Read data. */ +static int +evil_pread (nbdkit_next *next, + void *handle, void *buf, uint32_t count, uint64_t offset, + uint32_t flags, int *err) +{ + uint64_t seed, bstart, len; + struct random_state local_state; + + if (next->pread (next, buf, count, offset, flags, err) == -1) + return -1; + + switch (evil_mode) { + case COSMIC_RAYS: + /* Use the global random state because we want to flip bits at random. */ + corrupt_buffer (buf, count, 0, &state, FLIP); + break; + + case STUCK_BITS: + /* Split the request to align with blocks. */ + bstart = offset & ~(block_size-1); + while (count > 0) { + /* Set the seed so we corrupt the same bits relative to the offset. */ + seed = (int64_t) evil_seed + bstart; + xsrandom (seed, &local_state); + /* If the buffer straddles two blocks, shorten to just the part + * inside the first block. + */ + len = MIN (count, bstart + block_size - offset); + corrupt_buffer (buf, len, offset - bstart, &local_state, STUCK); + bstart += block_size; + offset += len; + buf += len; + count -= len; + } + break; + + case STUCK_WIRES: + /* Set the seed so we corrupt the same bits in every request. */ + seed = (int64_t) evil_seed; + xsrandom (seed, &local_state); + corrupt_buffer (buf, count, 0, &local_state, STUCK); + break; + } + + return 0; +} + +static const char * +evil_mode_to_string (enum mode mode) +{ + switch (mode) { + case COSMIC_RAYS: return "cosmic-rays"; + case STUCK_BITS: return "stuck-bits"; + case STUCK_WIRES: return "stuck-wires"; + } + abort (); +} + +static struct nbdkit_filter filter = { + .name = "evil", + .longname = "nbdkit evil filter", + .load = evil_load, + .config = evil_config, + .config_complete = evil_config_complete, + .config_help = evil_config_help, + .thread_model = evil_thread_model, + .get_ready = evil_get_ready, + .pread = evil_pread, +}; + +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/evil/nbdkit-evil-filter.pod b/filters/evil/nbdkit-evil-filter.pod new file mode 100644 index 0000000..ad81ced --- /dev/null +++ b/filters/evil/nbdkit-evil-filter.pod @@ -0,0 +1,170 @@ +=head1 NAME + +nbdkit-evil-filter - add random data corruption to reads + +=head1 SYNOPSIS + + nbdkit --filter=evil PLUGIN [PLUGIN-ARGS...] + evil=[cosmic-rays|stuck-bits|stuck-wires] + [evil-probability=PROB] [evil-stuck-probability=PROB] + [evil-seed=SEED] + +=head1 DESCRIPTION + +nbdkit-evil-filter is a Byzantine filter for L that +randomly corrupts data when reading from the underlying plugin. This +can be used for testing filesystem checksums. Note that it does not +change write operations, so the underlying plugin contains the correct +data. + +L is a related filter that injects hard errors +into the NBD protocol. + +This filter has several modes, controlled using the C +parameter. These are: + +=over 4 + +=item C + +Bits are flipped at random when reading data. The probability that a +bit is flipped is controlled using the C parameter, +defaulting to 1e-8 (on average 1 in every 100 million bits read is +flipped). + +=item C + +This is the default mode. + +Fixed bits in the backing file are stuck randomly high or low. The +C parameter controls the expected probability that a +particular bit is stuck, defaulting in this mode to 1e-8 (1 in 100 +million). C controls the probability that a +stuck bit is read as its stuck value or its correct value, defaulting +to 100% (always read as a stuck bit). + +=item C + +This is similar to C but instead of simulating bad backing +data, it simulates stuck wires along the data path (eg. in a +register). The difference is that when reading, the stuck bit always +happens at the same position in the packet of data being read, +regardless of where on the underlying disk it is being read from. +C controls the probability of a stuck wire, +defaulting in this mode to 1e-6 (1 in 1 million). +C controls the probability that a stuck bit is +read as its stuck value or its correct value, defaulting to 100% +(always read as a stuck bit). + +=back + +=head1 EXAMPLES + +Add some stuck bits to the backing file at random: + + nbdkit --filter=evil file disk.img + +Cosmic rays will flip (on average) one in every 100 million bits +copied from the backing file over NBD: + + nbdkit --filter=evil file disk.img evil=cosmic-rays \ + --run 'nbdcopy $uri output.img' + +=head1 NOTES + +=head2 Extents + +Plugins can be sparse. This filter only corrupts bits in non-sparse +parts of the backing disk and it leaves sparse regions unchanged +(which is realistic behaviour). If you wish to use this filter to +corrupt sparse regions, then combine this filter with +L. For example: + + nbdkit --filter=evil --filter=noextents memory 1G + +=head2 Probability limited to [ 1e-12 .. 1/8 ] + +The current implementation limits probabilities to the range +S<[ 1e-12 .. 1/8 ]>. Values below this range are treated the same as +0%. Values above this range are treated the same as 100%. + +=head1 PARAMETERS + +=over 4 + +=item B + +=item B + +=item B + +Select the mode of evil. See the L above. The default +is C. + +=item BN + +=item BNB<:>M + +=item BNB<%> + +Set the probability for the mode. You can either use a floating point +number between 0 and 1, eg. C or +C. Or you can write it as N in M, eg. +C or C. Or +you can write this as a percentage, eg. C. + +The default probability depends on the mode. + +=item BSEED + +To make runs repeatable, use this to set a seed for the random number +generator. Note that runs are repeatable only if you use the same +version of nbdkit, since in future we may change the algorithm. + +The default is to choose a seed at random. + +=item BN + +=item BNB<:>M + +=item BNB<%> + +For the "stuck-*" modes, the probability that when reading a stuck bit +you will read the stuck bit or the correct value. This defaults to 1 +(ie. 100%) which means the bit is always stuck. Setting it to 0.5 for +example will mean that half the time the bit appears stuck and half +the time you see the correct value. + +=back + +=head1 FILES + +=over 4 + +=item F<$filterdir/nbdkit-evil-filter.so> + +The filter. + +Use C to find the location of C<$filterdir>. + +=back + +=head1 VERSION + +C first appeared in nbdkit 1.36. + +=head1 SEE ALSO + +L, +L, +L, +L, +L. + +=head1 AUTHORS + +Richard W.M. Jones + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/filters/exitlast/Makefile.am b/filters/exitlast/Makefile.am new file mode 100644 index 0000000..a533abd --- /dev/null +++ b/filters/exitlast/Makefile.am @@ -0,0 +1,70 @@ +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 $(top_srcdir)/common-rules.mk + +EXTRA_DIST = nbdkit-exitlast-filter.pod + +filter_LTLIBRARIES = nbdkit-exitlast-filter.la + +nbdkit_exitlast_filter_la_SOURCES = \ + exitlast.c \ + $(top_srcdir)/include/nbdkit-filter.h \ + $(NULL) + +nbdkit_exitlast_filter_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + $(NULL) +nbdkit_exitlast_filter_la_CFLAGS = $(WARNINGS_CFLAGS) +nbdkit_exitlast_filter_la_LIBADD = \ + $(IMPORT_LIBRARY_ON_WINDOWS) \ + $(NULL) +nbdkit_exitlast_filter_la_LDFLAGS = \ + -module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \ + $(NULL) +if USE_LINKER_SCRIPT +nbdkit_exitlast_filter_la_LDFLAGS += \ + -Wl,--version-script=$(top_srcdir)/filters/filters.syms +endif + +if HAVE_POD + +man_MANS = nbdkit-exitlast-filter.1 +CLEANFILES += $(man_MANS) + +nbdkit-exitlast-filter.1: nbdkit-exitlast-filter.pod \ + $(top_builddir)/podwrapper.pl + $(PODWRAPPER) --section=1 --man $@ \ + --html $(top_builddir)/html/$@.html \ + $< + +endif HAVE_POD diff --git a/filters/exitlast/Makefile.in b/filters/exitlast/Makefile.in new file mode 100644 index 0000000..f737110 --- /dev/null +++ b/filters/exitlast/Makefile.in @@ -0,0 +1,931 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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@ +@USE_LINKER_SCRIPT_TRUE@am__append_1 = \ +@USE_LINKER_SCRIPT_TRUE@ -Wl,--version-script=$(top_srcdir)/filters/filters.syms + +@HAVE_POD_TRUE@am__append_2 = $(man_MANS) +subdir = filters/exitlast +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ocaml.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +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 = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(filterdir)" "$(DESTDIR)$(man1dir)" +LTLIBRARIES = $(filter_LTLIBRARIES) +am__DEPENDENCIES_1 = +nbdkit_exitlast_filter_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +am__objects_1 = +am_nbdkit_exitlast_filter_la_OBJECTS = \ + nbdkit_exitlast_filter_la-exitlast.lo $(am__objects_1) +nbdkit_exitlast_filter_la_OBJECTS = \ + $(am_nbdkit_exitlast_filter_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +nbdkit_exitlast_filter_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(nbdkit_exitlast_filter_la_CFLAGS) $(CFLAGS) \ + $(nbdkit_exitlast_filter_la_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = \ + ./$(DEPDIR)/nbdkit_exitlast_filter_la-exitlast.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(nbdkit_exitlast_filter_la_SOURCES) +DIST_SOURCES = $(nbdkit_exitlast_filter_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/common-rules.mk \ + $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ +BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ +CARGO = @CARGO@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_PLUGIN_CC = @CC_PLUGIN_CC@ +CC_PLUGIN_CFLAGS = @CC_PLUGIN_CFLAGS@ +CERTTOOL = @CERTTOOL@ +CFLAGS = @CFLAGS@ +COM_ERR_CFLAGS = @COM_ERR_CFLAGS@ +COM_ERR_LIBS = @COM_ERR_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CUT = @CUT@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LDFLAGS = @DL_LDFLAGS@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXT2FS_CFLAGS = @EXT2FS_CFLAGS@ +EXT2FS_LIBS = @EXT2FS_LIBS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GENISOIMAGE = @GENISOIMAGE@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GOARCH = @GOARCH@ +GOLANG = @GOLANG@ +GOOS = @GOOS@ +GOROOT = @GOROOT@ +GREP = @GREP@ +IMPORT_LIBRARY_ON_WINDOWS = @IMPORT_LIBRARY_ON_WINDOWS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +ISOPROG = @ISOPROG@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBLKIO_CFLAGS = @LIBBLKIO_CFLAGS@ +LIBBLKIO_LIBS = @LIBBLKIO_LIBS@ +LIBGUESTFS_CFLAGS = @LIBGUESTFS_CFLAGS@ +LIBGUESTFS_LIBS = @LIBGUESTFS_LIBS@ +LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ +LIBLZMA_LIBS = @LIBLZMA_LIBS@ +LIBNBD_CFLAGS = @LIBNBD_CFLAGS@ +LIBNBD_LIBS = @LIBNBD_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSELINUX_CFLAGS = @LIBSELINUX_CFLAGS@ +LIBSELINUX_LIBS = @LIBSELINUX_LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTORRENT_CFLAGS = @LIBTORRENT_CFLAGS@ +LIBTORRENT_LIBS = @LIBTORRENT_LIBS@ +LIBVIRT_CFLAGS = @LIBVIRT_CFLAGS@ +LIBVIRT_LIBS = @LIBVIRT_LIBS@ +LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ +LIBZSTD_LIBS = @LIBZSTD_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LUA_CFLAGS = @LUA_CFLAGS@ +LUA_LIBS = @LUA_LIBS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MC = @MC@ +MKDIR_P = @MKDIR_P@ +MKISOFS = @MKISOFS@ +NBDKIT_VERSION_MAJOR = @NBDKIT_VERSION_MAJOR@ +NBDKIT_VERSION_MICRO = @NBDKIT_VERSION_MICRO@ +NBDKIT_VERSION_MINOR = @NBDKIT_VERSION_MINOR@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_ON_WINDOWS = @NO_UNDEFINED_ON_WINDOWS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OCAML = @OCAML@ +OCAMLBEST = @OCAMLBEST@ +OCAMLBUILD = @OCAMLBUILD@ +OCAMLC = @OCAMLC@ +OCAMLCDOTOPT = @OCAMLCDOTOPT@ +OCAMLDEP = @OCAMLDEP@ +OCAMLDOC = @OCAMLDOC@ +OCAMLLIB = @OCAMLLIB@ +OCAMLMKLIB = @OCAMLMKLIB@ +OCAMLMKTOP = @OCAMLMKTOP@ +OCAMLOPT = @OCAMLOPT@ +OCAMLOPTDOTOPT = @OCAMLOPTDOTOPT@ +OCAMLOPTFLAGS = @OCAMLOPTFLAGS@ +OCAMLVERSION = @OCAMLVERSION@ +OCAML_MAJOR = @OCAML_MAJOR@ +OCAML_PLUGIN_LIBRARIES = @OCAML_PLUGIN_LIBRARIES@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PERL_ARCHLIB = @PERL_ARCHLIB@ +PERL_CFLAGS = @PERL_CFLAGS@ +PERL_LDOPTS = @PERL_LDOPTS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PODWRAPPER = @PODWRAPPER@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_CXX = @PTHREAD_CXX@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CFLAGS = @PYTHON_CFLAGS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +RUBY_CFLAGS = @RUBY_CFLAGS@ +RUBY_LIBS = @RUBY_LIBS@ +RUSTC = @RUSTC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOEXT = @SOEXT@ +SSH_CFLAGS = @SSH_CFLAGS@ +SSH_LIBS = @SSH_LIBS@ +STAT = @STAT@ +STRIP = @STRIP@ +TCL_CFLAGS = @TCL_CFLAGS@ +TCL_LIBS = @TCL_LIBS@ +TRUNCATE = @TRUNCATE@ +VALGRIND = @VALGRIND@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VERSION = @VERSION@ +WARNINGS_CFLAGS = @WARNINGS_CFLAGS@ +XORRISO = @XORRISO@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +ZLIB_NG_CFLAGS = @ZLIB_NG_CFLAGS@ +ZLIB_NG_LIBS = @ZLIB_NG_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DLLTOOL = @ac_ct_DLLTOOL@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_MC = @ac_ct_MC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bashcompdir = @bashcompdir@ +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@ +filters = @filters@ +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@ +lang_plugins = @lang_plugins@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +non_lang_plugins = @non_lang_plugins@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugins = @plugins@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +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@ + +# Convenient list terminator +NULL = +plugindir = $(libdir)/nbdkit/plugins +filterdir = $(libdir)/nbdkit/filters +CLEANFILES = *~ *.cmi *.cmx *.cmxa *.so *.dll $(am__append_2) +EXTRA_DIST = nbdkit-exitlast-filter.pod +filter_LTLIBRARIES = nbdkit-exitlast-filter.la +nbdkit_exitlast_filter_la_SOURCES = \ + exitlast.c \ + $(top_srcdir)/include/nbdkit-filter.h \ + $(NULL) + +nbdkit_exitlast_filter_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + $(NULL) + +nbdkit_exitlast_filter_la_CFLAGS = $(WARNINGS_CFLAGS) +nbdkit_exitlast_filter_la_LIBADD = \ + $(IMPORT_LIBRARY_ON_WINDOWS) \ + $(NULL) + +nbdkit_exitlast_filter_la_LDFLAGS = -module -avoid-version -shared \ + $(NO_UNDEFINED_ON_WINDOWS) $(NULL) $(am__append_1) +@HAVE_POD_TRUE@man_MANS = nbdkit-exitlast-filter.1 +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common-rules.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign filters/exitlast/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign filters/exitlast/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; +$(top_srcdir)/common-rules.mk $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +install-filterLTLIBRARIES: $(filter_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(filter_LTLIBRARIES)'; test -n "$(filterdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(filterdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(filterdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(filterdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(filterdir)"; \ + } + +uninstall-filterLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(filter_LTLIBRARIES)'; test -n "$(filterdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(filterdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(filterdir)/$$f"; \ + done + +clean-filterLTLIBRARIES: + -test -z "$(filter_LTLIBRARIES)" || rm -f $(filter_LTLIBRARIES) + @list='$(filter_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +nbdkit-exitlast-filter.la: $(nbdkit_exitlast_filter_la_OBJECTS) $(nbdkit_exitlast_filter_la_DEPENDENCIES) $(EXTRA_nbdkit_exitlast_filter_la_DEPENDENCIES) + $(AM_V_CCLD)$(nbdkit_exitlast_filter_la_LINK) -rpath $(filterdir) $(nbdkit_exitlast_filter_la_OBJECTS) $(nbdkit_exitlast_filter_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nbdkit_exitlast_filter_la-exitlast.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +nbdkit_exitlast_filter_la-exitlast.lo: exitlast.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_exitlast_filter_la_CPPFLAGS) $(CPPFLAGS) $(nbdkit_exitlast_filter_la_CFLAGS) $(CFLAGS) -MT nbdkit_exitlast_filter_la-exitlast.lo -MD -MP -MF $(DEPDIR)/nbdkit_exitlast_filter_la-exitlast.Tpo -c -o nbdkit_exitlast_filter_la-exitlast.lo `test -f 'exitlast.c' || echo '$(srcdir)/'`exitlast.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nbdkit_exitlast_filter_la-exitlast.Tpo $(DEPDIR)/nbdkit_exitlast_filter_la-exitlast.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='exitlast.c' object='nbdkit_exitlast_filter_la-exitlast.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_exitlast_filter_la_CPPFLAGS) $(CPPFLAGS) $(nbdkit_exitlast_filter_la_CFLAGS) $(CFLAGS) -c -o nbdkit_exitlast_filter_la-exitlast.lo `test -f 'exitlast.c' || echo '$(srcdir)/'`exitlast.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(MANS) +installdirs: + for dir in "$(DESTDIR)$(filterdir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: 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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-filterLTLIBRARIES clean-generic clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/nbdkit_exitlast_filter_la-exitlast.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-filterLTLIBRARIES install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/nbdkit_exitlast_filter_la-exitlast.Plo + -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-filterLTLIBRARIES uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-filterLTLIBRARIES clean-generic clean-libtool \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-filterLTLIBRARIES \ + install-html install-html-am install-info install-info-am \ + install-man install-man1 install-pdf install-pdf-am 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 tags-am uninstall \ + uninstall-am uninstall-filterLTLIBRARIES uninstall-man \ + uninstall-man1 + +.PRECIOUS: Makefile + + +@HAVE_POD_TRUE@nbdkit-exitlast-filter.1: nbdkit-exitlast-filter.pod \ +@HAVE_POD_TRUE@ $(top_builddir)/podwrapper.pl +@HAVE_POD_TRUE@ $(PODWRAPPER) --section=1 --man $@ \ +@HAVE_POD_TRUE@ --html $(top_builddir)/html/$@.html \ +@HAVE_POD_TRUE@ $< + +# 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/filters/exitlast/exitlast.c b/filters/exitlast/exitlast.c new file mode 100644 index 0000000..78843f9 --- /dev/null +++ b/filters/exitlast/exitlast.c @@ -0,0 +1,80 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include + +#include + +#ifdef HAVE_STDATOMIC_H +#include +#else +/* Some old platforms lack atomic types, but 32 bit ints are usually + * "atomic enough". + */ +#define _Atomic /**/ +#endif + +/* Counts client connections. When this drops to zero we exit. */ +static _Atomic unsigned connections; + +static void * +exitlast_open (nbdkit_next_open *next, nbdkit_context *nxdata, + int readonly, const char *exportname, int is_tls) +{ + if (next (nxdata, readonly, exportname) == -1) + return NULL; + + connections++; + + return NBDKIT_HANDLE_NOT_NEEDED; +} + +static void +exitlast_close (void *handle) +{ + if (--connections == 0) { + nbdkit_debug ("exitlast: exiting on last client connection"); + nbdkit_shutdown (); + } +} + +static struct nbdkit_filter filter = { + .name = "exitlast", + .longname = "nbdkit exitlast filter", + .open = exitlast_open, + .close = exitlast_close, +}; + +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/exitlast/nbdkit-exitlast-filter.pod b/filters/exitlast/nbdkit-exitlast-filter.pod new file mode 100644 index 0000000..b6a353f --- /dev/null +++ b/filters/exitlast/nbdkit-exitlast-filter.pod @@ -0,0 +1,62 @@ +=head1 NAME + +nbdkit-exitlast-filter - exit on last client connection + +=head1 SYNOPSIS + + nbdkit --filter=exitlast PLUGIN + +=head1 DESCRIPTION + +C is an nbdkit filter that causes nbdkit to +exit when there are no more client connections. Note that it doesn't +exit before the first client connection. + +One use for this is in combination with a superserver, to save +resources when nbdkit is not in use (see L). +Another use is to ensure nbdkit exits after the client has finished +(but see also nbdkit-captive(1) for other ways to do this). + +To exit when an event occurs, try L. + +=head1 PARAMETERS + +There are no parameters specific to nbdkit-exitlast-filter. Any +parameters are passed through to and processed by the underlying +plugin in the normal way. + +=head1 FILES + +=over 4 + +=item F<$filterdir/nbdkit-exitlast-filter.so> + +The filter. + +Use C to find the location of C<$filterdir>. + +=back + +=head1 VERSION + +C first appeared in nbdkit 1.20. + +=head1 SEE ALSO + +L, +L, +L, +L, +L, +L, +L, +L, +L. + +=head1 AUTHORS + +Richard W.M. Jones + +=head1 COPYRIGHT + +Copyright Red Hat diff --git a/filters/exitwhen/Makefile.am b/filters/exitwhen/Makefile.am new file mode 100644 index 0000000..0e0ecc3 --- /dev/null +++ b/filters/exitwhen/Makefile.am @@ -0,0 +1,75 @@ +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 $(top_srcdir)/common-rules.mk + +EXTRA_DIST = nbdkit-exitwhen-filter.pod + +filter_LTLIBRARIES = nbdkit-exitwhen-filter.la + +nbdkit_exitwhen_filter_la_SOURCES = \ + exitwhen.c \ + $(top_srcdir)/include/nbdkit-filter.h \ + $(NULL) + +nbdkit_exitwhen_filter_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/common/include \ + -I$(top_srcdir)/common/replacements \ + -I$(top_srcdir)/common/utils \ + $(NULL) +nbdkit_exitwhen_filter_la_CFLAGS = $(WARNINGS_CFLAGS) +nbdkit_exitwhen_filter_la_LIBADD = \ + $(top_builddir)/common/utils/libutils.la \ + $(top_builddir)/common/replacements/libcompat.la \ + $(IMPORT_LIBRARY_ON_WINDOWS) \ + $(NULL) +nbdkit_exitwhen_filter_la_LDFLAGS = \ + -module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \ + $(NULL) +if USE_LINKER_SCRIPT +nbdkit_exitwhen_filter_la_LDFLAGS += \ + -Wl,--version-script=$(top_srcdir)/filters/filters.syms +endif + +if HAVE_POD + +man_MANS = nbdkit-exitwhen-filter.1 +CLEANFILES += $(man_MANS) + +nbdkit-exitwhen-filter.1: nbdkit-exitwhen-filter.pod \ + $(top_builddir)/podwrapper.pl + $(PODWRAPPER) --section=1 --man $@ \ + --html $(top_builddir)/html/$@.html \ + $< + +endif HAVE_POD diff --git a/filters/exitwhen/Makefile.in b/filters/exitwhen/Makefile.in new file mode 100644 index 0000000..4234c0e --- /dev/null +++ b/filters/exitwhen/Makefile.in @@ -0,0 +1,938 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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@ + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +# nbdkit +# Copyright Red Hat +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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. + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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@ +@USE_LINKER_SCRIPT_TRUE@am__append_1 = \ +@USE_LINKER_SCRIPT_TRUE@ -Wl,--version-script=$(top_srcdir)/filters/filters.syms + +@HAVE_POD_TRUE@am__append_2 = $(man_MANS) +subdir = filters/exitwhen +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ocaml.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +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 = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(filterdir)" "$(DESTDIR)$(man1dir)" +LTLIBRARIES = $(filter_LTLIBRARIES) +am__DEPENDENCIES_1 = +nbdkit_exitwhen_filter_la_DEPENDENCIES = \ + $(top_builddir)/common/utils/libutils.la \ + $(top_builddir)/common/replacements/libcompat.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am__objects_1 = +am_nbdkit_exitwhen_filter_la_OBJECTS = \ + nbdkit_exitwhen_filter_la-exitwhen.lo $(am__objects_1) +nbdkit_exitwhen_filter_la_OBJECTS = \ + $(am_nbdkit_exitwhen_filter_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +nbdkit_exitwhen_filter_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(nbdkit_exitwhen_filter_la_CFLAGS) $(CFLAGS) \ + $(nbdkit_exitwhen_filter_la_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = \ + ./$(DEPDIR)/nbdkit_exitwhen_filter_la-exitwhen.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(nbdkit_exitwhen_filter_la_SOURCES) +DIST_SOURCES = $(nbdkit_exitwhen_filter_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/common-rules.mk \ + $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ +BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ +CARGO = @CARGO@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_PLUGIN_CC = @CC_PLUGIN_CC@ +CC_PLUGIN_CFLAGS = @CC_PLUGIN_CFLAGS@ +CERTTOOL = @CERTTOOL@ +CFLAGS = @CFLAGS@ +COM_ERR_CFLAGS = @COM_ERR_CFLAGS@ +COM_ERR_LIBS = @COM_ERR_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CUT = @CUT@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LDFLAGS = @DL_LDFLAGS@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXT2FS_CFLAGS = @EXT2FS_CFLAGS@ +EXT2FS_LIBS = @EXT2FS_LIBS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GENISOIMAGE = @GENISOIMAGE@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GOARCH = @GOARCH@ +GOLANG = @GOLANG@ +GOOS = @GOOS@ +GOROOT = @GOROOT@ +GREP = @GREP@ +IMPORT_LIBRARY_ON_WINDOWS = @IMPORT_LIBRARY_ON_WINDOWS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +ISOPROG = @ISOPROG@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBLKIO_CFLAGS = @LIBBLKIO_CFLAGS@ +LIBBLKIO_LIBS = @LIBBLKIO_LIBS@ +LIBGUESTFS_CFLAGS = @LIBGUESTFS_CFLAGS@ +LIBGUESTFS_LIBS = @LIBGUESTFS_LIBS@ +LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ +LIBLZMA_LIBS = @LIBLZMA_LIBS@ +LIBNBD_CFLAGS = @LIBNBD_CFLAGS@ +LIBNBD_LIBS = @LIBNBD_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSELINUX_CFLAGS = @LIBSELINUX_CFLAGS@ +LIBSELINUX_LIBS = @LIBSELINUX_LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTORRENT_CFLAGS = @LIBTORRENT_CFLAGS@ +LIBTORRENT_LIBS = @LIBTORRENT_LIBS@ +LIBVIRT_CFLAGS = @LIBVIRT_CFLAGS@ +LIBVIRT_LIBS = @LIBVIRT_LIBS@ +LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ +LIBZSTD_LIBS = @LIBZSTD_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LUA_CFLAGS = @LUA_CFLAGS@ +LUA_LIBS = @LUA_LIBS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MC = @MC@ +MKDIR_P = @MKDIR_P@ +MKISOFS = @MKISOFS@ +NBDKIT_VERSION_MAJOR = @NBDKIT_VERSION_MAJOR@ +NBDKIT_VERSION_MICRO = @NBDKIT_VERSION_MICRO@ +NBDKIT_VERSION_MINOR = @NBDKIT_VERSION_MINOR@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_ON_WINDOWS = @NO_UNDEFINED_ON_WINDOWS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OCAML = @OCAML@ +OCAMLBEST = @OCAMLBEST@ +OCAMLBUILD = @OCAMLBUILD@ +OCAMLC = @OCAMLC@ +OCAMLCDOTOPT = @OCAMLCDOTOPT@ +OCAMLDEP = @OCAMLDEP@ +OCAMLDOC = @OCAMLDOC@ +OCAMLLIB = @OCAMLLIB@ +OCAMLMKLIB = @OCAMLMKLIB@ +OCAMLMKTOP = @OCAMLMKTOP@ +OCAMLOPT = @OCAMLOPT@ +OCAMLOPTDOTOPT = @OCAMLOPTDOTOPT@ +OCAMLOPTFLAGS = @OCAMLOPTFLAGS@ +OCAMLVERSION = @OCAMLVERSION@ +OCAML_MAJOR = @OCAML_MAJOR@ +OCAML_PLUGIN_LIBRARIES = @OCAML_PLUGIN_LIBRARIES@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PERL_ARCHLIB = @PERL_ARCHLIB@ +PERL_CFLAGS = @PERL_CFLAGS@ +PERL_LDOPTS = @PERL_LDOPTS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PODWRAPPER = @PODWRAPPER@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_CXX = @PTHREAD_CXX@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +PYTHON = @PYTHON@ +PYTHON_CFLAGS = @PYTHON_CFLAGS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +RUBY = @RUBY@ +RUBY_CFLAGS = @RUBY_CFLAGS@ +RUBY_LIBS = @RUBY_LIBS@ +RUSTC = @RUSTC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOEXT = @SOEXT@ +SSH_CFLAGS = @SSH_CFLAGS@ +SSH_LIBS = @SSH_LIBS@ +STAT = @STAT@ +STRIP = @STRIP@ +TCL_CFLAGS = @TCL_CFLAGS@ +TCL_LIBS = @TCL_LIBS@ +TRUNCATE = @TRUNCATE@ +VALGRIND = @VALGRIND@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ +VALGRIND_LIBS = @VALGRIND_LIBS@ +VERSION = @VERSION@ +WARNINGS_CFLAGS = @WARNINGS_CFLAGS@ +XORRISO = @XORRISO@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +ZLIB_NG_CFLAGS = @ZLIB_NG_CFLAGS@ +ZLIB_NG_LIBS = @ZLIB_NG_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DLLTOOL = @ac_ct_DLLTOOL@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_MC = @ac_ct_MC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bashcompdir = @bashcompdir@ +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@ +filters = @filters@ +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@ +lang_plugins = @lang_plugins@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +non_lang_plugins = @non_lang_plugins@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugins = @plugins@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +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@ + +# Convenient list terminator +NULL = +plugindir = $(libdir)/nbdkit/plugins +filterdir = $(libdir)/nbdkit/filters +CLEANFILES = *~ *.cmi *.cmx *.cmxa *.so *.dll $(am__append_2) +EXTRA_DIST = nbdkit-exitwhen-filter.pod +filter_LTLIBRARIES = nbdkit-exitwhen-filter.la +nbdkit_exitwhen_filter_la_SOURCES = \ + exitwhen.c \ + $(top_srcdir)/include/nbdkit-filter.h \ + $(NULL) + +nbdkit_exitwhen_filter_la_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/common/include \ + -I$(top_srcdir)/common/replacements \ + -I$(top_srcdir)/common/utils \ + $(NULL) + +nbdkit_exitwhen_filter_la_CFLAGS = $(WARNINGS_CFLAGS) +nbdkit_exitwhen_filter_la_LIBADD = \ + $(top_builddir)/common/utils/libutils.la \ + $(top_builddir)/common/replacements/libcompat.la \ + $(IMPORT_LIBRARY_ON_WINDOWS) \ + $(NULL) + +nbdkit_exitwhen_filter_la_LDFLAGS = -module -avoid-version -shared \ + $(NO_UNDEFINED_ON_WINDOWS) $(NULL) $(am__append_1) +@HAVE_POD_TRUE@man_MANS = nbdkit-exitwhen-filter.1 +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common-rules.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign filters/exitwhen/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign filters/exitwhen/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; +$(top_srcdir)/common-rules.mk $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +install-filterLTLIBRARIES: $(filter_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(filter_LTLIBRARIES)'; test -n "$(filterdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(filterdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(filterdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(filterdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(filterdir)"; \ + } + +uninstall-filterLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(filter_LTLIBRARIES)'; test -n "$(filterdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(filterdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(filterdir)/$$f"; \ + done + +clean-filterLTLIBRARIES: + -test -z "$(filter_LTLIBRARIES)" || rm -f $(filter_LTLIBRARIES) + @list='$(filter_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +nbdkit-exitwhen-filter.la: $(nbdkit_exitwhen_filter_la_OBJECTS) $(nbdkit_exitwhen_filter_la_DEPENDENCIES) $(EXTRA_nbdkit_exitwhen_filter_la_DEPENDENCIES) + $(AM_V_CCLD)$(nbdkit_exitwhen_filter_la_LINK) -rpath $(filterdir) $(nbdkit_exitwhen_filter_la_OBJECTS) $(nbdkit_exitwhen_filter_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nbdkit_exitwhen_filter_la-exitwhen.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +nbdkit_exitwhen_filter_la-exitwhen.lo: exitwhen.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_exitwhen_filter_la_CPPFLAGS) $(CPPFLAGS) $(nbdkit_exitwhen_filter_la_CFLAGS) $(CFLAGS) -MT nbdkit_exitwhen_filter_la-exitwhen.lo -MD -MP -MF $(DEPDIR)/nbdkit_exitwhen_filter_la-exitwhen.Tpo -c -o nbdkit_exitwhen_filter_la-exitwhen.lo `test -f 'exitwhen.c' || echo '$(srcdir)/'`exitwhen.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nbdkit_exitwhen_filter_la-exitwhen.Tpo $(DEPDIR)/nbdkit_exitwhen_filter_la-exitwhen.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='exitwhen.c' object='nbdkit_exitwhen_filter_la-exitwhen.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nbdkit_exitwhen_filter_la_CPPFLAGS) $(CPPFLAGS) $(nbdkit_exitwhen_filter_la_CFLAGS) $(CFLAGS) -c -o nbdkit_exitwhen_filter_la-exitwhen.lo `test -f 'exitwhen.c' || echo '$(srcdir)/'`exitwhen.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(MANS) +installdirs: + for dir in "$(DESTDIR)$(filterdir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: 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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-filterLTLIBRARIES clean-generic clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/nbdkit_exitwhen_filter_la-exitwhen.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-filterLTLIBRARIES install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/nbdkit_exitwhen_filter_la-exitwhen.Plo + -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-filterLTLIBRARIES uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-filterLTLIBRARIES clean-generic clean-libtool \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-filterLTLIBRARIES \ + install-html install-html-am install-info install-info-am \ + install-man install-man1 install-pdf install-pdf-am 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 tags-am uninstall \ + uninstall-am uninstall-filterLTLIBRARIES uninstall-man \ + uninstall-man1 + +.PRECIOUS: Makefile + + +@HAVE_POD_TRUE@nbdkit-exitwhen-filter.1: nbdkit-exitwhen-filter.pod \ +@HAVE_POD_TRUE@ $(top_builddir)/podwrapper.pl +@HAVE_POD_TRUE@ $(PODWRAPPER) --section=1 --man $@ \ +@HAVE_POD_TRUE@ --html $(top_builddir)/html/$@.html \ +@HAVE_POD_TRUE@ $< + +# 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/filters/exitwhen/exitwhen.c b/filters/exitwhen/exitwhen.c new file mode 100644 index 0000000..6c0fb9c --- /dev/null +++ b/filters/exitwhen/exitwhen.c @@ -0,0 +1,535 @@ +/* nbdkit + * Copyright Red Hat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Red Hat 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 RED HAT 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 RED HAT 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 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_SYS_WAIT_H +#include +#endif + +#include + +#include + +#include "cleanup.h" +#include "poll.h" +#include "utils.h" +#include "vector.h" + +static unsigned pollsecs = 60; + +static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; +static unsigned connections = 0; /* NB: Protected by 'lock' */ +static bool exiting = false; + +/* The list of events generated from command line parameters. */ +struct event { + int type; +#define EVENT_FILE_CREATED 1 +#define EVENT_FILE_DELETED 2 +#ifndef WIN32 +#define EVENT_PROCESS_EXITS 3 +#define EVENT_FD_CLOSED 4 +#define EVENT_SCRIPT 5 +#endif + union { + char *filename; /* Filename or script. */ + int fd; /* For PROCESS_EXITS or FD_CLOSED. */ +#ifndef __linux__ + pid_t pid; /* For PROCESS_EXITS on non-Linux. */ +#endif + } u; +}; +DEFINE_VECTOR_TYPE (event_list, struct event); +static event_list events = empty_vector; + +static void +free_event (struct event event) +{ + switch (event.type) { +#ifdef EVENT_FILE_CREATED + case EVENT_FILE_CREATED: +#endif +#ifdef EVENT_FILE_DELETED + case EVENT_FILE_DELETED: +#endif +#ifdef EVENT_SCRIPT + case EVENT_SCRIPT: +#endif + free (event.u.filename); + break; +#ifdef EVENT_PROCESS_EXITS + case EVENT_PROCESS_EXITS: +#endif +#ifdef EVENT_FD_CLOSED + case EVENT_FD_CLOSED: +#endif +#ifdef __linux__ + close (event.u.fd); +#endif + break; + } +} + +static void +exitwhen_unload (void) +{ + event_list_iter (&events, free_event); + free (events.ptr); +} + +static void +exitwhen_dump_plugin (void) +{ +#ifdef EVENT_FILE_CREATED + printf ("exitwhen_file_created=yes\n"); +#endif +#ifdef EVENT_FILE_DELETED + printf ("exitwhen_file_deleted=yes\n"); +#endif +#ifdef EVENT_PROCESS_EXITS + printf ("exitwhen_process_exits=yes\n"); +#endif +#ifdef EVENT_FD_CLOSED + printf ("exitwhen_pipe_closed=yes\n"); +#endif +#ifdef EVENT_SCRIPT + printf ("exitwhen_script=yes\n"); +#endif +} + +/* If exiting is already true, this does nothing and returns true. + * Otherwise it checks if any event in the list has happened. If an + * event has happened, sets exiting to true. It returns the exiting + * flag. + * + * This must be called with &lock held. + */ +#ifdef EVENT_FILE_CREATED +static void check_for_event_file_created (const struct event *); +#endif +#ifdef EVENT_FILE_DELETED +static void check_for_event_file_deleted (const struct event *); +#endif +#ifdef EVENT_PROCESS_EXITS +static void check_for_event_process_exits (const struct event *); +#endif +#ifdef EVENT_FD_CLOSED +static void check_for_event_fd_closed (const struct event *); +#endif +#ifdef EVENT_SCRIPT +static void check_for_event_script (const struct event *); +#endif + +static bool +check_for_event (void) +{ + size_t i; + + if (!exiting) { + for (i = 0; i < events.len; ++i) { + const struct event *event = &events.ptr[i]; + + switch (event->type) { +#ifdef EVENT_FILE_CREATED + case EVENT_FILE_CREATED: + check_for_event_file_created (event); + break; +#endif +#ifdef EVENT_FILE_DELETED + case EVENT_FILE_DELETED: + check_for_event_file_deleted (event); + break; +#endif +#ifdef EVENT_PROCESS_EXITS + case EVENT_PROCESS_EXITS: + check_for_event_process_exits (event); + break; +#endif +#ifdef EVENT_FD_CLOSED + case EVENT_FD_CLOSED: + check_for_event_fd_closed (event); + break; +#endif +#ifdef EVENT_SCRIPT + case EVENT_SCRIPT: + check_for_event_script (event); + break; +#endif + } + } + } + + return exiting; +} + +#ifdef EVENT_FILE_CREATED +static void +check_for_event_file_created (const struct event *event) +{ + if (access (event->u.filename, R_OK) == 0) { + nbdkit_debug ("exit-when-file-created: detected %s created", + event->u.filename); + exiting = true; + } +} +#endif + +#ifdef EVENT_FILE_DELETED +static void +check_for_event_file_deleted (const struct event *event) +{ + if (access (event->u.filename, R_OK) == -1) { + if (errno == ENOTDIR || errno == ENOENT) { + nbdkit_debug ("exit-when-file-deleted: detected %s deleted", + event->u.filename); + exiting = true; + } + else { + /* Log the error but continue. */ + nbdkit_error ("exit-when-file-deleted: access: %s: %m", + event->u.filename); + } + } +} +#endif + +#ifdef EVENT_PROCESS_EXITS +static void +check_for_event_process_exits (const struct event *event) +{ +#ifdef __linux__ + char c; + + /* https://gitlab.freedesktop.org/polkit/polkit/-/issues/75 + * + * event->u.fd holds /proc/PID/stat of the original process open. + * If we can still read a byte from it then the original process is + * still around. If we get ESRCH then the process has exited. + */ + lseek (event->u.fd, 0, SEEK_SET); + if (read (event->u.fd, &c, 1) == -1) { + if (errno == ESRCH) { + nbdkit_debug ("exit-when-process-exits: detected process exit"); + exiting = true; + } + else { + /* Log the error but continue. */ + nbdkit_error ("exit-when-process-exits: read: %m"); + } + } +#else /* !__linux__ */ + /* XXX Find a safe way to do this on BSD at least. */ + if (kill (event->u.pid, 0) == -1 && errno == ESRCH) { + nbdkit_debug ("exit-when-process-exits: detected process exit"); + exiting = true; + } +#endif /* !__linux__ */ +} +#endif + +#ifdef EVENT_FD_CLOSED +static void +check_for_event_fd_closed (const struct event *event) +{ + int r; + struct pollfd fds[1]; + + /* event->u.fd is the read side of a pipe or socket. Check it is + * not closed. We don't actually read anything from the pipe. + */ + fds[0].fd = event->u.fd; + fds[0].events = 0; + r = poll (fds, 1, 0); + if (r == 1) { + if ((fds[0].revents & POLLHUP) != 0) { + nbdkit_debug ("exit-when-pipe-closed: detected pipe closed"); + exiting = true; + } + else if ((fds[0].revents & POLLNVAL) != 0) { + /* If we were passed a bad file descriptor that is user error + * and we should exit with an error early. Because + * check_for_event() is called first in get_ready() this should + * cause this to happen. + */ + nbdkit_error ("exit-when-pipe-closed: invalid file descriptor"); + exiting = true; + } + } + else if (r == -1) { + /* Log the error but continue. */ + nbdkit_error ("exit-when-pipe-closed: poll: %m"); + } +} +#endif + +#ifdef EVENT_SCRIPT +static void +check_for_event_script (const struct event *event) +{ + int r; + + /* event->u.filename is a script filename or command. Exit code 88 + * indicates the event has happened. + */ + r = system (event->u.filename); + if (r == -1) { + /* Log the error but continue. */ + nbdkit_error ("exit-when-script: %m"); + } + else if (WIFEXITED (r) && WEXITSTATUS (r) == 0) { + /* Normal case, do nothing. */ + } + else if (WIFEXITED (r) && WEXITSTATUS (r) == 88) { + nbdkit_debug ("exit-when-script: detected scripted event"); + exiting = true; + } + else { + /* Log the error but continue. */ + exit_status_to_nbd_error (r, "exit-when-script"); + } +} +#endif + +/* The background polling thread. + * + * This always polls every pollsecs seconds, but only checks for + * events when there are no connections. + */ +static void * __attribute__ ((noreturn)) +polling_thread (void *vp) +{ + for (;;) { + { + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock); + if (connections == 0 && check_for_event ()) { + nbdkit_debug ("exitwhen: shutdown from polling thread"); + nbdkit_shutdown (); + } + } + + sleep (pollsecs); + } +} + +/* Read command line parameters are build events list. */ +static int +exitwhen_config (nbdkit_next_config *next, nbdkit_backend *nxdata, + const char *key, const char *value) +{ + struct event event; + + if (0) ; +#if defined (EVENT_FILE_CREATED) && defined (EVENT_FILE_DELETED) + else if (strcmp (key, "exit-when-file-created") == 0 || + strcmp (key, "exit-when-file-deleted") == 0) { + char c = key[15]; + + assert (c == 'c' || c == 'd'); + event.type = c == 'c' ? EVENT_FILE_CREATED : EVENT_FILE_DELETED; + event.u.filename = nbdkit_absolute_path (value); + if (event.u.filename == NULL) + return -1; +#ifdef EVENT_FD_CLOSED + append_event: +#endif + if (event_list_append (&events, event) == -1) + return -1; + return 0; + } +#endif +#ifdef EVENT_FD_CLOSED + else if (strcmp (key, "exit-when-pipe-closed") == 0 || + strcmp (key, "exit-when-fd-closed") == 0) { + event.type = EVENT_FD_CLOSED; + if (nbdkit_parse_int ("exit-when-pipe-closed", value, &event.u.fd) == -1) + return -1; + goto append_event; + } +#endif +#ifdef EVENT_PROCESS_EXITS + else if (strcmp (key, "exit-when-process-exits") == 0 || + strcmp (key, "exit-when-pid-exits") == 0) { + uint64_t pid; +#ifdef __linux__ + CLEANUP_FREE char *str = NULL; +#endif + + event.type = EVENT_PROCESS_EXITS; + if (nbdkit_parse_uint64_t ("exit-when-process-exits", value, &pid) == -1) + return -1; +#ifdef __linux__ + /* See: https://gitlab.freedesktop.org/polkit/polkit/-/issues/75 */ + if (asprintf (&str, "/proc/%" PRIu64 "/stat", pid) == -1) { + nbdkit_error ("asprintf: %m"); + return -1; + } + event.u.fd = open (str, O_RDONLY); + if (event.u.fd == -1) { + nbdkit_error ("exit-when-process-exits: %s: %m", str); + return -1; + } +#else + event.u.pid = (pid_t) pid; +#endif + goto append_event; + } +#endif +#ifdef EVENT_SCRIPT + else if (strcmp (key, "exit-when-script") == 0) { + event.type = EVENT_SCRIPT; + event.u.filename = strdup (value); + if (event.u.filename == NULL) { + nbdkit_error ("strdup: %m"); + return -1; + } + goto append_event; + } +#endif + + /* This is a setting, not an event. */ + if (strcmp (key, "exit-when-poll") == 0) { + if (nbdkit_parse_unsigned ("exit-when-poll", value, &pollsecs) == -1) + return -1; + return 0; + } + + /* Otherwise pass the parameter to the plugin. */ + return next (nxdata, key, value); +} + +/* Before forking, run the check. If the event has already happened + * then we exit immediately. + */ +static int +exitwhen_get_ready (int thread_model) +{ + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock); + + if (check_for_event ()) + exit (EXIT_SUCCESS); + + return 0; +} + +/* After forking, start the background thread. Initially it is + * polling. + */ +static int +exitwhen_after_fork (nbdkit_backend *nxdata) +{ + int err; + pthread_t thread; + + err = pthread_create (&thread, NULL, polling_thread, NULL); + if (err != 0) { + errno = err; + nbdkit_error ("pthread_create: %m"); + return -1; + } + return 0; +} + +static int +exitwhen_preconnect (nbdkit_next_preconnect *next, nbdkit_backend *nxdata, + int readonly) +{ + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock); + + if (check_for_event ()) { + nbdkit_error ("exitwhen: nbdkit is exiting: rejecting new connection"); + return -1; + } + + if (next (nxdata, readonly) == -1) + return -1; + + return 0; +} + +static void * +exitwhen_open (nbdkit_next_open *next, nbdkit_context *nxdata, + int readonly, const char *exportname, int is_tls) +{ + if (next (nxdata, readonly, exportname) == -1) + return NULL; + + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock); + connections++; + + return NBDKIT_HANDLE_NOT_NEEDED; +} + +static void +exitwhen_close (void *handle) +{ + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock); + + check_for_event (); + + --connections; + if (connections == 0) { + if (exiting) { + nbdkit_debug ("exitwhen: exiting on last client connection"); + nbdkit_shutdown (); + } + } +} + +static struct nbdkit_filter filter = { + .name = "exitwhen", + .longname = "nbdkit exitwhen filter", + .unload = exitwhen_unload, + .dump_plugin = exitwhen_dump_plugin, + + .config = exitwhen_config, + .get_ready = exitwhen_get_ready, + .after_fork = exitwhen_after_fork, + + .preconnect = exitwhen_preconnect, + .open = exitwhen_open, + .close = exitwhen_close, +}; + +NBDKIT_REGISTER_FILTER (filter) diff --git a/filters/exitwhen/nbdkit-exitwhen-filter.pod b/filters/exitwhen/nbdkit-exitwhen-filter.pod new file mode 100644 index 0000000..a9e9c4c --- /dev/null +++ b/filters/exitwhen/nbdkit-exitwhen-filter.pod @@ -0,0 +1,201 @@ +=head1 NAME + +nbdkit-exitwhen-filter - exit gracefully when an event occurs + +=head1 SYNOPSIS + + nbdkit --filter=exitwhen PLUGIN + [exit-when-file-created=FILENAME] + [exit-when-file-deleted=FILENAME] + [exit-when-pipe-closed=FD] + [exit-when-process-exits=PID] + [exit-when-script=SCRIPT] + [exit-when-poll=SECS] + +=head1 DESCRIPTION + +C is an nbdkit filter that causes nbdkit to +exit gracefully when some external event occurs. Built-in events are: +a file being created or deleted, a pipe being closed, or a process +exiting. You can also define custom events using an external script +or command. + +After the event occurs nbdkit refuses new connections, waits for all +current clients to disconnect, and then exits. + +A similar filter is L. For other ways to +ensure that nbdkit exits when you want see L and +L. + +=head1 EXAMPLES + + nbdkit --filter=exitwhen memory 1G exit-when-file-created=/tmp/stop + +nbdkit will run normally until something creates F, +whereupon nbdkit will refuse new connections and exit as soon as the +last client has disconnected. If F exists before nbdkit +starts, it will exit immediately. + + nbdkit --filter=exitwhen memory 1G exit-when-process-exits=1234 + +nbdkit will exit gracefully when PID 1234 exits and all connections +close. If you want to exit when the parent process of nbdkit exits, +consider using the I<--exit-with-parent> flag instead. + +=head1 PARAMETERS + +You can define multiple C events on the command line: +nbdkit will exit if any of the events happens. If there are no +C events then the filter does nothing. + +=over 4 + +=item BFILENAME + +=item BFILENAME + +Exit when the named file is created or deleted. + +=item BFD + +The read end of a L is passed to nbdkit in the given file +descriptor number. Exit when the pipe is closed. The filter does not +read any data from the pipe. + +For an example of how to use this parameter, see: +L + +=item BPID + +Exit when process ID C exits. + +Note there is a small race between passing the process ID to the +filter and the filter checking it for the first time. During this +window the original PID might exit and an unrelated program might get +the same PID, thus holding nbdkit open for longer than wanted. The +pipe method above is more reliable if you are able to modify the other +process. + +=item BSCRIPTB<"> + +Create a custom event using the script or command C