hotspot.m4 revision 2753:826fdb1c3988
1184610Salfred#
2184610Salfred# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
3356395Shselasky# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4184610Salfred#
5184610Salfred# This code is free software; you can redistribute it and/or modify it
6184610Salfred# under the terms of the GNU General Public License version 2 only, as
7184610Salfred# published by the Free Software Foundation.  Oracle designates this
8184610Salfred# particular file as subject to the "Classpath" exception as provided
9184610Salfred# by Oracle in the LICENSE file that accompanied this code.
10184610Salfred#
11184610Salfred# This code is distributed in the hope that it will be useful, but WITHOUT
12184610Salfred# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13184610Salfred# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14184610Salfred# version 2 for more details (a copy is included in the LICENSE file that
15184610Salfred# accompanied this code).
16184610Salfred#
17184610Salfred# You should have received a copy of the GNU General Public License version
18184610Salfred# 2 along with this work; if not, write to the Free Software Foundation,
19184610Salfred# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20184610Salfred#
21184610Salfred# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22184610Salfred# or visit www.oracle.com if you need additional information or have any
23184610Salfred# questions.
24184610Salfred#
25184610Salfred
26184610Salfred# All valid JVM features, regardless of platform
27194230SthompsaVALID_JVM_FEATURES="compiler1 compiler2 zero shark minimal dtrace jvmti jvmci \
28194230Sthompsa    graal fprof vm-structs jni-check services management all-gcs nmt cds \
29184610Salfred    static-build link-time-opt aot"
30246616Shselasky
31246616Shselasky# All valid JVM variants
32246616ShselaskyVALID_JVM_VARIANTS="server client minimal core zero zeroshark custom"
33246616Shselasky
34246616Shselasky###############################################################################
35246616Shselasky# Check if the specified JVM variant should be built. To be used in shell if
36246616Shselasky# constructs, like this:
37246616Shselasky# if HOTSPOT_CHECK_JVM_VARIANT(server); then
38190180Sthompsa#
39224777Shselasky# Only valid to use after HOTSPOT_SETUP_JVM_VARIANTS has setup variants.
40246616Shselasky
41246616Shselasky# Definition kept in one line to allow inlining in if statements.
42184610Salfred# Additional [] needed to keep m4 from mangling shell constructs.
43207080SthompsaAC_DEFUN([HOTSPOT_CHECK_JVM_VARIANT],
44184610Salfred[ [ [[ " $JVM_VARIANTS " =~ " $1 " ]] ] ])
45239176Shselasky
46190730Sthompsa###############################################################################
47190730Sthompsa# Check if the specified JVM features are explicitly enabled. To be used in
48190730Sthompsa# shell if constructs, like this:
49190730Sthompsa# if HOTSPOT_CHECK_JVM_FEATURE(jvmti); then
50190730Sthompsa#
51194228Sthompsa# Only valid to use after HOTSPOT_SETUP_JVM_FEATURES has setup features.
52190730Sthompsa
53190730Sthompsa# Definition kept in one line to allow inlining in if statements.
54190730Sthompsa# Additional [] needed to keep m4 from mangling shell constructs.
55190730SthompsaAC_DEFUN([HOTSPOT_CHECK_JVM_FEATURE],
56260589Shselasky[ [ [[ " $JVM_FEATURES " =~ " $1 " ]] ] ])
57192984Sthompsa
58192984Sthompsa###############################################################################
59184610Salfred# Check which variants of the JVM that we want to build. Available variants are:
60184610Salfred#   server: normal interpreter, and a tiered C1/C2 compiler
61192984Sthompsa#   client: normal interpreter, and C1 (no C2 compiler)
62192984Sthompsa#   minimal: reduced form of client with optional features stripped out
63192984Sthompsa#   core: normal interpreter only, no compiler
64192984Sthompsa#   zero: C++ based interpreter only, no compiler
65192984Sthompsa#   zeroshark: C++ based interpreter, and a llvm-based compiler
66192984Sthompsa#   custom: baseline JVM with no default features
67192984Sthompsa#
68192984SthompsaAC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_VARIANTS],
69192984Sthompsa[
70192984Sthompsa  AC_ARG_WITH([jvm-variants], [AS_HELP_STRING([--with-jvm-variants],
71192984Sthompsa      [JVM variants (separated by commas) to build (server,client,minimal,core,zero,zeroshark,custom) @<:@server@:>@])])
72192984Sthompsa
73193045Sthompsa  SETUP_HOTSPOT_TARGET_CPU_PORT
74192984Sthompsa
75192984Sthompsa  if test "x$with_jvm_variants" = x; then
76192984Sthompsa    with_jvm_variants="server"
77192984Sthompsa  fi
78192984Sthompsa  JVM_VARIANTS_OPT="$with_jvm_variants"
79192984Sthompsa
80192984Sthompsa  # Has the user listed more than one variant?
81192984Sthompsa  # Additional [] needed to keep m4 from mangling shell constructs.
82192984Sthompsa  if [ [[ "$JVM_VARIANTS_OPT" =~ "," ]] ]; then
83192984Sthompsa    BUILDING_MULTIPLE_JVM_VARIANTS=true
84192984Sthompsa  else
85192984Sthompsa    BUILDING_MULTIPLE_JVM_VARIANTS=false
86192984Sthompsa  fi
87192984Sthompsa  # Replace the commas with AND for use in the build directory name.
88184610Salfred  JVM_VARIANTS_WITH_AND=`$ECHO "$JVM_VARIANTS_OPT" | $SED -e 's/,/AND/g'`
89184610Salfred
90184610Salfred  AC_MSG_CHECKING([which variants of the JVM to build])
91192984Sthompsa  # JVM_VARIANTS is a space-separated list.
92192499Sthompsa  # Also use minimal, not minimal1 (which is kept for backwards compatibility).
93184610Salfred  JVM_VARIANTS=`$ECHO $JVM_VARIANTS_OPT | $SED -e 's/,/ /g' -e 's/minimal1/minimal/'`
94184610Salfred  AC_MSG_RESULT([$JVM_VARIANTS])
95184610Salfred
96184610Salfred  # Check that the selected variants are valid
97184610Salfred
98191824Sthompsa  # grep filter function inspired by a comment to http://stackoverflow.com/a/1617326
99191824Sthompsa  # Notice that the original variant failes on SLES 10 and 11
100191824Sthompsa  NEEDLE=${VALID_JVM_VARIANTS// /$'\n'}
101191824Sthompsa  STACK=${JVM_VARIANTS// /$'\n'}
102191824Sthompsa  INVALID_VARIANTS=`$GREP -Fvx "${NEEDLE}" <<< "${STACK}"`
103191824Sthompsa  if test "x$INVALID_VARIANTS" != x; then
104191824Sthompsa    AC_MSG_NOTICE([Unknown variant(s) specified: $INVALID_VARIANTS])
105191824Sthompsa    AC_MSG_ERROR([The available JVM variants are: $VALID_JVM_VARIANTS])
106184610Salfred  fi
107184610Salfred
108184610Salfred  # All "special" variants share the same output directory ("server")
109186730Salfred  VALID_MULTIPLE_JVM_VARIANTS="server client minimal"
110186730Salfred  NEEDLE=${VALID_MULTIPLE_JVM_VARIANTS// /$'\n'}
111186730Salfred  STACK=${JVM_VARIANTS// /$'\n'}
112192984Sthompsa  INVALID_MULTIPLE_VARIANTS=`$GREP -Fvx "${NEEDLE}" <<< "${STACK}"`
113193045Sthompsa  if  test "x$INVALID_MULTIPLE_VARIANTS" != x && test "x$BUILDING_MULTIPLE_JVM_VARIANTS" = xtrue; then
114193074Sthompsa    AC_MSG_ERROR([You cannot build multiple variants with anything else than $VALID_MULTIPLE_JVM_VARIANTS.])
115193074Sthompsa  fi
116193074Sthompsa
117186730Salfred  # The "main" variant is the one used by other libs to link against during the
118186730Salfred  # build.
119186730Salfred  if test "x$BUILDING_MULTIPLE_JVM_VARIANTS" = "xtrue"; then
120246616Shselasky    MAIN_VARIANT_PRIO_ORDER="server client minimal"
121246616Shselasky    for variant in $MAIN_VARIANT_PRIO_ORDER; do
122246616Shselasky      if HOTSPOT_CHECK_JVM_VARIANT($variant); then
123246616Shselasky        JVM_VARIANT_MAIN="$variant"
124246616Shselasky        break
125246616Shselasky      fi
126246616Shselasky    done
127246616Shselasky  else
128246616Shselasky    JVM_VARIANT_MAIN="$JVM_VARIANTS"
129246616Shselasky  fi
130246616Shselasky
131246616Shselasky  AC_SUBST(JVM_VARIANTS)
132246616Shselasky  AC_SUBST(VALID_JVM_VARIANTS)
133246616Shselasky  AC_SUBST(JVM_VARIANT_MAIN)
134246616Shselasky
135246616Shselasky  if HOTSPOT_CHECK_JVM_VARIANT(zero) || HOTSPOT_CHECK_JVM_VARIANT(zeroshark); then
136246616Shselasky    # zero behaves as a platform and rewrites these values. This is really weird. :(
137246616Shselasky    # We are guaranteed that we do not build any other variants when building zero.
138246616Shselasky    HOTSPOT_TARGET_CPU=zero
139246616Shselasky    HOTSPOT_TARGET_CPU_ARCH=zero
140246616Shselasky  fi
141246616Shselasky])
142259218Shselasky
143246616Shselasky###############################################################################
144246616Shselasky# Check if dtrace should be enabled and has all prerequisites present.
145246616Shselasky#
146246616ShselaskyAC_DEFUN_ONCE([HOTSPOT_SETUP_DTRACE],
147246616Shselasky[
148246616Shselasky  # Test for dtrace dependencies
149246616Shselasky  AC_ARG_ENABLE([dtrace], [AS_HELP_STRING([--enable-dtrace@<:@=yes/no/auto@:>@],
150246616Shselasky      [enable dtrace. Default is auto, where dtrace is enabled if all dependencies
151246616Shselasky      are present.])])
152246616Shselasky
153246616Shselasky  DTRACE_DEP_MISSING=false
154246616Shselasky
155246616Shselasky  AC_MSG_CHECKING([for dtrace tool])
156246616Shselasky  if test "x$DTRACE" != "x" && test -x "$DTRACE"; then
157246616Shselasky    AC_MSG_RESULT([$DTRACE])
158246616Shselasky  else
159246616Shselasky    AC_MSG_RESULT([not found, cannot build dtrace])
160246616Shselasky    DTRACE_DEP_MISSING=true
161246616Shselasky  fi
162246616Shselasky
163246616Shselasky  AC_CHECK_HEADERS([sys/sdt.h], [DTRACE_HEADERS_OK=yes],[DTRACE_HEADERS_OK=no])
164246616Shselasky  if test "x$DTRACE_HEADERS_OK" != "xyes"; then
165305733Shselasky    DTRACE_DEP_MISSING=true
166246616Shselasky  fi
167246616Shselasky
168246616Shselasky  AC_MSG_CHECKING([if dtrace should be built])
169246616Shselasky  if test "x$enable_dtrace" = "xyes"; then
170246616Shselasky    if test "x$DTRACE_DEP_MISSING" = "xtrue"; then
171246616Shselasky      AC_MSG_RESULT([no, missing dependencies])
172246616Shselasky      HELP_MSG_MISSING_DEPENDENCY([dtrace])
173246616Shselasky      AC_MSG_ERROR([Cannot enable dtrace with missing dependencies. See above. $HELP_MSG])
174246616Shselasky    else
175246616Shselasky      INCLUDE_DTRACE=true
176246616Shselasky      AC_MSG_RESULT([yes, forced])
177246616Shselasky    fi
178356395Shselasky  elif test "x$enable_dtrace" = "xno"; then
179356395Shselasky    INCLUDE_DTRACE=false
180356395Shselasky    AC_MSG_RESULT([no, forced])
181356395Shselasky  elif test "x$enable_dtrace" = "xauto" || test "x$enable_dtrace" = "x"; then
182356395Shselasky    if test "x$DTRACE_DEP_MISSING" = "xtrue"; then
183356395Shselasky      INCLUDE_DTRACE=false
184356395Shselasky      AC_MSG_RESULT([no, missing dependencies])
185184610Salfred    else
186184610Salfred      INCLUDE_DTRACE=true
187184610Salfred      AC_MSG_RESULT([yes, dependencies present])
188192984Sthompsa    fi
189356395Shselasky  else
190356395Shselasky    AC_MSG_ERROR([Invalid value for --enable-dtrace: $enable_dtrace])
191356395Shselasky  fi
192356680Shselasky])
193356395Shselasky
194260589Shselasky################################################################################
195260589Shselasky# Check if AOT should be enabled
196207079Sthompsa#
197208008SthompsaAC_DEFUN_ONCE([HOTSPOT_ENABLE_DISABLE_AOT],
198305733Shselasky[
199207079Sthompsa  AC_ARG_ENABLE([aot], [AS_HELP_STRING([--enable-aot@<:@=yes/no/auto@:>@],
200207079Sthompsa      [enable ahead of time compilation feature. Default is auto, where aot is enabled if all dependencies are present.])])
201207079Sthompsa
202250204Shselasky  if test "x$enable_aot" = "x" || test "x$enable_aot" = "xauto"; then
203192984Sthompsa    ENABLE_AOT="true"
204250204Shselasky  elif test "x$enable_aot" = "xyes"; then
205250204Shselasky    ENABLE_AOT="true"
206250204Shselasky  elif test "x$enable_aot" = "xno"; then
207207080Sthompsa    ENABLE_AOT="false"
208250204Shselasky    AC_MSG_CHECKING([if aot should be enabled])
209193644Sthompsa    AC_MSG_RESULT([no, forced])
210250204Shselasky  else
211250204Shselasky    AC_MSG_ERROR([Invalid value for --enable-aot: $enable_aot])
212250204Shselasky  fi
213192984Sthompsa
214192984Sthompsa  if test "x$ENABLE_AOT" = "xtrue"; then
215184610Salfred    # Only enable AOT on X64 platforms.
216192984Sthompsa    if test "x$OPENJDK_TARGET_CPU" = "xx86_64"; then
217192984Sthompsa      if test -e "$HOTSPOT_TOPDIR/src/jdk.aot"; then
218192984Sthompsa        if test -e "$HOTSPOT_TOPDIR/src/jdk.internal.vm.compiler"; then
219192984Sthompsa          ENABLE_AOT="true"
220207080Sthompsa        else
221194228Sthompsa          ENABLE_AOT="false"
222193644Sthompsa          if test "x$enable_aot" = "xyes"; then
223190191Sthompsa            AC_MSG_ERROR([Cannot build AOT without hotspot/src/jdk.internal.vm.compiler sources. Remove --enable-aot.])
224192984Sthompsa          fi
225192984Sthompsa        fi
226224777Shselasky      else
227192984Sthompsa        ENABLE_AOT="false"
228190191Sthompsa        if test "x$enable_aot" = "xyes"; then
229190191Sthompsa          AC_MSG_ERROR([Cannot build AOT without hotspot/src/jdk.aot sources. Remove --enable-aot.])
230193045Sthompsa        fi
231184610Salfred      fi
232192500Sthompsa    else
233192500Sthompsa      ENABLE_AOT="false"
234184610Salfred      if test "x$enable_aot" = "xyes"; then
235184610Salfred        AC_MSG_ERROR([AOT is currently only supported on x86_64. Remove --enable-aot.])
236184610Salfred      fi
237184610Salfred    fi
238184610Salfred  fi
239225350Shselasky
240184610Salfred  AC_SUBST(ENABLE_AOT)
241184610Salfred])
242184610Salfred
243213435Shselasky###############################################################################
244267240Shselasky# Set up all JVM features for each JVM variant.
245184610Salfred#
246184610SalfredAC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_FEATURES],
247184610Salfred[
248184610Salfred  # The user can in some cases supply additional jvm features. For the custom
249184610Salfred  # variant, this defines the entire variant.
250184610Salfred  AC_ARG_WITH([jvm-features], [AS_HELP_STRING([--with-jvm-features],
251184610Salfred      [additional JVM features to enable (separated by comma),  use '--help' to show possible values @<:@none@:>@])])
252184610Salfred  if test "x$with_jvm_features" != x; then
253184610Salfred    AC_MSG_CHECKING([additional JVM features])
254213432Shselasky    JVM_FEATURES=`$ECHO $with_jvm_features | $SED -e 's/,/ /g'`
255257206Shselasky    AC_MSG_RESULT([$JVM_FEATURES])
256257206Shselasky  fi
257257206Shselasky
258267240Shselasky  # Override hotspot cpu definitions for ARM platforms
259190730Sthompsa  if test "x$OPENJDK_TARGET_CPU" = xarm; then
260193644Sthompsa    HOTSPOT_TARGET_CPU=arm_32
261184610Salfred    HOTSPOT_TARGET_CPU_DEFINE="ARM32"
262184610Salfred    JVM_LDFLAGS="$JVM_LDFLAGS -fsigned-char"
263184610Salfred    JVM_CFLAGS="$JVM_CFLAGS -DARM -fsigned-char"
264192984Sthompsa  elif test "x$OPENJDK_TARGET_CPU" = xaarch64 && test "x$HOTSPOT_TARGET_CPU_PORT" = xarm64; then
265184610Salfred    HOTSPOT_TARGET_CPU=arm_64
266207080Sthompsa    HOTSPOT_TARGET_CPU_ARCH=arm
267213435Shselasky    JVM_LDFLAGS="$JVM_LDFLAGS -fsigned-char"
268192984Sthompsa    JVM_CFLAGS="$JVM_CFLAGS -DARM -fsigned-char"
269184610Salfred  fi
270213435Shselasky
271213435Shselasky  # Verify that dependencies are met for explicitly set features.
272213435Shselasky  if HOTSPOT_CHECK_JVM_FEATURE(jvmti) && ! HOTSPOT_CHECK_JVM_FEATURE(services); then
273192984Sthompsa    AC_MSG_ERROR([Specified JVM feature 'jvmti' requires feature 'services'])
274192984Sthompsa  fi
275192984Sthompsa
276192984Sthompsa  if HOTSPOT_CHECK_JVM_FEATURE(management) && ! HOTSPOT_CHECK_JVM_FEATURE(nmt); then
277192984Sthompsa    AC_MSG_ERROR([Specified JVM feature 'management' requires feature 'nmt'])
278192984Sthompsa  fi
279192984Sthompsa
280192984Sthompsa  if HOTSPOT_CHECK_JVM_FEATURE(jvmci) && ! (HOTSPOT_CHECK_JVM_FEATURE(compiler1) || HOTSPOT_CHECK_JVM_FEATURE(compiler2)); then
281192984Sthompsa    AC_MSG_ERROR([Specified JVM feature 'jvmci' requires feature 'compiler2' or 'compiler1'])
282192984Sthompsa  fi
283192984Sthompsa
284222786Shselasky  if HOTSPOT_CHECK_JVM_FEATURE(compiler2) && ! HOTSPOT_CHECK_JVM_FEATURE(all-gcs); then
285222786Shselasky    AC_MSG_ERROR([Specified JVM feature 'compiler2' requires feature 'all-gcs'])
286246616Shselasky  fi
287246616Shselasky
288250207Shselasky  if HOTSPOT_CHECK_JVM_FEATURE(vm-structs) && ! HOTSPOT_CHECK_JVM_FEATURE(all-gcs); then
289250207Shselasky    AC_MSG_ERROR([Specified JVM feature 'vm-structs' requires feature 'all-gcs'])
290250207Shselasky  fi
291250207Shselasky
292184610Salfred  # Turn on additional features based on other parts of configure
293184610Salfred  if test "x$INCLUDE_DTRACE" = "xtrue"; then
294188987Sthompsa    JVM_FEATURES="$JVM_FEATURES dtrace"
295188987Sthompsa  else
296194228Sthompsa    if HOTSPOT_CHECK_JVM_FEATURE(dtrace); then
297188987Sthompsa      AC_MSG_ERROR([To enable dtrace, you must use --enable-dtrace])
298184610Salfred    fi
299184610Salfred  fi
300194677Sthompsa
301194228Sthompsa  if test "x$STATIC_BUILD" = "xtrue"; then
302192984Sthompsa    JVM_FEATURES="$JVM_FEATURES static-build"
303192500Sthompsa  else
304192500Sthompsa    if HOTSPOT_CHECK_JVM_FEATURE(static-build); then
305224777Shselasky      AC_MSG_ERROR([To enable static-build, you must use --enable-static-build])
306224777Shselasky    fi
307224777Shselasky  fi
308224777Shselasky
309277136Shselasky  if ! HOTSPOT_CHECK_JVM_VARIANT(zero) && ! HOTSPOT_CHECK_JVM_VARIANT(zeroshark); then
310224777Shselasky    if HOTSPOT_CHECK_JVM_FEATURE(zero); then
311194228Sthompsa      AC_MSG_ERROR([To enable zero/zeroshark, you must use --with-jvm-variants=zero/zeroshark])
312185948Sthompsa    fi
313205036Sthompsa  fi
314194228Sthompsa
315185948Sthompsa  if ! HOTSPOT_CHECK_JVM_VARIANT(zeroshark); then
316194228Sthompsa    if HOTSPOT_CHECK_JVM_FEATURE(shark); then
317194228Sthompsa      AC_MSG_ERROR([To enable shark, you must use --with-jvm-variants=zeroshark])
318193644Sthompsa    fi
319194228Sthompsa  fi
320185948Sthompsa
321194228Sthompsa  # Only enable jvmci on x86_64, sparcv9 and aarch64.
322194228Sthompsa  if test "x$OPENJDK_TARGET_CPU" = "xx86_64" || \
323184610Salfred     test "x$OPENJDK_TARGET_CPU" = "xsparcv9" || \
324194228Sthompsa     test "x$OPENJDK_TARGET_CPU" = "xaarch64" ; then
325194228Sthompsa    JVM_FEATURES_jvmci="jvmci"
326213435Shselasky  else
327213435Shselasky    JVM_FEATURES_jvmci=""
328213435Shselasky  fi
329361208Shselasky
330361208Shselasky  AC_MSG_CHECKING([if jdk.internal.vm.compiler should be built])
331361208Shselasky  if HOTSPOT_CHECK_JVM_FEATURE(graal); then
332246616Shselasky    AC_MSG_RESULT([yes, forced])
333300667Shselasky    if test "x$JVM_FEATURES_jvmci" != "xjvmci" ; then
334300667Shselasky      AC_MSG_ERROR([Specified JVM feature 'graal' requires feature 'jvmci'])
335300667Shselasky    fi
336196498Salfred    INCLUDE_GRAAL="true"
337208008Sthompsa  else
338208008Sthompsa    # By default enable graal build where AOT is available
339305733Shselasky    if test "x$ENABLE_AOT" = "xtrue"; then
340305733Shselasky      AC_MSG_RESULT([yes])
341196498Salfred      JVM_FEATURES_graal="graal"
342184610Salfred      INCLUDE_GRAAL="true"
343260589Shselasky    else
344260589Shselasky      AC_MSG_RESULT([no])
345260589Shselasky      JVM_FEATURES_graal=""
346260589Shselasky      INCLUDE_GRAAL="false"
347260589Shselasky    fi
348260589Shselasky  fi
349194230Sthompsa
350  AC_SUBST(INCLUDE_GRAAL)
351
352  AC_MSG_CHECKING([if aot should be enabled])
353  if test "x$ENABLE_AOT" = "xtrue"; then
354    if test "x$enable_aot" = "xyes"; then
355      AC_MSG_RESULT([yes, forced])
356    else
357      AC_MSG_RESULT([yes])
358    fi
359    JVM_FEATURES_aot="aot"
360  else
361    if test "x$enable_aot" = "xno"; then
362      AC_MSG_RESULT([no, forced])
363    else
364      AC_MSG_RESULT([no])
365    fi
366    JVM_FEATURES_aot=""
367  fi
368
369  if test "x$OPENJDK_TARGET_CPU" = xarm ; then
370    # Default to use link time optimizations on minimal on arm
371    JVM_FEATURES_link_time_opt="link-time-opt"
372  else
373    JVM_FEATURES_link_time_opt=""
374  fi
375
376  # All variants but minimal (and custom) get these features
377  NON_MINIMAL_FEATURES="$NON_MINIMAL_FEATURES jvmti fprof vm-structs jni-check services management all-gcs nmt cds"
378
379  # Enable features depending on variant.
380  JVM_FEATURES_server="compiler1 compiler2 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci $JVM_FEATURES_aot $JVM_FEATURES_graal"
381  JVM_FEATURES_client="compiler1 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci"
382  JVM_FEATURES_core="$NON_MINIMAL_FEATURES $JVM_FEATURES"
383  JVM_FEATURES_minimal="compiler1 minimal $JVM_FEATURES $JVM_FEATURES_link_time_opt"
384  JVM_FEATURES_zero="zero $NON_MINIMAL_FEATURES $JVM_FEATURES"
385  JVM_FEATURES_zeroshark="zero shark $NON_MINIMAL_FEATURES $JVM_FEATURES"
386  JVM_FEATURES_custom="$JVM_FEATURES"
387
388  AC_SUBST(JVM_FEATURES_server)
389  AC_SUBST(JVM_FEATURES_client)
390  AC_SUBST(JVM_FEATURES_core)
391  AC_SUBST(JVM_FEATURES_minimal)
392  AC_SUBST(JVM_FEATURES_zero)
393  AC_SUBST(JVM_FEATURES_zeroshark)
394  AC_SUBST(JVM_FEATURES_custom)
395
396  # Used for verification of Makefiles by check-jvm-feature
397  AC_SUBST(VALID_JVM_FEATURES)
398
399  # We don't support --with-jvm-interpreter anymore, use zero instead.
400  BASIC_DEPRECATED_ARG_WITH(jvm-interpreter)
401])
402
403###############################################################################
404# Validate JVM features once all setup is complete, including custom setup.
405#
406AC_DEFUN_ONCE([HOTSPOT_VALIDATE_JVM_FEATURES],
407[
408  # Keep feature lists sorted and free of duplicates
409  JVM_FEATURES_server="$($ECHO $($PRINTF '%s\n' $JVM_FEATURES_server | $SORT -u))"
410  JVM_FEATURES_client="$($ECHO $($PRINTF '%s\n' $JVM_FEATURES_client | $SORT -u))"
411  JVM_FEATURES_core="$($ECHO $($PRINTF '%s\n' $JVM_FEATURES_core | $SORT -u))"
412  JVM_FEATURES_minimal="$($ECHO $($PRINTF '%s\n' $JVM_FEATURES_minimal | $SORT -u))"
413  JVM_FEATURES_zero="$($ECHO $($PRINTF '%s\n' $JVM_FEATURES_zero | $SORT -u))"
414  JVM_FEATURES_zeroshark="$($ECHO $($PRINTF '%s\n' $JVM_FEATURES_zeroshark | $SORT -u))"
415  JVM_FEATURES_custom="$($ECHO $($PRINTF '%s\n' $JVM_FEATURES_custom | $SORT -u))"
416
417  # Validate features
418  for variant in $JVM_VARIANTS; do
419    AC_MSG_CHECKING([JVM features for JVM variant '$variant'])
420    features_var_name=JVM_FEATURES_$variant
421    JVM_FEATURES_TO_TEST=${!features_var_name}
422    AC_MSG_RESULT([$JVM_FEATURES_TO_TEST])
423    NEEDLE=${VALID_JVM_FEATURES// /$'\n'}
424    STACK=${JVM_FEATURES_TO_TEST// /$'\n'}
425    INVALID_FEATURES=`$GREP -Fvx "${NEEDLE}" <<< "${STACK}"`
426    if test "x$INVALID_FEATURES" != x; then
427      AC_MSG_ERROR([Invalid JVM feature(s): $INVALID_FEATURES])
428    fi
429  done
430])
431
432################################################################################
433#
434# Specify which sources will be used to build the 64-bit ARM port
435#
436# --with-cpu-port=arm64   will use hotspot/src/cpu/arm
437# --with-cpu-port=aarch64 will use hotspot/src/cpu/aarch64
438#
439AC_DEFUN([SETUP_HOTSPOT_TARGET_CPU_PORT],
440[
441  AC_ARG_WITH(cpu-port, [AS_HELP_STRING([--with-cpu-port],
442      [specify sources to use for Hotspot 64-bit ARM port (arm64,aarch64) @<:@aarch64@:>@ ])])
443
444  if test "x$with_cpu_port" != x; then
445    if test "x$OPENJDK_TARGET_CPU" != xaarch64; then
446      AC_MSG_ERROR([--with-cpu-port only available on aarch64])
447    fi
448    if test "x$with_cpu_port" != xarm64 && \
449        test "x$with_cpu_port" != xaarch64; then
450      AC_MSG_ERROR([--with-cpu-port must specify arm64 or aarch64])
451    fi
452    HOTSPOT_TARGET_CPU_PORT="$with_cpu_port"
453  fi
454])
455
456
457################################################################################
458# Check if gtest should be built
459#
460AC_DEFUN_ONCE([HOTSPOT_ENABLE_DISABLE_GTEST],
461[
462  AC_ARG_ENABLE([hotspot-gtest], [AS_HELP_STRING([--disable-hotspot-gtest],
463      [Disables building of the Hotspot unit tests])])
464
465  if test -e "$HOTSPOT_TOPDIR/test/native"; then
466    GTEST_DIR_EXISTS="true"
467  else
468    GTEST_DIR_EXISTS="false"
469  fi
470
471  AC_MSG_CHECKING([if Hotspot gtest unit tests should be built])
472  if test "x$enable_hotspot_gtest" = "xyes"; then
473    if test "x$GTEST_DIR_EXISTS" = "xtrue"; then
474      AC_MSG_RESULT([yes, forced])
475      BUILD_GTEST="true"
476    else
477      AC_MSG_ERROR([Cannot build gtest without the test source])
478    fi
479  elif test "x$enable_hotspot_gtest" = "xno"; then
480    AC_MSG_RESULT([no, forced])
481    BUILD_GTEST="false"
482  elif test "x$enable_hotspot_gtest" = "x"; then
483    if test "x$GTEST_DIR_EXISTS" = "xtrue"; then
484      AC_MSG_RESULT([yes])
485      BUILD_GTEST="true"
486    else
487      AC_MSG_RESULT([no])
488      BUILD_GTEST="false"
489    fi
490  else
491    AC_MSG_ERROR([--enable-gtest must be either yes or no])
492  fi
493
494  AC_SUBST(BUILD_GTEST)
495])
496