common/autoconf/jdk-options.m4

Fri, 26 Oct 2012 14:29:57 -0700

author
ohair
date
Fri, 26 Oct 2012 14:29:57 -0700
changeset 494
e64f2cb57d05
parent 478
2ba6f4da4bf3
child 495
e3182741ade2
permissions
-rw-r--r--

8000992: Update new build-infra makefiles
Summary: Build-infra project integration. Multiple authors on this work: erikj and ihse primarily, also changes from ohair, tbell, and dholmes. Special credit to ohstrom for his smartjavac work.
Reviewed-by: erikj, ihse, dholmes, tbell

     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 #
    26 AC_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 #
    39 AC_MSG_CHECKING([which variant of the JDK to build])
    40 AC_ARG_WITH([jdk-variant], [AS_HELP_STRING([--with-jdk-variant],
    41 	[JDK variant to build (normal) @<:@normal@:>@])])
    43 if test "x$with_jdk_variant" = xnormal || test "x$with_jdk_variant" = x; then
    44     JDK_VARIANT="normal"
    45 else
    46     AC_MSG_ERROR([The available JDK variants are: normal])
    47 fi
    49 AC_SUBST(JDK_VARIANT)
    51 AC_MSG_RESULT([$JDK_VARIANT])
    52 ])
    54 AC_DEFUN_ONCE([JDKOPT_SETUP_JVM_VARIANTS],
    55 [
    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
    67 AC_MSG_CHECKING([which variants of the JVM to build])
    68 AC_ARG_WITH([jvm-variants], [AS_HELP_STRING([--with-jvm-variants],
    69 	[JVM variants (separated by commas) to build (server, client, kernel, zero, zeroshark) @<:@server@:>@])])
    71 if test "x$with_jvm_variants" = x; then
    72      with_jvm_variants="server"
    73 fi
    75 JVM_VARIANTS=",$with_jvm_variants,"
    76 TEST_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/server,//' -e 's/client,//' -e 's/kernel,//' -e 's/zero,//' -e 's/zeroshark,//'`
    78 if test "x$TEST_VARIANTS" != "x,"; then
    79    AC_MSG_ERROR([The available JVM variants are: server, client, kernel, zero, zeroshark])
    80 fi   
    81 AC_MSG_RESULT([$with_jvm_variants])
    83 JVM_VARIANT_SERVER=`$ECHO "$JVM_VARIANTS" | $SED -e '/,server,/!s/.*/false/g' -e '/,server,/s/.*/true/g'`
    84 JVM_VARIANT_CLIENT=`$ECHO "$JVM_VARIANTS" | $SED -e '/,client,/!s/.*/false/g' -e '/,client,/s/.*/true/g'` 
    85 JVM_VARIANT_KERNEL=`$ECHO "$JVM_VARIANTS" | $SED -e '/,kernel,/!s/.*/false/g' -e '/,kernel,/s/.*/true/g'`
    86 JVM_VARIANT_ZERO=`$ECHO "$JVM_VARIANTS" | $SED -e '/,zero,/!s/.*/false/g' -e '/,zero,/s/.*/true/g'`
    87 JVM_VARIANT_ZEROSHARK=`$ECHO "$JVM_VARIANTS" | $SED -e '/,zeroshark,/!s/.*/false/g' -e '/,zeroshark,/s/.*/true/g'`
    89 if 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
    93 fi
    94 if 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
    98 fi
   100 # Replace the commas with AND for use in the build directory name.
   101 ANDED_JVM_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/^,//' -e 's/,$//' -e 's/,/AND/'`
   102 COUNT_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/'`
   103 if test "x$COUNT_VARIANTS" != "x,1"; then
   104     BUILDING_MULTIPLE_JVM_VARIANTS=yes
   105 else
   106     BUILDING_MULTIPLE_JVM_VARIANTS=no
   107 fi
   109 AC_SUBST(JVM_VARIANTS)
   110 AC_SUBST(JVM_VARIANT_SERVER)
   111 AC_SUBST(JVM_VARIANT_CLIENT)
   112 AC_SUBST(JVM_VARIANT_KERNEL)
   113 AC_SUBST(JVM_VARIANT_ZERO)
   114 AC_SUBST(JVM_VARIANT_ZEROSHARK)
   116 if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
   117    MACOSX_UNIVERSAL="true"
   118 fi
   120 AC_SUBST(MACOSX_UNIVERSAL)
   122 ])
   124 AC_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 #
   133 DEBUG_LEVEL="release"              
   134 AC_MSG_CHECKING([which debug level to use])
   135 AC_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"])
   142 AC_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     ])
   150 AC_MSG_RESULT([$DEBUG_LEVEL])
   152 if 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])
   156 fi
   159 ###############################################################################
   160 #
   161 # Setup legacy vars/targets and new vars to deal with different debug levels.
   162 #
   164 case $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            ;;
   189 esac
   191 #####
   192 # Generate the legacy makefile targets for hotspot.
   193 # The hotspot api for selecting the build artifacts, really, needs to be improved.
   194 #
   195 HOTSPOT_TARGET=""
   197 if test "x$JVM_VARIANT_SERVER" = xtrue; then
   198     HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL} "
   199 fi
   201 if test "x$JVM_VARIANT_CLIENT" = xtrue; then
   202     HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}1 "
   203 fi
   205 if test "x$JVM_VARIANT_KERNEL" = xtrue; then
   206     HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}kernel "
   207 fi
   209 if test "x$JVM_VARIANT_ZERO" = xtrue; then
   210     HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}zero "
   211 fi
   213 if test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then
   214     HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}shark "
   215 fi
   217 HOTSPOT_TARGET="$HOTSPOT_TARGET docs export_$HOTSPOT_EXPORT"
   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.
   223 if test "x$MACOSX_UNIVERSAL" = xtrue; then
   224     HOTSPOT_TARGET=universal_product
   225 fi
   227 #####
   229 AC_SUBST(DEBUG_LEVEL)
   230 AC_SUBST(VARIANT)
   231 AC_SUBST(FASTDEBUG)
   232 AC_SUBST(DEBUG_CLASSFILES)
   233 AC_SUBST(BUILD_VARIANT_RELEASE)
   234 ])
   236 AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS],
   237 [
   239 ###############################################################################
   240 #
   241 # Should we build only OpenJDK even if closed sources are present?
   242 #
   243 AC_ARG_ENABLE([openjdk-only], [AS_HELP_STRING([--enable-openjdk-only],
   244     [supress building closed source even if present @<:@disabled@:>@])],,[enable_openjdk_only="no"])
   246 AC_MSG_CHECKING([for presence of closed sources])
   247 if test -d "$SRC_ROOT/jdk/src/closed"; then
   248     CLOSED_SOURCE_PRESENT=yes
   249 else
   250     CLOSED_SOURCE_PRESENT=no
   251 fi
   252 AC_MSG_RESULT([$CLOSED_SOURCE_PRESENT])
   254 AC_MSG_CHECKING([if closed source is supressed (openjdk-only)])
   255 SUPRESS_CLOSED_SOURCE="$enable_openjdk_only"
   256 AC_MSG_RESULT([$SUPRESS_CLOSED_SOURCE])
   258 if 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
   263 else
   264   if test "x$SUPRESS_CLOSED_SOURCE" = "xyes"; then
   265     OPENJDK=true
   266   else
   267     OPENJDK=false
   268   fi
   269 fi
   271 if test "x$OPENJDK" = "xtrue"; then
   272     SET_OPENJDK="OPENJDK=true"
   273 fi
   275 AC_SUBST(SET_OPENJDK)
   277 ###############################################################################
   278 #
   279 # Should we build a JDK/JVM with headful support (ie a graphical ui)?
   280 # We always build headless support.
   281 #
   282 AC_MSG_CHECKING([headful support])
   283 AC_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])
   287 SUPPORT_HEADLESS=yes
   288 BUILD_HEADLESS="BUILD_HEADLESS:=true"
   290 if test "x$SUPPORT_HEADFUL" = xyes; then
   291     # We are building both headful and headless.
   292     headful_msg="inlude support for both headful and headless"
   293 fi
   295 if test "x$SUPPORT_HEADFUL" = xno; then
   296     # Thus we are building headless only.
   297     BUILD_HEADLESS="BUILD_HEADLESS:=true"
   298     headful_msg="headless only"
   299 fi
   301 AC_MSG_RESULT([$headful_msg])
   303 AC_SUBST(SUPPORT_HEADLESS)
   304 AC_SUBST(SUPPORT_HEADFUL)
   305 AC_SUBST(BUILD_HEADLESS)
   307 # Control wether Hotspot runs Queens test after build.
   308 AC_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])
   311 if test "x$enable_hotspot_test_in_build" = "xyes"; then
   312     TEST_IN_BUILD=true
   313 else
   314     TEST_IN_BUILD=false
   315 fi
   316 AC_SUBST(TEST_IN_BUILD)
   318 ###############################################################################
   319 #
   320 # Choose cacerts source file
   321 #
   322 AC_ARG_WITH(cacerts-file, [AS_HELP_STRING([--with-cacerts-file],
   323     [specify alternative cacerts file])])
   324 if test "x$with_cacerts_file" != x; then
   325     CACERTS_FILE=$with_cacerts_file
   326 else
   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
   332 fi
   333 AC_SUBST(CACERTS_FILE)
   335 ###############################################################################
   336 #
   337 # Compress jars
   338 #
   339 COMPRESS_JARS=false
   341 AC_SUBST(COMPRESS_JARS)
   342 ])
   344 AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_VERSION_NUMBERS],
   345 [
   346 # Source the version numbers
   347 . $AUTOCONF_DIR/version.numbers
   348 if test "x$OPENJDK" = "xfalse"; then
   349     . $AUTOCONF_DIR/closed.version.numbers
   350 fi
   351 # Now set the JDK version, milestone, build number etc.
   352 AC_SUBST(JDK_MAJOR_VERSION)
   353 AC_SUBST(JDK_MINOR_VERSION)
   354 AC_SUBST(JDK_MICRO_VERSION)
   355 AC_SUBST(JDK_UPDATE_VERSION)
   356 AC_SUBST(JDK_BUILD_NUMBER)
   357 AC_SUBST(MILESTONE)
   358 AC_SUBST(LAUNCHER_NAME)
   359 AC_SUBST(PRODUCT_NAME)
   360 AC_SUBST(PRODUCT_SUFFIX)
   361 AC_SUBST(JDK_RC_PLATFORM_NAME)
   362 AC_SUBST(COMPANY_NAME)
   363 AC_SUBST(MACOSX_BUNDLE_NAME_BASE)
   364 AC_SUBST(MACOSX_BUNDLE_ID_BASE)
   366 COPYRIGHT_YEAR=`date +'%Y'`
   367 AC_SUBST(COPYRIGHT_YEAR)
   369 RUNTIME_NAME="$PRODUCT_NAME $PRODUCT_SUFFIX"
   370 AC_SUBST(RUNTIME_NAME)
   372 if test "x$JDK_UPDATE_VERSION" != x; then
   373     JDK_VERSION="${JDK_MAJOR_VERSION}.${JDK_MINOR_VERSION}.${JDK_MICRO_VERSION}_${JDK_UPDATE_VERSION}"
   374 else
   375     JDK_VERSION="${JDK_MAJOR_VERSION}.${JDK_MINOR_VERSION}.${JDK_MICRO_VERSION}"
   376 fi
   377 AC_SUBST(JDK_VERSION)
   379 if test "x$MILESTONE" != x; then
   380     RELEASE="${JDK_VERSION}-${MILESTONE}${BUILD_VARIANT_RELEASE}"
   381 else
   382     RELEASE="${JDK_VERSION}${BUILD_VARIANT_RELEASE}"
   383 fi
   384 AC_SUBST(RELEASE)
   386 if test "x$JDK_BUILD_NUMBER" != x; then
   387     FULL_VERSION="${RELEASE}-${JDK_BUILD_NUMBER}"
   388 else
   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}"
   395 fi
   396 AC_SUBST(FULL_VERSION)
   397 COOKED_BUILD_NUMBER=`$ECHO $JDK_BUILD_NUMBER | $SED -e 's/^b//' -e 's/^0//'`
   398 AC_SUBST(COOKED_BUILD_NUMBER)
   399 ])
   401 AC_DEFUN_ONCE([JDKOPT_SETUP_BUILD_TWEAKS],
   402 [
   403 HOTSPOT_MAKE_ARGS="$HOTSPOT_TARGET"
   404 AC_SUBST(HOTSPOT_MAKE_ARGS)
   406 # The name of the Service Agent jar.
   407 SALIB_NAME="${LIBRARY_PREFIX}saproc${SHARED_LIBRARY_SUFFIX}"
   408 if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
   409     SALIB_NAME="${LIBRARY_PREFIX}sawindbg${SHARED_LIBRARY_SUFFIX}"
   410 fi
   411 AC_SUBST(SALIB_NAME)
   413 ])
   415 AC_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 #
   421 ENABLE_DEBUG_SYMBOLS=default
   423 # default on macosx is no...
   424 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
   425    ENABLE_DEBUG_SYMBOLS=no
   426 fi
   428 AC_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 )
   433 AC_MSG_CHECKING([if we should generate debug symbols])
   435 if 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])
   439 fi
   441 if 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
   448 fi
   450 AC_MSG_RESULT([$ENABLE_DEBUG_SYMBOLS])
   452 #
   453 # ZIP_DEBUGINFO_FILES
   454 #
   455 ZIP_DEBUGINFO_FILES=yes
   457 AC_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 )
   462 AC_MSG_CHECKING([if we should zip debug-info files])
   463 AC_MSG_RESULT([$ZIP_DEBUGINFO_FILES])
   465 # Hotspot wants ZIP_DEBUGINFO_FILES to be 1 for yes
   466 #   use that...
   467 if test "x$ZIP_DEBUGINFO_FILES" = "xyes"; then
   468    ZIP_DEBUGINFO_FILES=1
   469 else
   470    ZIP_DEBUGINFO_FILES=0
   471 fi
   473 AC_SUBST(ENABLE_DEBUG_SYMBOLS)
   474 AC_SUBST(ZIP_DEBUGINFO_FILES)
   475 AC_SUBST(CFLAGS_DEBUG_SYMBOLS)
   476 AC_SUBST(CXXFLAGS_DEBUG_SYMBOLS)
   477 ])
   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
   483 AC_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])
   485 AC_SUBST(CUSTOM_MAKE_DIR)

mercurial