2015-10-07 13:26:48 +00:00
|
|
|
#
|
2020-04-24 09:19:16 +00:00
|
|
|
# Copyright (c) 2011, 2020, 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.
|
|
|
|
#
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Check if a potential freeype library match is correct and usable
|
|
|
|
################################################################################
|
|
|
|
AC_DEFUN([LIB_CHECK_POTENTIAL_FREETYPE],
|
|
|
|
[
|
|
|
|
POTENTIAL_FREETYPE_INCLUDE_PATH="$1"
|
|
|
|
POTENTIAL_FREETYPE_LIB_PATH="$2"
|
|
|
|
METHOD="$3"
|
|
|
|
|
|
|
|
# Let's start with an optimistic view of the world :-)
|
|
|
|
FOUND_FREETYPE=yes
|
|
|
|
|
|
|
|
# First look for the canonical freetype main include file ft2build.h.
|
|
|
|
if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
|
2018-03-12 20:53:20 +00:00
|
|
|
# Oh no! Let's try in the freetype2 directory.
|
2015-10-07 13:26:48 +00:00
|
|
|
POTENTIAL_FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH/freetype2"
|
|
|
|
if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
|
|
|
|
# Fail.
|
|
|
|
FOUND_FREETYPE=no
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2018-03-12 20:53:20 +00:00
|
|
|
if test "x$FOUND_FREETYPE" = "xyes"; then
|
2015-10-07 13:26:48 +00:00
|
|
|
# Include file found, let's continue the sanity check.
|
|
|
|
AC_MSG_NOTICE([Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD])
|
|
|
|
|
|
|
|
FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
|
|
|
|
if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
|
2018-03-12 20:53:20 +00:00
|
|
|
AC_MSG_NOTICE([Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location.])
|
|
|
|
FOUND_FREETYPE=no
|
2015-10-07 13:26:48 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2018-03-12 20:53:20 +00:00
|
|
|
if test "x$FOUND_FREETYPE" = "xyes"; then
|
2015-10-07 13:26:48 +00:00
|
|
|
FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH"
|
|
|
|
AC_MSG_CHECKING([for freetype includes])
|
|
|
|
AC_MSG_RESULT([$FREETYPE_INCLUDE_PATH])
|
|
|
|
FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH"
|
|
|
|
AC_MSG_CHECKING([for freetype libraries])
|
|
|
|
AC_MSG_RESULT([$FREETYPE_LIB_PATH])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Setup freetype (The FreeType2 font rendering library)
|
|
|
|
################################################################################
|
|
|
|
AC_DEFUN_ONCE([LIB_SETUP_FREETYPE],
|
|
|
|
[
|
|
|
|
AC_ARG_WITH(freetype, [AS_HELP_STRING([--with-freetype],
|
2020-04-24 09:19:16 +00:00
|
|
|
[specify whether to use 'system' or 'bundled' freetype.
|
2024-08-30 08:58:18 +00:00
|
|
|
The selected option applies to both build time and run time.
|
|
|
|
The default behaviour can be platform dependent.
|
|
|
|
If using 'system' and either the include files or libraries cannot be
|
|
|
|
located automatically, then additionally specify both using
|
|
|
|
--with-freetype-include and --with-freetype-lib.])])
|
2015-10-07 13:26:48 +00:00
|
|
|
AC_ARG_WITH(freetype-include, [AS_HELP_STRING([--with-freetype-include],
|
|
|
|
[specify directory for the freetype include files])])
|
|
|
|
AC_ARG_WITH(freetype-lib, [AS_HELP_STRING([--with-freetype-lib],
|
|
|
|
[specify directory for the freetype library])])
|
|
|
|
|
2020-04-24 09:19:16 +00:00
|
|
|
# This setup is to verify access to system installed freetype header and
|
|
|
|
# libraries. On Windows and MacOS this does not apply and using these options
|
8244224: Implementation of JEP 381: Remove the Solaris and SPARC Ports
Reviewed-by: alanb, bchristi, dcubed, dfuchs, eosterlund, erikj, glaubitz, ihse, iignatyev, jjiang, kbarrett, ksrini, kvn, naoto, prr, rriggs, serb, sspitsyn, stefank, tschatzl, valeriep, weijun, weijun
2020-05-21 00:33:37 +00:00
|
|
|
# will report an error. On other platforms they will default to using the
|
|
|
|
# system libraries. If they are found automatically, nothing need be done.
|
|
|
|
# If they are not found, the configure "--with-freetype-*" options may be
|
|
|
|
# used to fix that. If the preference is to bundle on these platforms then
|
|
|
|
# use --with-freetype=bundled.
|
2020-04-24 09:19:16 +00:00
|
|
|
|
2015-10-07 13:26:48 +00:00
|
|
|
FREETYPE_BASE_NAME=freetype
|
|
|
|
FREETYPE_CFLAGS=
|
|
|
|
FREETYPE_LIBS=
|
|
|
|
|
2024-08-30 08:58:18 +00:00
|
|
|
if (test "x$with_freetype_include" = "x" && \
|
|
|
|
test "x$with_freetype_lib" != "x") || \
|
|
|
|
(test "x$with_freetype_include" != "x" && \
|
|
|
|
test "x$with_freetype_lib" = "x"); then
|
2020-04-24 09:19:16 +00:00
|
|
|
AC_MSG_ERROR([Must specify both or neither of --with-freetype-include and --with-freetype-lib])
|
2018-03-12 20:53:20 +00:00
|
|
|
fi
|
2015-10-07 13:26:48 +00:00
|
|
|
|
2018-03-12 20:53:20 +00:00
|
|
|
FREETYPE_TO_USE=bundled
|
2020-04-24 09:19:16 +00:00
|
|
|
if test "x$OPENJDK_TARGET_OS" != "xwindows" && \
|
|
|
|
test "x$OPENJDK_TARGET_OS" != "xmacosx" && \
|
|
|
|
test "x$OPENJDK_TARGET_OS" != "xaix"; then
|
2018-03-12 20:53:20 +00:00
|
|
|
FREETYPE_TO_USE=system
|
|
|
|
fi
|
2020-04-24 09:19:16 +00:00
|
|
|
if test "x$with_freetype" != "x" ; then
|
|
|
|
if test "x$with_freetype" = "xsystem" ; then
|
2018-03-12 20:53:20 +00:00
|
|
|
FREETYPE_TO_USE=system
|
2020-04-24 09:19:16 +00:00
|
|
|
elif test "x$with_freetype" = "xbundled" ; then
|
2018-03-12 20:53:20 +00:00
|
|
|
FREETYPE_TO_USE=bundled
|
2020-04-24 09:19:16 +00:00
|
|
|
if test "x$with_freetype_include" != "x" || \
|
|
|
|
test "x$with_freetype_lib" != "x" ; then
|
2019-01-29 14:19:43 +00:00
|
|
|
AC_MSG_ERROR(['bundled' cannot be specified with --with-freetype-include and --with-freetype-lib])
|
2015-10-07 13:26:48 +00:00
|
|
|
fi
|
2018-03-12 20:53:20 +00:00
|
|
|
else
|
2020-04-24 09:19:16 +00:00
|
|
|
AC_MSG_ERROR([Valid values for --with-freetype are 'system' and 'bundled'])
|
2015-10-07 13:26:48 +00:00
|
|
|
fi
|
2018-03-12 20:53:20 +00:00
|
|
|
fi
|
2015-10-07 13:26:48 +00:00
|
|
|
|
2020-04-24 09:19:16 +00:00
|
|
|
if test "x$with_freetype_include" != "x" && \
|
|
|
|
test "x$with_freetype_lib" != "x" ; then
|
|
|
|
FREETYPE_TO_USE=system
|
2018-03-12 20:53:20 +00:00
|
|
|
fi
|
2015-10-07 13:26:48 +00:00
|
|
|
|
2020-04-24 09:19:16 +00:00
|
|
|
if test "x$FREETYPE_TO_USE" = "xsystem" && \
|
2024-08-30 08:58:18 +00:00
|
|
|
(test "x$OPENJDK_TARGET_OS" = "xwindows" || \
|
|
|
|
test "x$OPENJDK_TARGET_OS" = "xmacosx"); then
|
2020-04-24 09:19:16 +00:00
|
|
|
AC_MSG_ERROR([Only bundled freetype can be specified on Mac and Windows])
|
2018-03-12 20:53:20 +00:00
|
|
|
fi
|
2015-10-07 13:26:48 +00:00
|
|
|
|
2020-04-24 09:19:16 +00:00
|
|
|
if test "x$with_freetype_include" != "x" ; then
|
2018-03-12 20:53:20 +00:00
|
|
|
POTENTIAL_FREETYPE_INCLUDE_PATH="$with_freetype_include"
|
|
|
|
fi
|
2020-04-24 09:19:16 +00:00
|
|
|
if test "x$with_freetype_lib" != "x" ; then
|
2018-03-12 20:53:20 +00:00
|
|
|
POTENTIAL_FREETYPE_LIB_PATH="$with_freetype_lib"
|
|
|
|
fi
|
2015-10-07 13:26:48 +00:00
|
|
|
|
2020-04-24 09:19:16 +00:00
|
|
|
if test "x$FREETYPE_TO_USE" = "xsystem" ; then
|
|
|
|
if test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" != "x" && \
|
|
|
|
test "x$POTENTIAL_FREETYPE_LIB_PATH" != "x" ; then
|
2018-03-12 20:53:20 +00:00
|
|
|
# Okay, we got it. Check that it works.
|
2020-04-24 09:19:16 +00:00
|
|
|
LIB_CHECK_POTENTIAL_FREETYPE($POTENTIAL_FREETYPE_INCLUDE_PATH,
|
|
|
|
$POTENTIAL_FREETYPE_LIB_PATH, [--with-freetype])
|
|
|
|
if test "x$FOUND_FREETYPE" != "xyes" ; then
|
2018-03-12 20:53:20 +00:00
|
|
|
AC_MSG_ERROR([Can not find or use freetype at location given by --with-freetype-lib|include])
|
2015-10-07 13:26:48 +00:00
|
|
|
fi
|
|
|
|
else
|
2020-04-24 09:19:16 +00:00
|
|
|
# User did not specify a location, but asked for system freetype.
|
|
|
|
# Try to locate it.
|
|
|
|
|
|
|
|
# If we have a sysroot, assume that's where we are supposed to look and
|
|
|
|
# skip pkg-config.
|
|
|
|
if test "x$SYSROOT" = "x" ; then
|
|
|
|
if test "x$FOUND_FREETYPE" != "xyes" ; then
|
|
|
|
# Check modules using pkg-config, but only if we have it (ugly output
|
|
|
|
# results otherwise)
|
|
|
|
if test "x$PKG_CONFIG" != "x" ; then
|
2015-10-07 13:26:48 +00:00
|
|
|
PKG_CHECK_MODULES(FREETYPE, freetype2, [FOUND_FREETYPE=yes], [FOUND_FREETYPE=no])
|
2020-04-24 09:19:16 +00:00
|
|
|
if test "x$FOUND_FREETYPE" = "xyes" ; then
|
2018-03-12 20:53:20 +00:00
|
|
|
AC_MSG_CHECKING([for freetype])
|
|
|
|
AC_MSG_RESULT([yes (using pkg-config)])
|
2015-10-07 13:26:48 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2020-04-24 09:19:16 +00:00
|
|
|
if test "x$FOUND_FREETYPE" != "xyes" ; then
|
2015-10-07 13:26:48 +00:00
|
|
|
# Check in well-known locations
|
2018-03-12 20:53:20 +00:00
|
|
|
FREETYPE_BASE_DIR="$SYSROOT/usr"
|
|
|
|
|
2020-04-24 09:19:16 +00:00
|
|
|
if test "x$OPENJDK_TARGET_CPU_BITS" = "x64" ; then
|
|
|
|
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include],
|
|
|
|
[$FREETYPE_BASE_DIR/lib/$OPENJDK_TARGET_CPU-linux-gnu], [well-known location])
|
|
|
|
if test "x$FOUND_FREETYPE" != "xyes" ; then
|
|
|
|
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include],
|
|
|
|
[$FREETYPE_BASE_DIR/lib64], [well-known location])
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include],
|
|
|
|
[$FREETYPE_BASE_DIR/lib/i386-linux-gnu], [well-known location])
|
|
|
|
if test "x$FOUND_FREETYPE" != "xyes" ; then
|
|
|
|
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include],
|
|
|
|
[$FREETYPE_BASE_DIR/lib32], [well-known location])
|
|
|
|
fi
|
2018-03-12 20:53:20 +00:00
|
|
|
fi
|
2020-04-24 09:19:16 +00:00
|
|
|
|
|
|
|
if test "x$FOUND_FREETYPE" != "xyes" ; then
|
|
|
|
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include],
|
|
|
|
[$FREETYPE_BASE_DIR/lib], [well-known location])
|
2018-03-12 20:53:20 +00:00
|
|
|
fi
|
2015-10-07 13:26:48 +00:00
|
|
|
|
2021-03-08 10:14:46 +00:00
|
|
|
if test "x$FOUND_FREETYPE" != "xyes" ; then
|
|
|
|
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include],
|
|
|
|
[$FREETYPE_BASE_DIR/lib/$OPENJDK_TARGET_CPU-$OPENJDK_TARGET_OS-$OPENJDK_TARGET_ABI], [well-known location])
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test "x$FOUND_FREETYPE" != "xyes" ; then
|
|
|
|
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include],
|
|
|
|
[$FREETYPE_BASE_DIR/lib/$OPENJDK_TARGET_CPU_AUTOCONF-$OPENJDK_TARGET_OS-$OPENJDK_TARGET_ABI], [well-known location])
|
|
|
|
fi
|
|
|
|
|
2020-04-24 09:19:16 +00:00
|
|
|
if test "x$FOUND_FREETYPE" != "xyes" ; then
|
|
|
|
FREETYPE_BASE_DIR="$SYSROOT/usr/X11"
|
|
|
|
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include],
|
|
|
|
[$FREETYPE_BASE_DIR/lib], [well-known location])
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test "x$FOUND_FREETYPE" != "xyes" ; then
|
|
|
|
FREETYPE_BASE_DIR="$SYSROOT/usr/local"
|
|
|
|
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include],
|
|
|
|
[$FREETYPE_BASE_DIR/lib], [well-known location])
|
2015-10-07 13:26:48 +00:00
|
|
|
fi
|
|
|
|
fi # end check in well-known locations
|
|
|
|
|
2020-04-24 09:19:16 +00:00
|
|
|
if test "x$FOUND_FREETYPE" != "xyes" ; then
|
2015-10-07 13:26:48 +00:00
|
|
|
HELP_MSG_MISSING_DEPENDENCY([freetype])
|
|
|
|
AC_MSG_ERROR([Could not find freetype! $HELP_MSG ])
|
|
|
|
fi
|
|
|
|
fi # end user specified settings
|
|
|
|
|
|
|
|
# Set FREETYPE_CFLAGS, _LIBS and _LIB_PATH from include and lib dir.
|
2020-04-24 09:19:16 +00:00
|
|
|
if test "x$FREETYPE_CFLAGS" = "x" ; then
|
|
|
|
if test -d $FREETYPE_INCLUDE_PATH/freetype2/freetype ; then
|
2015-10-07 13:26:48 +00:00
|
|
|
FREETYPE_CFLAGS="-I$FREETYPE_INCLUDE_PATH/freetype2 -I$FREETYPE_INCLUDE_PATH"
|
|
|
|
else
|
|
|
|
FREETYPE_CFLAGS="-I$FREETYPE_INCLUDE_PATH"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2020-04-24 09:19:16 +00:00
|
|
|
if test "x$FREETYPE_LIBS" = "x" ; then
|
2018-03-12 20:53:20 +00:00
|
|
|
FREETYPE_LIBS="-L$FREETYPE_LIB_PATH -l$FREETYPE_BASE_NAME"
|
2015-10-07 13:26:48 +00:00
|
|
|
fi
|
2018-03-12 20:53:20 +00:00
|
|
|
fi
|
2015-10-07 13:26:48 +00:00
|
|
|
|
2020-04-24 09:19:16 +00:00
|
|
|
AC_MSG_RESULT([Using freetype: $FREETYPE_TO_USE])
|
2017-06-08 12:53:48 +00:00
|
|
|
|
2018-03-12 20:53:20 +00:00
|
|
|
AC_SUBST(FREETYPE_TO_USE)
|
2015-10-07 13:26:48 +00:00
|
|
|
AC_SUBST(FREETYPE_CFLAGS)
|
|
|
|
AC_SUBST(FREETYPE_LIBS)
|
|
|
|
])
|