jdk

Форк
0
/
lib-bundled.m4 
315 строк · 10.6 Кб
1
#
2
# Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
#
5
# This code is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License version 2 only, as
7
# published by the Free Software Foundation.  Oracle designates this
8
# particular file as subject to the "Classpath" exception as provided
9
# by Oracle in the LICENSE file that accompanied this code.
10
#
11
# This code is distributed in the hope that it will be useful, but WITHOUT
12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14
# version 2 for more details (a copy is included in the LICENSE file that
15
# accompanied this code).
16
#
17
# You should have received a copy of the GNU General Public License version
18
# 2 along with this work; if not, write to the Free Software Foundation,
19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
#
21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
# or visit www.oracle.com if you need additional information or have any
23
# questions.
24
#
25

26
################################################################################
27
# Setup bundled libraries.
28
#
29
# For libjpeg, giflib, libpng, lcms2 and zlib the source is present in the
30
# OpenJDK repository (referred to as "bundled"). Default is to use libjpeg,
31
# giflib, libpng and lcms2 libraries as "bundled". The default for zlib is
32
# to use the bundled zlib on Windows and AIX, otherwise the external ("system")
33
# zlib, if present. However the libs may be replaced by an external ("system")
34
# version by the user.
35
################################################################################
36
AC_DEFUN_ONCE([LIB_SETUP_BUNDLED_LIBS],
37
[
38
  LIB_SETUP_LIBJPEG
39
  LIB_SETUP_GIFLIB
40
  LIB_SETUP_LIBPNG
41
  LIB_SETUP_ZLIB
42
  LIB_SETUP_LCMS
43
  LIB_SETUP_HARFBUZZ
44
])
45

46
################################################################################
47
# Setup libjpeg
48
################################################################################
49
AC_DEFUN_ONCE([LIB_SETUP_LIBJPEG],
50
[
51
  AC_ARG_WITH(libjpeg, [AS_HELP_STRING([--with-libjpeg],
52
      [use libjpeg from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
53

54
  AC_MSG_CHECKING([for which libjpeg to use])
55
  # default is bundled
56
  DEFAULT_LIBJPEG=bundled
57
  # if user didn't specify, use DEFAULT_LIBJPEG
58
  if test "x${with_libjpeg}" = "x"; then
59
    with_libjpeg=${DEFAULT_LIBJPEG}
60
  fi
61
  AC_MSG_RESULT(${with_libjpeg})
62

63
  if test "x${with_libjpeg}" = "xbundled"; then
64
    USE_EXTERNAL_LIBJPEG=false
65
  elif test "x${with_libjpeg}" = "xsystem"; then
66
    AC_CHECK_HEADER(jpeglib.h, [],
67
        [ AC_MSG_ERROR([--with-libjpeg=system specified, but jpeglib.h not found!])])
68
    AC_CHECK_LIB(jpeg, jpeg_CreateDecompress, [],
69
        [ AC_MSG_ERROR([--with-libjpeg=system specified, but no libjpeg found])])
70

71
    USE_EXTERNAL_LIBJPEG=true
72
    LIBJPEG_LIBS="-ljpeg"
73
  else
74
    AC_MSG_ERROR([Invalid use of --with-libjpeg: ${with_libjpeg}, use 'system' or 'bundled'])
75
  fi
76

77
  AC_SUBST(USE_EXTERNAL_LIBJPEG)
78
  AC_SUBST(LIBJPEG_LIBS)
79
])
80

81
################################################################################
82
# Setup giflib
83
################################################################################
84
AC_DEFUN_ONCE([LIB_SETUP_GIFLIB],
85
[
86
  AC_ARG_WITH(giflib, [AS_HELP_STRING([--with-giflib],
87
      [use giflib from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
88

89
  AC_MSG_CHECKING([for which giflib to use])
90
  # default is bundled
91
  DEFAULT_GIFLIB=bundled
92
  # if user didn't specify, use DEFAULT_GIFLIB
93
  if test "x${with_giflib}" = "x"; then
94
    with_giflib=${DEFAULT_GIFLIB}
95
  fi
96
  AC_MSG_RESULT(${with_giflib})
97

98
  if test "x${with_giflib}" = "xbundled"; then
99
    USE_EXTERNAL_LIBGIF=false
100
  elif test "x${with_giflib}" = "xsystem"; then
101
    AC_CHECK_HEADER(gif_lib.h, [],
102
        [ AC_MSG_ERROR([--with-giflib=system specified, but gif_lib.h not found!])])
103
    AC_CHECK_LIB(gif, DGifGetCode, [],
104
        [ AC_MSG_ERROR([--with-giflib=system specified, but no giflib found!])])
105

106
    USE_EXTERNAL_LIBGIF=true
107
    GIFLIB_LIBS=-lgif
108
  else
109
    AC_MSG_ERROR([Invalid value of --with-giflib: ${with_giflib}, use 'system' or 'bundled'])
110
  fi
111

112
  AC_SUBST(USE_EXTERNAL_LIBGIF)
113
  AC_SUBST(GIFLIB_LIBS)
114
])
115

116
################################################################################
117
# Setup libpng
118
################################################################################
119
AC_DEFUN_ONCE([LIB_SETUP_LIBPNG],
120
[
121
  AC_ARG_WITH(libpng, [AS_HELP_STRING([--with-libpng],
122
     [use libpng from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
123

124
  PKG_CHECK_MODULES(PNG, libpng, [LIBPNG_FOUND=yes], [LIBPNG_FOUND=no])
125
  AC_MSG_CHECKING([for which libpng to use])
126

127
  # default is bundled
128
  DEFAULT_LIBPNG=bundled
129
  # if user didn't specify, use DEFAULT_LIBPNG
130
  if test "x${with_libpng}" = "x"; then
131
    with_libpng=${DEFAULT_LIBPNG}
132
  fi
133

134
  if test "x${with_libpng}" = "xbundled"; then
135
    USE_EXTERNAL_LIBPNG=false
136
    PNG_CFLAGS=""
137
    PNG_LIBS=""
138
    AC_MSG_RESULT([bundled])
139
  elif test "x${with_libpng}" = "xsystem"; then
140
    if test "x${LIBPNG_FOUND}" = "xyes"; then
141
      # PKG_CHECK_MODULES will set PNG_CFLAGS and PNG_LIBS
142
      USE_EXTERNAL_LIBPNG=true
143
      AC_MSG_RESULT([system])
144
    else
145
      AC_MSG_RESULT([system not found])
146
      AC_MSG_ERROR([--with-libpng=system specified, but no libpng found!])
147
    fi
148
  else
149
    AC_MSG_ERROR([Invalid value of --with-libpng: ${with_libpng}, use 'system' or 'bundled'])
150
  fi
151

152
  AC_SUBST(USE_EXTERNAL_LIBPNG)
153
  AC_SUBST(PNG_CFLAGS)
154
  AC_SUBST(PNG_LIBS)
155
])
156

157
################################################################################
158
# Setup zlib
159
################################################################################
160
AC_DEFUN_ONCE([LIB_SETUP_ZLIB],
161
[
162
  AC_ARG_WITH(zlib, [AS_HELP_STRING([--with-zlib],
163
      [use zlib from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
164

165
  AC_CHECK_LIB(z, compress,
166
      [ ZLIB_FOUND=yes ],
167
      [ ZLIB_FOUND=no ])
168

169
  AC_MSG_CHECKING([for which zlib to use])
170

171
  DEFAULT_ZLIB=system
172
  if test "x$OPENJDK_TARGET_OS" = xwindows -o "x$OPENJDK_TARGET_OS" = xaix; then
173
    # On windows and aix default is bundled
174
    DEFAULT_ZLIB=bundled
175
  elif test "x$OPENJDK_TARGET_OS" = xmacosx -a "x$OPENJDK_TARGET_CPU" = xaarch64; then
176
    DEFAULT_ZLIB=bundled
177
  fi
178

179
  if test "x${ZLIB_FOUND}" != "xyes"; then
180
    # If we don't find any system...set default to bundled
181
    DEFAULT_ZLIB=bundled
182
  fi
183

184
  # If user didn't specify, use DEFAULT_ZLIB
185
  if test "x${with_zlib}" = "x"; then
186
    with_zlib=${DEFAULT_ZLIB}
187
  fi
188

189
  if test "x${with_zlib}" = "xbundled"; then
190
    USE_EXTERNAL_LIBZ=false
191
    AC_MSG_RESULT([bundled])
192
  elif test "x${with_zlib}" = "xsystem"; then
193
    if test "x${ZLIB_FOUND}" = "xyes"; then
194
      USE_EXTERNAL_LIBZ=true
195
      AC_MSG_RESULT([system])
196

197
      if test "x$USE_EXTERNAL_LIBPNG" != "xtrue"; then
198
        # If we use bundled libpng, we must verify that we have a proper zlib.
199
        # For instance zlib-ng has had issues with inflateValidate().
200
        AC_MSG_CHECKING([for system zlib functionality])
201
        AC_COMPILE_IFELSE(
202
            [AC_LANG_PROGRAM([#include "zlib.h"], [
203
                #if ZLIB_VERNUM >= 0x1281
204
                  inflateValidate(NULL, 0);
205
                #endif
206
            ])],
207
            [AC_MSG_RESULT([ok])],
208
            [
209
                AC_MSG_RESULT([not ok])
210
                AC_MSG_ERROR([System zlib not working correctly])
211
            ]
212
        )
213
      fi
214
    else
215
      AC_MSG_RESULT([system not found])
216
      AC_MSG_ERROR([--with-zlib=system specified, but no zlib found!])
217
    fi
218
  else
219
    AC_MSG_ERROR([Invalid value for --with-zlib: ${with_zlib}, use 'system' or 'bundled'])
220
  fi
221

222
  LIBZ_CFLAGS=""
223
  LIBZ_LIBS=""
224
  if test "x$USE_EXTERNAL_LIBZ" = "xfalse"; then
225
    LIBZ_CFLAGS="$LIBZ_CFLAGS -I$TOPDIR/src/java.base/share/native/libzip/zlib"
226
    if test "x$OPENJDK_TARGET_OS" = xmacosx; then
227
        LIBZ_CFLAGS="$LIBZ_CFLAGS -DHAVE_UNISTD_H"
228
    fi
229
  else
230
    LIBZ_LIBS="-lz"
231
  fi
232

233
  AC_SUBST(USE_EXTERNAL_LIBZ)
234
  AC_SUBST(LIBZ_CFLAGS)
235
  AC_SUBST(LIBZ_LIBS)
236
])
237

238
################################################################################
239
# Setup lcms (Little CMS)
240
################################################################################
241
AC_DEFUN_ONCE([LIB_SETUP_LCMS],
242
[
243
  AC_ARG_WITH(lcms, [AS_HELP_STRING([--with-lcms],
244
      [use lcms2 from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
245

246
  AC_MSG_CHECKING([for which lcms to use])
247

248
  DEFAULT_LCMS=bundled
249
  # If user didn't specify, use DEFAULT_LCMS
250
  if test "x${with_lcms}" = "x"; then
251
    with_lcms=${DEFAULT_LCMS}
252
  fi
253

254
  if test "x${with_lcms}" = "xbundled"; then
255
    USE_EXTERNAL_LCMS=false
256
    LCMS_CFLAGS=""
257
    LCMS_LIBS=""
258
    AC_MSG_RESULT([bundled])
259
  elif test "x${with_lcms}" = "xsystem"; then
260
    AC_MSG_RESULT([system])
261
    PKG_CHECK_MODULES([LCMS], [lcms2], [LCMS_FOUND=yes], [LCMS_FOUND=no])
262
    if test "x${LCMS_FOUND}" = "xyes"; then
263
      # PKG_CHECK_MODULES will set LCMS_CFLAGS and LCMS_LIBS
264
      USE_EXTERNAL_LCMS=true
265
    else
266
      AC_MSG_ERROR([--with-lcms=system specified, but no lcms found!])
267
    fi
268
  else
269
    AC_MSG_ERROR([Invalid value for --with-lcms: ${with_lcms}, use 'system' or 'bundled'])
270
  fi
271

272
  AC_SUBST(USE_EXTERNAL_LCMS)
273
  AC_SUBST(LCMS_CFLAGS)
274
  AC_SUBST(LCMS_LIBS)
275
])
276

277
################################################################################
278
# Setup harfbuzz
279
################################################################################
280
AC_DEFUN_ONCE([LIB_SETUP_HARFBUZZ],
281
[
282
  AC_ARG_WITH(harfbuzz, [AS_HELP_STRING([--with-harfbuzz],
283
      [use harfbuzz from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
284

285
  AC_MSG_CHECKING([for which harfbuzz to use])
286

287
  DEFAULT_HARFBUZZ=bundled
288
  # If user didn't specify, use DEFAULT_HARFBUZZ
289
  if test "x${with_harfbuzz}" = "x"; then
290
    with_harfbuzz=${DEFAULT_HARFBUZZ}
291
  fi
292

293
  if test "x${with_harfbuzz}" = "xbundled"; then
294
    USE_EXTERNAL_HARFBUZZ=false
295
    HARFBUZZ_CFLAGS=""
296
    HARFBUZZ_LIBS=""
297
    AC_MSG_RESULT([bundled])
298
  elif test "x${with_harfbuzz}" = "xsystem"; then
299
    AC_MSG_RESULT([system])
300
    PKG_CHECK_MODULES([HARFBUZZ], [harfbuzz], [HARFBUZZ_FOUND=yes], [HARFBUZZ_FOUND=no])
301
    if test "x${HARFBUZZ_FOUND}" = "xyes"; then
302
      # PKG_CHECK_MODULES will set HARFBUZZ_CFLAGS and HARFBUZZ_LIBS
303
      USE_EXTERNAL_HARFBUZZ=true
304
    else
305
      HELP_MSG_MISSING_DEPENDENCY([harfbuzz])
306
      AC_MSG_ERROR([--with-harfbuzz=system specified, but no harfbuzz found! $HELP_MSG])
307
    fi
308
  else
309
    AC_MSG_ERROR([Invalid value for --with-harfbuzz: ${with_harfbuzz}, use 'system' or 'bundled'])
310
  fi
311

312
  AC_SUBST(USE_EXTERNAL_HARFBUZZ)
313
  AC_SUBST(HARFBUZZ_CFLAGS)
314
  AC_SUBST(HARFBUZZ_LIBS)
315
])
316

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.