Skip to content

Commit

Permalink
8175795: configure should verify that system zlib contains needed fun…
Browse files Browse the repository at this point in the history
…ctionality

Reviewed-by: erikj
  • Loading branch information
ihse committed Dec 4, 2017
1 parent 5b835ea commit fcfa246
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 19 deletions.
70 changes: 52 additions & 18 deletions make/autoconf/generated-configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5159,7 +5159,7 @@ VS_SDK_PLATFORM_NAME_2013=
#CUSTOM_AUTOCONF_INCLUDE

# Do not change or remove the following line, it is needed for consistency checks:
DATE_WHEN_GENERATED=1512085548
DATE_WHEN_GENERATED=1512410983

###############################################################################
#
Expand Down Expand Up @@ -66263,23 +66263,6 @@ if test "${with_libpng+set}" = set; then :
fi


{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for which libpng to use" >&5
$as_echo_n "checking for which libpng to use... " >&6; }

# default is bundled
DEFAULT_LIBPNG=bundled
# if user didn't specify, use DEFAULT_LIBPNG
if test "x${with_libpng}" = "x"; then
with_libpng=${DEFAULT_LIBPNG}
fi

if test "x${with_libpng}" = "xbundled"; then
USE_EXTERNAL_LIBPNG=false
PNG_CFLAGS=""
PNG_LIBS=""
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: bundled" >&5
$as_echo "bundled" >&6; }
elif test "x${with_libpng}" = "xsystem"; then

pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PNG" >&5
Expand Down Expand Up @@ -66347,6 +66330,23 @@ else
$as_echo "yes" >&6; }
LIBPNG_FOUND=yes
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for which libpng to use" >&5
$as_echo_n "checking for which libpng to use... " >&6; }

# default is bundled
DEFAULT_LIBPNG=bundled
# if user didn't specify, use DEFAULT_LIBPNG
if test "x${with_libpng}" = "x"; then
with_libpng=${DEFAULT_LIBPNG}
fi

if test "x${with_libpng}" = "xbundled"; then
USE_EXTERNAL_LIBPNG=false
PNG_CFLAGS=""
PNG_LIBS=""
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: bundled" >&5
$as_echo "bundled" >&6; }
elif test "x${with_libpng}" = "xsystem"; then
if test "x${LIBPNG_FOUND}" = "xyes"; then
# PKG_CHECK_MODULES will set PNG_CFLAGS and PNG_LIBS
USE_EXTERNAL_LIBPNG=true
Expand Down Expand Up @@ -66444,6 +66444,40 @@ $as_echo "bundled" >&6; }
USE_EXTERNAL_LIBZ=true
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: system" >&5
$as_echo "system" >&6; }

if test "x$USE_EXTERNAL_LIBPNG" != "xtrue"; then
# If we use bundled libpng, we must verify that we have a proper zlib.
# For instance zlib-ng has had issues with inflateValidate().
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for system zlib functionality" >&5
$as_echo_n "checking for system zlib functionality... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include "zlib.h"
int
main ()
{

#if ZLIB_VERNUM >= 0x1281
inflateValidate(NULL, 0);
#endif

;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
$as_echo "ok" >&6; }
else

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not ok" >&5
$as_echo "not ok" >&6; }
as_fn_error $? "System zlib not working correctly" "$LINENO" 5


fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: system not found" >&5
$as_echo "system not found" >&6; }
Expand Down
20 changes: 19 additions & 1 deletion make/autoconf/lib-bundled.m4
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ AC_DEFUN_ONCE([LIB_SETUP_LIBPNG],
AC_ARG_WITH(libpng, [AS_HELP_STRING([--with-libpng],
[use libpng from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
PKG_CHECK_MODULES(PNG, libpng, [LIBPNG_FOUND=yes], [LIBPNG_FOUND=no])
AC_MSG_CHECKING([for which libpng to use])
# default is bundled
Expand All @@ -128,7 +129,6 @@ AC_DEFUN_ONCE([LIB_SETUP_LIBPNG],
PNG_LIBS=""
AC_MSG_RESULT([bundled])
elif test "x${with_libpng}" = "xsystem"; then
PKG_CHECK_MODULES(PNG, libpng, [LIBPNG_FOUND=yes], [LIBPNG_FOUND=no])
if test "x${LIBPNG_FOUND}" = "xyes"; then
# PKG_CHECK_MODULES will set PNG_CFLAGS and PNG_LIBS
USE_EXTERNAL_LIBPNG=true
Expand Down Expand Up @@ -183,6 +183,24 @@ AC_DEFUN_ONCE([LIB_SETUP_ZLIB],
if test "x${ZLIB_FOUND}" = "xyes"; then
USE_EXTERNAL_LIBZ=true
AC_MSG_RESULT([system])
if test "x$USE_EXTERNAL_LIBPNG" != "xtrue"; then
# If we use bundled libpng, we must verify that we have a proper zlib.
# For instance zlib-ng has had issues with inflateValidate().
AC_MSG_CHECKING([for system zlib functionality])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include "zlib.h"], [
#if ZLIB_VERNUM >= 0x1281
inflateValidate(NULL, 0);
#endif
])],
[AC_MSG_RESULT([ok])],
[
AC_MSG_RESULT([not ok])
AC_MSG_ERROR([System zlib not working correctly])
]
)
fi
else
AC_MSG_RESULT([system not found])
AC_MSG_ERROR([--with-zlib=system specified, but no zlib found!])
Expand Down

0 comments on commit fcfa246

Please sign in to comment.