jdk-options.m4 revision 492:e64f2cb57d05
1# 2# Copyright (c) 2011, 2012, 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 26AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_VARIANT], 27[ 28############################################################################### 29# 30# Check which variant of the JDK that we want to build. 31# Currently we have: 32# normal: standard edition 33# but the custom make system may add other variants 34# 35# Effectively the JDK variant gives a name to a specific set of 36# modules to compile into the JDK. In the future, these modules 37# might even be Jigsaw modules. 38# 39AC_MSG_CHECKING([which variant of the JDK to build]) 40AC_ARG_WITH([jdk-variant], [AS_HELP_STRING([--with-jdk-variant], 41 [JDK variant to build (normal) @<:@normal@:>@])]) 42 43if test "x$with_jdk_variant" = xnormal || test "x$with_jdk_variant" = x; then 44 JDK_VARIANT="normal" 45else 46 AC_MSG_ERROR([The available JDK variants are: normal]) 47fi 48 49AC_SUBST(JDK_VARIANT) 50 51AC_MSG_RESULT([$JDK_VARIANT]) 52]) 53 54AC_DEFUN_ONCE([JDKOPT_SETUP_JVM_VARIANTS], 55[ 56 57############################################################################### 58# 59# Check which variants of the JVM that we want to build. 60# Currently we have: 61# server: normal interpreter and a tiered C1/C2 compiler 62# client: normal interpreter and C1 (no C2 compiler) (only 32-bit platforms) 63# kernel: kernel footprint JVM that passes the TCK without major performance problems, 64# ie normal interpreter and C1, only the serial GC, kernel jvmti etc 65# zero: no machine code interpreter, no compiler 66# zeroshark: zero interpreter and shark/llvm compiler backend 67AC_MSG_CHECKING([which variants of the JVM to build]) 68AC_ARG_WITH([jvm-variants], [AS_HELP_STRING([--with-jvm-variants], 69 [JVM variants (separated by commas) to build (server, client, kernel, zero, zeroshark) @<:@server@:>@])]) 70 71if test "x$with_jvm_variants" = x; then 72 with_jvm_variants="server" 73fi 74 75JVM_VARIANTS=",$with_jvm_variants," 76TEST_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/server,//' -e 's/client,//' -e 's/kernel,//' -e 's/zero,//' -e 's/zeroshark,//'` 77 78if test "x$TEST_VARIANTS" != "x,"; then 79 AC_MSG_ERROR([The available JVM variants are: server, client, kernel, zero, zeroshark]) 80fi 81AC_MSG_RESULT([$with_jvm_variants]) 82 83JVM_VARIANT_SERVER=`$ECHO "$JVM_VARIANTS" | $SED -e '/,server,/!s/.*/false/g' -e '/,server,/s/.*/true/g'` 84JVM_VARIANT_CLIENT=`$ECHO "$JVM_VARIANTS" | $SED -e '/,client,/!s/.*/false/g' -e '/,client,/s/.*/true/g'` 85JVM_VARIANT_KERNEL=`$ECHO "$JVM_VARIANTS" | $SED -e '/,kernel,/!s/.*/false/g' -e '/,kernel,/s/.*/true/g'` 86JVM_VARIANT_ZERO=`$ECHO "$JVM_VARIANTS" | $SED -e '/,zero,/!s/.*/false/g' -e '/,zero,/s/.*/true/g'` 87JVM_VARIANT_ZEROSHARK=`$ECHO "$JVM_VARIANTS" | $SED -e '/,zeroshark,/!s/.*/false/g' -e '/,zeroshark,/s/.*/true/g'` 88 89if test "x$JVM_VARIANT_CLIENT" = xtrue; then 90 if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then 91 AC_MSG_ERROR([You cannot build a client JVM for a 64-bit machine.]) 92 fi 93fi 94if test "x$JVM_VARIANT_KERNEL" = xtrue; then 95 if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then 96 AC_MSG_ERROR([You cannot build a kernel JVM for a 64-bit machine.]) 97 fi 98fi 99 100# Replace the commas with AND for use in the build directory name. 101ANDED_JVM_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/^,//' -e 's/,$//' -e 's/,/AND/'` 102COUNT_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/server,/1/' -e 's/client,/1/' -e 's/kernel,/1/' -e 's/zero,/1/' -e 's/zeroshark,/1/'` 103if test "x$COUNT_VARIANTS" != "x,1"; then 104 BUILDING_MULTIPLE_JVM_VARIANTS=yes 105else 106 BUILDING_MULTIPLE_JVM_VARIANTS=no 107fi 108 109AC_SUBST(JVM_VARIANTS) 110AC_SUBST(JVM_VARIANT_SERVER) 111AC_SUBST(JVM_VARIANT_CLIENT) 112AC_SUBST(JVM_VARIANT_KERNEL) 113AC_SUBST(JVM_VARIANT_ZERO) 114AC_SUBST(JVM_VARIANT_ZEROSHARK) 115 116if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then 117 MACOSX_UNIVERSAL="true" 118fi 119 120AC_SUBST(MACOSX_UNIVERSAL) 121 122]) 123 124AC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_LEVEL], 125[ 126############################################################################### 127# 128# Set the debug level 129# release: no debug information, all optimizations, no asserts. 130# fastdebug: debug information (-g), all optimizations, all asserts 131# slowdebug: debug information (-g), no optimizations, all asserts 132# 133DEBUG_LEVEL="release" 134AC_MSG_CHECKING([which debug level to use]) 135AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug], 136 [set the debug level to fastdebug (shorthand for --with-debug-level=fastdebug) @<:@disabled@:>@])], 137 [ 138 ENABLE_DEBUG="${enableval}" 139 DEBUG_LEVEL="fastdebug" 140 ], [ENABLE_DEBUG="no"]) 141 142AC_ARG_WITH([debug-level], [AS_HELP_STRING([--with-debug-level], 143 [set the debug level (release, fastdebug, slowdebug) @<:@release@:>@])], 144 [ 145 DEBUG_LEVEL="${withval}" 146 if test "x$ENABLE_DEBUG" = xyes; then 147 AC_MSG_ERROR([You cannot use both --enable-debug and --with-debug-level at the same time.]) 148 fi 149 ]) 150AC_MSG_RESULT([$DEBUG_LEVEL]) 151 152if test "x$DEBUG_LEVEL" != xrelease && \ 153 test "x$DEBUG_LEVEL" != xfastdebug && \ 154 test "x$DEBUG_LEVEL" != xslowdebug; then 155 AC_MSG_ERROR([Allowed debug levels are: release, fastdebug and slowdebug]) 156fi 157 158 159############################################################################### 160# 161# Setup legacy vars/targets and new vars to deal with different debug levels. 162# 163 164case $DEBUG_LEVEL in 165 release ) 166 VARIANT="OPT" 167 FASTDEBUG="false" 168 DEBUG_CLASSFILES="false" 169 BUILD_VARIANT_RELEASE="" 170 HOTSPOT_DEBUG_LEVEL="product" 171 HOTSPOT_EXPORT="product" 172 ;; 173 fastdebug ) 174 VARIANT="DBG" 175 FASTDEBUG="true" 176 DEBUG_CLASSFILES="true" 177 BUILD_VARIANT_RELEASE="-fastdebug" 178 HOTSPOT_DEBUG_LEVEL="fastdebug" 179 HOTSPOT_EXPORT="fastdebug" 180 ;; 181 slowdebug ) 182 VARIANT="DBG" 183 FASTDEBUG="false" 184 DEBUG_CLASSFILES="true" 185 BUILD_VARIANT_RELEASE="-debug" 186 HOTSPOT_DEBUG_LEVEL="jvmg" 187 HOTSPOT_EXPORT="debug" 188 ;; 189esac 190 191##### 192# Generate the legacy makefile targets for hotspot. 193# The hotspot api for selecting the build artifacts, really, needs to be improved. 194# 195HOTSPOT_TARGET="" 196 197if test "x$JVM_VARIANT_SERVER" = xtrue; then 198 HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL} " 199fi 200 201if test "x$JVM_VARIANT_CLIENT" = xtrue; then 202 HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}1 " 203fi 204 205if test "x$JVM_VARIANT_KERNEL" = xtrue; then 206 HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}kernel " 207fi 208 209if test "x$JVM_VARIANT_ZERO" = xtrue; then 210 HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}zero " 211fi 212 213if test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then 214 HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}shark " 215fi 216 217HOTSPOT_TARGET="$HOTSPOT_TARGET docs export_$HOTSPOT_EXPORT" 218 219# On Macosx universal binaries are produced, but they only contain 220# 64 bit intel. This invalidates control of which jvms are built 221# from configure, but only server is valid anyway. Fix this 222# when hotspot makefiles are rewritten. 223if test "x$MACOSX_UNIVERSAL" = xtrue; then 224 HOTSPOT_TARGET=universal_product 225fi 226 227##### 228 229AC_SUBST(DEBUG_LEVEL) 230AC_SUBST(VARIANT) 231AC_SUBST(FASTDEBUG) 232AC_SUBST(DEBUG_CLASSFILES) 233AC_SUBST(BUILD_VARIANT_RELEASE) 234]) 235 236AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS], 237[ 238 239############################################################################### 240# 241# Should we build only OpenJDK even if closed sources are present? 242# 243AC_ARG_ENABLE([openjdk-only], [AS_HELP_STRING([--enable-openjdk-only], 244 [supress building closed source even if present @<:@disabled@:>@])],,[enable_openjdk_only="no"]) 245 246AC_MSG_CHECKING([for presence of closed sources]) 247if test -d "$SRC_ROOT/jdk/src/closed"; then 248 CLOSED_SOURCE_PRESENT=yes 249else 250 CLOSED_SOURCE_PRESENT=no 251fi 252AC_MSG_RESULT([$CLOSED_SOURCE_PRESENT]) 253 254AC_MSG_CHECKING([if closed source is supressed (openjdk-only)]) 255SUPRESS_CLOSED_SOURCE="$enable_openjdk_only" 256AC_MSG_RESULT([$SUPRESS_CLOSED_SOURCE]) 257 258if test "x$CLOSED_SOURCE_PRESENT" = xno; then 259 OPENJDK=true 260 if test "x$SUPRESS_CLOSED_SOURCE" = "xyes"; then 261 AC_MSG_WARN([No closed source present, --enable-openjdk-only makes no sense]) 262 fi 263else 264 if test "x$SUPRESS_CLOSED_SOURCE" = "xyes"; then 265 OPENJDK=true 266 else 267 OPENJDK=false 268 fi 269fi 270 271if test "x$OPENJDK" = "xtrue"; then 272 SET_OPENJDK="OPENJDK=true" 273fi 274 275AC_SUBST(SET_OPENJDK) 276 277############################################################################### 278# 279# Should we build a JDK/JVM with headful support (ie a graphical ui)? 280# We always build headless support. 281# 282AC_MSG_CHECKING([headful support]) 283AC_ARG_ENABLE([headful], [AS_HELP_STRING([--disable-headful], 284 [disable building headful support (graphical UI support) @<:@enabled@:>@])], 285 [SUPPORT_HEADFUL=${enable_headful}], [SUPPORT_HEADFUL=yes]) 286 287SUPPORT_HEADLESS=yes 288BUILD_HEADLESS="BUILD_HEADLESS:=true" 289 290if test "x$SUPPORT_HEADFUL" = xyes; then 291 # We are building both headful and headless. 292 headful_msg="inlude support for both headful and headless" 293fi 294 295if test "x$SUPPORT_HEADFUL" = xno; then 296 # Thus we are building headless only. 297 BUILD_HEADLESS="BUILD_HEADLESS:=true" 298 headful_msg="headless only" 299fi 300 301AC_MSG_RESULT([$headful_msg]) 302 303AC_SUBST(SUPPORT_HEADLESS) 304AC_SUBST(SUPPORT_HEADFUL) 305AC_SUBST(BUILD_HEADLESS) 306 307# Control wether Hotspot runs Queens test after build. 308AC_ARG_ENABLE([hotspot-test-in-build], [AS_HELP_STRING([--enable-hotspot-test-in-build], 309 [run the Queens test after Hotspot build @<:@disabled@:>@])],, 310 [enable_hotspot_test_in_build=no]) 311if test "x$enable_hotspot_test_in_build" = "xyes"; then 312 TEST_IN_BUILD=true 313else 314 TEST_IN_BUILD=false 315fi 316AC_SUBST(TEST_IN_BUILD) 317 318############################################################################### 319# 320# Choose cacerts source file 321# 322AC_ARG_WITH(cacerts-file, [AS_HELP_STRING([--with-cacerts-file], 323 [specify alternative cacerts file])]) 324if test "x$with_cacerts_file" != x; then 325 CACERTS_FILE=$with_cacerts_file 326else 327 if test "x$OPENJDK" = "xtrue"; then 328 CACERTS_FILE=${SRC_ROOT}/jdk/src/share/lib/security/cacerts 329 else 330 CACERTS_FILE=${SRC_ROOT}/jdk/src/closed/share/lib/security/cacerts.internal 331 fi 332fi 333AC_SUBST(CACERTS_FILE) 334 335############################################################################### 336# 337# Compress jars 338# 339COMPRESS_JARS=false 340 341AC_SUBST(COMPRESS_JARS) 342]) 343 344AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_VERSION_NUMBERS], 345[ 346# Source the version numbers 347. $AUTOCONF_DIR/version.numbers 348if test "x$OPENJDK" = "xfalse"; then 349 . $AUTOCONF_DIR/closed.version.numbers 350fi 351# Now set the JDK version, milestone, build number etc. 352AC_SUBST(JDK_MAJOR_VERSION) 353AC_SUBST(JDK_MINOR_VERSION) 354AC_SUBST(JDK_MICRO_VERSION) 355AC_SUBST(JDK_UPDATE_VERSION) 356AC_SUBST(JDK_BUILD_NUMBER) 357AC_SUBST(MILESTONE) 358AC_SUBST(LAUNCHER_NAME) 359AC_SUBST(PRODUCT_NAME) 360AC_SUBST(PRODUCT_SUFFIX) 361AC_SUBST(JDK_RC_PLATFORM_NAME) 362AC_SUBST(COMPANY_NAME) 363AC_SUBST(MACOSX_BUNDLE_NAME_BASE) 364AC_SUBST(MACOSX_BUNDLE_ID_BASE) 365 366COPYRIGHT_YEAR=`date +'%Y'` 367AC_SUBST(COPYRIGHT_YEAR) 368 369RUNTIME_NAME="$PRODUCT_NAME $PRODUCT_SUFFIX" 370AC_SUBST(RUNTIME_NAME) 371 372if test "x$JDK_UPDATE_VERSION" != x; then 373 JDK_VERSION="${JDK_MAJOR_VERSION}.${JDK_MINOR_VERSION}.${JDK_MICRO_VERSION}_${JDK_UPDATE_VERSION}" 374else 375 JDK_VERSION="${JDK_MAJOR_VERSION}.${JDK_MINOR_VERSION}.${JDK_MICRO_VERSION}" 376fi 377AC_SUBST(JDK_VERSION) 378 379if test "x$MILESTONE" != x; then 380 RELEASE="${JDK_VERSION}-${MILESTONE}${BUILD_VARIANT_RELEASE}" 381else 382 RELEASE="${JDK_VERSION}${BUILD_VARIANT_RELEASE}" 383fi 384AC_SUBST(RELEASE) 385 386if test "x$JDK_BUILD_NUMBER" != x; then 387 FULL_VERSION="${RELEASE}-${JDK_BUILD_NUMBER}" 388else 389 JDK_BUILD_NUMBER=b00 390 BUILD_DATE=`date '+%Y_%m_%d_%H_%M'` 391 # Avoid [:alnum:] since it depends on the locale. 392 CLEAN_USERNAME=`echo "$USER" | $TR -d -c 'abcdefghijklmnopqrstuvqxyz0123456789'` 393 USER_RELEASE_SUFFIX=`echo "${CLEAN_USERNAME}_${BUILD_DATE}" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` 394 FULL_VERSION="${RELEASE}-${USER_RELEASE_SUFFIX}-${JDK_BUILD_NUMBER}" 395fi 396AC_SUBST(FULL_VERSION) 397COOKED_BUILD_NUMBER=`$ECHO $JDK_BUILD_NUMBER | $SED -e 's/^b//' -e 's/^0//'` 398AC_SUBST(COOKED_BUILD_NUMBER) 399]) 400 401AC_DEFUN_ONCE([JDKOPT_SETUP_BUILD_TWEAKS], 402[ 403HOTSPOT_MAKE_ARGS="$HOTSPOT_TARGET" 404AC_SUBST(HOTSPOT_MAKE_ARGS) 405 406# The name of the Service Agent jar. 407SALIB_NAME="${LIBRARY_PREFIX}saproc${SHARED_LIBRARY_SUFFIX}" 408if test "x$OPENJDK_TARGET_OS" = "xwindows"; then 409 SALIB_NAME="${LIBRARY_PREFIX}sawindbg${SHARED_LIBRARY_SUFFIX}" 410fi 411AC_SUBST(SALIB_NAME) 412 413]) 414 415AC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_SYMBOLS], 416[ 417# 418# ENABLE_DEBUG_SYMBOLS 419# This must be done after the toolchain is setup, since we're looking at objcopy. 420# 421ENABLE_DEBUG_SYMBOLS=default 422 423# default on macosx is no... 424if test "x$OPENJDK_TARGET_OS" = xmacosx; then 425 ENABLE_DEBUG_SYMBOLS=no 426fi 427 428AC_ARG_ENABLE([debug-symbols], 429 [AS_HELP_STRING([--disable-debug-symbols],[disable generation of debug symbols @<:@enabled@:>@])], 430 [ENABLE_DEBUG_SYMBOLS=${enable_debug_symbols}], 431) 432 433AC_MSG_CHECKING([if we should generate debug symbols]) 434 435if test "x$ENABLE_DEBUG_SYMBOLS" = "xyes" && test "x$OBJCOPY" = x; then 436 # explicit enabling of enable-debug-symbols and can't find objcopy 437 # this is an error 438 AC_MSG_ERROR([Unable to find objcopy, cannot enable debug-symbols]) 439fi 440 441if test "x$ENABLE_DEBUG_SYMBOLS" = "xdefault"; then 442 # Default is on if objcopy is found, otherwise off 443 if test "x$OBJCOPY" != x || test "x$OPENJDK_TARGET_OS" = xwindows; then 444 ENABLE_DEBUG_SYMBOLS=yes 445 else 446 ENABLE_DEBUG_SYMBOLS=no 447 fi 448fi 449 450AC_MSG_RESULT([$ENABLE_DEBUG_SYMBOLS]) 451 452# 453# ZIP_DEBUGINFO_FILES 454# 455ZIP_DEBUGINFO_FILES=yes 456 457AC_ARG_ENABLE([zip-debug-info], 458 [AS_HELP_STRING([--disable-zip-debug-info],[disable zipping of debug-info files @<:@enabled@:>@])], 459 [ZIP_DEBUGINFO_FILES=${enable_zip_debug_info}], 460) 461 462AC_MSG_CHECKING([if we should zip debug-info files]) 463AC_MSG_RESULT([$ZIP_DEBUGINFO_FILES]) 464 465# Hotspot wants ZIP_DEBUGINFO_FILES to be 1 for yes 466# use that... 467if test "x$ZIP_DEBUGINFO_FILES" = "xyes"; then 468 ZIP_DEBUGINFO_FILES=1 469else 470 ZIP_DEBUGINFO_FILES=0 471fi 472 473AC_SUBST(ENABLE_DEBUG_SYMBOLS) 474AC_SUBST(ZIP_DEBUGINFO_FILES) 475AC_SUBST(CFLAGS_DEBUG_SYMBOLS) 476AC_SUBST(CXXFLAGS_DEBUG_SYMBOLS) 477]) 478 479# Support for customization of the build process. Some build files 480# will include counterparts from this location, if they exist. This allows 481# for a degree of customization of the build targets and the rules/recipes 482# to create them 483AC_ARG_WITH([custom-make-dir], [AS_HELP_STRING([--with-custom-make-dir], 484 [use this directory for custom build/make files])], [CUSTOM_MAKE_DIR=$with_custom_make_dir]) 485AC_SUBST(CUSTOM_MAKE_DIR) 486