make/autoconf/lib-freetype.m4
author erikj
Thu, 30 Nov 2017 17:28:21 -0800
changeset 48035 69d409f1b81e
parent 47216 71c04702a3d5
child 49234 3375a8039fde
permissions -rw-r--r--
8190464: OpenJDK on macosx needs to bundle freetype Reviewed-by: ihse
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     1
#
43046
717ce6d4eaa1 8171409: Create a smoother configure experience on macosx
ihse
parents: 41040
diff changeset
     2
# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     4
#
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    10
#
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    15
# accompanied this code).
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    16
#
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    20
#
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    23
# questions.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    24
#
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    25
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    26
################################################################################
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    27
# Build the freetype lib from source
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    28
################################################################################
26400
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    29
AC_DEFUN([LIB_BUILD_FREETYPE],
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    30
[
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    31
  FREETYPE_SRC_PATH="$1"
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    32
  BUILD_FREETYPE=yes
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    33
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    34
  # Check if the freetype sources are acessible..
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    35
  if ! test -d $FREETYPE_SRC_PATH; then
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    36
    AC_MSG_WARN([--with-freetype-src specified, but can not find path "$FREETYPE_SRC_PATH" - ignoring --with-freetype-src])
26400
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    37
    BUILD_FREETYPE=no
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    38
  fi
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    39
  # ..and contain a vc2010 project file
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    40
  vcxproj_path="$FREETYPE_SRC_PATH/builds/windows/vc2010/freetype.vcxproj"
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    41
  if test "x$BUILD_FREETYPE" = xyes && ! test -s $vcxproj_path; then
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    42
    AC_MSG_WARN([Can not find project file $vcxproj_path (you may try a newer freetype version) - ignoring --with-freetype-src])
26400
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    43
    BUILD_FREETYPE=no
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    44
  fi
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    45
  # Now check if configure found a version of 'msbuild.exe'
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    46
  if test "x$BUILD_FREETYPE" = xyes && test "x$MSBUILD" == x ; then
27331
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
    47
    AC_MSG_WARN([Can not find an msbuild.exe executable (you may try to install .NET 4.0) - ignoring --with-freetype-src])
26400
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    48
    BUILD_FREETYPE=no
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    49
  fi
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    50
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    51
  # Ready to go..
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    52
  if test "x$BUILD_FREETYPE" = xyes; then
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    53
    # msbuild requires trailing slashes for output directories
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    54
    freetype_lib_path="$FREETYPE_SRC_PATH/lib$OPENJDK_TARGET_CPU_BITS/"
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    55
    freetype_lib_path_unix="$freetype_lib_path"
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    56
    freetype_obj_path="$FREETYPE_SRC_PATH/obj$OPENJDK_TARGET_CPU_BITS/"
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    57
    BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(vcxproj_path)
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    58
    BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(freetype_lib_path)
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    59
    BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(freetype_obj_path)
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    60
    if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    61
      freetype_platform=x64
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    62
    else
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    63
      freetype_platform=win32
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    64
    fi
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    65
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    66
    # The original freetype project file is for VS 2010 (i.e. 'v100'),
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    67
    # so we have to adapt the toolset if building with any other toolsed (i.e. SDK).
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    68
    # Currently 'PLATFORM_TOOLSET' is set in 'TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT'/
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    69
    # 'TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT' in toolchain_windows.m4
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    70
    AC_MSG_NOTICE([Trying to compile freetype sources with PlatformToolset=$PLATFORM_TOOLSET to $freetype_lib_path_unix ...])
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    71
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    72
    # First we try to build the freetype.dll
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    73
    $ECHO -e "@echo off\n"\
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    74
        "$MSBUILD $vcxproj_path "\
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    75
        "/p:PlatformToolset=$PLATFORM_TOOLSET "\
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    76
        "/p:Configuration=\"Release Multithreaded\" "\
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    77
        "/p:Platform=$freetype_platform "\
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    78
        "/p:ConfigurationType=DynamicLibrary "\
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    79
        "/p:TargetName=freetype "\
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    80
        "/p:OutDir=\"$freetype_lib_path\" "\
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    81
        "/p:IntDir=\"$freetype_obj_path\" > freetype.log" > freetype.bat
26400
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    82
    cmd /c freetype.bat
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    83
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    84
    if test -s "$freetype_lib_path_unix/freetype.dll"; then
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    85
      # If that succeeds we also build freetype.lib
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    86
      $ECHO -e "@echo off\n"\
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    87
          "$MSBUILD $vcxproj_path "\
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    88
          "/p:PlatformToolset=$PLATFORM_TOOLSET "\
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    89
          "/p:Configuration=\"Release Multithreaded\" "\
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    90
          "/p:Platform=$freetype_platform "\
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    91
          "/p:ConfigurationType=StaticLibrary "\
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    92
          "/p:TargetName=freetype "\
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    93
          "/p:OutDir=\"$freetype_lib_path\" "\
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    94
          "/p:IntDir=\"$freetype_obj_path\" >> freetype.log" > freetype.bat
26400
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    95
      cmd /c freetype.bat
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    96
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    97
      if test -s "$freetype_lib_path_unix/freetype.lib"; then
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    98
        # Once we build both, lib and dll, set freetype lib and include path appropriately
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    99
        POTENTIAL_FREETYPE_INCLUDE_PATH="$FREETYPE_SRC_PATH/include"
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   100
        POTENTIAL_FREETYPE_LIB_PATH="$freetype_lib_path_unix"
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   101
        AC_MSG_NOTICE([Compiling freetype sources succeeded! (see freetype.log for build results)])
26400
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   102
      else
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   103
        BUILD_FREETYPE=no
26400
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   104
      fi
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   105
    else
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   106
      BUILD_FREETYPE=no
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   107
    fi
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   108
  fi
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   109
])
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   110
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   111
################################################################################
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   112
# Check if a potential freeype library match is correct and usable
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   113
################################################################################
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   114
AC_DEFUN([LIB_CHECK_POTENTIAL_FREETYPE],
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   115
[
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   116
  POTENTIAL_FREETYPE_INCLUDE_PATH="$1"
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   117
  POTENTIAL_FREETYPE_LIB_PATH="$2"
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   118
  METHOD="$3"
26400
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   119
27331
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   120
  # Let's start with an optimistic view of the world :-)
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   121
  FOUND_FREETYPE=yes
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   122
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   123
  # First look for the canonical freetype main include file ft2build.h.
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   124
  if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   125
    # Oh no! Let's try in the freetype2 directory. This is needed at least at Mac OS X Yosemite.
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   126
    POTENTIAL_FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH/freetype2"
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   127
    if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   128
      # Fail.
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   129
      FOUND_FREETYPE=no
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   130
    fi
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   131
  fi
27595
cff167b3bfa2 8065914: Various improvements and cleanup of build system
ihse
parents: 27331
diff changeset
   132
27331
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   133
  if test "x$FOUND_FREETYPE" = xyes; then
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   134
    # Include file found, let's continue the sanity check.
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   135
    AC_MSG_NOTICE([Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   136
27331
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   137
    # Reset to default value
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   138
    FREETYPE_BASE_NAME=freetype
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   139
    FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   140
    if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
27331
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   141
      if test "x$OPENJDK_TARGET_OS" = xmacosx \
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   142
          && test -s "$POTENTIAL_FREETYPE_LIB_PATH/${LIBRARY_PREFIX}freetype.6${SHARED_LIBRARY_SUFFIX}"; then
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   143
        # On Mac OS X Yosemite, the symlink from libfreetype.dylib to libfreetype.6.dylib disappeared. Check
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   144
        # for the .6 version explicitly.
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   145
        FREETYPE_BASE_NAME=freetype.6
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   146
        FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   147
        AC_MSG_NOTICE([Compensating for missing symlink by using version 6 explicitly])
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   148
      else
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   149
        AC_MSG_NOTICE([Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location.])
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   150
        FOUND_FREETYPE=no
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   151
      fi
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   152
    else
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   153
      if test "x$OPENJDK_TARGET_OS" = xwindows; then
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   154
        # On Windows, we will need both .lib and .dll file.
27331
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   155
        if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib"; then
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   156
          AC_MSG_NOTICE([Could not find $POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib. Ignoring location.])
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   157
          FOUND_FREETYPE=no
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   158
        fi
24081
f98557ef4bf8 8042213: Freetype detection fails on Solaris sparcv9 when using devkit
erikj
parents: 23428
diff changeset
   159
      elif test "x$OPENJDK_TARGET_OS" = xsolaris \
f98557ef4bf8 8042213: Freetype detection fails on Solaris sparcv9 when using devkit
erikj
parents: 23428
diff changeset
   160
          && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
f98557ef4bf8 8042213: Freetype detection fails on Solaris sparcv9 when using devkit
erikj
parents: 23428
diff changeset
   161
        # Found lib in isa dir, use that instead.
f98557ef4bf8 8042213: Freetype detection fails on Solaris sparcv9 when using devkit
erikj
parents: 23428
diff changeset
   162
        POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
27331
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   163
        AC_MSG_NOTICE([Rewriting to use $POTENTIAL_FREETYPE_LIB_PATH instead])
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   164
      fi
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   165
    fi
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   166
  fi
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   167
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   168
  if test "x$FOUND_FREETYPE" = xyes; then
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   169
    BASIC_FIXUP_PATH(POTENTIAL_FREETYPE_INCLUDE_PATH)
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   170
    BASIC_FIXUP_PATH(POTENTIAL_FREETYPE_LIB_PATH)
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   171
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   172
    FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH"
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   173
    AC_MSG_CHECKING([for freetype includes])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   174
    AC_MSG_RESULT([$FREETYPE_INCLUDE_PATH])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   175
    FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH"
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   176
    AC_MSG_CHECKING([for freetype libraries])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   177
    AC_MSG_RESULT([$FREETYPE_LIB_PATH])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   178
  fi
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   179
])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   180
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   181
################################################################################
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   182
# Setup freetype (The FreeType2 font rendering library)
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   183
################################################################################
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   184
AC_DEFUN_ONCE([LIB_SETUP_FREETYPE],
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   185
[
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   186
  AC_ARG_WITH(freetype, [AS_HELP_STRING([--with-freetype],
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   187
      [specify prefix directory for the freetype package
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   188
      (expecting the libraries under PATH/lib and the headers under PATH/include)])])
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   189
  AC_ARG_WITH(freetype-include, [AS_HELP_STRING([--with-freetype-include],
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   190
      [specify directory for the freetype include files])])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   191
  AC_ARG_WITH(freetype-lib, [AS_HELP_STRING([--with-freetype-lib],
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   192
      [specify directory for the freetype library])])
26400
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   193
  AC_ARG_WITH(freetype-src, [AS_HELP_STRING([--with-freetype-src],
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   194
      [specify directory with freetype sources to automatically build the library (experimental, Windows-only)])])
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   195
  AC_ARG_ENABLE(freetype-bundling, [AS_HELP_STRING([--disable-freetype-bundling],
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   196
      [disable bundling of the freetype library with the build result @<:@enabled on Windows or when using --with-freetype, disabled otherwise@:>@])])
45510
ef977f09bac8 8178064: OpenJDK RI binary should include the license file for freetype
erikj
parents: 43046
diff changeset
   197
  AC_ARG_WITH(freetype-license, [AS_HELP_STRING([--with-freetype-license],
ef977f09bac8 8178064: OpenJDK RI binary should include the license file for freetype
erikj
parents: 43046
diff changeset
   198
      [if bundling freetype, also bundle this license file])])
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   199
27331
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   200
  # Need to specify explicitly since it needs to be overridden on some versions of macosx
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   201
  FREETYPE_BASE_NAME=freetype
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   202
  FREETYPE_CFLAGS=
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   203
  FREETYPE_LIBS=
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   204
  FREETYPE_BUNDLE_LIB_PATH=
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   205
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   206
  if test "x$NEEDS_LIB_FREETYPE" = xfalse; then
33393
0f584e7d6ab6 8140762: Specifying --without-LIB if not needed should not result in warning
ihse
parents: 32921
diff changeset
   207
    if (test "x$with_freetype" != x  && test "x$with_freetype" != xno) || \
0f584e7d6ab6 8140762: Specifying --without-LIB if not needed should not result in warning
ihse
parents: 32921
diff changeset
   208
        (test "x$with_freetype_include" != x && test "x$with_freetype_include" != xno) || \
0f584e7d6ab6 8140762: Specifying --without-LIB if not needed should not result in warning
ihse
parents: 32921
diff changeset
   209
        (test "x$with_freetype_lib" != x && test "x$with_freetype_lib" != xno) || \
0f584e7d6ab6 8140762: Specifying --without-LIB if not needed should not result in warning
ihse
parents: 32921
diff changeset
   210
        (test "x$with_freetype_src" != x && test "x$with_freetype_src" != xno); then
0f584e7d6ab6 8140762: Specifying --without-LIB if not needed should not result in warning
ihse
parents: 32921
diff changeset
   211
      AC_MSG_WARN([[freetype not used, so --with-freetype[-*] is ignored]])
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   212
    fi
33393
0f584e7d6ab6 8140762: Specifying --without-LIB if not needed should not result in warning
ihse
parents: 32921
diff changeset
   213
    if (test "x$enable_freetype_bundling" != x && test "x$enable_freetype_bundling" != xno); then
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   214
      AC_MSG_WARN([freetype not used, so --enable-freetype-bundling is ignored])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   215
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   216
  else
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   217
    # freetype is needed to build; go get it!
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   218
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   219
    BUNDLE_FREETYPE="$enable_freetype_bundling"
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   220
26400
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   221
    if  test "x$with_freetype_src" != x; then
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   222
      if test "x$OPENJDK_TARGET_OS" = xwindows; then
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   223
        # Try to build freetype if --with-freetype-src was given on Windows
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   224
        LIB_BUILD_FREETYPE([$with_freetype_src])
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   225
        if test "x$BUILD_FREETYPE" = xyes; then
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   226
          # Okay, we built it. Check that it works.
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   227
          LIB_CHECK_POTENTIAL_FREETYPE($POTENTIAL_FREETYPE_INCLUDE_PATH, $POTENTIAL_FREETYPE_LIB_PATH, [--with-freetype-src])
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   228
          if test "x$FOUND_FREETYPE" != xyes; then
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   229
            AC_MSG_ERROR([Can not use the built freetype at location given by --with-freetype-src])
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   230
          fi
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   231
        else
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   232
          AC_MSG_NOTICE([User specified --with-freetype-src but building freetype failed. (see freetype.log for build results)])
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   233
          AC_MSG_ERROR([Consider building freetype manually and using --with-freetype instead.])
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   234
        fi
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   235
      else
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   236
        AC_MSG_WARN([--with-freetype-src is currently only supported on Windows - ignoring])
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   237
      fi
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   238
    fi
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   239
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   240
    if test "x$with_freetype" != x || test "x$with_freetype_include" != x || test "x$with_freetype_lib" != x; then
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   241
      # User has specified settings
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   242
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   243
      if test "x$BUNDLE_FREETYPE" = x; then
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   244
        # If not specified, default is to bundle freetype
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   245
        BUNDLE_FREETYPE=yes
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   246
      fi
26400
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   247
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   248
      if test "x$with_freetype" != x; then
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   249
        POTENTIAL_FREETYPE_INCLUDE_PATH="$with_freetype/include"
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   250
        POTENTIAL_FREETYPE_LIB_PATH="$with_freetype/lib"
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   251
      fi
26400
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   252
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   253
      # Allow --with-freetype-lib and --with-freetype-include to override
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   254
      if test "x$with_freetype_include" != x; then
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   255
        POTENTIAL_FREETYPE_INCLUDE_PATH="$with_freetype_include"
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   256
      fi
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   257
      if test "x$with_freetype_lib" != x; then
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   258
        POTENTIAL_FREETYPE_LIB_PATH="$with_freetype_lib"
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   259
      fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   260
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   261
      if test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" != x && test "x$POTENTIAL_FREETYPE_LIB_PATH" != x; then
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   262
        # Okay, we got it. Check that it works.
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   263
        LIB_CHECK_POTENTIAL_FREETYPE($POTENTIAL_FREETYPE_INCLUDE_PATH, $POTENTIAL_FREETYPE_LIB_PATH, [--with-freetype])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   264
        if test "x$FOUND_FREETYPE" != xyes; then
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   265
          AC_MSG_ERROR([Can not find or use freetype at location given by --with-freetype])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   266
        fi
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   267
      else
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   268
        # User specified only one of lib or include. This is an error.
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   269
        if test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" = x ; then
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   270
          AC_MSG_NOTICE([User specified --with-freetype-lib but not --with-freetype-include])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   271
          AC_MSG_ERROR([Need both freetype lib and include paths. Consider using --with-freetype instead.])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   272
        else
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   273
          AC_MSG_NOTICE([User specified --with-freetype-include but not --with-freetype-lib])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   274
          AC_MSG_ERROR([Need both freetype lib and include paths. Consider using --with-freetype instead.])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   275
        fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   276
      fi
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   277
    else
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   278
      # User did not specify settings, but we need freetype. Try to locate it.
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   279
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   280
      if test "x$BUNDLE_FREETYPE" = x; then
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   281
        # If not specified, default is to bundle freetype only on windows
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   282
        if test "x$OPENJDK_TARGET_OS" = xwindows; then
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   283
          BUNDLE_FREETYPE=yes
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   284
        else
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   285
          BUNDLE_FREETYPE=no
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   286
        fi
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   287
      fi
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   288
23428
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23165
diff changeset
   289
      # If we have a sysroot, assume that's where we are supposed to look and skip pkg-config.
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23165
diff changeset
   290
      if test "x$SYSROOT" = x; then
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23165
diff changeset
   291
        if test "x$FOUND_FREETYPE" != xyes; then
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23165
diff changeset
   292
          # Check modules using pkg-config, but only if we have it (ugly output results otherwise)
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23165
diff changeset
   293
          if test "x$PKG_CONFIG" != x; then
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23165
diff changeset
   294
            PKG_CHECK_MODULES(FREETYPE, freetype2, [FOUND_FREETYPE=yes], [FOUND_FREETYPE=no])
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23165
diff changeset
   295
            if test "x$FOUND_FREETYPE" = xyes; then
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23165
diff changeset
   296
              # On solaris, pkg_check adds -lz to freetype libs, which isn't necessary for us.
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23165
diff changeset
   297
              FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's/-lz//g'`
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23165
diff changeset
   298
              # 64-bit libs for Solaris x86 are installed in the amd64 subdirectory, change lib to lib/amd64
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23165
diff changeset
   299
              if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23165
diff changeset
   300
                FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's?/lib?/lib/amd64?g'`
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23165
diff changeset
   301
              fi
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   302
              # PKG_CHECK_MODULES will set FREETYPE_CFLAGS and _LIBS, but we don't get a lib path for bundling.
23428
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23165
diff changeset
   303
              if test "x$BUNDLE_FREETYPE" = xyes; then
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23165
diff changeset
   304
                AC_MSG_NOTICE([Found freetype using pkg-config, but ignoring since we can not bundle that])
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23165
diff changeset
   305
                FOUND_FREETYPE=no
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23165
diff changeset
   306
              else
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23165
diff changeset
   307
                AC_MSG_CHECKING([for freetype])
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23165
diff changeset
   308
                AC_MSG_RESULT([yes (using pkg-config)])
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23165
diff changeset
   309
              fi
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   310
            fi
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   311
          fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   312
        fi
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   313
      fi
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   314
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   315
      if test "x$FOUND_FREETYPE" != xyes; then
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   316
        # Check in well-known locations
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   317
        if test "x$OPENJDK_TARGET_OS" = xwindows; then
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   318
          FREETYPE_BASE_DIR="$PROGRAMFILES/GnuWin32"
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   319
          BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(FREETYPE_BASE_DIR)
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   320
          LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   321
          if test "x$FOUND_FREETYPE" != xyes; then
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   322
            FREETYPE_BASE_DIR="$ProgramW6432/GnuWin32"
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   323
            BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(FREETYPE_BASE_DIR)
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   324
            LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   325
          fi
34604
2adbe257ce54 8145548: Add default directory for freetype source
ihse
parents: 33393
diff changeset
   326
          if test "x$FOUND_FREETYPE" != xyes; then
2adbe257ce54 8145548: Add default directory for freetype source
ihse
parents: 33393
diff changeset
   327
            FREETYPE_BASE_DIR="$HOME/freetype"
2adbe257ce54 8145548: Add default directory for freetype source
ihse
parents: 33393
diff changeset
   328
            BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(FREETYPE_BASE_DIR)
2adbe257ce54 8145548: Add default directory for freetype source
ihse
parents: 33393
diff changeset
   329
            if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
2adbe257ce54 8145548: Add default directory for freetype source
ihse
parents: 33393
diff changeset
   330
              LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib64], [well-known location])
2adbe257ce54 8145548: Add default directory for freetype source
ihse
parents: 33393
diff changeset
   331
            else
2adbe257ce54 8145548: Add default directory for freetype source
ihse
parents: 33393
diff changeset
   332
              LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib32], [well-known location])
2adbe257ce54 8145548: Add default directory for freetype source
ihse
parents: 33393
diff changeset
   333
            fi
2adbe257ce54 8145548: Add default directory for freetype source
ihse
parents: 33393
diff changeset
   334
            if test "x$FOUND_FREETYPE" != xyes && test -d $FREETYPE_BASE_DIR \
2adbe257ce54 8145548: Add default directory for freetype source
ihse
parents: 33393
diff changeset
   335
                && test -s "$FREETYPE_BASE_DIR/builds/windows/vc2010/freetype.vcxproj" && test "x$MSBUILD" != x; then
2adbe257ce54 8145548: Add default directory for freetype source
ihse
parents: 33393
diff changeset
   336
              # Source is available, as a last resort try to build freetype in default location
2adbe257ce54 8145548: Add default directory for freetype source
ihse
parents: 33393
diff changeset
   337
              LIB_BUILD_FREETYPE($FREETYPE_BASE_DIR)
2adbe257ce54 8145548: Add default directory for freetype source
ihse
parents: 33393
diff changeset
   338
              if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
2adbe257ce54 8145548: Add default directory for freetype source
ihse
parents: 33393
diff changeset
   339
                LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib64], [well-known location])
2adbe257ce54 8145548: Add default directory for freetype source
ihse
parents: 33393
diff changeset
   340
              else
2adbe257ce54 8145548: Add default directory for freetype source
ihse
parents: 33393
diff changeset
   341
                LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib32], [well-known location])
2adbe257ce54 8145548: Add default directory for freetype source
ihse
parents: 33393
diff changeset
   342
              fi
2adbe257ce54 8145548: Add default directory for freetype source
ihse
parents: 33393
diff changeset
   343
            fi
2adbe257ce54 8145548: Add default directory for freetype source
ihse
parents: 33393
diff changeset
   344
          fi
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   345
        else
23428
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23165
diff changeset
   346
          FREETYPE_BASE_DIR="$SYSROOT/usr"
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   347
          LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   348
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   349
          if test "x$FOUND_FREETYPE" != xyes; then
23428
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23165
diff changeset
   350
            FREETYPE_BASE_DIR="$SYSROOT/usr/X11"
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   351
            LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   352
          fi
43046
717ce6d4eaa1 8171409: Create a smoother configure experience on macosx
ihse
parents: 41040
diff changeset
   353
          if test "x$FOUND_FREETYPE" != xyes; then
717ce6d4eaa1 8171409: Create a smoother configure experience on macosx
ihse
parents: 41040
diff changeset
   354
            FREETYPE_BASE_DIR="$SYSROOT/usr/local"
717ce6d4eaa1 8171409: Create a smoother configure experience on macosx
ihse
parents: 41040
diff changeset
   355
            LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
717ce6d4eaa1 8171409: Create a smoother configure experience on macosx
ihse
parents: 41040
diff changeset
   356
          fi
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   357
35742
5f1361f764af 8147754: Configure fails to detect freetype installed by XQuartz on OSX 10.11
ddehaven
parents: 34604
diff changeset
   358
          if test "x$OPENJDK_TARGET_OS" = xmacosx; then
5f1361f764af 8147754: Configure fails to detect freetype installed by XQuartz on OSX 10.11
ddehaven
parents: 34604
diff changeset
   359
            if test "x$FOUND_FREETYPE" != xyes; then
5f1361f764af 8147754: Configure fails to detect freetype installed by XQuartz on OSX 10.11
ddehaven
parents: 34604
diff changeset
   360
              # Due to changes in OSX 10.11 XQuartz now installs to /opt/X11
5f1361f764af 8147754: Configure fails to detect freetype installed by XQuartz on OSX 10.11
ddehaven
parents: 34604
diff changeset
   361
              FREETYPE_BASE_DIR="$SYSROOT/opt/X11"
5f1361f764af 8147754: Configure fails to detect freetype installed by XQuartz on OSX 10.11
ddehaven
parents: 34604
diff changeset
   362
              LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
5f1361f764af 8147754: Configure fails to detect freetype installed by XQuartz on OSX 10.11
ddehaven
parents: 34604
diff changeset
   363
            fi
5f1361f764af 8147754: Configure fails to detect freetype installed by XQuartz on OSX 10.11
ddehaven
parents: 34604
diff changeset
   364
          fi
5f1361f764af 8147754: Configure fails to detect freetype installed by XQuartz on OSX 10.11
ddehaven
parents: 34604
diff changeset
   365
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   366
          if test "x$FOUND_FREETYPE" != xyes; then
23428
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23165
diff changeset
   367
            FREETYPE_BASE_DIR="$SYSROOT/usr"
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   368
            if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
46252
15f3e60ff095 8186438: 'configure' fails to find installed libfreetype on Ubuntu AArch64
dchuyko
parents: 45510
diff changeset
   369
              LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib/$OPENJDK_TARGET_CPU-linux-gnu], [well-known location])
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   370
            else
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   371
              LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib/i386-linux-gnu], [well-known location])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   372
              if test "x$FOUND_FREETYPE" != xyes; then
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   373
                LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib32], [well-known location])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   374
              fi
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   375
            fi
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   376
          fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   377
        fi
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   378
      fi # end check in well-known locations
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   379
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   380
      if test "x$FOUND_FREETYPE" != xyes; then
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   381
        HELP_MSG_MISSING_DEPENDENCY([freetype])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   382
        AC_MSG_ERROR([Could not find freetype! $HELP_MSG ])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   383
      fi
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   384
    fi # end user specified settings
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   385
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   386
    # Set FREETYPE_CFLAGS, _LIBS and _LIB_PATH from include and lib dir.
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   387
    if test "x$FREETYPE_CFLAGS" = x; then
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   388
      BASIC_FIXUP_PATH(FREETYPE_INCLUDE_PATH)
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   389
      if test -d $FREETYPE_INCLUDE_PATH/freetype2/freetype; then
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   390
        FREETYPE_CFLAGS="-I$FREETYPE_INCLUDE_PATH/freetype2 -I$FREETYPE_INCLUDE_PATH"
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   391
      else
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   392
        FREETYPE_CFLAGS="-I$FREETYPE_INCLUDE_PATH"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   393
      fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   394
    fi
26400
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   395
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   396
    if test "x$FREETYPE_LIBS" = x; then
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   397
      BASIC_FIXUP_PATH(FREETYPE_LIB_PATH)
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   398
      if test "x$OPENJDK_TARGET_OS" = xwindows; then
27331
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   399
        FREETYPE_LIBS="$FREETYPE_LIB_PATH/$FREETYPE_BASE_NAME.lib"
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   400
      else
27331
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
   401
        FREETYPE_LIBS="-L$FREETYPE_LIB_PATH -l$FREETYPE_BASE_NAME"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   402
      fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   403
    fi
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   404
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   405
    # Try to compile it
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   406
    AC_MSG_CHECKING([if we can compile and link with freetype])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   407
    AC_LANG_PUSH(C++)
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   408
    PREV_CXXCFLAGS="$CXXFLAGS"
21056
16245d19b19a 8027300: configure should use LIBS instead of LDFLAGS when testing freetype
ihse
parents: 20655
diff changeset
   409
    PREV_LIBS="$LIBS"
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   410
    PREV_CXX="$CXX"
26400
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   411
    CXXFLAGS="$CXXFLAGS $FREETYPE_CFLAGS"
21056
16245d19b19a 8027300: configure should use LIBS instead of LDFLAGS when testing freetype
ihse
parents: 20655
diff changeset
   412
    LIBS="$LIBS $FREETYPE_LIBS"
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   413
    CXX="$FIXPATH $CXX"
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   414
    AC_LINK_IFELSE([AC_LANG_SOURCE([[
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   415
          #include<ft2build.h>
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   416
          #include FT_FREETYPE_H
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   417
          int main () {
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   418
            FT_Init_FreeType(NULL);
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   419
            return 0;
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   420
          }
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   421
        ]])],
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   422
        [
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   423
          AC_MSG_RESULT([yes])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   424
        ],
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   425
        [
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   426
          AC_MSG_RESULT([no])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   427
          AC_MSG_NOTICE([Could not compile and link with freetype. This might be a 32/64-bit mismatch.])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   428
          AC_MSG_NOTICE([Using FREETYPE_CFLAGS=$FREETYPE_CFLAGS and FREETYPE_LIBS=$FREETYPE_LIBS])
26400
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   429
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   430
          HELP_MSG_MISSING_DEPENDENCY([freetype])
26400
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   431
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   432
          AC_MSG_ERROR([Can not continue without freetype. $HELP_MSG])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   433
        ]
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   434
    )
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   435
    CXXCFLAGS="$PREV_CXXFLAGS"
21056
16245d19b19a 8027300: configure should use LIBS instead of LDFLAGS when testing freetype
ihse
parents: 20655
diff changeset
   436
    LIBS="$PREV_LIBS"
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   437
    CXX="$PREV_CXX"
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   438
    AC_LANG_POP(C++)
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   439
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   440
    AC_MSG_CHECKING([if we should bundle freetype])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   441
    if test "x$BUNDLE_FREETYPE" = xyes; then
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   442
      FREETYPE_BUNDLE_LIB_PATH="$FREETYPE_LIB_PATH"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   443
    fi
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   444
    AC_MSG_RESULT([$BUNDLE_FREETYPE])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   445
48035
69d409f1b81e 8190464: OpenJDK on macosx needs to bundle freetype
erikj
parents: 47216
diff changeset
   446
    if test "x$BUNDLE_FREETYPE" = xyes; then
69d409f1b81e 8190464: OpenJDK on macosx needs to bundle freetype
erikj
parents: 47216
diff changeset
   447
      FREETYPE_LICENSE=""
69d409f1b81e 8190464: OpenJDK on macosx needs to bundle freetype
erikj
parents: 47216
diff changeset
   448
      AC_MSG_CHECKING([for freetype license])
69d409f1b81e 8190464: OpenJDK on macosx needs to bundle freetype
erikj
parents: 47216
diff changeset
   449
      if test "x$with_freetype_license" = "xyes"; then
69d409f1b81e 8190464: OpenJDK on macosx needs to bundle freetype
erikj
parents: 47216
diff changeset
   450
        AC_MSG_RESULT([no])
69d409f1b81e 8190464: OpenJDK on macosx needs to bundle freetype
erikj
parents: 47216
diff changeset
   451
        AC_MSG_ERROR([--with-freetype-license must have a value])
69d409f1b81e 8190464: OpenJDK on macosx needs to bundle freetype
erikj
parents: 47216
diff changeset
   452
      elif test "x$with_freetype_license" != "x"; then
69d409f1b81e 8190464: OpenJDK on macosx needs to bundle freetype
erikj
parents: 47216
diff changeset
   453
        AC_MSG_RESULT([$with_freetype_license])
69d409f1b81e 8190464: OpenJDK on macosx needs to bundle freetype
erikj
parents: 47216
diff changeset
   454
        FREETYPE_LICENSE="$with_freetype_license"
69d409f1b81e 8190464: OpenJDK on macosx needs to bundle freetype
erikj
parents: 47216
diff changeset
   455
        BASIC_FIXUP_PATH(FREETYPE_LICENSE)
69d409f1b81e 8190464: OpenJDK on macosx needs to bundle freetype
erikj
parents: 47216
diff changeset
   456
        if test ! -f "$FREETYPE_LICENSE"; then
69d409f1b81e 8190464: OpenJDK on macosx needs to bundle freetype
erikj
parents: 47216
diff changeset
   457
          AC_MSG_ERROR([$FREETYPE_LICENSE cannot be found])
69d409f1b81e 8190464: OpenJDK on macosx needs to bundle freetype
erikj
parents: 47216
diff changeset
   458
        fi
69d409f1b81e 8190464: OpenJDK on macosx needs to bundle freetype
erikj
parents: 47216
diff changeset
   459
      else
69d409f1b81e 8190464: OpenJDK on macosx needs to bundle freetype
erikj
parents: 47216
diff changeset
   460
        if test "x$with_freetype" != "x" && test -f $with_freetype/freetype.md; then
69d409f1b81e 8190464: OpenJDK on macosx needs to bundle freetype
erikj
parents: 47216
diff changeset
   461
          FREETYPE_LICENSE="$with_freetype/freetype.md"
69d409f1b81e 8190464: OpenJDK on macosx needs to bundle freetype
erikj
parents: 47216
diff changeset
   462
          AC_MSG_RESULT([$FREETYPE_LICENSE])
69d409f1b81e 8190464: OpenJDK on macosx needs to bundle freetype
erikj
parents: 47216
diff changeset
   463
          BASIC_FIXUP_PATH(FREETYPE_LICENSE)
69d409f1b81e 8190464: OpenJDK on macosx needs to bundle freetype
erikj
parents: 47216
diff changeset
   464
        else
69d409f1b81e 8190464: OpenJDK on macosx needs to bundle freetype
erikj
parents: 47216
diff changeset
   465
          AC_MSG_RESULT([no])
69d409f1b81e 8190464: OpenJDK on macosx needs to bundle freetype
erikj
parents: 47216
diff changeset
   466
        fi
69d409f1b81e 8190464: OpenJDK on macosx needs to bundle freetype
erikj
parents: 47216
diff changeset
   467
      fi
69d409f1b81e 8190464: OpenJDK on macosx needs to bundle freetype
erikj
parents: 47216
diff changeset
   468
    fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   469
48035
69d409f1b81e 8190464: OpenJDK on macosx needs to bundle freetype
erikj
parents: 47216
diff changeset
   470
  fi # end freetype needed
45510
ef977f09bac8 8178064: OpenJDK RI binary should include the license file for freetype
erikj
parents: 43046
diff changeset
   471
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   472
  AC_SUBST(FREETYPE_BUNDLE_LIB_PATH)
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   473
  AC_SUBST(FREETYPE_CFLAGS)
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   474
  AC_SUBST(FREETYPE_LIBS)
45510
ef977f09bac8 8178064: OpenJDK RI binary should include the license file for freetype
erikj
parents: 43046
diff changeset
   475
  AC_SUBST(FREETYPE_LICENSE)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   476
])