make/autoconf/lib-bundled.m4
changeset 48056 ee64cb4455a9
parent 47216 71c04702a3d5
child 48751 54f355e65415
equal deleted inserted replaced
48055:14cd5bd01d81 48056:ee64cb4455a9
   111 AC_DEFUN_ONCE([LIB_SETUP_LIBPNG],
   111 AC_DEFUN_ONCE([LIB_SETUP_LIBPNG],
   112 [
   112 [
   113   AC_ARG_WITH(libpng, [AS_HELP_STRING([--with-libpng],
   113   AC_ARG_WITH(libpng, [AS_HELP_STRING([--with-libpng],
   114      [use libpng from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
   114      [use libpng from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
   115 
   115 
       
   116   PKG_CHECK_MODULES(PNG, libpng, [LIBPNG_FOUND=yes], [LIBPNG_FOUND=no])
   116   AC_MSG_CHECKING([for which libpng to use])
   117   AC_MSG_CHECKING([for which libpng to use])
   117 
   118 
   118   # default is bundled
   119   # default is bundled
   119   DEFAULT_LIBPNG=bundled
   120   DEFAULT_LIBPNG=bundled
   120   # if user didn't specify, use DEFAULT_LIBPNG
   121   # if user didn't specify, use DEFAULT_LIBPNG
   126     USE_EXTERNAL_LIBPNG=false
   127     USE_EXTERNAL_LIBPNG=false
   127     PNG_CFLAGS=""
   128     PNG_CFLAGS=""
   128     PNG_LIBS=""
   129     PNG_LIBS=""
   129     AC_MSG_RESULT([bundled])
   130     AC_MSG_RESULT([bundled])
   130   elif test "x${with_libpng}" = "xsystem"; then
   131   elif test "x${with_libpng}" = "xsystem"; then
   131     PKG_CHECK_MODULES(PNG, libpng, [LIBPNG_FOUND=yes], [LIBPNG_FOUND=no])
       
   132     if test "x${LIBPNG_FOUND}" = "xyes"; then
   132     if test "x${LIBPNG_FOUND}" = "xyes"; then
   133       # PKG_CHECK_MODULES will set PNG_CFLAGS and PNG_LIBS
   133       # PKG_CHECK_MODULES will set PNG_CFLAGS and PNG_LIBS
   134       USE_EXTERNAL_LIBPNG=true
   134       USE_EXTERNAL_LIBPNG=true
   135       AC_MSG_RESULT([system])
   135       AC_MSG_RESULT([system])
   136     else
   136     else
   181     AC_MSG_RESULT([bundled])
   181     AC_MSG_RESULT([bundled])
   182   elif test "x${with_zlib}" = "xsystem"; then
   182   elif test "x${with_zlib}" = "xsystem"; then
   183     if test "x${ZLIB_FOUND}" = "xyes"; then
   183     if test "x${ZLIB_FOUND}" = "xyes"; then
   184       USE_EXTERNAL_LIBZ=true
   184       USE_EXTERNAL_LIBZ=true
   185       AC_MSG_RESULT([system])
   185       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
   186     else
   204     else
   187       AC_MSG_RESULT([system not found])
   205       AC_MSG_RESULT([system not found])
   188       AC_MSG_ERROR([--with-zlib=system specified, but no zlib found!])
   206       AC_MSG_ERROR([--with-zlib=system specified, but no zlib found!])
   189     fi
   207     fi
   190   else
   208   else