make/autoconf/lib-bundled.m4
author michaelm
Thu, 14 Nov 2019 10:16:28 +0000
branchunixdomainchannels
changeset 59076 998df1368cca
parent 54918 b88bcaa94c10
permissions -rw-r--r--
unixdomainchannels: unix domain automatic bind
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
#
54918
b88bcaa94c10 8223944: fix zlib related building docu and comments
mbaesken
parents: 54831
diff changeset
     2
# Copyright (c) 2011, 2019, 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 bundled libraries.
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    28
#
54918
b88bcaa94c10 8223944: fix zlib related building docu and comments
mbaesken
parents: 54831
diff changeset
    29
# For libjpeg, giflib, libpng, lcms2 and zlib the source is present in the
b88bcaa94c10 8223944: fix zlib related building docu and comments
mbaesken
parents: 54831
diff changeset
    30
# OpenJDK repository (referred to as "bundled"). Default is to use libjpeg,
b88bcaa94c10 8223944: fix zlib related building docu and comments
mbaesken
parents: 54831
diff changeset
    31
# giflib, libpng and lcms2 libraries as "bundled". The default for zlib is
b88bcaa94c10 8223944: fix zlib related building docu and comments
mbaesken
parents: 54831
diff changeset
    32
# to use the bundled zlib on Windows and AIX, otherwise the external ("system")
b88bcaa94c10 8223944: fix zlib related building docu and comments
mbaesken
parents: 54831
diff changeset
    33
# zlib, if present. However the libs may be replaced by an external ("system")
b88bcaa94c10 8223944: fix zlib related building docu and comments
mbaesken
parents: 54831
diff changeset
    34
# version by the user.
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    35
################################################################################
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    36
AC_DEFUN_ONCE([LIB_SETUP_BUNDLED_LIBS],
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    37
[
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    38
  LIB_SETUP_LIBJPEG
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    39
  LIB_SETUP_GIFLIB
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    40
  LIB_SETUP_LIBPNG
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    41
  LIB_SETUP_ZLIB
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    42
  LIB_SETUP_LCMS
26400
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    43
])
4d6c6f2df610 8057538: Build the freetype library during configure on Windows
simonis
parents: 25039
diff changeset
    44
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    45
################################################################################
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    46
# Setup libjpeg
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    47
################################################################################
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    48
AC_DEFUN_ONCE([LIB_SETUP_LIBJPEG],
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    49
[
25035
2c0a89ff0198 8043805: Allow using a system-installed libjpeg
omajid
parents: 24415
diff changeset
    50
  AC_ARG_WITH(libjpeg, [AS_HELP_STRING([--with-libjpeg],
2c0a89ff0198 8043805: Allow using a system-installed libjpeg
omajid
parents: 24415
diff changeset
    51
      [use libjpeg from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
2c0a89ff0198 8043805: Allow using a system-installed libjpeg
omajid
parents: 24415
diff changeset
    52
2c0a89ff0198 8043805: Allow using a system-installed libjpeg
omajid
parents: 24415
diff changeset
    53
  AC_MSG_CHECKING([for which libjpeg to use])
2c0a89ff0198 8043805: Allow using a system-installed libjpeg
omajid
parents: 24415
diff changeset
    54
  # default is bundled
2c0a89ff0198 8043805: Allow using a system-installed libjpeg
omajid
parents: 24415
diff changeset
    55
  DEFAULT_LIBJPEG=bundled
2c0a89ff0198 8043805: Allow using a system-installed libjpeg
omajid
parents: 24415
diff changeset
    56
  # if user didn't specify, use DEFAULT_LIBJPEG
2c0a89ff0198 8043805: Allow using a system-installed libjpeg
omajid
parents: 24415
diff changeset
    57
  if test "x${with_libjpeg}" = "x"; then
2c0a89ff0198 8043805: Allow using a system-installed libjpeg
omajid
parents: 24415
diff changeset
    58
    with_libjpeg=${DEFAULT_LIBJPEG}
2c0a89ff0198 8043805: Allow using a system-installed libjpeg
omajid
parents: 24415
diff changeset
    59
  fi
2c0a89ff0198 8043805: Allow using a system-installed libjpeg
omajid
parents: 24415
diff changeset
    60
  AC_MSG_RESULT(${with_libjpeg})
2c0a89ff0198 8043805: Allow using a system-installed libjpeg
omajid
parents: 24415
diff changeset
    61
2c0a89ff0198 8043805: Allow using a system-installed libjpeg
omajid
parents: 24415
diff changeset
    62
  if test "x${with_libjpeg}" = "xbundled"; then
2c0a89ff0198 8043805: Allow using a system-installed libjpeg
omajid
parents: 24415
diff changeset
    63
    USE_EXTERNAL_LIBJPEG=false
2c0a89ff0198 8043805: Allow using a system-installed libjpeg
omajid
parents: 24415
diff changeset
    64
  elif test "x${with_libjpeg}" = "xsystem"; then
2c0a89ff0198 8043805: Allow using a system-installed libjpeg
omajid
parents: 24415
diff changeset
    65
    AC_CHECK_HEADER(jpeglib.h, [],
2c0a89ff0198 8043805: Allow using a system-installed libjpeg
omajid
parents: 24415
diff changeset
    66
        [ AC_MSG_ERROR([--with-libjpeg=system specified, but jpeglib.h not found!])])
2c0a89ff0198 8043805: Allow using a system-installed libjpeg
omajid
parents: 24415
diff changeset
    67
    AC_CHECK_LIB(jpeg, jpeg_CreateDecompress, [],
2c0a89ff0198 8043805: Allow using a system-installed libjpeg
omajid
parents: 24415
diff changeset
    68
        [ AC_MSG_ERROR([--with-libjpeg=system specified, but no libjpeg found])])
2c0a89ff0198 8043805: Allow using a system-installed libjpeg
omajid
parents: 24415
diff changeset
    69
2c0a89ff0198 8043805: Allow using a system-installed libjpeg
omajid
parents: 24415
diff changeset
    70
    USE_EXTERNAL_LIBJPEG=true
2c0a89ff0198 8043805: Allow using a system-installed libjpeg
omajid
parents: 24415
diff changeset
    71
  else
2c0a89ff0198 8043805: Allow using a system-installed libjpeg
omajid
parents: 24415
diff changeset
    72
    AC_MSG_ERROR([Invalid use of --with-libjpeg: ${with_libjpeg}, use 'system' or 'bundled'])
2c0a89ff0198 8043805: Allow using a system-installed libjpeg
omajid
parents: 24415
diff changeset
    73
  fi
2c0a89ff0198 8043805: Allow using a system-installed libjpeg
omajid
parents: 24415
diff changeset
    74
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
    75
  AC_SUBST(USE_EXTERNAL_LIBJPEG)
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    76
])
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    77
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    78
################################################################################
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    79
# Setup giflib
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    80
################################################################################
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    81
AC_DEFUN_ONCE([LIB_SETUP_GIFLIB],
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
    82
[
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
    83
  AC_ARG_WITH(giflib, [AS_HELP_STRING([--with-giflib],
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
    84
      [use giflib from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
16424
d955df81d716 8011278: Allow using a system-installed giflib
omajid
parents: 15915
diff changeset
    85
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
    86
  AC_MSG_CHECKING([for which giflib to use])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
    87
  # default is bundled
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
    88
  DEFAULT_GIFLIB=bundled
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
    89
  # if user didn't specify, use DEFAULT_GIFLIB
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
    90
  if test "x${with_giflib}" = "x"; then
16424
d955df81d716 8011278: Allow using a system-installed giflib
omajid
parents: 15915
diff changeset
    91
    with_giflib=${DEFAULT_GIFLIB}
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
    92
  fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
    93
  AC_MSG_RESULT(${with_giflib})
16424
d955df81d716 8011278: Allow using a system-installed giflib
omajid
parents: 15915
diff changeset
    94
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
    95
  if test "x${with_giflib}" = "xbundled"; then
16424
d955df81d716 8011278: Allow using a system-installed giflib
omajid
parents: 15915
diff changeset
    96
    USE_EXTERNAL_LIBGIF=false
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
    97
  elif test "x${with_giflib}" = "xsystem"; then
16424
d955df81d716 8011278: Allow using a system-installed giflib
omajid
parents: 15915
diff changeset
    98
    AC_CHECK_HEADER(gif_lib.h, [],
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
    99
        [ AC_MSG_ERROR([--with-giflib=system specified, but gif_lib.h not found!])])
16424
d955df81d716 8011278: Allow using a system-installed giflib
omajid
parents: 15915
diff changeset
   100
    AC_CHECK_LIB(gif, DGifGetCode, [],
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   101
        [ AC_MSG_ERROR([--with-giflib=system specified, but no giflib found!])])
16424
d955df81d716 8011278: Allow using a system-installed giflib
omajid
parents: 15915
diff changeset
   102
d955df81d716 8011278: Allow using a system-installed giflib
omajid
parents: 15915
diff changeset
   103
    USE_EXTERNAL_LIBGIF=true
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   104
  else
16424
d955df81d716 8011278: Allow using a system-installed giflib
omajid
parents: 15915
diff changeset
   105
    AC_MSG_ERROR([Invalid value of --with-giflib: ${with_giflib}, use 'system' or 'bundled'])
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   106
  fi
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   107
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   108
  AC_SUBST(USE_EXTERNAL_LIBGIF)
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   109
])
24413
1d117d2dfe92 8042159: Allow using a system-installed lcms2
omajid
parents: 23428
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
# Setup libpng
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   113
################################################################################
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   114
AC_DEFUN_ONCE([LIB_SETUP_LIBPNG],
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   115
[
23163
1e2f42892ffe 8035341: Allow using a system installed libpng
omajid
parents: 22710
diff changeset
   116
  AC_ARG_WITH(libpng, [AS_HELP_STRING([--with-libpng],
1e2f42892ffe 8035341: Allow using a system installed libpng
omajid
parents: 22710
diff changeset
   117
     [use libpng from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
1e2f42892ffe 8035341: Allow using a system installed libpng
omajid
parents: 22710
diff changeset
   118
48056
ee64cb4455a9 8175795: configure should verify that system zlib contains needed functionality
ihse
parents: 47216
diff changeset
   119
  PKG_CHECK_MODULES(PNG, libpng, [LIBPNG_FOUND=yes], [LIBPNG_FOUND=no])
23163
1e2f42892ffe 8035341: Allow using a system installed libpng
omajid
parents: 22710
diff changeset
   120
  AC_MSG_CHECKING([for which libpng to use])
1e2f42892ffe 8035341: Allow using a system installed libpng
omajid
parents: 22710
diff changeset
   121
1e2f42892ffe 8035341: Allow using a system installed libpng
omajid
parents: 22710
diff changeset
   122
  # default is bundled
1e2f42892ffe 8035341: Allow using a system installed libpng
omajid
parents: 22710
diff changeset
   123
  DEFAULT_LIBPNG=bundled
1e2f42892ffe 8035341: Allow using a system installed libpng
omajid
parents: 22710
diff changeset
   124
  # if user didn't specify, use DEFAULT_LIBPNG
1e2f42892ffe 8035341: Allow using a system installed libpng
omajid
parents: 22710
diff changeset
   125
  if test "x${with_libpng}" = "x"; then
43383
5e74f3dd4656 8173107: Fix autoconf/spec.gmk mismatches
ihse
parents: 41458
diff changeset
   126
    with_libpng=${DEFAULT_LIBPNG}
23163
1e2f42892ffe 8035341: Allow using a system installed libpng
omajid
parents: 22710
diff changeset
   127
  fi
1e2f42892ffe 8035341: Allow using a system installed libpng
omajid
parents: 22710
diff changeset
   128
1e2f42892ffe 8035341: Allow using a system installed libpng
omajid
parents: 22710
diff changeset
   129
  if test "x${with_libpng}" = "xbundled"; then
43383
5e74f3dd4656 8173107: Fix autoconf/spec.gmk mismatches
ihse
parents: 41458
diff changeset
   130
    USE_EXTERNAL_LIBPNG=false
5e74f3dd4656 8173107: Fix autoconf/spec.gmk mismatches
ihse
parents: 41458
diff changeset
   131
    PNG_CFLAGS=""
5e74f3dd4656 8173107: Fix autoconf/spec.gmk mismatches
ihse
parents: 41458
diff changeset
   132
    PNG_LIBS=""
5e74f3dd4656 8173107: Fix autoconf/spec.gmk mismatches
ihse
parents: 41458
diff changeset
   133
    AC_MSG_RESULT([bundled])
23163
1e2f42892ffe 8035341: Allow using a system installed libpng
omajid
parents: 22710
diff changeset
   134
  elif test "x${with_libpng}" = "xsystem"; then
43383
5e74f3dd4656 8173107: Fix autoconf/spec.gmk mismatches
ihse
parents: 41458
diff changeset
   135
    if test "x${LIBPNG_FOUND}" = "xyes"; then
5e74f3dd4656 8173107: Fix autoconf/spec.gmk mismatches
ihse
parents: 41458
diff changeset
   136
      # PKG_CHECK_MODULES will set PNG_CFLAGS and PNG_LIBS
5e74f3dd4656 8173107: Fix autoconf/spec.gmk mismatches
ihse
parents: 41458
diff changeset
   137
      USE_EXTERNAL_LIBPNG=true
5e74f3dd4656 8173107: Fix autoconf/spec.gmk mismatches
ihse
parents: 41458
diff changeset
   138
      AC_MSG_RESULT([system])
5e74f3dd4656 8173107: Fix autoconf/spec.gmk mismatches
ihse
parents: 41458
diff changeset
   139
    else
5e74f3dd4656 8173107: Fix autoconf/spec.gmk mismatches
ihse
parents: 41458
diff changeset
   140
      AC_MSG_RESULT([system not found])
5e74f3dd4656 8173107: Fix autoconf/spec.gmk mismatches
ihse
parents: 41458
diff changeset
   141
      AC_MSG_ERROR([--with-libpng=system specified, but no libpng found!])
5e74f3dd4656 8173107: Fix autoconf/spec.gmk mismatches
ihse
parents: 41458
diff changeset
   142
    fi
23163
1e2f42892ffe 8035341: Allow using a system installed libpng
omajid
parents: 22710
diff changeset
   143
  else
43383
5e74f3dd4656 8173107: Fix autoconf/spec.gmk mismatches
ihse
parents: 41458
diff changeset
   144
    AC_MSG_ERROR([Invalid value of --with-libpng: ${with_libpng}, use 'system' or 'bundled'])
23163
1e2f42892ffe 8035341: Allow using a system installed libpng
omajid
parents: 22710
diff changeset
   145
  fi
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   146
23163
1e2f42892ffe 8035341: Allow using a system installed libpng
omajid
parents: 22710
diff changeset
   147
  AC_SUBST(USE_EXTERNAL_LIBPNG)
43383
5e74f3dd4656 8173107: Fix autoconf/spec.gmk mismatches
ihse
parents: 41458
diff changeset
   148
  AC_SUBST(PNG_CFLAGS)
5e74f3dd4656 8173107: Fix autoconf/spec.gmk mismatches
ihse
parents: 41458
diff changeset
   149
  AC_SUBST(PNG_LIBS)
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   150
])
23163
1e2f42892ffe 8035341: Allow using a system installed libpng
omajid
parents: 22710
diff changeset
   151
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   152
################################################################################
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   153
# Setup zlib
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   154
################################################################################
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   155
AC_DEFUN_ONCE([LIB_SETUP_ZLIB],
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   156
[
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   157
  AC_ARG_WITH(zlib, [AS_HELP_STRING([--with-zlib],
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   158
      [use zlib from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   159
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   160
  AC_CHECK_LIB(z, compress,
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   161
      [ ZLIB_FOUND=yes ],
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   162
      [ ZLIB_FOUND=no ])
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   163
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   164
  AC_MSG_CHECKING([for which zlib to use])
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   165
36546
fb6c19577a6a 8031767: Support system or alternative implementations of zlib
sherman
parents: 32921
diff changeset
   166
  DEFAULT_ZLIB=system
54831
88954c14eb57 8223685: used bundled zlib on AIX by default
mbaesken
parents: 52804
diff changeset
   167
  if test "x$OPENJDK_TARGET_OS" = xwindows -o "x$OPENJDK_TARGET_OS" = xaix; then
88954c14eb57 8223685: used bundled zlib on AIX by default
mbaesken
parents: 52804
diff changeset
   168
    # On windows and aix default is bundled, on others default is system
36546
fb6c19577a6a 8031767: Support system or alternative implementations of zlib
sherman
parents: 32921
diff changeset
   169
    DEFAULT_ZLIB=bundled
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   170
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   171
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   172
  if test "x${ZLIB_FOUND}" != "xyes"; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   173
    # If we don't find any system...set default to bundled
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   174
    DEFAULT_ZLIB=bundled
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   175
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   176
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   177
  # If user didn't specify, use DEFAULT_ZLIB
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   178
  if test "x${with_zlib}" = "x"; then
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   179
    with_zlib=${DEFAULT_ZLIB}
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   180
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   181
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   182
  if test "x${with_zlib}" = "xbundled"; then
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   183
    USE_EXTERNAL_LIBZ=false
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   184
    AC_MSG_RESULT([bundled])
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   185
  elif test "x${with_zlib}" = "xsystem"; then
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   186
    if test "x${ZLIB_FOUND}" = "xyes"; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   187
      USE_EXTERNAL_LIBZ=true
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   188
      AC_MSG_RESULT([system])
48056
ee64cb4455a9 8175795: configure should verify that system zlib contains needed functionality
ihse
parents: 47216
diff changeset
   189
ee64cb4455a9 8175795: configure should verify that system zlib contains needed functionality
ihse
parents: 47216
diff changeset
   190
      if test "x$USE_EXTERNAL_LIBPNG" != "xtrue"; then
ee64cb4455a9 8175795: configure should verify that system zlib contains needed functionality
ihse
parents: 47216
diff changeset
   191
        # If we use bundled libpng, we must verify that we have a proper zlib.
ee64cb4455a9 8175795: configure should verify that system zlib contains needed functionality
ihse
parents: 47216
diff changeset
   192
        # For instance zlib-ng has had issues with inflateValidate().
ee64cb4455a9 8175795: configure should verify that system zlib contains needed functionality
ihse
parents: 47216
diff changeset
   193
        AC_MSG_CHECKING([for system zlib functionality])
ee64cb4455a9 8175795: configure should verify that system zlib contains needed functionality
ihse
parents: 47216
diff changeset
   194
        AC_COMPILE_IFELSE(
ee64cb4455a9 8175795: configure should verify that system zlib contains needed functionality
ihse
parents: 47216
diff changeset
   195
            [AC_LANG_PROGRAM([#include "zlib.h"], [
ee64cb4455a9 8175795: configure should verify that system zlib contains needed functionality
ihse
parents: 47216
diff changeset
   196
                #if ZLIB_VERNUM >= 0x1281
ee64cb4455a9 8175795: configure should verify that system zlib contains needed functionality
ihse
parents: 47216
diff changeset
   197
                  inflateValidate(NULL, 0);
ee64cb4455a9 8175795: configure should verify that system zlib contains needed functionality
ihse
parents: 47216
diff changeset
   198
                #endif
ee64cb4455a9 8175795: configure should verify that system zlib contains needed functionality
ihse
parents: 47216
diff changeset
   199
            ])],
ee64cb4455a9 8175795: configure should verify that system zlib contains needed functionality
ihse
parents: 47216
diff changeset
   200
            [AC_MSG_RESULT([ok])],
ee64cb4455a9 8175795: configure should verify that system zlib contains needed functionality
ihse
parents: 47216
diff changeset
   201
            [
ee64cb4455a9 8175795: configure should verify that system zlib contains needed functionality
ihse
parents: 47216
diff changeset
   202
                AC_MSG_RESULT([not ok])
ee64cb4455a9 8175795: configure should verify that system zlib contains needed functionality
ihse
parents: 47216
diff changeset
   203
                AC_MSG_ERROR([System zlib not working correctly])
ee64cb4455a9 8175795: configure should verify that system zlib contains needed functionality
ihse
parents: 47216
diff changeset
   204
            ]
ee64cb4455a9 8175795: configure should verify that system zlib contains needed functionality
ihse
parents: 47216
diff changeset
   205
        )
ee64cb4455a9 8175795: configure should verify that system zlib contains needed functionality
ihse
parents: 47216
diff changeset
   206
      fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   207
    else
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   208
      AC_MSG_RESULT([system not found])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   209
      AC_MSG_ERROR([--with-zlib=system specified, but no zlib found!])
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   210
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   211
  else
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   212
    AC_MSG_ERROR([Invalid value for --with-zlib: ${with_zlib}, use 'system' or 'bundled'])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   213
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   214
48758
ba19a21d727d 8196951: jdk build fails with clang: error: no such file or directory: '@LIBZ_CFLAGS@'
erikj
parents: 48753
diff changeset
   215
  LIBZ_CFLAGS=""
ba19a21d727d 8196951: jdk build fails with clang: error: no such file or directory: '@LIBZ_CFLAGS@'
erikj
parents: 48753
diff changeset
   216
  LIBZ_LIBS=""
48753
d018e76655fb 8196911: Windows build fails with not finding zlib.h
erikj
parents: 48751
diff changeset
   217
  if test "x$USE_EXTERNAL_LIBZ" = "xfalse"; then
48751
54f355e65415 8196803: Fix build warnings in jdk libraries with Xcode 9
erikj
parents: 48056
diff changeset
   218
    LIBZ_CFLAGS="$LIBZ_CFLAGS -I$TOPDIR/src/java.base/share/native/libzip/zlib"
54f355e65415 8196803: Fix build warnings in jdk libraries with Xcode 9
erikj
parents: 48056
diff changeset
   219
  else
54f355e65415 8196803: Fix build warnings in jdk libraries with Xcode 9
erikj
parents: 48056
diff changeset
   220
    LIBZ_LIBS="-lz"
54f355e65415 8196803: Fix build warnings in jdk libraries with Xcode 9
erikj
parents: 48056
diff changeset
   221
  fi
54f355e65415 8196803: Fix build warnings in jdk libraries with Xcode 9
erikj
parents: 48056
diff changeset
   222
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   223
  AC_SUBST(USE_EXTERNAL_LIBZ)
48751
54f355e65415 8196803: Fix build warnings in jdk libraries with Xcode 9
erikj
parents: 48056
diff changeset
   224
  AC_SUBST(LIBZ_CFLAGS)
54f355e65415 8196803: Fix build warnings in jdk libraries with Xcode 9
erikj
parents: 48056
diff changeset
   225
  AC_SUBST(LIBZ_LIBS)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   226
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   227
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   228
################################################################################
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   229
# Setup lcms (Little CMS)
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   230
################################################################################
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   231
AC_DEFUN_ONCE([LIB_SETUP_LCMS],
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   232
[
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   233
  AC_ARG_WITH(lcms, [AS_HELP_STRING([--with-lcms],
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   234
      [use lcms2 from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   235
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   236
  AC_MSG_CHECKING([for which lcms to use])
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   237
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   238
  DEFAULT_LCMS=bundled
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   239
  # If user didn't specify, use DEFAULT_LCMS
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   240
  if test "x${with_lcms}" = "x"; then
43383
5e74f3dd4656 8173107: Fix autoconf/spec.gmk mismatches
ihse
parents: 41458
diff changeset
   241
    with_lcms=${DEFAULT_LCMS}
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   242
  fi
16581
b2cddec593f4 8011388: Support building zero and zeroshark with the new build
omajid
parents: 16424
diff changeset
   243
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   244
  if test "x${with_lcms}" = "xbundled"; then
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   245
    USE_EXTERNAL_LCMS=false
43383
5e74f3dd4656 8173107: Fix autoconf/spec.gmk mismatches
ihse
parents: 41458
diff changeset
   246
    LCMS_CFLAGS=""
5e74f3dd4656 8173107: Fix autoconf/spec.gmk mismatches
ihse
parents: 41458
diff changeset
   247
    LCMS_LIBS=""
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   248
    AC_MSG_RESULT([bundled])
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   249
  elif test "x${with_lcms}" = "xsystem"; then
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   250
    AC_MSG_RESULT([system])
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   251
    PKG_CHECK_MODULES([LCMS], [lcms2], [LCMS_FOUND=yes], [LCMS_FOUND=no])
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   252
    if test "x${LCMS_FOUND}" = "xyes"; then
43383
5e74f3dd4656 8173107: Fix autoconf/spec.gmk mismatches
ihse
parents: 41458
diff changeset
   253
      # PKG_CHECK_MODULES will set LCMS_CFLAGS and LCMS_LIBS
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   254
      USE_EXTERNAL_LCMS=true
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   255
    else
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   256
      AC_MSG_ERROR([--with-lcms=system specified, but no lcms found!])
16581
b2cddec593f4 8011388: Support building zero and zeroshark with the new build
omajid
parents: 16424
diff changeset
   257
    fi
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   258
  else
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   259
    AC_MSG_ERROR([Invalid value for --with-lcms: ${with_lcms}, use 'system' or 'bundled'])
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 19524
diff changeset
   260
  fi
16581
b2cddec593f4 8011388: Support building zero and zeroshark with the new build
omajid
parents: 16424
diff changeset
   261
32921
8e0250dfa145 8138761: Improved handling of libffi, and cleanup of libraries.m4
ihse
parents: 31327
diff changeset
   262
  AC_SUBST(USE_EXTERNAL_LCMS)
43383
5e74f3dd4656 8173107: Fix autoconf/spec.gmk mismatches
ihse
parents: 41458
diff changeset
   263
  AC_SUBST(LCMS_CFLAGS)
5e74f3dd4656 8173107: Fix autoconf/spec.gmk mismatches
ihse
parents: 41458
diff changeset
   264
  AC_SUBST(LCMS_LIBS)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   265
])