annotate make/autoconf/lib-bundled.m4 @ 49578:7c82bb507446

8190333: sun/security/ssl/X509KeyManager/PreferredKey.java failed with "Failed to get the preferable key aliases" Reviewed-by: mullan
author amjiang
date Tue, 10 Apr 2018 18:16:12 -0700
parents d018e76655fb
children 28094715ae71
rev   line source
erikj@13133 1 #
ihse@43383 2 # Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
erikj@13133 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
erikj@13133 4 #
erikj@13133 5 # This code is free software; you can redistribute it and/or modify it
erikj@13133 6 # under the terms of the GNU General Public License version 2 only, as
erikj@13133 7 # published by the Free Software Foundation. Oracle designates this
erikj@13133 8 # particular file as subject to the "Classpath" exception as provided
erikj@13133 9 # by Oracle in the LICENSE file that accompanied this code.
erikj@13133 10 #
erikj@13133 11 # This code is distributed in the hope that it will be useful, but WITHOUT
erikj@13133 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
erikj@13133 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
erikj@13133 14 # version 2 for more details (a copy is included in the LICENSE file that
erikj@13133 15 # accompanied this code).
erikj@13133 16 #
erikj@13133 17 # You should have received a copy of the GNU General Public License version
erikj@13133 18 # 2 along with this work; if not, write to the Free Software Foundation,
erikj@13133 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
erikj@13133 20 #
erikj@13133 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
erikj@13133 22 # or visit www.oracle.com if you need additional information or have any
erikj@13133 23 # questions.
erikj@13133 24 #
erikj@13133 25
ihse@32921 26 ################################################################################
ihse@32921 27 # Setup bundled libraries.
ihse@32921 28 #
ihse@32921 29 # For libjpeg, giflib, libpng, lcms2 and zlib, the source is present in the
ihse@32921 30 # OpenJDK repository. Default is to use these libraries as bundled, but they
ihse@32921 31 # might be replaced by en external version by the user.
ihse@32921 32 ################################################################################
ihse@32921 33 AC_DEFUN_ONCE([LIB_SETUP_BUNDLED_LIBS],
erikj@13133 34 [
ihse@32921 35 LIB_SETUP_LIBJPEG
ihse@32921 36 LIB_SETUP_GIFLIB
ihse@32921 37 LIB_SETUP_LIBPNG
ihse@32921 38 LIB_SETUP_ZLIB
ihse@32921 39 LIB_SETUP_LCMS
erikj@13133 40 ])
erikj@13133 41
ihse@32921 42 ################################################################################
ihse@32921 43 # Setup libjpeg
ihse@32921 44 ################################################################################
ihse@32921 45 AC_DEFUN_ONCE([LIB_SETUP_LIBJPEG],
erikj@13133 46 [
omajid@25035 47 AC_ARG_WITH(libjpeg, [AS_HELP_STRING([--with-libjpeg],
omajid@25035 48 [use libjpeg from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
omajid@25035 49
omajid@25035 50 AC_MSG_CHECKING([for which libjpeg to use])
omajid@25035 51 # default is bundled
omajid@25035 52 DEFAULT_LIBJPEG=bundled
omajid@25035 53 # if user didn't specify, use DEFAULT_LIBJPEG
omajid@25035 54 if test "x${with_libjpeg}" = "x"; then
omajid@25035 55 with_libjpeg=${DEFAULT_LIBJPEG}
omajid@25035 56 fi
omajid@25035 57 AC_MSG_RESULT(${with_libjpeg})
omajid@25035 58
omajid@25035 59 if test "x${with_libjpeg}" = "xbundled"; then
omajid@25035 60 USE_EXTERNAL_LIBJPEG=false
omajid@25035 61 elif test "x${with_libjpeg}" = "xsystem"; then
omajid@25035 62 AC_CHECK_HEADER(jpeglib.h, [],
omajid@25035 63 [ AC_MSG_ERROR([--with-libjpeg=system specified, but jpeglib.h not found!])])
omajid@25035 64 AC_CHECK_LIB(jpeg, jpeg_CreateDecompress, [],
omajid@25035 65 [ AC_MSG_ERROR([--with-libjpeg=system specified, but no libjpeg found])])
omajid@25035 66
omajid@25035 67 USE_EXTERNAL_LIBJPEG=true
omajid@25035 68 else
omajid@25035 69 AC_MSG_ERROR([Invalid use of --with-libjpeg: ${with_libjpeg}, use 'system' or 'bundled'])
omajid@25035 70 fi
omajid@25035 71
ihse@20363 72 AC_SUBST(USE_EXTERNAL_LIBJPEG)
ihse@32921 73 ])
erikj@13133 74
ihse@32921 75 ################################################################################
ihse@32921 76 # Setup giflib
ihse@32921 77 ################################################################################
ihse@32921 78 AC_DEFUN_ONCE([LIB_SETUP_GIFLIB],
ihse@32921 79 [
ihse@20363 80 AC_ARG_WITH(giflib, [AS_HELP_STRING([--with-giflib],
ihse@20363 81 [use giflib from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
omajid@16424 82
ihse@20363 83 AC_MSG_CHECKING([for which giflib to use])
ihse@20363 84 # default is bundled
ihse@20363 85 DEFAULT_GIFLIB=bundled
ihse@20363 86 # if user didn't specify, use DEFAULT_GIFLIB
ihse@20363 87 if test "x${with_giflib}" = "x"; then
omajid@16424 88 with_giflib=${DEFAULT_GIFLIB}
ihse@20363 89 fi
ihse@20363 90 AC_MSG_RESULT(${with_giflib})
omajid@16424 91
ihse@20363 92 if test "x${with_giflib}" = "xbundled"; then
omajid@16424 93 USE_EXTERNAL_LIBGIF=false
ihse@20363 94 elif test "x${with_giflib}" = "xsystem"; then
omajid@16424 95 AC_CHECK_HEADER(gif_lib.h, [],
ihse@20363 96 [ AC_MSG_ERROR([--with-giflib=system specified, but gif_lib.h not found!])])
omajid@16424 97 AC_CHECK_LIB(gif, DGifGetCode, [],
ihse@20363 98 [ AC_MSG_ERROR([--with-giflib=system specified, but no giflib found!])])
omajid@16424 99
omajid@16424 100 USE_EXTERNAL_LIBGIF=true
ihse@20363 101 else
omajid@16424 102 AC_MSG_ERROR([Invalid value of --with-giflib: ${with_giflib}, use 'system' or 'bundled'])
ihse@20363 103 fi
ihse@32921 104
ihse@20363 105 AC_SUBST(USE_EXTERNAL_LIBGIF)
ihse@32921 106 ])
erikj@13133 107
ihse@32921 108 ################################################################################
ihse@32921 109 # Setup libpng
ihse@32921 110 ################################################################################
ihse@32921 111 AC_DEFUN_ONCE([LIB_SETUP_LIBPNG],
ihse@32921 112 [
omajid@23163 113 AC_ARG_WITH(libpng, [AS_HELP_STRING([--with-libpng],
omajid@23163 114 [use libpng from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
omajid@23163 115
ihse@48056 116 PKG_CHECK_MODULES(PNG, libpng, [LIBPNG_FOUND=yes], [LIBPNG_FOUND=no])
omajid@23163 117 AC_MSG_CHECKING([for which libpng to use])
omajid@23163 118
omajid@23163 119 # default is bundled
omajid@23163 120 DEFAULT_LIBPNG=bundled
omajid@23163 121 # if user didn't specify, use DEFAULT_LIBPNG
omajid@23163 122 if test "x${with_libpng}" = "x"; then
ihse@43383 123 with_libpng=${DEFAULT_LIBPNG}
omajid@23163 124 fi
omajid@23163 125
omajid@23163 126 if test "x${with_libpng}" = "xbundled"; then
ihse@43383 127 USE_EXTERNAL_LIBPNG=false
ihse@43383 128 PNG_CFLAGS=""
ihse@43383 129 PNG_LIBS=""
ihse@43383 130 AC_MSG_RESULT([bundled])
omajid@23163 131 elif test "x${with_libpng}" = "xsystem"; then
ihse@43383 132 if test "x${LIBPNG_FOUND}" = "xyes"; then
ihse@43383 133 # PKG_CHECK_MODULES will set PNG_CFLAGS and PNG_LIBS
ihse@43383 134 USE_EXTERNAL_LIBPNG=true
ihse@43383 135 AC_MSG_RESULT([system])
ihse@43383 136 else
ihse@43383 137 AC_MSG_RESULT([system not found])
ihse@43383 138 AC_MSG_ERROR([--with-libpng=system specified, but no libpng found!])
ihse@43383 139 fi
omajid@23163 140 else
ihse@43383 141 AC_MSG_ERROR([Invalid value of --with-libpng: ${with_libpng}, use 'system' or 'bundled'])
omajid@23163 142 fi
ihse@32921 143
omajid@23163 144 AC_SUBST(USE_EXTERNAL_LIBPNG)
ihse@43383 145 AC_SUBST(PNG_CFLAGS)
ihse@43383 146 AC_SUBST(PNG_LIBS)
ihse@32921 147 ])
omajid@23163 148
ihse@32921 149 ################################################################################
ihse@32921 150 # Setup zlib
ihse@32921 151 ################################################################################
ihse@32921 152 AC_DEFUN_ONCE([LIB_SETUP_ZLIB],
ihse@32921 153 [
ihse@20363 154 AC_ARG_WITH(zlib, [AS_HELP_STRING([--with-zlib],
ihse@20363 155 [use zlib from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
erikj@13133 156
ihse@20363 157 AC_CHECK_LIB(z, compress,
ihse@20363 158 [ ZLIB_FOUND=yes ],
ihse@20363 159 [ ZLIB_FOUND=no ])
erikj@13133 160
ihse@20363 161 AC_MSG_CHECKING([for which zlib to use])
erikj@13133 162
sherman@36546 163 DEFAULT_ZLIB=system
sherman@36546 164 if test "x$OPENJDK_TARGET_OS" = xwindows; then
sherman@36546 165 # On windows default is bundled...on others default is system
sherman@36546 166 DEFAULT_ZLIB=bundled
ihse@20363 167 fi
erikj@13133 168
ihse@20363 169 if test "x${ZLIB_FOUND}" != "xyes"; then
ihse@20363 170 # If we don't find any system...set default to bundled
erikj@13133 171 DEFAULT_ZLIB=bundled
ihse@20363 172 fi
erikj@13133 173
ihse@20363 174 # If user didn't specify, use DEFAULT_ZLIB
ihse@20363 175 if test "x${with_zlib}" = "x"; then
erikj@13133 176 with_zlib=${DEFAULT_ZLIB}
ihse@20363 177 fi
erikj@13133 178
ihse@20363 179 if test "x${with_zlib}" = "xbundled"; then
erikj@13133 180 USE_EXTERNAL_LIBZ=false
erikj@13133 181 AC_MSG_RESULT([bundled])
ihse@20363 182 elif test "x${with_zlib}" = "xsystem"; then
erikj@13133 183 if test "x${ZLIB_FOUND}" = "xyes"; then
ihse@20363 184 USE_EXTERNAL_LIBZ=true
ihse@20363 185 AC_MSG_RESULT([system])
ihse@48056 186
ihse@48056 187 if test "x$USE_EXTERNAL_LIBPNG" != "xtrue"; then
ihse@48056 188 # If we use bundled libpng, we must verify that we have a proper zlib.
ihse@48056 189 # For instance zlib-ng has had issues with inflateValidate().
ihse@48056 190 AC_MSG_CHECKING([for system zlib functionality])
ihse@48056 191 AC_COMPILE_IFELSE(
ihse@48056 192 [AC_LANG_PROGRAM([#include "zlib.h"], [
ihse@48056 193 #if ZLIB_VERNUM >= 0x1281
ihse@48056 194 inflateValidate(NULL, 0);
ihse@48056 195 #endif
ihse@48056 196 ])],
ihse@48056 197 [AC_MSG_RESULT([ok])],
ihse@48056 198 [
ihse@48056 199 AC_MSG_RESULT([not ok])
ihse@48056 200 AC_MSG_ERROR([System zlib not working correctly])
ihse@48056 201 ]
ihse@48056 202 )
ihse@48056 203 fi
erikj@13133 204 else
ihse@20363 205 AC_MSG_RESULT([system not found])
ihse@20363 206 AC_MSG_ERROR([--with-zlib=system specified, but no zlib found!])
erikj@13133 207 fi
ihse@20363 208 else
ihse@20363 209 AC_MSG_ERROR([Invalid value for --with-zlib: ${with_zlib}, use 'system' or 'bundled'])
ihse@20363 210 fi
erikj@13133 211
erikj@48759 212 LIBZ_CFLAGS=""
erikj@48759 213 LIBZ_LIBS=""
erikj@48754 214 if test "x$USE_EXTERNAL_LIBZ" = "xfalse"; then
erikj@48752 215 LIBZ_CFLAGS="$LIBZ_CFLAGS -I$TOPDIR/src/java.base/share/native/libzip/zlib"
erikj@48752 216 else
erikj@48752 217 LIBZ_LIBS="-lz"
erikj@48752 218 fi
erikj@48752 219
ihse@20363 220 AC_SUBST(USE_EXTERNAL_LIBZ)
erikj@48752 221 AC_SUBST(LIBZ_CFLAGS)
erikj@48752 222 AC_SUBST(LIBZ_LIBS)
ihse@32921 223 ])
erikj@13133 224
ihse@32921 225 ################################################################################
ihse@32921 226 # Setup lcms (Little CMS)
ihse@32921 227 ################################################################################
ihse@32921 228 AC_DEFUN_ONCE([LIB_SETUP_LCMS],
ihse@32921 229 [
ihse@32921 230 AC_ARG_WITH(lcms, [AS_HELP_STRING([--with-lcms],
ihse@32921 231 [use lcms2 from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
ohair@13697 232
ihse@32921 233 AC_MSG_CHECKING([for which lcms to use])
erikj@13133 234
ihse@32921 235 DEFAULT_LCMS=bundled
ihse@32921 236 # If user didn't specify, use DEFAULT_LCMS
ihse@32921 237 if test "x${with_lcms}" = "x"; then
ihse@43383 238 with_lcms=${DEFAULT_LCMS}
ihse@20363 239 fi
erikj@13133 240
ihse@32921 241 if test "x${with_lcms}" = "xbundled"; then
ihse@32921 242 USE_EXTERNAL_LCMS=false
ihse@43383 243 LCMS_CFLAGS=""
ihse@43383 244 LCMS_LIBS=""
ihse@32921 245 AC_MSG_RESULT([bundled])
ihse@32921 246 elif test "x${with_lcms}" = "xsystem"; then
ihse@32921 247 AC_MSG_RESULT([system])
ihse@32921 248 PKG_CHECK_MODULES([LCMS], [lcms2], [LCMS_FOUND=yes], [LCMS_FOUND=no])
ihse@32921 249 if test "x${LCMS_FOUND}" = "xyes"; then
ihse@43383 250 # PKG_CHECK_MODULES will set LCMS_CFLAGS and LCMS_LIBS
ihse@32921 251 USE_EXTERNAL_LCMS=true
ihse@32921 252 else
ihse@32921 253 AC_MSG_ERROR([--with-lcms=system specified, but no lcms found!])
erikj@13133 254 fi
ihse@32921 255 else
ihse@32921 256 AC_MSG_ERROR([Invalid value for --with-lcms: ${with_lcms}, use 'system' or 'bundled'])
ihse@20363 257 fi
omajid@16581 258
ihse@32921 259 AC_SUBST(USE_EXTERNAL_LCMS)
ihse@43383 260 AC_SUBST(LCMS_CFLAGS)
ihse@43383 261 AC_SUBST(LCMS_LIBS)
erikj@13133 262 ])