jdk

Форк
0
/
jvm-features.m4 
583 строки · 22.7 Кб
1
#
2
# Copyright (c) 2011, 2024, 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
# Terminology used in this file:
28
#
29
# Valid features      == All possible features that the JVM knows about.
30
# Deprecated features == Previously known features (not considered valid).
31
# Available features  == Features that are possible to use in this configuration.
32
# Default features    == Features that are on by default in this configuration.
33
# Enabled features    == Features requested by the user to be present.
34
# Disabled features   == Features excluded from being used by the user.
35
# Active features     == The exact set of features to be used for a JVM variant.
36
#
37
# All valid features are considered available, unless listed as unavailable.
38
# All available features will be turned on as default, unless listed in a filter.
39
###############################################################################
40

41
# We need these as m4 defines to be able to loop over them using m4 later on.
42

43
# All valid JVM features, regardless of platform
44
m4_define(jvm_features_valid, m4_normalize( \
45
    ifdef([custom_jvm_features_valid], custom_jvm_features_valid) \
46
    \
47
    cds compiler1 compiler2 dtrace epsilongc g1gc jfr jni-check \
48
    jvmci jvmti link-time-opt management minimal opt-size parallelgc \
49
    serialgc services shenandoahgc vm-structs zero zgc \
50
))
51

52
# Deprecated JVM features (these are ignored, but with a warning)
53
m4_define(jvm_features_deprecated, m4_normalize(
54
    cmsgc trace \
55
))
56

57
# Feature descriptions
58
m4_define(jvm_feature_desc_cds, [enable class data sharing (CDS)])
59
m4_define(jvm_feature_desc_compiler1, [enable hotspot compiler C1])
60
m4_define(jvm_feature_desc_compiler2, [enable hotspot compiler C2])
61
m4_define(jvm_feature_desc_dtrace, [enable dtrace support])
62
m4_define(jvm_feature_desc_epsilongc, [include the epsilon (no-op) garbage collector])
63
m4_define(jvm_feature_desc_g1gc, [include the G1 garbage collector])
64
m4_define(jvm_feature_desc_jfr, [enable JDK Flight Recorder (JFR)])
65
m4_define(jvm_feature_desc_jni_check, [enable -Xcheck:jni support])
66
m4_define(jvm_feature_desc_jvmci, [enable JVM Compiler Interface (JVMCI)])
67
m4_define(jvm_feature_desc_jvmti, [enable Java Virtual Machine Tool Interface (JVM TI)])
68
m4_define(jvm_feature_desc_link_time_opt, [enable link time optimization])
69
m4_define(jvm_feature_desc_management, [enable java.lang.management API support])
70
m4_define(jvm_feature_desc_minimal, [support building variant 'minimal'])
71
m4_define(jvm_feature_desc_opt_size, [optimize the JVM library for size])
72
m4_define(jvm_feature_desc_parallelgc, [include the parallel garbage collector])
73
m4_define(jvm_feature_desc_serialgc, [include the serial garbage collector])
74
m4_define(jvm_feature_desc_services, [enable diagnostic services and client attaching])
75
m4_define(jvm_feature_desc_shenandoahgc, [include the Shenandoah garbage collector])
76
m4_define(jvm_feature_desc_static_build, [build static library instead of dynamic])
77
m4_define(jvm_feature_desc_vm_structs, [export JVM structures to the Serviceablility Agent])
78
m4_define(jvm_feature_desc_zero, [support building variant 'zero'])
79
m4_define(jvm_feature_desc_zgc, [include the Z garbage collector])
80

81
###############################################################################
82
# Parse command line options for JVM feature selection. After this function
83
# has run $JVM_FEATURES_ENABLED, $JVM_FEATURES_DISABLED and $JVM_FEATURES_VALID
84
# can be used.
85
#
86
AC_DEFUN_ONCE([JVM_FEATURES_PARSE_OPTIONS],
87
[
88
  # Setup shell variables from the m4 lists
89
  UTIL_SORT_LIST(JVM_FEATURES_VALID, "jvm_features_valid")
90
  UTIL_SORT_LIST(JVM_FEATURES_DEPRECATED, "jvm_features_deprecated")
91

92
  # For historical reasons, some jvm features have their own, shorter names.
93
  # Keep those as aliases for the --enable-jvm-feature-* style arguments.
94
  UTIL_ALIASED_ARG_ENABLE(cds, --enable-jvm-feature-cds)
95
  UTIL_ALIASED_ARG_ENABLE(dtrace, --enable-jvm-feature-dtrace)
96

97
  # First check for features using the
98
  # --with-jvm-features="<[-]feature>[,<[-]feature> ...]" syntax.
99
  AC_ARG_WITH([jvm-features], [AS_HELP_STRING([--with-jvm-features],
100
      [JVM features to enable (foo) or disable (-foo), separated by comma. Use
101
      '--help' to show possible values @<:@none@:>@])])
102
  if test "x$with_jvm_features" != x; then
103
    # Replace ","  with " ".
104
    user_jvm_feature_list=${with_jvm_features//,/ }
105
    JVM_FEATURES_ENABLED=`$ECHO $user_jvm_feature_list | \
106
        $AWK '{ for (i=1; i<=NF; i++) if (!match($i, /^-.*/)) printf("%s ", $i) }'`
107
    JVM_FEATURES_DISABLED=`$ECHO $user_jvm_feature_list | \
108
        $AWK '{ for (i=1; i<=NF; i++) if (match($i, /^-.*/)) printf("%s ", substr($i, 2))}'`
109

110
    # Verify that the user has provided only valid (or deprecated) features
111
    UTIL_GET_NON_MATCHING_VALUES(invalid_features, $JVM_FEATURES_ENABLED \
112
        $JVM_FEATURES_DISABLED, $JVM_FEATURES_VALID $JVM_FEATURES_DEPRECATED)
113
    if test "x$invalid_features" != x; then
114
      AC_MSG_NOTICE([Unknown JVM features specified: '$invalid_features'])
115
      AC_MSG_NOTICE([The available JVM features are: '$JVM_FEATURES_VALID'])
116
      AC_MSG_ERROR([Cannot continue])
117
    fi
118

119
    # Check if the user has provided deprecated features
120
    UTIL_GET_MATCHING_VALUES(deprecated_features, $JVM_FEATURES_ENABLED \
121
        $JVM_FEATURES_DISABLED, $JVM_FEATURES_DEPRECATED)
122
    if test "x$deprecated_features" != x; then
123
      AC_MSG_WARN([Deprecated JVM features specified (will be ignored): '$deprecated_features'])
124
      # Filter out deprecated features
125
      UTIL_GET_NON_MATCHING_VALUES(JVM_FEATURES_ENABLED, \
126
          $JVM_FEATURES_ENABLED, $deprecated_features)
127
      UTIL_GET_NON_MATCHING_VALUES(JVM_FEATURES_DISABLED, \
128
          $JVM_FEATURES_DISABLED, $deprecated_features)
129
    fi
130
  fi
131

132
  # Then check for features using the "--enable-jvm-feature-<feature>" syntax.
133
  # Using m4, loop over all features with the variable FEATURE.
134
  m4_foreach(FEATURE, m4_split(jvm_features_valid), [
135
    # Create an m4 variable containing a shell variable name (like
136
    # "enable_jvm_feature_static_build"), and the description.
137
    m4_define(FEATURE_SHELL, [enable_jvm_feature_]m4_translit(FEATURE, -, _))
138
    m4_define(FEATURE_DESCRIPTION, [jvm_feature_desc_]m4_translit(FEATURE, -, _))
139

140
    AC_ARG_ENABLE(jvm-feature-FEATURE, AS_HELP_STRING(
141
        [--enable-jvm-feature-FEATURE], [enable jvm feature 'FEATURE' (FEATURE_DESCRIPTION)]))
142

143
    if test "x$FEATURE_SHELL" = xyes; then
144
      JVM_FEATURES_ENABLED="$JVM_FEATURES_ENABLED FEATURE"
145
    elif test "x$FEATURE_SHELL" = xno; then
146
      JVM_FEATURES_DISABLED="$JVM_FEATURES_DISABLED FEATURE"
147
    elif test "x$FEATURE_SHELL" != x; then
148
      AC_MSG_ERROR([Invalid value for --enable-jvm-feature-FEATURE: '$FEATURE_SHELL'])
149
    fi
150

151
    m4_undefine([FEATURE_SHELL])
152
    m4_undefine([FEATURE_DESCRIPTION])
153
  ])
154

155
  # Likewise, check for deprecated arguments.
156
  m4_foreach(FEATURE, m4_split(jvm_features_deprecated), [
157
    AC_ARG_ENABLE(jvm-feature-FEATURE, AS_HELP_STRING(
158
        [--enable-jvm-feature-FEATURE],
159
        [Deprecated. Option is kept for backwards compatibility and is ignored]))
160

161
    m4_define(FEATURE_SHELL, [enable_jvm_feature_]m4_translit(FEATURE, -, _))
162

163
    if test "x$FEATURE_SHELL" != x; then
164
      AC_MSG_WARN([Deprecated JVM feature, will be ignored: --enable-jvm-feature-FEATURE])
165
    fi
166

167
    m4_undefine([FEATURE_SHELL])
168
  ])
169

170
  # Check if the user has both enabled and disabled a feature
171
  UTIL_GET_MATCHING_VALUES(enabled_and_disabled, $JVM_FEATURES_ENABLED, \
172
      $JVM_FEATURES_DISABLED)
173
  if test "x$enabled_and_disabled" != x; then
174
    AC_MSG_NOTICE([These feature are both enabled and disabled: '$enabled_and_disabled'])
175
    AC_MSG_NOTICE([This can happen if you mix --with-jvm-features and --enable-jvm-feature-*])
176
    AC_MSG_NOTICE([The recommendation is to only use --enable-jvm-feature-*])
177
    AC_MSG_ERROR([Cannot continue])
178
  fi
179

180
  # Clean up lists and announce results to user
181
  UTIL_SORT_LIST(JVM_FEATURES_ENABLED, $JVM_FEATURES_ENABLED)
182
  AC_MSG_CHECKING([for JVM features enabled by the user])
183
  if test "x$JVM_FEATURES_ENABLED" != x; then
184
    AC_MSG_RESULT(['$JVM_FEATURES_ENABLED'])
185
  else
186
    AC_MSG_RESULT([none])
187
  fi
188

189
  UTIL_SORT_LIST(JVM_FEATURES_DISABLED, $JVM_FEATURES_DISABLED)
190
  AC_MSG_CHECKING([for JVM features disabled by the user])
191
  if test "x$JVM_FEATURES_DISABLED" != x; then
192
    AC_MSG_RESULT(['$JVM_FEATURES_DISABLED'])
193
  else
194
    AC_MSG_RESULT([none])
195
  fi
196

197
  # Makefiles use VALID_JVM_FEATURES in check-jvm-feature to verify correctness.
198
  VALID_JVM_FEATURES="$JVM_FEATURES_VALID"
199
  AC_SUBST(VALID_JVM_FEATURES)
200
])
201

202
###############################################################################
203
# Helper function for the JVM_FEATURES_CHECK_* suite.
204
# The code in the code block should assign 'false' to the variable AVAILABLE
205
# if the feature is not available, and this function will handle everything
206
# else that is needed.
207
#
208
# arg 1: The name of the feature to test
209
# arg 2: The code block to execute
210
#
211
AC_DEFUN([JVM_FEATURES_CHECK_AVAILABILITY],
212
[
213
  # Assume that feature is available
214
  AVAILABLE=true
215

216
  # Execute feature test block
217
  $2
218

219
  AC_MSG_CHECKING([if JVM feature '$1' is available])
220
  if test "x$AVAILABLE" = "xtrue"; then
221
    AC_MSG_RESULT([yes])
222
  else
223
    AC_MSG_RESULT([no])
224
    JVM_FEATURES_PLATFORM_UNAVAILABLE="$JVM_FEATURES_PLATFORM_UNAVAILABLE $1"
225
  fi
226
])
227

228
###############################################################################
229
# Check if the feature 'cds' is available on this platform.
230
#
231
AC_DEFUN_ONCE([JVM_FEATURES_CHECK_CDS],
232
[
233
  JVM_FEATURES_CHECK_AVAILABILITY(cds, [
234
    AC_MSG_CHECKING([if platform is supported by CDS])
235
    if test "x$OPENJDK_TARGET_OS" = xaix; then
236
      AC_MSG_RESULT([no, $OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU])
237
      AVAILABLE=false
238
    else
239
      AC_MSG_RESULT([yes])
240
    fi
241
  ])
242
])
243

244
###############################################################################
245
# Check if the feature 'dtrace' is available on this platform.
246
#
247
AC_DEFUN_ONCE([JVM_FEATURES_CHECK_DTRACE],
248
[
249
  JVM_FEATURES_CHECK_AVAILABILITY(dtrace, [
250
    AC_MSG_CHECKING([for dtrace tool and platform support])
251
    if test "x$OPENJDK_TARGET_CPU_ARCH" = "xppc"; then
252
      AC_MSG_RESULT([no, $OPENJDK_TARGET_CPU_ARCH])
253
      AVAILABLE=false
254
    elif test "x$OPENJDK_TARGET_CPU_ARCH" = "xs390"; then
255
      AC_MSG_RESULT([no, $OPENJDK_TARGET_CPU_ARCH])
256
      AVAILABLE=false
257
    elif test "x$DTRACE" != "x" && test -x "$DTRACE"; then
258
      AC_MSG_RESULT([$DTRACE])
259
    else
260
      AC_MSG_RESULT([no])
261
      AVAILABLE=false
262
    fi
263

264
    AC_CHECK_HEADERS([sys/sdt.h], [dtrace_headers_ok=true])
265
    if test "x$dtrace_headers_ok" != "xtrue"; then
266
      HELP_MSG_MISSING_DEPENDENCY([dtrace])
267
      AC_MSG_NOTICE([Cannot enable dtrace with missing dependencies. See above.])
268
      AVAILABLE=false
269
    fi
270
  ])
271
])
272

273
###############################################################################
274
# Check if the feature 'jvmci' is available on this platform.
275
#
276
AC_DEFUN_ONCE([JVM_FEATURES_CHECK_JVMCI],
277
[
278
  JVM_FEATURES_CHECK_AVAILABILITY(jvmci, [
279
    AC_MSG_CHECKING([if platform is supported by JVMCI])
280
    if test "x$OPENJDK_TARGET_CPU" = "xx86_64"; then
281
      AC_MSG_RESULT([yes])
282
    elif test "x$OPENJDK_TARGET_CPU" = "xaarch64"; then
283
      AC_MSG_RESULT([yes])
284
    elif test "x$OPENJDK_TARGET_CPU" = "xriscv64"; then
285
      AC_MSG_RESULT([yes])
286
    else
287
      AC_MSG_RESULT([no, $OPENJDK_TARGET_CPU])
288
      AVAILABLE=false
289
    fi
290
  ])
291
])
292

293
###############################################################################
294
# Check if the feature 'shenandoahgc' is available on this platform.
295
#
296
AC_DEFUN_ONCE([JVM_FEATURES_CHECK_SHENANDOAHGC],
297
[
298
  JVM_FEATURES_CHECK_AVAILABILITY(shenandoahgc, [
299
    AC_MSG_CHECKING([if platform is supported by Shenandoah])
300
    if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86" || \
301
        test "x$OPENJDK_TARGET_CPU" = "xaarch64" || \
302
        test "x$OPENJDK_TARGET_CPU" = "xppc64le" || \
303
        test "x$OPENJDK_TARGET_CPU" = "xriscv64"; then
304
      AC_MSG_RESULT([yes])
305
    else
306
      AC_MSG_RESULT([no, $OPENJDK_TARGET_CPU])
307
      AVAILABLE=false
308
    fi
309
  ])
310
])
311

312
###############################################################################
313
# Check if the feature 'zgc' is available on this platform.
314
#
315
AC_DEFUN_ONCE([JVM_FEATURES_CHECK_ZGC],
316
[
317
  JVM_FEATURES_CHECK_AVAILABILITY(zgc, [
318
    AC_MSG_CHECKING([if platform is supported by ZGC])
319
    if test "x$OPENJDK_TARGET_CPU" = "xx86_64"; then
320
      if test "x$OPENJDK_TARGET_OS" = "xlinux" || \
321
          test "x$OPENJDK_TARGET_OS" = "xwindows" || \
322
          test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
323
        AC_MSG_RESULT([yes])
324
      else
325
        AC_MSG_RESULT([no, $OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU])
326
        AVAILABLE=false
327
      fi
328
    elif test "x$OPENJDK_TARGET_CPU" = "xaarch64"; then
329
      if test "x$OPENJDK_TARGET_OS" = "xlinux" || \
330
          test "x$OPENJDK_TARGET_OS" = "xwindows" || \
331
          test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
332
        AC_MSG_RESULT([yes])
333
      else
334
        AC_MSG_RESULT([no, $OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU])
335
        AVAILABLE=false
336
      fi
337
    elif test "x$OPENJDK_TARGET_CPU" = "xppc64le" || \
338
        test "x$OPENJDK_TARGET_CPU" = "xriscv64"; then
339
      if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
340
        AC_MSG_RESULT([yes])
341
      else
342
        AC_MSG_RESULT([no, $OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU])
343
        AVAILABLE=false
344
      fi
345
    else
346
      AC_MSG_RESULT([no, $OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU])
347
      AVAILABLE=false
348
    fi
349

350
    if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
351
      AC_MSG_CHECKING([if Windows APIs required for ZGC is present])
352
      AC_COMPILE_IFELSE(
353
        [AC_LANG_PROGRAM([[#include <windows.h>]],
354
          [[struct MEM_EXTENDED_PARAMETER x;]])
355
        ],
356
        [
357
          AC_MSG_RESULT([yes])
358
        ],
359
        [
360
          AC_MSG_RESULT([no, missing required APIs])
361
          AVAILABLE=false
362
        ]
363
      )
364
    fi
365
  ])
366
])
367

368
###############################################################################
369
# Setup JVM_FEATURES_PLATFORM_UNAVAILABLE and JVM_FEATURES_PLATFORM_FILTER
370
# to contain those features that are unavailable, or should be off by default,
371
# for this platform, regardless of JVM variant.
372
#
373
AC_DEFUN_ONCE([JVM_FEATURES_PREPARE_PLATFORM],
374
[
375
  # The checks below should add unavailable features to
376
  # JVM_FEATURES_PLATFORM_UNAVAILABLE.
377

378
  JVM_FEATURES_CHECK_CDS
379
  JVM_FEATURES_CHECK_DTRACE
380
  JVM_FEATURES_CHECK_JVMCI
381
  JVM_FEATURES_CHECK_SHENANDOAHGC
382
  JVM_FEATURES_CHECK_ZGC
383

384
])
385

386
###############################################################################
387
# Setup JVM_FEATURES_VARIANT_UNAVAILABLE and JVM_FEATURES_VARIANT_FILTER
388
# to contain those features that are unavailable, or should be off by default,
389
# for this particular JVM variant.
390
#
391
# arg 1: JVM variant
392
#
393
AC_DEFUN([JVM_FEATURES_PREPARE_VARIANT],
394
[
395
  variant=$1
396

397
  # Check which features are unavailable for this JVM variant.
398
  # This means that is not possible to build these features for this variant.
399
  if test "x$variant" = "xminimal"; then
400
    JVM_FEATURES_VARIANT_UNAVAILABLE="cds zero"
401
  elif test "x$variant" = "xcore"; then
402
    JVM_FEATURES_VARIANT_UNAVAILABLE="cds minimal zero"
403
  elif test "x$variant" = "xzero"; then
404
    JVM_FEATURES_VARIANT_UNAVAILABLE="compiler1 compiler2 \
405
        jvmci minimal zgc"
406
  else
407
    JVM_FEATURES_VARIANT_UNAVAILABLE="minimal zero"
408
  fi
409

410
  # Check which features should be off by default for this JVM variant.
411
  if test "x$variant" = "xclient"; then
412
    JVM_FEATURES_VARIANT_FILTER="compiler2 jvmci link-time-opt opt-size"
413
  elif test "x$variant" = "xminimal"; then
414
    JVM_FEATURES_VARIANT_FILTER="cds compiler2 dtrace epsilongc g1gc \
415
        jfr jni-check jvmci jvmti management parallelgc services \
416
        shenandoahgc vm-structs zgc"
417
    if test "x$OPENJDK_TARGET_CPU" = xarm ; then
418
      JVM_FEATURES_VARIANT_FILTER="$JVM_FEATURES_VARIANT_FILTER opt-size"
419
    else
420
      # Only arm-32 should have link-time-opt enabled as default.
421
      JVM_FEATURES_VARIANT_FILTER="$JVM_FEATURES_VARIANT_FILTER \
422
          link-time-opt"
423
    fi
424
  elif test "x$variant" = "xcore"; then
425
    JVM_FEATURES_VARIANT_FILTER="compiler1 compiler2 jvmci \
426
        link-time-opt opt-size"
427
  elif test "x$variant" = "xzero"; then
428
    JVM_FEATURES_VARIANT_FILTER="jfr link-time-opt opt-size"
429
  else
430
    JVM_FEATURES_VARIANT_FILTER="link-time-opt opt-size"
431
  fi
432
])
433

434
###############################################################################
435
# Calculate the actual set of active JVM features for this JVM variant. Store
436
# the result in JVM_FEATURES_ACTIVE.
437
#
438
# arg 1: JVM variant
439
#
440
AC_DEFUN([JVM_FEATURES_CALCULATE_ACTIVE],
441
[
442
  variant=$1
443

444
  # The default is set to all valid features except those unavailable or listed
445
  # in a filter.
446
  if test "x$variant" != xcustom; then
447
    UTIL_GET_NON_MATCHING_VALUES(default_for_variant, $JVM_FEATURES_VALID, \
448
        $JVM_FEATURES_PLATFORM_UNAVAILABLE $JVM_FEATURES_VARIANT_UNAVAILABLE \
449
        $JVM_FEATURES_PLATFORM_FILTER $JVM_FEATURES_VARIANT_FILTER)
450
  else
451
    # Except for the 'custom' variant, where the default is to start with an
452
    # empty set.
453
    default_for_variant=""
454
  fi
455

456
  # Verify that explicitly enabled features are available
457
  UTIL_GET_MATCHING_VALUES(enabled_but_unavailable, $JVM_FEATURES_ENABLED, \
458
      $JVM_FEATURES_PLATFORM_UNAVAILABLE $JVM_FEATURES_VARIANT_UNAVAILABLE)
459
  if test "x$enabled_but_unavailable" != x; then
460
    AC_MSG_NOTICE([ERROR: Unavailable JVM features explicitly enabled for '$variant': '$enabled_but_unavailable'])
461
    AC_MSG_ERROR([Cannot continue])
462
  fi
463

464
  # Notify the user if their command line options has no real effect
465
  UTIL_GET_MATCHING_VALUES(enabled_but_default, $JVM_FEATURES_ENABLED, \
466
      $default_for_variant)
467
  if test "x$enabled_but_default" != x; then
468
    AC_MSG_NOTICE([Default JVM features explicitly enabled for '$variant': '$enabled_but_default'])
469
  fi
470
  UTIL_GET_MATCHING_VALUES(disabled_but_unavailable, $JVM_FEATURES_DISABLED, \
471
      $JVM_FEATURES_PLATFORM_UNAVAILABLE $JVM_FEATURES_VARIANT_UNAVAILABLE)
472
  if test "x$disabled_but_unavailable" != x; then
473
    AC_MSG_NOTICE([Unavailable JVM features explicitly disabled for '$variant': '$disabled_but_unavailable'])
474
  fi
475

476
  # JVM_FEATURES_ACTIVE is the set of all default features and all explicitly
477
  # enabled features, with the explicitly disabled features filtered out.
478
  UTIL_GET_NON_MATCHING_VALUES(JVM_FEATURES_ACTIVE, $default_for_variant \
479
      $JVM_FEATURES_ENABLED, $JVM_FEATURES_DISABLED)
480
])
481

482
###############################################################################
483
# Helper function for JVM_FEATURES_VERIFY. Check if the specified JVM
484
# feature is active. To be used in shell if constructs, like this:
485
# 'if JVM_FEATURES_IS_ACTIVE(jvmti); then'
486
#
487
# Definition kept in one line to allow inlining in if statements.
488
# Additional [] needed to keep m4 from mangling shell constructs.
489
AC_DEFUN([JVM_FEATURES_IS_ACTIVE],
490
[ [ [[ " $JVM_FEATURES_ACTIVE " =~ ' '$1' ' ]] ] ])
491

492
###############################################################################
493
# Verify that the resulting set of features is consistent and legal.
494
#
495
# arg 1: JVM variant
496
#
497
AC_DEFUN([JVM_FEATURES_VERIFY],
498
[
499
  variant=$1
500

501
  if JVM_FEATURES_IS_ACTIVE(jvmci) && ! (JVM_FEATURES_IS_ACTIVE(compiler1) || \
502
      JVM_FEATURES_IS_ACTIVE(compiler2)); then
503
    AC_MSG_ERROR([Specified JVM feature 'jvmci' requires feature 'compiler2' or 'compiler1' for variant '$variant'])
504
  fi
505

506
  if JVM_FEATURES_IS_ACTIVE(jvmti) && ! JVM_FEATURES_IS_ACTIVE(services); then
507
    AC_MSG_ERROR([Specified JVM feature 'jvmti' requires feature 'services' for variant '$variant'])
508
  fi
509

510
  # For backwards compatibility, disable a feature "globally" if one variant
511
  # is missing the feature.
512
  if ! JVM_FEATURES_IS_ACTIVE(cds); then
513
    ENABLE_CDS="false"
514
  fi
515
  if ! JVM_FEATURES_IS_ACTIVE(jvmci); then
516
    INCLUDE_JVMCI="false"
517
  fi
518
  if JVM_FEATURES_IS_ACTIVE(compiler2); then
519
    INCLUDE_COMPILER2="true"
520
  fi
521

522
  # Verify that we have at least one gc selected (i.e., feature named "*gc").
523
  if ! JVM_FEATURES_IS_ACTIVE(.*gc); then
524
      AC_MSG_NOTICE([At least one gc needed for variant '$variant'.])
525
      AC_MSG_NOTICE([Specified features: '$JVM_FEATURES_ACTIVE'])
526
      AC_MSG_ERROR([Cannot continue])
527
  fi
528
])
529

530
###############################################################################
531
# Set up all JVM features for each enabled JVM variant. Requires that
532
# JVM_FEATURES_PARSE_OPTIONS has been called.
533
#
534
AC_DEFUN_ONCE([JVM_FEATURES_SETUP],
535
[
536
  # Set up variant-independent factors
537
  JVM_FEATURES_PREPARE_PLATFORM
538

539
  # For backwards compatibility, tentatively enable these features "globally",
540
  # and disable them in JVM_FEATURES_VERIFY if a variant is found that are
541
  # missing any of them.
542
  ENABLE_CDS="true"
543
  INCLUDE_JVMCI="true"
544
  INCLUDE_COMPILER2="false"
545

546
  for variant in $JVM_VARIANTS; do
547
    # Figure out if any features are unavailable, or should be filtered out
548
    # by default, for this variant.
549
    # Store the result in JVM_FEATURES_VARIANT_UNAVAILABLE and
550
    # JVM_FEATURES_VARIANT_FILTER.
551
    JVM_FEATURES_PREPARE_VARIANT($variant)
552

553
    # Calculate the resulting set of enabled features for this variant.
554
    # The result is stored in JVM_FEATURES_ACTIVE.
555
    JVM_FEATURES_CALCULATE_ACTIVE($variant)
556

557
    # Verify consistency for JVM_FEATURES_ACTIVE.
558
    JVM_FEATURES_VERIFY($variant)
559

560
    # Keep feature list sorted and free of duplicates
561
    UTIL_SORT_LIST(JVM_FEATURES_ACTIVE, $JVM_FEATURES_ACTIVE)
562
    AC_MSG_CHECKING([JVM features to use for variant '$variant'])
563
    AC_MSG_RESULT(['$JVM_FEATURES_ACTIVE'])
564

565
    # Save this as e.g. JVM_FEATURES_server, using indirect variable
566
    # referencing.
567
    features_var_name=JVM_FEATURES_$variant
568
    eval $features_var_name=\"$JVM_FEATURES_ACTIVE\"
569
  done
570

571
  # Unfortunately AC_SUBST does not work with non-literally named variables,
572
  # so list all variants here.
573
  AC_SUBST(JVM_FEATURES_server)
574
  AC_SUBST(JVM_FEATURES_client)
575
  AC_SUBST(JVM_FEATURES_minimal)
576
  AC_SUBST(JVM_FEATURES_core)
577
  AC_SUBST(JVM_FEATURES_zero)
578
  AC_SUBST(JVM_FEATURES_custom)
579

580
  AC_SUBST(INCLUDE_JVMCI)
581
  AC_SUBST(INCLUDE_COMPILER2)
582

583
])
584

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

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

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

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