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 # All valid JVM variants
 27 VALID_JVM_VARIANTS="server client minimal core zero custom"
 28 
 29 # Valhalla temporarily disabled
 30 VALHALLA_TEMP=false
 31 
 32 ###############################################################################
 33 # Check if the specified JVM variant should be built. To be used in shell if
 34 # constructs, like this:
 35 # if HOTSPOT_CHECK_JVM_VARIANT(server); then
 36 #
 37 # Only valid to use after HOTSPOT_SETUP_JVM_VARIANTS has setup variants.
 38 
 39 # Definition kept in one line to allow inlining in if statements.
 40 # Additional [] needed to keep m4 from mangling shell constructs.
 41 AC_DEFUN([HOTSPOT_CHECK_JVM_VARIANT],
 42 [ [ [[ " $JVM_VARIANTS " =~ " $1 " ]] ] ])
 43 
 44 ###############################################################################
 45 # Check which variants of the JVM that we want to build. Available variants are:
 46 #   server: normal interpreter, and a tiered C1/C2 compiler
 47 #   client: normal interpreter, and C1 (no C2 compiler)
 48 #   minimal: reduced form of client with optional features stripped out
 49 #   core: normal interpreter only, no compiler
 50 #   zero: C++ based interpreter only, no compiler
 51 #   custom: baseline JVM with no default features
 52 #
 53 AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_VARIANTS],
 54 [
 55   AC_ARG_WITH([jvm-variants], [AS_HELP_STRING([--with-jvm-variants],
 56       [JVM variants to build, separated by commas (server client minimal core
 57       zero custom) @<:@server@:>@])])
 58 
 59   if test "x$with_jvm_variants" = x; then
 60     with_jvm_variants="server"
 61   fi
 62   JVM_VARIANTS_OPT="$with_jvm_variants"
 63 
 64   # Has the user listed more than one variant?
 65   # Additional [] needed to keep m4 from mangling shell constructs.
 66   if [ [[ "$JVM_VARIANTS_OPT" =~ "," ]] ]; then
 67     BUILDING_MULTIPLE_JVM_VARIANTS=true
 68   else
 69     BUILDING_MULTIPLE_JVM_VARIANTS=false
 70   fi
 71   # Replace the commas with AND for use in the build directory name.
 72   JVM_VARIANTS_WITH_AND=`$ECHO "$JVM_VARIANTS_OPT" | $SED -e 's/,/AND/g'`
 73 
 74   AC_MSG_CHECKING([which variants of the JVM to build])
 75   # JVM_VARIANTS is a space-separated list.
 76   # Also use minimal, not minimal1 (which is kept for backwards compatibility).
 77   JVM_VARIANTS=`$ECHO $JVM_VARIANTS_OPT | $SED -e 's/,/ /g' -e 's/minimal1/minimal/'`
 78   AC_MSG_RESULT([$JVM_VARIANTS])
 79 
 80   # Check that the selected variants are valid
 81   UTIL_GET_NON_MATCHING_VALUES(INVALID_VARIANTS, $JVM_VARIANTS, \
 82       $VALID_JVM_VARIANTS)
 83   if test "x$INVALID_VARIANTS" != x; then
 84     AC_MSG_NOTICE([Unknown variant(s) specified: "$INVALID_VARIANTS"])
 85     AC_MSG_NOTICE([The available JVM variants are: "$VALID_JVM_VARIANTS"])
 86     AC_MSG_ERROR([Cannot continue])
 87   fi
 88 
 89   # The "main" variant is the one used by other libs to link against during the
 90   # build.
 91   if test "x$BUILDING_MULTIPLE_JVM_VARIANTS" = "xtrue"; then
 92     MAIN_VARIANT_PRIO_ORDER="server client minimal zero"
 93     for variant in $MAIN_VARIANT_PRIO_ORDER; do
 94       if HOTSPOT_CHECK_JVM_VARIANT($variant); then
 95         JVM_VARIANT_MAIN="$variant"
 96         break
 97       fi
 98     done
 99   else
100     JVM_VARIANT_MAIN="$JVM_VARIANTS"
101   fi
102 
103   AC_SUBST(JVM_VARIANTS)
104   AC_SUBST(VALID_JVM_VARIANTS)
105   AC_SUBST(JVM_VARIANT_MAIN)
106 ])
107 
108 ###############################################################################
109 # Misc hotspot setup that does not fit elsewhere.
110 #
111 AC_DEFUN_ONCE([HOTSPOT_SETUP_MISC],
112 [
113   if HOTSPOT_CHECK_JVM_VARIANT(zero); then
114     # zero behaves as a platform and rewrites these values. This is a bit weird.
115     # But when building zero, we never build any other variants so it works.
116     HOTSPOT_TARGET_CPU=zero
117     HOTSPOT_TARGET_CPU_ARCH=zero
118   fi
119 
120 
121   AC_ARG_WITH([hotspot-build-time], [AS_HELP_STRING([--with-hotspot-build-time],
122   [timestamp to use in hotspot version string, empty means determined at build time @<:@source-date/empty@:>@])])
123 
124   AC_MSG_CHECKING([what hotspot build time to use])
125 
126   if test "x$with_hotspot_build_time" != x; then
127     HOTSPOT_BUILD_TIME="$with_hotspot_build_time"
128     AC_MSG_RESULT([$HOTSPOT_BUILD_TIME (from --with-hotspot-build-time)])
129   else
130     if test "x$SOURCE_DATE" = xupdated; then
131       HOTSPOT_BUILD_TIME=""
132       AC_MSG_RESULT([determined at build time (default)])
133     else
134       # If we have a fixed value for SOURCE_DATE, use it as default
135       HOTSPOT_BUILD_TIME="$SOURCE_DATE_ISO_8601"
136       AC_MSG_RESULT([$HOTSPOT_BUILD_TIME (from --with-source-date)])
137     fi
138   fi
139 
140   AC_SUBST(HOTSPOT_BUILD_TIME)
141 
142 
143   # Override hotspot cpu definitions for ARM platforms
144   if test "x$OPENJDK_TARGET_CPU" = xarm; then
145     HOTSPOT_TARGET_CPU=arm_32
146     HOTSPOT_TARGET_CPU_DEFINE="ARM32"
147   fi
148 ])