make/autoconf/lib-ffi.m4
author dchuyko
Tue, 19 Jun 2018 18:18:46 +0300
changeset 50642 fff48b02d4a6
parent 47216 71c04702a3d5
permissions -rw-r--r--
8198719: MethodHandleHelper.linkToStatic should drop MH arg Reviewed-by: vlivanov, dlong
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
#
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
     2
# Copyright (c) 2015, 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
# Setup libffi (Foreign Function Interface)
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    28
################################################################################
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    29
AC_DEFUN_ONCE([LIB_SETUP_LIBFFI],
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    30
[
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    31
  AC_ARG_WITH(libffi, [AS_HELP_STRING([--with-libffi],
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    32
      [specify prefix directory for the libffi package
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    33
      (expecting the libraries under PATH/lib and the headers under PATH/include)])])
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    34
  AC_ARG_WITH(libffi-include, [AS_HELP_STRING([--with-libffi-include],
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    35
      [specify directory for the libffi include files])])
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    36
  AC_ARG_WITH(libffi-lib, [AS_HELP_STRING([--with-libffi-lib],
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    37
      [specify directory for the libffi library])])
42425
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
    38
  AC_ARG_ENABLE(libffi-bundling, [AS_HELP_STRING([--enable-libffi-bundling],
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
    39
      [enable bundling of libffi.so to make the built JDK runnable on more systems])])
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    40
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    41
  if test "x$NEEDS_LIB_FFI" = xfalse; then
33393
0f584e7d6ab6 8140762: Specifying --without-LIB if not needed should not result in warning
ihse
parents: 32921
diff changeset
    42
    if (test "x${with_libffi}" != x && test "x${with_libffi}" != xno) || \
0f584e7d6ab6 8140762: Specifying --without-LIB if not needed should not result in warning
ihse
parents: 32921
diff changeset
    43
        (test "x${with_libffi_include}" != x && test "x${with_libffi_include}" != xno) || \
0f584e7d6ab6 8140762: Specifying --without-LIB if not needed should not result in warning
ihse
parents: 32921
diff changeset
    44
        (test "x${with_libffi_lib}" != x && test "x${with_libffi_lib}" != xno); then
0f584e7d6ab6 8140762: Specifying --without-LIB if not needed should not result in warning
ihse
parents: 32921
diff changeset
    45
      AC_MSG_WARN([[libffi not used, so --with-libffi[-*] is ignored]])
27330
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    46
    fi
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    47
    LIBFFI_CFLAGS=
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    48
    LIBFFI_LIBS=
27330
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    49
  else
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    50
    LIBFFI_FOUND=no
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    51
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    52
    if test "x${with_libffi}" = xno || test "x${with_libffi_include}" = xno || test "x${with_libffi_lib}" = xno; then
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    53
      AC_MSG_ERROR([It is not possible to disable the use of libffi. Remove the --without-libffi option.])
27330
5e83ad1a521a 8062661: Do not perform X11 checks in configure when X11 is not needed
ihse
parents: 27239
diff changeset
    54
    fi
27239
12771c65e334 8062159: Fix Xrender check to work with sysroot
erikj
parents: 26400
diff changeset
    55
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    56
    if test "x${with_libffi}" != x; then
42425
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
    57
      LIBFFI_LIB_PATH="${with_libffi}/lib"
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    58
      LIBFFI_LIBS="-L${with_libffi}/lib -lffi"
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    59
      LIBFFI_CFLAGS="-I${with_libffi}/include"
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    60
      LIBFFI_FOUND=yes
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    61
    fi
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    62
    if test "x${with_libffi_include}" != x; then
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    63
      LIBFFI_CFLAGS="-I${with_libffi_include}"
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    64
      LIBFFI_FOUND=yes
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    65
    fi
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    66
    if test "x${with_libffi_lib}" != x; then
42425
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
    67
      LIBFFI_LIB_PATH="${with_libffi_lib}"
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    68
      LIBFFI_LIBS="-L${with_libffi_lib} -lffi"
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    69
      LIBFFI_FOUND=yes
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
    70
    fi
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    71
    # Do not try pkg-config if we have a sysroot set.
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    72
    if test "x$SYSROOT" = x; then
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    73
      if test "x$LIBFFI_FOUND" = xno; then
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    74
        # Figure out LIBFFI_CFLAGS and LIBFFI_LIBS
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    75
        PKG_CHECK_MODULES([LIBFFI], [libffi], [LIBFFI_FOUND=yes], [LIBFFI_FOUND=no])
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    76
      fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
    77
    fi
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    78
    if test "x$LIBFFI_FOUND" = xno; then
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    79
      AC_CHECK_HEADERS([ffi.h],
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
    80
          [
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    81
            LIBFFI_FOUND=yes
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    82
            LIBFFI_CFLAGS=
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    83
            LIBFFI_LIBS=-lffi
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    84
          ],
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    85
          [LIBFFI_FOUND=no]
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
    86
      )
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
    87
    fi
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    88
    if test "x$LIBFFI_FOUND" = xno; then
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    89
      HELP_MSG_MISSING_DEPENDENCY([ffi])
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    90
      AC_MSG_ERROR([Could not find libffi! $HELP_MSG])
26400
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    91
    fi
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    92
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    93
    AC_MSG_CHECKING([if libffi works])
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    94
    AC_LANG_PUSH(C)
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    95
    OLD_CFLAGS="$CFLAGS"
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    96
    CFLAGS="$CFLAGS $LIBFFI_CFLAGS"
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    97
    OLD_LIBS="$LIBS"
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    98
    LIBS="$LIBS $LIBFFI_LIBS"
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    99
    AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <ffi.h>],
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   100
        [
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   101
          ffi_call(NULL, NULL, NULL, NULL);
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   102
          return 0;
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   103
        ])],
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   104
        [LIBFFI_WORKS=yes],
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   105
        [LIBFFI_WORKS=no]
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   106
    )
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   107
    CFLAGS="$OLD_CFLAGS"
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   108
    LIBS="$OLD_LIBS"
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   109
    AC_LANG_POP(C)
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   110
    AC_MSG_RESULT([$LIBFFI_WORKS])
26400
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
   111
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   112
    if test "x$LIBFFI_WORKS" = xno; then
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   113
      HELP_MSG_MISSING_DEPENDENCY([ffi])
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   114
      AC_MSG_ERROR([Found libffi but could not link and compile with it. $HELP_MSG])
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   115
    fi
42425
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   116
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   117
    AC_MSG_CHECKING([if libffi should be bundled])
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   118
    if test "x$enable_libffi_bundling" = "x"; then
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   119
      AC_MSG_RESULT([no])
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   120
      ENABLE_LIBFFI_BUNDLING=false
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   121
    elif  test "x$enable_libffi_bundling" = "xno"; then
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   122
      AC_MSG_RESULT([no, forced])
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   123
      ENABLE_LIBFFI_BUNDLING=false
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   124
    elif  test "x$enable_libffi_bundling" = "xyes"; then
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   125
      AC_MSG_RESULT([yes, forced])
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   126
      ENABLE_LIBFFI_BUNDLING=true
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   127
    else
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   128
      AC_MSG_ERROR([Invalid value for --enable-libffi-bundling])
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   129
    fi
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   130
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   131
    # Find the libffi.so.X to bundle
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   132
    if test "x${ENABLE_LIBFFI_BUNDLING}" = "xtrue"; then
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   133
      AC_MSG_CHECKING([for libffi lib file location])
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   134
      if test "x${LIBFFI_LIB_PATH}" != x; then
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   135
        if test -e ${LIBFFI_LIB_PATH}/libffi.so.?; then
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   136
          LIBFFI_LIB_FILE="${LIBFFI_LIB_PATH}/libffi.so.?"
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   137
        else
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   138
          AC_MSG_ERROR([Could not locate libffi.so.? for bundling in ${LIBFFI_LIB_PATH}])
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   139
        fi
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   140
      else
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   141
        # If we don't have an explicit path, look in a few obvious places
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   142
        if test "x${OPENJDK_TARGET_CPU}" = "xx86"; then
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   143
          if test -e ${SYSROOT}/usr/lib/libffi.so.? ; then
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   144
            LIBFFI_LIB_FILE="${SYSROOT}/usr/lib/libffi.so.?"
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   145
          elif test -e ${SYSROOT}/usr/lib/i386-linux-gnu/libffi.so.? ; then
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   146
            LIBFFI_LIB_FILE="${SYSROOT}/usr/lib/i386-linux-gnu/libffi.so.?"
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   147
          else
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   148
            AC_MSG_ERROR([Could not locate libffi.so.? for bundling])
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   149
          fi
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   150
        elif test "x${OPENJDK_TARGET_CPU}" = "xx86_64"; then
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   151
          if test -e ${SYSROOT}/usr/lib64/libffi.so.? ; then
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   152
            LIBFFI_LIB_FILE="${SYSROOT}/usr/lib64/libffi.so.?"
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   153
          elif test -e ${SYSROOT}/usr/lib/x86_64-linux-gnu/libffi.so.? ; then
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   154
            LIBFFI_LIB_FILE="${SYSROOT}/usr/lib/x86_64-linux-gnu/libffi.so.?"
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   155
          else
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   156
            AC_MSG_ERROR([Could not locate libffi.so.? for bundling])
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   157
          fi
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   158
        else
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   159
          # Fallback on the default /usr/lib dir
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   160
          if test -e ${SYSROOT}/usr/lib/libffi.so.? ; then
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   161
            LIBFFI_LIB_FILE="${SYSROOT}/usr/lib/libffi.so.?"
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   162
          else
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   163
            AC_MSG_ERROR([Could not locate libffi.so.? for bundling])
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   164
          fi
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   165
        fi
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   166
      fi
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   167
      # Make sure the wildcard is evaluated
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   168
      LIBFFI_LIB_FILE="$(ls ${LIBFFI_LIB_FILE})"
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   169
      AC_MSG_RESULT([${LIBFFI_LIB_FILE}])
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   170
    fi
20654
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   171
  fi
2c17cbccf2ef 8001922: Improve freetype handling.
ihse
parents: 20649
diff changeset
   172
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   173
  AC_SUBST(LIBFFI_CFLAGS)
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   174
  AC_SUBST(LIBFFI_LIBS)
42425
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   175
  AC_SUBST(ENABLE_LIBFFI_BUNDLING)
57cde06ae8d6 8141590: Cannot build Zero with devkit
erikj
parents: 33393
diff changeset
   176
  AC_SUBST(LIBFFI_LIB_FILE)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   177
])