1 # 2 # Copyright (c) 2011, 2016, 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 # Check which interpreter of the JVM we want to build. 28 # Currently we have: 29 # template: Template interpreter (the default) 30 # cpp : C++ interpreter 31 AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_INTERPRETER], 32 [ 33 AC_ARG_WITH([jvm-interpreter], [AS_HELP_STRING([--with-jvm-interpreter], 34 [JVM interpreter to build (template, cpp) @<:@template@:>@])]) 35 36 AC_MSG_CHECKING([which interpreter of the JVM to build]) 37 if test "x$with_jvm_interpreter" = x; then 38 JVM_INTERPRETER="template" 39 else 40 JVM_INTERPRETER="$with_jvm_interpreter" 41 fi 42 AC_MSG_RESULT([$JVM_INTERPRETER]) 43 44 if test "x$JVM_INTERPRETER" != xtemplate && test "x$JVM_INTERPRETER" != xcpp; then 45 AC_MSG_ERROR([The available JVM interpreters are: template, cpp]) 46 fi 47 48 AC_SUBST(JVM_INTERPRETER) 49 ]) 50 51 ############################################################################### 52 # Check which variants of the JVM that we want to build. 53 # Currently we have: 54 # server: normal interpreter and a C2 or tiered C1/C2 compiler 55 # client: normal interpreter and C1 (no C2 compiler) (only 32-bit platforms) 56 # minimal1: reduced form of client with optional VM services and features stripped out 57 # zero: no machine code interpreter, no compiler 58 # zeroshark: zero interpreter and shark/llvm compiler backend 59 # core: interpreter only, no compiler (only works on some platforms) 60 AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_VARIANTS], 61 [ 62 AC_MSG_CHECKING([which variants of the JVM to build]) 63 AC_ARG_WITH([jvm-variants], [AS_HELP_STRING([--with-jvm-variants], 64 [JVM variants (separated by commas) to build (server, client, minimal1, zero, zeroshark, core) @<:@server@:>@])]) 65 66 if test "x$with_jvm_variants" = x; then 67 with_jvm_variants="server" 68 fi 69 70 JVM_VARIANTS=",$with_jvm_variants," 71 TEST_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/server,//' -e 's/client,//' -e 's/minimal1,//' -e 's/zero,//' -e 's/zeroshark,//' -e 's/core,//'` 72 73 if test "x$TEST_VARIANTS" != "x,"; then 74 AC_MSG_ERROR([The available JVM variants are: server, client, minimal1, zero, zeroshark, core]) 75 fi 76 AC_MSG_RESULT([$with_jvm_variants]) 77 78 JVM_VARIANT_SERVER=`$ECHO "$JVM_VARIANTS" | $SED -e '/,server,/!s/.*/false/g' -e '/,server,/s/.*/true/g'` 79 JVM_VARIANT_CLIENT=`$ECHO "$JVM_VARIANTS" | $SED -e '/,client,/!s/.*/false/g' -e '/,client,/s/.*/true/g'` 80 JVM_VARIANT_MINIMAL1=`$ECHO "$JVM_VARIANTS" | $SED -e '/,minimal1,/!s/.*/false/g' -e '/,minimal1,/s/.*/true/g'` 81 JVM_VARIANT_ZERO=`$ECHO "$JVM_VARIANTS" | $SED -e '/,zero,/!s/.*/false/g' -e '/,zero,/s/.*/true/g'` 82 JVM_VARIANT_ZEROSHARK=`$ECHO "$JVM_VARIANTS" | $SED -e '/,zeroshark,/!s/.*/false/g' -e '/,zeroshark,/s/.*/true/g'` 83 JVM_VARIANT_CORE=`$ECHO "$JVM_VARIANTS" | $SED -e '/,core,/!s/.*/false/g' -e '/,core,/s/.*/true/g'` 84 85 if test "x$JVM_VARIANT_CLIENT" = xtrue; then 86 if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then 87 AC_MSG_ERROR([You cannot build a client JVM for a 64-bit machine.]) 88 fi 89 fi 90 if test "x$JVM_VARIANT_MINIMAL1" = xtrue; then 91 if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then 92 AC_MSG_ERROR([You cannot build a minimal JVM for a 64-bit machine.]) 93 fi 94 fi 95 96 # Replace the commas with AND for use in the build directory name. 97 ANDED_JVM_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/^,//' -e 's/,$//' -e 's/,/AND/g'` 98 COUNT_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/server,/1/' -e 's/client,/1/' -e 's/minimal1,/1/' -e 's/zero,/1/' -e 's/zeroshark,/1/' -e 's/core,/1/'` 99 if test "x$COUNT_VARIANTS" != "x,1"; then 100 BUILDING_MULTIPLE_JVM_VARIANTS=yes 101 else 102 BUILDING_MULTIPLE_JVM_VARIANTS=no 103 fi 104 105 if test "x$JVM_VARIANT_ZERO" = xtrue && test "x$BUILDING_MULTIPLE_JVM_VARIANTS" = xyes; then 106 AC_MSG_ERROR([You cannot build multiple variants with zero.]) 107 fi 108 109 AC_SUBST(JVM_VARIANTS) 110 AC_SUBST(JVM_VARIANT_SERVER) 111 AC_SUBST(JVM_VARIANT_CLIENT) 112 AC_SUBST(JVM_VARIANT_MINIMAL1) 113 AC_SUBST(JVM_VARIANT_ZERO) 114 AC_SUBST(JVM_VARIANT_ZEROSHARK) 115 AC_SUBST(JVM_VARIANT_CORE) 116 117 AC_MSG_CHECKING([if servicability agent (jdk.hotspot.agent) should be built]) 118 INCLUDE_SA=true 119 if test "x$JVM_VARIANT_ZERO" = xtrue ; then 120 INCLUDE_SA=false 121 fi 122 if test "x$JVM_VARIANT_ZEROSHARK" = xtrue ; then 123 INCLUDE_SA=false 124 fi 125 if test "x$OPENJDK_TARGET_OS" = xaix ; then 126 INCLUDE_SA=false 127 fi 128 if test "x$OPENJDK_TARGET_OS_ENV" = xbsd.openbsd || test "x$OPENJDK_TARGET_OS_ENV" = xbsd.netbsd; then 129 INCLUDE_SA=false 130 fi 131 if test "x$OPENJDK_TARGET_CPU" = xaarch64; then 132 INCLUDE_SA=false 133 fi 134 if test "x$INCLUDE_SA" = xtrue; then 135 AC_MSG_RESULT([yes]) 136 else 137 AC_MSG_RESULT([no]) 138 fi 139 AC_SUBST(INCLUDE_SA) 140 141 if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then 142 MACOSX_UNIVERSAL="true" 143 fi 144 145 AC_SUBST(MACOSX_UNIVERSAL) 146 ]) 147 148 149 ############################################################################### 150 # Setup legacy vars/targets and new vars to deal with different debug levels. 151 # 152 # release: no debug information, all optimizations, no asserts. 153 # optimized: no debug information, all optimizations, no asserts, HotSpot target is 'optimized'. 154 # fastdebug: debug information (-g), all optimizations, all asserts 155 # slowdebug: debug information (-g), no optimizations, all asserts 156 # 157 AC_DEFUN_ONCE([HOTSPOT_SETUP_DEBUG_LEVEL], 158 [ 159 case $DEBUG_LEVEL in 160 release ) 161 VARIANT="OPT" 162 FASTDEBUG="false" 163 DEBUG_CLASSFILES="false" 164 BUILD_VARIANT_RELEASE="" 165 HOTSPOT_DEBUG_LEVEL="product" 166 HOTSPOT_EXPORT="product" 167 ;; 168 fastdebug ) 169 VARIANT="DBG" 170 FASTDEBUG="true" 171 DEBUG_CLASSFILES="true" 172 BUILD_VARIANT_RELEASE="-fastdebug" 173 HOTSPOT_DEBUG_LEVEL="fastdebug" 174 HOTSPOT_EXPORT="fastdebug" 175 ;; 176 slowdebug ) 177 VARIANT="DBG" 178 FASTDEBUG="false" 179 DEBUG_CLASSFILES="true" 180 BUILD_VARIANT_RELEASE="-debug" 181 HOTSPOT_DEBUG_LEVEL="debug" 182 HOTSPOT_EXPORT="debug" 183 ;; 184 optimized ) 185 VARIANT="OPT" 186 FASTDEBUG="false" 187 DEBUG_CLASSFILES="false" 188 BUILD_VARIANT_RELEASE="-optimized" 189 HOTSPOT_DEBUG_LEVEL="optimized" 190 HOTSPOT_EXPORT="optimized" 191 ;; 192 esac 193 194 # The debug level 'optimized' is a little special because it is currently only 195 # applicable to the HotSpot build where it means to build a completely 196 # optimized version of the VM without any debugging code (like for the 197 # 'release' debug level which is called 'product' in the HotSpot build) but 198 # with the exception that it can contain additional code which is otherwise 199 # protected by '#ifndef PRODUCT' macros. These 'optimized' builds are used to 200 # test new and/or experimental features which are not intended for customer 201 # shipment. Because these new features need to be tested and benchmarked in 202 # real world scenarios, we want to build the containing JDK at the 'release' 203 # debug level. 204 if test "x$DEBUG_LEVEL" = xoptimized; then 205 DEBUG_LEVEL="release" 206 fi 207 208 ##### 209 # Generate the legacy makefile targets for hotspot. 210 # The hotspot api for selecting the build artifacts, really, needs to be improved. 211 # JDK-7195896 will fix this on the hotspot side by using the JVM_VARIANT_* variables to 212 # determine what needs to be built. All we will need to set here is all_product, all_fastdebug etc 213 # But until then ... 214 HOTSPOT_TARGET="" 215 216 if test "x$JVM_VARIANT_SERVER" = xtrue; then 217 HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL} " 218 fi 219 220 if test "x$JVM_VARIANT_CLIENT" = xtrue; then 221 HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}1 " 222 fi 223 224 if test "x$JVM_VARIANT_MINIMAL1" = xtrue; then 225 HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}minimal1 " 226 fi 227 228 if test "x$JVM_VARIANT_ZERO" = xtrue; then 229 HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}zero " 230 fi 231 232 if test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then 233 HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}shark " 234 fi 235 236 if test "x$JVM_VARIANT_CORE" = xtrue; then 237 HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}core " 238 fi 239 240 HOTSPOT_TARGET="$HOTSPOT_TARGET docs export_$HOTSPOT_EXPORT" 241 242 # On Macosx universal binaries are produced, but they only contain 243 # 64 bit intel. This invalidates control of which jvms are built 244 # from configure, but only server is valid anyway. Fix this 245 # when hotspot makefiles are rewritten. 246 if test "x$MACOSX_UNIVERSAL" = xtrue; then 247 HOTSPOT_TARGET=universal_${HOTSPOT_EXPORT} 248 fi 249 250 ##### 251 252 AC_SUBST(DEBUG_LEVEL) 253 AC_SUBST(VARIANT) 254 AC_SUBST(FASTDEBUG) 255 AC_SUBST(DEBUG_CLASSFILES) 256 AC_SUBST(BUILD_VARIANT_RELEASE) 257 ]) 258 259 AC_DEFUN_ONCE([HOTSPOT_SETUP_HOTSPOT_OPTIONS], 260 [ 261 # Control wether Hotspot runs Queens test after build. 262 AC_ARG_ENABLE([hotspot-test-in-build], [AS_HELP_STRING([--enable-hotspot-test-in-build], 263 [run the Queens test after Hotspot build @<:@disabled@:>@])],, 264 [enable_hotspot_test_in_build=no]) 265 if test "x$enable_hotspot_test_in_build" = "xyes"; then 266 TEST_IN_BUILD=true 267 else 268 TEST_IN_BUILD=false 269 fi 270 AC_SUBST(TEST_IN_BUILD) 271 ]) 272 273 AC_DEFUN_ONCE([HOTSPOT_SETUP_BUILD_TWEAKS], 274 [ 275 HOTSPOT_MAKE_ARGS="$HOTSPOT_TARGET" 276 AC_SUBST(HOTSPOT_MAKE_ARGS) 277 ]) 278 279 # -g is already added by ENABLE_DEBUG_SYMBOLS and the hotspot makefiles 280 # will basically do slowdebug builds when DEBUG_BINARIES is set for 281 # fastdebug builds 282 DEBUG_BINARIES=false 283 # Fastdebug builds with this setting will essentially be slowdebug 284 # in hotspot. 285 # -g is already added by ENABLE_DEBUG_SYMBOLS and the hotspot makefiles 286 # will basically do slowdebug builds when DEBUG_BINARIES is set for 287 # fastdebug builds 288 DEBUG_BINARIES=false