mirror of
https://github.com/libarchive/libarchive.git
synced 2026-01-18 17:11:25 +01:00
cmake: look for zlib >= 1.2.1 (#2318)
zlib 1.2.0 added this improvement for inflate: "Raw inflate no longer needs an extra dummy byte at end" libarchive does not feed zlib extra data beyond end of stream, so it does not work with zlib < 1.2.0.
This commit is contained in:
committed by
GitHub
parent
853bf656ef
commit
6df5cb464b
@@ -443,7 +443,10 @@ SET(ADDITIONAL_LIBS "")
|
||||
# Find ZLIB
|
||||
#
|
||||
IF(ENABLE_ZLIB)
|
||||
FIND_PACKAGE(ZLIB)
|
||||
# Require zlib >= 1.2.1, see: https://github.com/libarchive/libarchive/issues/615
|
||||
# zlib 1.2.0 should also work, but it is difficult to test for. Let's require
|
||||
# zlib >= 1.2.1 for consistency with the autoconf build.
|
||||
FIND_PACKAGE(ZLIB 1.2.1 REQUIRED)
|
||||
ELSE()
|
||||
SET(ZLIB_FOUND FALSE) # Override cached value
|
||||
ENDIF()
|
||||
|
||||
19
configure.ac
19
configure.ac
@@ -380,8 +380,23 @@ AC_ARG_WITH([zlib],
|
||||
AS_HELP_STRING([--without-zlib], [Don't build support for gzip through zlib]))
|
||||
|
||||
if test "x$with_zlib" != "xno"; then
|
||||
AC_CHECK_HEADERS([zlib.h])
|
||||
AC_CHECK_LIB(z,inflate)
|
||||
old_LIBS="$LIBS"
|
||||
LIBS="$LIBS -lz"
|
||||
AC_LINK_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <zlib.h>
|
||||
#if !defined(ZLIB_VERNUM)
|
||||
// zlib 1.2.0 should work too, but it's difficult to test for.
|
||||
// zlib 1.2.1 onwards have ZLIB_VERNUM, which is easy to check.
|
||||
#error zlib >= 1.2.1 is required.
|
||||
#endif
|
||||
// Check that there's an inflate function.
|
||||
int main(int argc, char **argv) { inflate(NULL, 0); return 0; }
|
||||
]])],
|
||||
[AC_DEFINE([HAVE_ZLIB_H], [1], [Define to 1 if you have zlib >= 1.2.1])
|
||||
AC_MSG_RESULT([found a suitable version of zlib (>= 1.2.1)])
|
||||
],
|
||||
[AC_MSG_RESULT([could not find a suitable version of zlib (>= 1.2.1)])
|
||||
LIBS="$old_LIBS"])
|
||||
fi
|
||||
|
||||
AC_ARG_WITH([bz2lib],
|
||||
|
||||
Reference in New Issue
Block a user