Skip to content

Commit ee079d1

Browse files
author
ihse
committed
8175795: configure should verify that system zlib contains needed functionality
Reviewed-by: erikj
1 parent 1edf2d6 commit ee079d1

File tree

2 files changed

+71
-19
lines changed

2 files changed

+71
-19
lines changed

make/autoconf/generated-configure.sh

+52-18
Original file line numberDiff line numberDiff line change
@@ -5159,7 +5159,7 @@ VS_SDK_PLATFORM_NAME_2013=
51595159
#CUSTOM_AUTOCONF_INCLUDE
51605160

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

51645164
###############################################################################
51655165
#
@@ -66263,23 +66263,6 @@ if test "${with_libpng+set}" = set; then :
6626366263
fi
6626466264

6626566265

66266-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for which libpng to use" >&5
66267-
$as_echo_n "checking for which libpng to use... " >&6; }
66268-
66269-
# default is bundled
66270-
DEFAULT_LIBPNG=bundled
66271-
# if user didn't specify, use DEFAULT_LIBPNG
66272-
if test "x${with_libpng}" = "x"; then
66273-
with_libpng=${DEFAULT_LIBPNG}
66274-
fi
66275-
66276-
if test "x${with_libpng}" = "xbundled"; then
66277-
USE_EXTERNAL_LIBPNG=false
66278-
PNG_CFLAGS=""
66279-
PNG_LIBS=""
66280-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: bundled" >&5
66281-
$as_echo "bundled" >&6; }
66282-
elif test "x${with_libpng}" = "xsystem"; then
6628366266

6628466267
pkg_failed=no
6628566268
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PNG" >&5
@@ -66347,6 +66330,23 @@ else
6634766330
$as_echo "yes" >&6; }
6634866331
LIBPNG_FOUND=yes
6634966332
fi
66333+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for which libpng to use" >&5
66334+
$as_echo_n "checking for which libpng to use... " >&6; }
66335+
66336+
# default is bundled
66337+
DEFAULT_LIBPNG=bundled
66338+
# if user didn't specify, use DEFAULT_LIBPNG
66339+
if test "x${with_libpng}" = "x"; then
66340+
with_libpng=${DEFAULT_LIBPNG}
66341+
fi
66342+
66343+
if test "x${with_libpng}" = "xbundled"; then
66344+
USE_EXTERNAL_LIBPNG=false
66345+
PNG_CFLAGS=""
66346+
PNG_LIBS=""
66347+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: bundled" >&5
66348+
$as_echo "bundled" >&6; }
66349+
elif test "x${with_libpng}" = "xsystem"; then
6635066350
if test "x${LIBPNG_FOUND}" = "xyes"; then
6635166351
# PKG_CHECK_MODULES will set PNG_CFLAGS and PNG_LIBS
6635266352
USE_EXTERNAL_LIBPNG=true
@@ -66444,6 +66444,40 @@ $as_echo "bundled" >&6; }
6644466444
USE_EXTERNAL_LIBZ=true
6644566445
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: system" >&5
6644666446
$as_echo "system" >&6; }
66447+
66448+
if test "x$USE_EXTERNAL_LIBPNG" != "xtrue"; then
66449+
# If we use bundled libpng, we must verify that we have a proper zlib.
66450+
# For instance zlib-ng has had issues with inflateValidate().
66451+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for system zlib functionality" >&5
66452+
$as_echo_n "checking for system zlib functionality... " >&6; }
66453+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
66454+
/* end confdefs.h. */
66455+
#include "zlib.h"
66456+
int
66457+
main ()
66458+
{
66459+
66460+
#if ZLIB_VERNUM >= 0x1281
66461+
inflateValidate(NULL, 0);
66462+
#endif
66463+
66464+
;
66465+
return 0;
66466+
}
66467+
_ACEOF
66468+
if ac_fn_cxx_try_compile "$LINENO"; then :
66469+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
66470+
$as_echo "ok" >&6; }
66471+
else
66472+
66473+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not ok" >&5
66474+
$as_echo "not ok" >&6; }
66475+
as_fn_error $? "System zlib not working correctly" "$LINENO" 5
66476+
66477+
66478+
fi
66479+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
66480+
fi
6644766481
else
6644866482
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: system not found" >&5
6644966483
$as_echo "system not found" >&6; }

make/autoconf/lib-bundled.m4

+19-1
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ AC_DEFUN_ONCE([LIB_SETUP_LIBPNG],
113113
AC_ARG_WITH(libpng, [AS_HELP_STRING([--with-libpng],
114114
[use libpng from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
115115
116+
PKG_CHECK_MODULES(PNG, libpng, [LIBPNG_FOUND=yes], [LIBPNG_FOUND=no])
116117
AC_MSG_CHECKING([for which libpng to use])
117118
118119
# default is bundled
@@ -128,7 +129,6 @@ AC_DEFUN_ONCE([LIB_SETUP_LIBPNG],
128129
PNG_LIBS=""
129130
AC_MSG_RESULT([bundled])
130131
elif test "x${with_libpng}" = "xsystem"; then
131-
PKG_CHECK_MODULES(PNG, libpng, [LIBPNG_FOUND=yes], [LIBPNG_FOUND=no])
132132
if test "x${LIBPNG_FOUND}" = "xyes"; then
133133
# PKG_CHECK_MODULES will set PNG_CFLAGS and PNG_LIBS
134134
USE_EXTERNAL_LIBPNG=true
@@ -183,6 +183,24 @@ AC_DEFUN_ONCE([LIB_SETUP_ZLIB],
183183
if test "x${ZLIB_FOUND}" = "xyes"; then
184184
USE_EXTERNAL_LIBZ=true
185185
AC_MSG_RESULT([system])
186+
187+
if test "x$USE_EXTERNAL_LIBPNG" != "xtrue"; then
188+
# If we use bundled libpng, we must verify that we have a proper zlib.
189+
# For instance zlib-ng has had issues with inflateValidate().
190+
AC_MSG_CHECKING([for system zlib functionality])
191+
AC_COMPILE_IFELSE(
192+
[AC_LANG_PROGRAM([#include "zlib.h"], [
193+
#if ZLIB_VERNUM >= 0x1281
194+
inflateValidate(NULL, 0);
195+
#endif
196+
])],
197+
[AC_MSG_RESULT([ok])],
198+
[
199+
AC_MSG_RESULT([not ok])
200+
AC_MSG_ERROR([System zlib not working correctly])
201+
]
202+
)
203+
fi
186204
else
187205
AC_MSG_RESULT([system not found])
188206
AC_MSG_ERROR([--with-zlib=system specified, but no zlib found!])

0 commit comments

Comments
 (0)