1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354
|
#
# Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
################################################################################
# Setup bundled libraries.
#
# For libjpeg, giflib, libpng, lcms2 and zlib the source is present in the
# OpenJDK repository (referred to as "bundled"). Default is to use libjpeg,
# giflib, libpng and lcms2 libraries as "bundled". The default for zlib is
# to use the bundled zlib on Windows and AIX, otherwise the external ("system")
# zlib, if present. However the libs may be replaced by an external ("system")
# version by the user.
################################################################################
AC_DEFUN_ONCE([LIB_SETUP_BUNDLED_LIBS],
[
LIB_SETUP_LIBJPEG
LIB_SETUP_GIFLIB
LIB_SETUP_LIBPNG
LIB_SETUP_ZLIB
LIB_SETUP_LCMS
LIB_SETUP_HARFBUZZ
LIB_SETUP_PCSCLITE
])
################################################################################
# Setup libjpeg
################################################################################
AC_DEFUN_ONCE([LIB_SETUP_LIBJPEG],
[
AC_ARG_WITH(libjpeg, [AS_HELP_STRING([--with-libjpeg],
[use libjpeg from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
AC_MSG_CHECKING([for which libjpeg to use])
# default is bundled
DEFAULT_LIBJPEG=bundled
# if user didn't specify, use DEFAULT_LIBJPEG
if test "x${with_libjpeg}" = "x"; then
with_libjpeg=${DEFAULT_LIBJPEG}
fi
AC_MSG_RESULT(${with_libjpeg})
if test "x${with_libjpeg}" = "xbundled"; then
USE_EXTERNAL_LIBJPEG=false
elif test "x${with_libjpeg}" = "xsystem"; then
AC_CHECK_HEADER(jpeglib.h, [],
[ AC_MSG_ERROR([--with-libjpeg=system specified, but jpeglib.h not found!])])
AC_CHECK_LIB(jpeg, jpeg_CreateDecompress, [],
[ AC_MSG_ERROR([--with-libjpeg=system specified, but no libjpeg found])])
USE_EXTERNAL_LIBJPEG=true
LIBJPEG_LIBS="-ljpeg"
else
AC_MSG_ERROR([Invalid use of --with-libjpeg: ${with_libjpeg}, use 'system' or 'bundled'])
fi
AC_SUBST(USE_EXTERNAL_LIBJPEG)
AC_SUBST(LIBJPEG_LIBS)
])
################################################################################
# Setup giflib
################################################################################
AC_DEFUN_ONCE([LIB_SETUP_GIFLIB],
[
AC_ARG_WITH(giflib, [AS_HELP_STRING([--with-giflib],
[use giflib from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
AC_MSG_CHECKING([for which giflib to use])
# default is bundled
DEFAULT_GIFLIB=bundled
# if user didn't specify, use DEFAULT_GIFLIB
if test "x${with_giflib}" = "x"; then
with_giflib=${DEFAULT_GIFLIB}
fi
AC_MSG_RESULT(${with_giflib})
if test "x${with_giflib}" = "xbundled"; then
USE_EXTERNAL_LIBGIF=false
elif test "x${with_giflib}" = "xsystem"; then
AC_CHECK_HEADER(gif_lib.h, [],
[ AC_MSG_ERROR([--with-giflib=system specified, but gif_lib.h not found!])])
AC_CHECK_LIB(gif, DGifGetCode, [],
[ AC_MSG_ERROR([--with-giflib=system specified, but no giflib found!])])
USE_EXTERNAL_LIBGIF=true
GIFLIB_LIBS=-lgif
else
AC_MSG_ERROR([Invalid value of --with-giflib: ${with_giflib}, use 'system' or 'bundled'])
fi
AC_SUBST(USE_EXTERNAL_LIBGIF)
AC_SUBST(GIFLIB_LIBS)
])
################################################################################
# Setup libpng
################################################################################
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
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=""
AC_MSG_RESULT([bundled])
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
AC_MSG_RESULT([system])
else
AC_MSG_RESULT([system not found])
AC_MSG_ERROR([--with-libpng=system specified, but no libpng found!])
fi
else
AC_MSG_ERROR([Invalid value of --with-libpng: ${with_libpng}, use 'system' or 'bundled'])
fi
AC_SUBST(USE_EXTERNAL_LIBPNG)
AC_SUBST(PNG_CFLAGS)
AC_SUBST(PNG_LIBS)
])
################################################################################
# Setup zlib
################################################################################
AC_DEFUN_ONCE([LIB_SETUP_ZLIB],
[
AC_ARG_WITH(zlib, [AS_HELP_STRING([--with-zlib],
[use zlib from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
AC_CHECK_LIB(z, compress,
[ ZLIB_FOUND=yes ],
[ ZLIB_FOUND=no ])
AC_MSG_CHECKING([for which zlib to use])
DEFAULT_ZLIB=system
if test "x$OPENJDK_TARGET_OS" = xwindows -o "x$OPENJDK_TARGET_OS" = xaix; then
# On windows and aix default is bundled
DEFAULT_ZLIB=bundled
elif test "x$OPENJDK_TARGET_OS" = xmacosx -a "x$OPENJDK_TARGET_CPU" = xaarch64; then
DEFAULT_ZLIB=bundled
fi
if test "x${ZLIB_FOUND}" != "xyes"; then
# If we don't find any system...set default to bundled
DEFAULT_ZLIB=bundled
fi
# If user didn't specify, use DEFAULT_ZLIB
if test "x${with_zlib}" = "x"; then
with_zlib=${DEFAULT_ZLIB}
fi
if test "x${with_zlib}" = "xbundled"; then
USE_EXTERNAL_LIBZ=false
AC_MSG_RESULT([bundled])
elif test "x${with_zlib}" = "xsystem"; then
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!])
fi
else
AC_MSG_ERROR([Invalid value for --with-zlib: ${with_zlib}, use 'system' or 'bundled'])
fi
LIBZ_CFLAGS=""
LIBZ_LIBS=""
if test "x$USE_EXTERNAL_LIBZ" = "xfalse"; then
LIBZ_CFLAGS="$LIBZ_CFLAGS -I$TOPDIR/src/java.base/share/native/libzip/zlib"
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
LIBZ_CFLAGS="$LIBZ_CFLAGS -DHAVE_UNISTD_H"
fi
else
LIBZ_LIBS="-lz"
fi
AC_SUBST(USE_EXTERNAL_LIBZ)
AC_SUBST(LIBZ_CFLAGS)
AC_SUBST(LIBZ_LIBS)
])
################################################################################
# Setup lcms (Little CMS)
################################################################################
AC_DEFUN_ONCE([LIB_SETUP_LCMS],
[
AC_ARG_WITH(lcms, [AS_HELP_STRING([--with-lcms],
[use lcms2 from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
AC_MSG_CHECKING([for which lcms to use])
DEFAULT_LCMS=bundled
# If user didn't specify, use DEFAULT_LCMS
if test "x${with_lcms}" = "x"; then
with_lcms=${DEFAULT_LCMS}
fi
if test "x${with_lcms}" = "xbundled"; then
USE_EXTERNAL_LCMS=false
LCMS_CFLAGS=""
LCMS_LIBS=""
AC_MSG_RESULT([bundled])
elif test "x${with_lcms}" = "xsystem"; then
AC_MSG_RESULT([system])
PKG_CHECK_MODULES([LCMS], [lcms2], [LCMS_FOUND=yes], [LCMS_FOUND=no])
if test "x${LCMS_FOUND}" = "xyes"; then
# PKG_CHECK_MODULES will set LCMS_CFLAGS and LCMS_LIBS
USE_EXTERNAL_LCMS=true
else
AC_MSG_ERROR([--with-lcms=system specified, but no lcms found!])
fi
else
AC_MSG_ERROR([Invalid value for --with-lcms: ${with_lcms}, use 'system' or 'bundled'])
fi
AC_SUBST(USE_EXTERNAL_LCMS)
AC_SUBST(LCMS_CFLAGS)
AC_SUBST(LCMS_LIBS)
])
################################################################################
# Setup harfbuzz
################################################################################
AC_DEFUN_ONCE([LIB_SETUP_HARFBUZZ],
[
AC_ARG_WITH(harfbuzz, [AS_HELP_STRING([--with-harfbuzz],
[use harfbuzz from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
AC_MSG_CHECKING([for which harfbuzz to use])
DEFAULT_HARFBUZZ=bundled
# If user didn't specify, use DEFAULT_HARFBUZZ
if test "x${with_harfbuzz}" = "x"; then
with_harfbuzz=${DEFAULT_HARFBUZZ}
fi
if test "x${with_harfbuzz}" = "xbundled"; then
USE_EXTERNAL_HARFBUZZ=false
HARFBUZZ_CFLAGS=""
HARFBUZZ_LIBS=""
AC_MSG_RESULT([bundled])
elif test "x${with_harfbuzz}" = "xsystem"; then
AC_MSG_RESULT([system])
PKG_CHECK_MODULES([HARFBUZZ], [harfbuzz], [HARFBUZZ_FOUND=yes], [HARFBUZZ_FOUND=no])
if test "x${HARFBUZZ_FOUND}" = "xyes"; then
# PKG_CHECK_MODULES will set HARFBUZZ_CFLAGS and HARFBUZZ_LIBS
USE_EXTERNAL_HARFBUZZ=true
else
HELP_MSG_MISSING_DEPENDENCY([harfbuzz])
AC_MSG_ERROR([--with-harfbuzz=system specified, but no harfbuzz found! $HELP_MSG])
fi
else
AC_MSG_ERROR([Invalid value for --with-harfbuzz: ${with_harfbuzz}, use 'system' or 'bundled'])
fi
AC_SUBST(USE_EXTERNAL_HARFBUZZ)
AC_SUBST(HARFBUZZ_CFLAGS)
AC_SUBST(HARFBUZZ_LIBS)
])
################################################################################
# Setup pcsclite
################################################################################
AC_DEFUN_ONCE([LIB_SETUP_PCSCLITE],
[
AC_ARG_WITH(pcsclite, [AS_HELP_STRING([--with-pcsclite],
[use pcsclite from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
AC_MSG_CHECKING([for which pcsclite to use])
# default is bundled
DEFAULT_PCSCLITE=bundled
# if user didn't specify, use DEFAULT_PCSCLITE
if test "x${with_pcsclite}" = "x"; then
with_libpng=${DEFAULT_PCSCLITE}
fi
if test "x${with_pcsclite}" = "xbundled"; then
USE_EXTERNAL_PCSCLITE=false
AC_MSG_RESULT([bundled])
elif test "x${with_pcsclite}" = "xsystem"; then
PKG_CHECK_MODULES(PCSCLITE, libpcsclite,
[ PCSCLITE_FOUND=yes ],
[ PCSCLITE_FOUND=no ])
if test "x${PCSCLITE_FOUND}" = "xyes"; then
USE_EXTERNAL_PCSCLITE=true
AC_MSG_RESULT([system])
else
AC_MSG_RESULT([system not found])
AC_MSG_ERROR([--with-pcsclite=system specified, but no pcsclite found!])
fi
else
AC_MSG_ERROR([Invalid value of --with-pcsclite: ${with_pcsclite}, use 'system' or 'bundled'])
fi
AC_SUBST(USE_EXTERNAL_PCSCLITE)
])
|