2015-10-07 13:26:48 +00:00
|
|
|
#
|
2022-05-12 08:09:54 +00:00
|
|
|
# Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
|
2015-10-07 13:26:48 +00:00
|
|
|
# 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.
|
|
|
|
#
|
2019-05-16 11:21:41 +00:00
|
|
|
# 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.
|
2015-10-07 13:26:48 +00:00
|
|
|
################################################################################
|
|
|
|
AC_DEFUN_ONCE([LIB_SETUP_BUNDLED_LIBS],
|
|
|
|
[
|
|
|
|
LIB_SETUP_LIBJPEG
|
|
|
|
LIB_SETUP_GIFLIB
|
|
|
|
LIB_SETUP_LIBPNG
|
|
|
|
LIB_SETUP_ZLIB
|
|
|
|
LIB_SETUP_LCMS
|
2020-08-04 19:20:37 +00:00
|
|
|
LIB_SETUP_HARFBUZZ
|
2015-10-07 13:26:48 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# 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
|
2024-03-27 14:44:40 +00:00
|
|
|
LIBJPEG_LIBS="-ljpeg"
|
2015-10-07 13:26:48 +00:00
|
|
|
else
|
|
|
|
AC_MSG_ERROR([Invalid use of --with-libjpeg: ${with_libjpeg}, use 'system' or 'bundled'])
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_SUBST(USE_EXTERNAL_LIBJPEG)
|
2024-03-27 14:44:40 +00:00
|
|
|
AC_SUBST(LIBJPEG_LIBS)
|
2015-10-07 13:26:48 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# 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
|
2024-03-27 14:44:40 +00:00
|
|
|
GIFLIB_LIBS=-lgif
|
2015-10-07 13:26:48 +00:00
|
|
|
else
|
|
|
|
AC_MSG_ERROR([Invalid value of --with-giflib: ${with_giflib}, use 'system' or 'bundled'])
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_SUBST(USE_EXTERNAL_LIBGIF)
|
2024-03-27 14:44:40 +00:00
|
|
|
AC_SUBST(GIFLIB_LIBS)
|
2015-10-07 13:26:48 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Setup libpng
|
|
|
|
################################################################################
|
|
|
|
AC_DEFUN_ONCE([LIB_SETUP_LIBPNG],
|
|
|
|
[
|
|
|
|
AC_ARG_WITH(libpng, [AS_HELP_STRING([--with-libpng],
|
2024-08-30 08:58:18 +00:00
|
|
|
[use libpng from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
|
2015-10-07 13:26:48 +00:00
|
|
|
|
2017-12-04 18:10:15 +00:00
|
|
|
PKG_CHECK_MODULES(PNG, libpng, [LIBPNG_FOUND=yes], [LIBPNG_FOUND=no])
|
2015-10-07 13:26:48 +00:00
|
|
|
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
|
2017-02-02 11:05:51 +00:00
|
|
|
with_libpng=${DEFAULT_LIBPNG}
|
2015-10-07 13:26:48 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if test "x${with_libpng}" = "xbundled"; then
|
2017-02-02 11:05:51 +00:00
|
|
|
USE_EXTERNAL_LIBPNG=false
|
|
|
|
PNG_CFLAGS=""
|
|
|
|
PNG_LIBS=""
|
|
|
|
AC_MSG_RESULT([bundled])
|
2015-10-07 13:26:48 +00:00
|
|
|
elif test "x${with_libpng}" = "xsystem"; then
|
2017-02-02 11:05:51 +00:00
|
|
|
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
|
2015-10-07 13:26:48 +00:00
|
|
|
else
|
2017-02-02 11:05:51 +00:00
|
|
|
AC_MSG_ERROR([Invalid value of --with-libpng: ${with_libpng}, use 'system' or 'bundled'])
|
2015-10-07 13:26:48 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
AC_SUBST(USE_EXTERNAL_LIBPNG)
|
2017-02-02 11:05:51 +00:00
|
|
|
AC_SUBST(PNG_CFLAGS)
|
|
|
|
AC_SUBST(PNG_LIBS)
|
2015-10-07 13:26:48 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# 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])
|
|
|
|
|
2016-03-25 17:55:56 +00:00
|
|
|
DEFAULT_ZLIB=system
|
2019-05-14 07:14:36 +00:00
|
|
|
if test "x$OPENJDK_TARGET_OS" = xwindows -o "x$OPENJDK_TARGET_OS" = xaix; then
|
2022-05-13 01:55:46 +00:00
|
|
|
# On windows and aix default is bundled
|
|
|
|
DEFAULT_ZLIB=bundled
|
|
|
|
elif test "x$OPENJDK_TARGET_OS" = xmacosx -a "x$OPENJDK_TARGET_CPU" = xaarch64; then
|
2016-03-25 17:55:56 +00:00
|
|
|
DEFAULT_ZLIB=bundled
|
2015-10-07 13:26:48 +00:00
|
|
|
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])
|
2017-12-04 18:10:15 +00:00
|
|
|
|
|
|
|
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
|
2015-10-07 13:26:48 +00:00
|
|
|
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
|
|
|
|
|
2018-02-07 17:48:43 +00:00
|
|
|
LIBZ_CFLAGS=""
|
|
|
|
LIBZ_LIBS=""
|
2018-02-06 21:47:50 +00:00
|
|
|
if test "x$USE_EXTERNAL_LIBZ" = "xfalse"; then
|
2018-02-06 18:12:05 +00:00
|
|
|
LIBZ_CFLAGS="$LIBZ_CFLAGS -I$TOPDIR/src/java.base/share/native/libzip/zlib"
|
2022-05-12 08:09:54 +00:00
|
|
|
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
|
|
|
LIBZ_CFLAGS="$LIBZ_CFLAGS -DHAVE_UNISTD_H"
|
|
|
|
fi
|
2018-02-06 18:12:05 +00:00
|
|
|
else
|
|
|
|
LIBZ_LIBS="-lz"
|
|
|
|
fi
|
|
|
|
|
2015-10-07 13:26:48 +00:00
|
|
|
AC_SUBST(USE_EXTERNAL_LIBZ)
|
2018-02-06 18:12:05 +00:00
|
|
|
AC_SUBST(LIBZ_CFLAGS)
|
|
|
|
AC_SUBST(LIBZ_LIBS)
|
2015-10-07 13:26:48 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# 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
|
2017-02-02 11:05:51 +00:00
|
|
|
with_lcms=${DEFAULT_LCMS}
|
2015-10-07 13:26:48 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if test "x${with_lcms}" = "xbundled"; then
|
|
|
|
USE_EXTERNAL_LCMS=false
|
2017-02-02 11:05:51 +00:00
|
|
|
LCMS_CFLAGS=""
|
|
|
|
LCMS_LIBS=""
|
2015-10-07 13:26:48 +00:00
|
|
|
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
|
2017-02-02 11:05:51 +00:00
|
|
|
# PKG_CHECK_MODULES will set LCMS_CFLAGS and LCMS_LIBS
|
2015-10-07 13:26:48 +00:00
|
|
|
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)
|
2017-02-02 11:05:51 +00:00
|
|
|
AC_SUBST(LCMS_CFLAGS)
|
|
|
|
AC_SUBST(LCMS_LIBS)
|
2015-10-07 13:26:48 +00:00
|
|
|
])
|
2020-08-04 19:20:37 +00:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# 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)
|
|
|
|
])
|