2 * Copyright (c) 2009-2012,2014 Michihiro NAKAJIMA
3 * Copyright (c) 2003-2007 Tim Kientzle
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 #include "archive_platform.h"
28 __FBSDID("$FreeBSD$");
53 #include "archive_private.h"
54 #include "archive_string.h"
57 archive_version_details(void)
59 static struct archive_string str;
61 const char *zlib = archive_zlib_version();
62 const char *liblzma = archive_liblzma_version();
63 const char *bzlib = archive_bzlib_version();
64 const char *liblz4 = archive_liblz4_version();
65 const char *libzstd = archive_libzstd_version();
68 archive_string_init(&str);
70 archive_strcat(&str, ARCHIVE_VERSION_STRING);
72 archive_strcat(&str, " zlib/");
73 archive_strcat(&str, zlib);
76 archive_strcat(&str, " liblzma/");
77 archive_strcat(&str, liblzma);
80 const char *p = bzlib;
81 const char *sep = strchr(p, ',');
84 archive_strcat(&str, " bz2lib/");
85 archive_strncat(&str, p, sep - p);
88 archive_strcat(&str, " liblz4/");
89 archive_strcat(&str, liblz4);
92 archive_strcat(&str, " libzstd/");
93 archive_strcat(&str, libzstd);
100 archive_zlib_version(void)
110 archive_liblzma_version(void)
113 return LZMA_VERSION_STRING;
120 archive_bzlib_version(void)
123 return BZ2_bzlibVersion();
130 archive_liblz4_version(void)
132 #if defined(HAVE_LZ4_H) && defined(HAVE_LIBLZ4)
134 #define NUMBER(x) str(x)
135 return NUMBER(LZ4_VERSION_MAJOR) "." NUMBER(LZ4_VERSION_MINOR) "." NUMBER(LZ4_VERSION_RELEASE);
144 archive_libzstd_version(void)
146 #if HAVE_ZSTD_H && HAVE_LIBZSTD
147 return ZSTD_VERSION_STRING;