make/autoconf/lib-freetype.m4
author herrick
Thu, 28 Mar 2019 13:49:38 -0400
branchJDK-8200758-branch
changeset 57292 7a683c461b80
parent 53597 04b92d6fc45d
permissions -rw-r--r--
Merge
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
#
49234
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
     2
# Copyright (c) 2011, 2018, 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
# 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
    28
################################################################################
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
    29
AC_DEFUN([LIB_CHECK_POTENTIAL_FREETYPE],
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
    30
[
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
    31
  POTENTIAL_FREETYPE_INCLUDE_PATH="$1"
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
    32
  POTENTIAL_FREETYPE_LIB_PATH="$2"
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
    33
  METHOD="$3"
26400
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    34
27331
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
    35
  # 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
    36
  FOUND_FREETYPE=yes
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
    37
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
    38
  # 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
    39
  if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
49234
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
    40
    # Oh no! Let's try in the freetype2 directory.
27331
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
    41
    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
    42
    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
    43
      # Fail.
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
    44
      FOUND_FREETYPE=no
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
    45
    fi
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
    46
  fi
27595
cff167b3bfa2 8065914: Various improvements and cleanup of build system
ihse
parents: 27331
diff changeset
    47
49234
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
    48
  if test "x$FOUND_FREETYPE" = "xyes"; then
27331
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
    49
    # Include file found, let's continue the sanity check.
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
    50
    AC_MSG_NOTICE([Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
    51
27331
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
    52
    FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
    53
    if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
49234
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
    54
      AC_MSG_NOTICE([Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location.])
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
    55
      FOUND_FREETYPE=no
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
    56
    else
49234
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
    57
      if test "x$OPENJDK_TARGET_OS" = "xsolaris" \
24081
f98557ef4bf8 8042213: Freetype detection fails on Solaris sparcv9 when using devkit
erikj
parents: 23428
diff changeset
    58
          && 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
    59
        # Found lib in isa dir, use that instead.
f98557ef4bf8 8042213: Freetype detection fails on Solaris sparcv9 when using devkit
erikj
parents: 23428
diff changeset
    60
        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
    61
        AC_MSG_NOTICE([Rewriting to use $POTENTIAL_FREETYPE_LIB_PATH instead])
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
    62
      fi
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
    63
    fi
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
    64
  fi
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
    65
49234
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
    66
  if test "x$FOUND_FREETYPE" = "xyes"; then
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
    67
    FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH"
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
    68
    AC_MSG_CHECKING([for freetype includes])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
    69
    AC_MSG_RESULT([$FREETYPE_INCLUDE_PATH])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
    70
    FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH"
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
    71
    AC_MSG_CHECKING([for freetype libraries])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
    72
    AC_MSG_RESULT([$FREETYPE_LIB_PATH])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
    73
  fi
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
    74
])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
    75
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    76
################################################################################
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    77
# Setup freetype (The FreeType2 font rendering library)
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    78
################################################################################
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    79
AC_DEFUN_ONCE([LIB_SETUP_FREETYPE],
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    80
[
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
    81
  AC_ARG_WITH(freetype, [AS_HELP_STRING([--with-freetype],
49234
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
    82
      [specify whether to use 'system' or 'bundled' freetype. Other values are errors.
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
    83
       The selected option applies to both build time and run time.
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
    84
       The default behaviour can be platform dependent.
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
    85
       If using 'system' and either the include files or libraries cannot be
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
    86
       located automatically, then additionally specify both using
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
    87
       --with-freetype-include and --with-freetype-lib.])])
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
    88
  AC_ARG_WITH(freetype-include, [AS_HELP_STRING([--with-freetype-include],
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
    89
      [specify directory for the freetype include files])])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
    90
  AC_ARG_WITH(freetype-lib, [AS_HELP_STRING([--with-freetype-lib],
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
    91
      [specify directory for the freetype library])])
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    92
49234
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
    93
  # This setup is to verify access to system installed freetype header and libraries.
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
    94
  # On Windows and MacOS this does not apply and using these options will report an error.
53597
04b92d6fc45d 8218046: use bundled freetype in the AIX build by default
mbaesken
parents: 53561
diff changeset
    95
  # On other platforms (Linux, Solaris), they will default to using
49234
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
    96
  # the system libraries. If they are found automatically, nothing need be done.
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
    97
  # If they are not found, the configure "--with-freetype-*" options may be used to fix that.
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
    98
  # If the preference is to bundle on these platforms then use --with-freetype=bundled
27331
3947187af23d 8062816: Fix configure freetype detection on Mac OS X Yosemite
ihse
parents: 27330
diff changeset
    99
  FREETYPE_BASE_NAME=freetype
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   100
  FREETYPE_CFLAGS=
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   101
  FREETYPE_LIBS=
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   102
49234
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   103
  if (test "x$with_freetype_include" = "x"  && test "x$with_freetype_lib" != "x") || \
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   104
     (test "x$with_freetype_include" != "x"  && test "x$with_freetype_lib" = "x"); then
53561
3f4b89a17892 8217979: lib-freetype related configure messages contain wrong configure flag names
mbaesken
parents: 52447
diff changeset
   105
       AC_MSG_ERROR(['must specify both or neither of --with-freetype-include and --with-freetype-lib])
49234
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   106
  fi
26400
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   107
49234
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   108
  FREETYPE_TO_USE=bundled
53597
04b92d6fc45d 8218046: use bundled freetype in the AIX build by default
mbaesken
parents: 53561
diff changeset
   109
  if (test "x$OPENJDK_TARGET_OS" != "xwindows" && test "x$OPENJDK_TARGET_OS" != "xmacosx" \
04b92d6fc45d 8218046: use bundled freetype in the AIX build by default
mbaesken
parents: 53561
diff changeset
   110
      && test "x$OPENJDK_TARGET_OS" != "xaix"); then
49234
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   111
    FREETYPE_TO_USE=system
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   112
  fi
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   113
  if (test "x$with_freetype" != "x"); then
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   114
    if (test "x$with_freetype" = "xsystem"); then
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   115
      FREETYPE_TO_USE=system
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   116
    elif (test "x$with_freetype" = "xbundled"); then
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   117
      FREETYPE_TO_USE=bundled
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   118
      if (test "x$with_freetype_include" != "x"  || test "x$with_freetype_lib" != "x"); then
53561
3f4b89a17892 8217979: lib-freetype related configure messages contain wrong configure flag names
mbaesken
parents: 52447
diff changeset
   119
        AC_MSG_ERROR(['bundled' cannot be specified with --with-freetype-include and --with-freetype-lib])
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   120
      fi
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   121
    else
49234
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   122
       AC_MSG_ERROR(['valid values for --with-freetype are 'system' and 'bundled'])
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   123
    fi
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   124
  fi
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   125
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   126
  if (test "x$with_freetype_include" != "x"  && test "x$with_freetype_lib" != "x"); then 
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   127
      FREETYPE_TO_USE=system
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   128
  fi
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   129
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   130
  if (test "x$FREETYPE_TO_USE" = "xsystem") && \
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   131
     (test "x$OPENJDK_TARGET_OS" = "xwindows" || test "x$OPENJDK_TARGET_OS" = "xmacosx"); then
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   132
       AC_MSG_ERROR([Only bundled freetype can be specified on Mac and Windows])
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   133
  fi
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   134
49234
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   135
  if (test "x$with_freetype_include" != "x"); then
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   136
    POTENTIAL_FREETYPE_INCLUDE_PATH="$with_freetype_include"
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   137
  fi
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   138
  if (test "x$with_freetype_lib" != "x"); then
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   139
    POTENTIAL_FREETYPE_LIB_PATH="$with_freetype_lib"
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   140
  fi
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   141
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   142
  if (test "x$FREETYPE_TO_USE" = "xsystem"); then
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   143
    if (test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" != "x" && test "x$POTENTIAL_FREETYPE_LIB_PATH" != "x"); then
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   144
      # Okay, we got it. Check that it works.
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   145
      LIB_CHECK_POTENTIAL_FREETYPE($POTENTIAL_FREETYPE_INCLUDE_PATH, $POTENTIAL_FREETYPE_LIB_PATH, [--with-freetype])
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   146
      if (test "x$FOUND_FREETYPE" != "xyes"); then
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   147
        AC_MSG_ERROR([Can not find or use freetype at location given by --with-freetype-lib|include])
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   148
      fi
49234
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   149
    else
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   150
      # User did not specify a location, but asked for system freetype. Try to locate it.
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   151
23428
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23165
diff changeset
   152
      # If we have a sysroot, assume that's where we are supposed to look and skip pkg-config.
49234
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   153
      if (test "x$SYSROOT" = "x"); then
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   154
        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
   155
          # Check modules using pkg-config, but only if we have it (ugly output results otherwise)
49234
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   156
          if (test "x$PKG_CONFIG" != "x"); then
23428
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23165
diff changeset
   157
            PKG_CHECK_MODULES(FREETYPE, freetype2, [FOUND_FREETYPE=yes], [FOUND_FREETYPE=no])
49234
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   158
            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
   159
              # 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
   160
              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
   161
              # 64-bit libs for Solaris x86 are installed in the amd64 subdirectory, change lib to lib/amd64
49234
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   162
              if (test "x$OPENJDK_TARGET_OS" = "xsolaris" && test "x$OPENJDK_TARGET_CPU" = "xx86_64"); then
23428
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23165
diff changeset
   163
                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
   164
              fi
49234
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   165
              AC_MSG_CHECKING([for freetype])
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   166
              AC_MSG_RESULT([yes (using pkg-config)])
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   167
            fi
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   168
          fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   169
        fi
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   170
      fi
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   171
49234
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   172
      if (test "x$FOUND_FREETYPE" != "xyes"); then
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   173
        # Check in well-known locations
49234
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   174
        FREETYPE_BASE_DIR="$SYSROOT/usr"
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   175
        LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   176
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   177
        if (test "x$FOUND_FREETYPE" != "xyes"); then
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   178
          FREETYPE_BASE_DIR="$SYSROOT/usr/X11"
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   179
          LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
49234
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   180
        fi
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   181
        if (test "x$FOUND_FREETYPE" != "xyes"); then
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   182
          FREETYPE_BASE_DIR="$SYSROOT/usr/local"
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   183
          LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   184
        fi
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   185
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   186
        if (test "x$FOUND_FREETYPE" != "xyes"); then
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   187
          FREETYPE_BASE_DIR="$SYSROOT/usr"
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   188
          if (test "x$OPENJDK_TARGET_CPU_BITS" = "x64"); then
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   189
            LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib/$OPENJDK_TARGET_CPU-linux-gnu], [well-known location])
52447
4547f8303f2d 8213515: Improve freetype detection on linux/ppc64/ppc64le/s390x
simonis
parents: 49234
diff changeset
   190
            if (test "x$FOUND_FREETYPE" != "xyes"); then
4547f8303f2d 8213515: Improve freetype detection on linux/ppc64/ppc64le/s390x
simonis
parents: 49234
diff changeset
   191
              LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib64], [well-known location])
4547f8303f2d 8213515: Improve freetype detection on linux/ppc64/ppc64le/s390x
simonis
parents: 49234
diff changeset
   192
            fi
49234
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   193
          else
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   194
            LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib/i386-linux-gnu], [well-known location])
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   195
            if (test "x$FOUND_FREETYPE" != "xyes"); then
34604
2adbe257ce54 8145548: Add default directory for freetype source
ihse
parents: 33393
diff changeset
   196
              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
   197
            fi
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   198
          fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   199
        fi
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   200
      fi # end check in well-known locations
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   201
49234
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   202
      if (test "x$FOUND_FREETYPE" != "xyes"); then
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   203
        HELP_MSG_MISSING_DEPENDENCY([freetype])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   204
        AC_MSG_ERROR([Could not find freetype! $HELP_MSG ])
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   205
      fi
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   206
    fi # end user specified settings
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   207
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   208
    # Set FREETYPE_CFLAGS, _LIBS and _LIB_PATH from include and lib dir.
49234
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   209
    if (test "x$FREETYPE_CFLAGS" = "x"); then
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   210
      if (test -d $FREETYPE_INCLUDE_PATH/freetype2/freetype); then
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   211
        FREETYPE_CFLAGS="-I$FREETYPE_INCLUDE_PATH/freetype2 -I$FREETYPE_INCLUDE_PATH"
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   212
      else
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   213
        FREETYPE_CFLAGS="-I$FREETYPE_INCLUDE_PATH"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   214
      fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   215
    fi
26400
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   216
49234
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   217
    if (test "x$FREETYPE_LIBS" = "x"); then
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   218
      FREETYPE_LIBS="-L$FREETYPE_LIB_PATH -l$FREETYPE_BASE_NAME"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   219
    fi
49234
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   220
  fi
26400
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   221
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   222
49234
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   223
    AC_MSG_RESULT([Using freetype: $FREETYPE_TO_USE])
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   224
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   225
49234
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 48035
diff changeset
   226
  AC_SUBST(FREETYPE_TO_USE)
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   227
  AC_SUBST(FREETYPE_CFLAGS)
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   228
  AC_SUBST(FREETYPE_LIBS)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   229
])