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