1 #
   2 # Copyright (c) 2011, 2020, 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   # All "special" variants share the same output directory ("server")
  87   VALID_MULTIPLE_JVM_VARIANTS="server client minimal"
  88   UTIL_GET_NON_MATCHING_VALUES(INVALID_MULTIPLE_VARIANTS, $JVM_VARIANTS, \
  89       $VALID_MULTIPLE_JVM_VARIANTS)
  90   if  test "x$INVALID_MULTIPLE_VARIANTS" != x && \
  91       test "x$BUILDING_MULTIPLE_JVM_VARIANTS" = xtrue; then
  92     AC_MSG_ERROR([You can only build multiple variants using these variants: '$VALID_MULTIPLE_JVM_VARIANTS'])
  93   fi
  94 
  95   # The "main" variant is the one used by other libs to link against during the
  96   # build.
  97   if test "x$BUILDING_MULTIPLE_JVM_VARIANTS" = "xtrue"; then
  98     MAIN_VARIANT_PRIO_ORDER="server client minimal"
  99     for variant in $MAIN_VARIANT_PRIO_ORDER; do
 100       if HOTSPOT_CHECK_JVM_VARIANT($variant); then
 101         JVM_VARIANT_MAIN="$variant"
 102         break
 103       fi
 104     done
 105   else
 106     JVM_VARIANT_MAIN="$JVM_VARIANTS"
 107   fi
 108 
 109   AC_SUBST(JVM_VARIANTS)
 110   AC_SUBST(VALID_JVM_VARIANTS)
 111   AC_SUBST(JVM_VARIANT_MAIN)
 112 ])
 113 
 114 ###############################################################################
 115 # Check if gtest should be built
 116 #
 117 AC_DEFUN_ONCE([HOTSPOT_ENABLE_DISABLE_GTEST],
 118 [
 119   GTEST_AVAILABLE=true
 120 
 121   AC_MSG_CHECKING([if Hotspot gtest test source is present])
 122   if test -e "${TOPDIR}/test/hotspot/gtest"; then
 123     AC_MSG_RESULT([yes])
 124   else
 125     AC_MSG_RESULT([no, cannot build gtest])
 126     GTEST_AVAILABLE=false
 127   fi
 128 
 129   UTIL_ARG_ENABLE(NAME: hotspot-gtest, DEFAULT: auto,
 130       RESULT: BUILD_GTEST, AVAILABLE: $GTEST_AVAILABLE,
 131       DEFAULT_DESC: [enabled if possible to build],
 132       DESC: [enable building of the Hotspot unit tests])
 133   AC_SUBST(BUILD_GTEST)
 134 ])
 135 
 136 ###############################################################################
 137 # Misc hotspot setup that does not fit elsewhere.
 138 #
 139 AC_DEFUN_ONCE([HOTSPOT_SETUP_MISC],
 140 [
 141   if HOTSPOT_CHECK_JVM_VARIANT(zero); then
 142     # zero behaves as a platform and rewrites these values. This is a bit weird.
 143     # But when building zero, we never build any other variants so it works.
 144     HOTSPOT_TARGET_CPU=zero
 145     HOTSPOT_TARGET_CPU_ARCH=zero
 146   fi
 147 
 148   AC_ARG_WITH([hotspot-build-time], [AS_HELP_STRING([--with-hotspot-build-time],
 149   [timestamp to use in hotspot version string, empty for on-the-fly @<:@empty@:>@])])
 150 
 151   if test "x$with_hotspot_build_time" != x; then
 152     HOTSPOT_BUILD_TIME="$with_hotspot_build_time"
 153   fi
 154   AC_SUBST(HOTSPOT_BUILD_TIME)
 155 
 156 
 157   # Override hotspot cpu definitions for ARM platforms
 158   if test "x$OPENJDK_TARGET_CPU" = xarm; then
 159     HOTSPOT_TARGET_CPU=arm_32
 160     HOTSPOT_TARGET_CPU_DEFINE="ARM32"
 161   fi
 162 
 163   # --with-cpu-port is no longer supported
 164   UTIL_DEPRECATED_ARG_WITH(with-cpu-port)
 165 ])