1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821
|
#
# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
###############################################################################
# Check which variant of the JDK that we want to build.
# Currently we have:
# normal: standard edition
# but the custom make system may add other variants
#
# Effectively the JDK variant gives a name to a specific set of
# modules to compile into the JDK.
AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_VARIANT],
[
# Deprecated in JDK 12
UTIL_DEPRECATED_ARG_WITH([jdk-variant])
])
###############################################################################
# Set the debug level
# release: no debug information, all optimizations, no asserts.
# optimized: no debug information, all optimizations, no asserts, HotSpot target is 'optimized'.
# fastdebug: debug information (-g), all optimizations, all asserts
# slowdebug: debug information (-g), no optimizations, all asserts
AC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_LEVEL],
[
DEBUG_LEVEL="release"
UTIL_ARG_ENABLE(NAME: debug, DEFAULT: false, RESULT: ENABLE_DEBUG,
DESC: [enable debugging (shorthand for --with-debug-level=fastdebug)],
IF_ENABLED: [ DEBUG_LEVEL="fastdebug" ])
AC_MSG_CHECKING([which debug level to use])
AC_ARG_WITH([debug-level], [AS_HELP_STRING([--with-debug-level],
[set the debug level (release, fastdebug, slowdebug, optimized) @<:@release@:>@])],
[
DEBUG_LEVEL="${withval}"
if test "x$ENABLE_DEBUG" = xtrue; then
AC_MSG_ERROR([You cannot use both --enable-debug and --with-debug-level at the same time.])
fi
])
AC_MSG_RESULT([$DEBUG_LEVEL])
if test "x$DEBUG_LEVEL" != xrelease && \
test "x$DEBUG_LEVEL" != xoptimized && \
test "x$DEBUG_LEVEL" != xfastdebug && \
test "x$DEBUG_LEVEL" != xslowdebug; then
AC_MSG_ERROR([Allowed debug levels are: release, fastdebug, slowdebug and optimized])
fi
# Translate DEBUG_LEVEL to debug level used by Hotspot
HOTSPOT_DEBUG_LEVEL="$DEBUG_LEVEL"
if test "x$DEBUG_LEVEL" = xrelease; then
HOTSPOT_DEBUG_LEVEL="product"
elif test "x$DEBUG_LEVEL" = xslowdebug; then
HOTSPOT_DEBUG_LEVEL="debug"
fi
if test "x$DEBUG_LEVEL" = xoptimized; then
# The debug level 'optimized' is a little special because it is currently only
# applicable to the HotSpot build where it means to build a completely
# optimized version of the VM without any debugging code (like for the
# 'release' debug level which is called 'product' in the HotSpot build) but
# with the exception that it can contain additional code which is otherwise
# protected by '#ifndef PRODUCT' macros. These 'optimized' builds are used to
# test new and/or experimental features which are not intended for customer
# shipment. Because these new features need to be tested and benchmarked in
# real world scenarios, we want to build the containing JDK at the 'release'
# debug level.
DEBUG_LEVEL="release"
fi
AC_SUBST(HOTSPOT_DEBUG_LEVEL)
AC_SUBST(DEBUG_LEVEL)
])
###############################################################################
#
# Should we build only OpenJDK even if closed sources are present?
#
AC_DEFUN_ONCE([JDKOPT_SETUP_OPEN_OR_CUSTOM],
[
UTIL_ARG_ENABLE(NAME: openjdk-only, DEFAULT: false,
RESULT: SUPPRESS_CUSTOM_EXTENSIONS,
DESC: [suppress building custom source even if present],
CHECKING_MSG: [if custom source is suppressed (openjdk-only)])
])
AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS],
[
# Should we build a JDK without a graphical UI?
UTIL_ARG_ENABLE(NAME: headless-only, DEFAULT: false,
RESULT: ENABLE_HEADLESS_ONLY,
DESC: [only build headless (no GUI) support],
CHECKING_MSG: [if we should build headless-only (no GUI)])
AC_SUBST(ENABLE_HEADLESS_ONLY)
# should we linktime gc unused code sections in the JDK build ?
if test "x$OPENJDK_TARGET_OS" = "xlinux" && test "x$OPENJDK_TARGET_CPU" = xs390x; then
LINKTIME_GC_DEFAULT=true
else
LINKTIME_GC_DEFAULT=false
fi
UTIL_ARG_ENABLE(NAME: linktime-gc, DEFAULT: $LINKTIME_GC_DEFAULT,
DEFAULT_DESC: [auto], RESULT: ENABLE_LINKTIME_GC,
DESC: [use link time gc on unused code sections in the JDK build],
CHECKING_MSG: [if linker should clean out unused code (linktime-gc)])
AC_SUBST(ENABLE_LINKTIME_GC)
# Check for full doc dependencies
FULL_DOCS_AVAILABLE=true
AC_MSG_CHECKING([for graphviz dot])
if test "x$DOT" != "x"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no, cannot generate full docs])
FULL_DOCS_AVAILABLE=false
fi
AC_MSG_CHECKING([for pandoc])
if test "x$ENABLE_PANDOC" = "xtrue"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no, cannot generate full docs])
FULL_DOCS_AVAILABLE=false
fi
# Should we build the complete docs, or just a lightweight version?
UTIL_ARG_ENABLE(NAME: full-docs, DEFAULT: auto, RESULT: ENABLE_FULL_DOCS,
AVAILABLE: $FULL_DOCS_AVAILABLE, DESC: [build complete documentation],
DEFAULT_DESC: [enabled if all tools found])
AC_SUBST(ENABLE_FULL_DOCS)
# Choose cacerts source file
AC_ARG_WITH(cacerts-file, [AS_HELP_STRING([--with-cacerts-file],
[specify alternative cacerts file])])
AC_MSG_CHECKING([for cacerts file])
if test "x$with_cacerts_file" == x; then
AC_MSG_RESULT([default])
else
CACERTS_FILE=$with_cacerts_file
if test ! -f "$CACERTS_FILE"; then
AC_MSG_RESULT([fail])
AC_MSG_ERROR([Specified cacerts file "$CACERTS_FILE" does not exist])
fi
AC_MSG_RESULT([$CACERTS_FILE])
fi
AC_SUBST(CACERTS_FILE)
# Choose cacerts source folder for user provided PEM files
AC_ARG_WITH(cacerts-src, [AS_HELP_STRING([--with-cacerts-src],
[specify alternative cacerts source folder containing certificates])])
CACERTS_SRC=""
AC_MSG_CHECKING([for cacerts source])
if test "x$with_cacerts_src" == x; then
AC_MSG_RESULT([default])
else
CACERTS_SRC=$with_cacerts_src
if test ! -d "$CACERTS_SRC"; then
AC_MSG_RESULT([fail])
AC_MSG_ERROR([Specified cacerts source folder "$CACERTS_SRC" does not exist])
fi
AC_MSG_RESULT([$CACERTS_SRC])
fi
AC_SUBST(CACERTS_SRC)
# Enable or disable unlimited crypto
UTIL_ARG_ENABLE(NAME: unlimited-crypto, DEFAULT: true, RESULT: UNLIMITED_CRYPTO,
DESC: [enable unlimited crypto policy])
AC_SUBST(UNLIMITED_CRYPTO)
# Should we build the serviceability agent (SA)?
INCLUDE_SA=true
if HOTSPOT_CHECK_JVM_VARIANT(zero); then
INCLUDE_SA=false
fi
if test "x$OPENJDK_TARGET_OS" = xaix ; then
INCLUDE_SA=false
fi
if test "x$OPENJDK_TARGET_CPU" = xs390x ; then
INCLUDE_SA=false
fi
AC_SUBST(INCLUDE_SA)
# Setup default CDS alignment. On platforms where one build may run on machines with different
# page sizes, the JVM choses a compatible alignment to fit all possible page sizes. This slightly
# increases archive size.
# The only platform having this problem at the moment is Linux on aarch64, which may encounter
# three different page sizes: 4K, 64K, and if run on Mac m1 hardware, 16K.
COMPATIBLE_CDS_ALIGNMENT_DEFAULT=false
if test "x$OPENJDK_TARGET_OS" = "xlinux" && test "x$OPENJDK_TARGET_CPU" = "xaarch64"; then
COMPATIBLE_CDS_ALIGNMENT_DEFAULT=auto
fi
# Compress jars
COMPRESS_JARS=false
AC_SUBST(COMPRESS_JARS)
# Setup default copyright year. Mostly overridden when building close to a new year.
AC_ARG_WITH(copyright-year, [AS_HELP_STRING([--with-copyright-year],
[Set copyright year value for build @<:@current year@:>@])])
if test "x$with_copyright_year" = xyes; then
AC_MSG_ERROR([Copyright year must have a value])
elif test "x$with_copyright_year" != x; then
COPYRIGHT_YEAR="$with_copyright_year"
elif test "x$SOURCE_DATE_EPOCH" != x; then
if test "x$IS_GNU_DATE" = xyes; then
COPYRIGHT_YEAR=`date --date=@$SOURCE_DATE_EPOCH +%Y`
else
COPYRIGHT_YEAR=`date -j -f %s $SOURCE_DATE_EPOCH +%Y`
fi
else
COPYRIGHT_YEAR=`$DATE +'%Y'`
fi
AC_SUBST(COPYRIGHT_YEAR)
# Override default library path
AC_ARG_WITH([jni-libpath], [AS_HELP_STRING([--with-jni-libpath],
[override default JNI library search path])])
AC_MSG_CHECKING([for jni library path])
if test "x${with_jni_libpath}" = "x" || test "x${with_jni_libpath}" = "xno"; then
AC_MSG_RESULT([default])
elif test "x${with_jni_libpath}" = "xyes"; then
AC_MSG_RESULT([invalid])
AC_MSG_ERROR([The --with-jni-libpath option requires an argument.])
else
HOTSPOT_OVERRIDE_LIBPATH=${with_jni_libpath}
if test "x$OPENJDK_TARGET_OS" != "xlinux" &&
test "x$OPENJDK_TARGET_OS" != "xbsd" &&
test "x$OPENJDK_TARGET_OS" != "xaix"; then
AC_MSG_RESULT([fail])
AC_MSG_ERROR([Overriding JNI library path is supported only on Linux, BSD and AIX.])
fi
AC_MSG_RESULT(${HOTSPOT_OVERRIDE_LIBPATH})
fi
AC_SUBST(HOTSPOT_OVERRIDE_LIBPATH)
])
###############################################################################
AC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_SYMBOLS],
[
#
# Native debug symbols.
# This must be done after the toolchain is setup, since we're looking at objcopy.
#
AC_MSG_CHECKING([what type of native debug symbols to use])
AC_ARG_WITH([native-debug-symbols],
[AS_HELP_STRING([--with-native-debug-symbols],
[set the native debug symbol configuration (none, internal, external, zipped) @<:@varying@:>@])],
[
if test "x$OPENJDK_TARGET_OS" = xwindows; then
if test "x$withval" = xinternal; then
AC_MSG_ERROR([Windows does not support the parameter 'internal' for --with-native-debug-symbols])
fi
fi
],
[
if test "x$STATIC_BUILD" = xtrue; then
with_native_debug_symbols="none"
else
with_native_debug_symbols="external"
fi
])
AC_MSG_RESULT([$with_native_debug_symbols])
if test "x$with_native_debug_symbols" = xnone; then
COMPILE_WITH_DEBUG_SYMBOLS=false
COPY_DEBUG_SYMBOLS=false
ZIP_EXTERNAL_DEBUG_SYMBOLS=false
elif test "x$with_native_debug_symbols" = xinternal; then
COMPILE_WITH_DEBUG_SYMBOLS=true
COPY_DEBUG_SYMBOLS=false
ZIP_EXTERNAL_DEBUG_SYMBOLS=false
elif test "x$with_native_debug_symbols" = xexternal; then
if test "x$OPENJDK_TARGET_OS" = xlinux; then
if test "x$OBJCOPY" = x; then
# enabling of enable-debug-symbols and can't find objcopy
# this is an error
AC_MSG_ERROR([Unable to find objcopy, cannot enable native debug symbols])
fi
fi
COMPILE_WITH_DEBUG_SYMBOLS=true
COPY_DEBUG_SYMBOLS=true
ZIP_EXTERNAL_DEBUG_SYMBOLS=false
elif test "x$with_native_debug_symbols" = xzipped; then
if test "x$OPENJDK_TARGET_OS" = xlinux; then
if test "x$OBJCOPY" = x; then
# enabling of enable-debug-symbols and can't find objcopy
# this is an error
AC_MSG_ERROR([Unable to find objcopy, cannot enable native debug symbols])
fi
fi
COMPILE_WITH_DEBUG_SYMBOLS=true
COPY_DEBUG_SYMBOLS=true
ZIP_EXTERNAL_DEBUG_SYMBOLS=true
else
AC_MSG_ERROR([Allowed native debug symbols are: none, internal, external, zipped])
fi
AC_SUBST(COMPILE_WITH_DEBUG_SYMBOLS)
AC_SUBST(COPY_DEBUG_SYMBOLS)
AC_SUBST(ZIP_EXTERNAL_DEBUG_SYMBOLS)
# Should we add external native debug symbols to the shipped bundles?
AC_MSG_CHECKING([if we should add external native debug symbols to the shipped bundles])
AC_ARG_WITH([external-symbols-in-bundles],
[AS_HELP_STRING([--with-external-symbols-in-bundles],
[which type of external native debug symbol information shall be shipped in product bundles (none, public, full)
(e.g. ship full/stripped pdbs on Windows) @<:@none@:>@])])
if test "x$with_external_symbols_in_bundles" = x || test "x$with_external_symbols_in_bundles" = xnone ; then
AC_MSG_RESULT([no])
elif test "x$with_external_symbols_in_bundles" = xfull || test "x$with_external_symbols_in_bundles" = xpublic ; then
if test "x$OPENJDK_TARGET_OS" != xwindows ; then
AC_MSG_ERROR([--with-external-symbols-in-bundles currently only works on windows!])
elif test "x$COPY_DEBUG_SYMBOLS" != xtrue ; then
AC_MSG_ERROR([--with-external-symbols-in-bundles only works when --with-native-debug-symbols=external is used!])
elif test "x$with_external_symbols_in_bundles" = xfull ; then
AC_MSG_RESULT([full])
SHIP_DEBUG_SYMBOLS=full
else
AC_MSG_RESULT([public])
SHIP_DEBUG_SYMBOLS=public
fi
else
AC_MSG_ERROR([$with_external_symbols_in_bundles is an unknown value for --with-external-symbols-in-bundles])
fi
AC_SUBST(SHIP_DEBUG_SYMBOLS)
])
################################################################################
#
# Native and Java code coverage
#
AC_DEFUN_ONCE([JDKOPT_SETUP_CODE_COVERAGE],
[
UTIL_ARG_ENABLE(NAME: native-coverage, DEFAULT: false, RESULT: GCOV_ENABLED,
DESC: [enable native compilation with code coverage data],
CHECK_AVAILABLE: [
AC_MSG_CHECKING([if native coverage is available])
if test "x$TOOLCHAIN_TYPE" = "xgcc" ||
test "x$TOOLCHAIN_TYPE" = "xclang"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AVAILABLE=false
fi
],
IF_ENABLED: [
GCOV_CFLAGS="-fprofile-arcs -ftest-coverage -fno-inline"
GCOV_LDFLAGS="-fprofile-arcs"
JVM_CFLAGS="$JVM_CFLAGS $GCOV_CFLAGS"
JVM_LDFLAGS="$JVM_LDFLAGS $GCOV_LDFLAGS"
CFLAGS_JDKLIB="$CFLAGS_JDKLIB $GCOV_CFLAGS"
CFLAGS_JDKEXE="$CFLAGS_JDKEXE $GCOV_CFLAGS"
CXXFLAGS_JDKLIB="$CXXFLAGS_JDKLIB $GCOV_CFLAGS"
CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $GCOV_CFLAGS"
LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $GCOV_LDFLAGS"
LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $GCOV_LDFLAGS"
])
AC_SUBST(GCOV_ENABLED)
AC_ARG_WITH(jcov, [AS_HELP_STRING([--with-jcov],
[jcov library location])])
AC_ARG_WITH(jcov-input-jdk, [AS_HELP_STRING([--with-jcov-input-jdk],
[jdk image to instrument])])
AC_ARG_WITH(jcov-filters, [AS_HELP_STRING([--with-jcov-filters],
[filters to limit code for jcov instrumentation and report generation])])
JCOV_HOME=
JCOV_INPUT_JDK=
JCOV_ENABLED=
JCOV_FILTERS=
if test "x$with_jcov" = "x" ; then
JCOV_ENABLED="false"
else
JCOV_HOME="$with_jcov"
if test ! -f "$JCOV_HOME/lib/jcov.jar"; then
AC_MSG_RESULT([fail])
AC_MSG_ERROR([Invalid JCov bundle: "$JCOV_HOME/lib/jcov.jar" does not exist])
fi
JCOV_ENABLED="true"
UTIL_FIXUP_PATH(JCOV_HOME)
if test "x$with_jcov_input_jdk" != "x" ; then
JCOV_INPUT_JDK="$with_jcov_input_jdk"
if test ! -f "$JCOV_INPUT_JDK/bin/java" && test ! -f "$JCOV_INPUT_JDK/bin/java.exe"; then
AC_MSG_RESULT([fail])
AC_MSG_ERROR([Invalid JDK bundle: "$JCOV_INPUT_JDK/bin/java" does not exist])
fi
UTIL_FIXUP_PATH(JCOV_INPUT_JDK)
fi
if test "x$with_jcov_filters" != "x" ; then
JCOV_FILTERS="$with_jcov_filters"
fi
fi
AC_SUBST(JCOV_ENABLED)
AC_SUBST(JCOV_HOME)
AC_SUBST(JCOV_INPUT_JDK)
AC_SUBST(JCOV_FILTERS)
])
###############################################################################
#
# AddressSanitizer
#
AC_DEFUN_ONCE([JDKOPT_SETUP_ADDRESS_SANITIZER],
[
UTIL_ARG_ENABLE(NAME: asan, DEFAULT: false,
DESC: [enable AddressSanitizer],
CHECK_AVAILABLE: [
AC_MSG_CHECKING([if AddressSanitizer (asan) is available])
if test "x$TOOLCHAIN_TYPE" = "xgcc" ||
test "x$TOOLCHAIN_TYPE" = "xclang"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AVAILABLE=false
fi
],
IF_ENABLED: [
# ASan is simply incompatible with gcc -Wstringop-truncation. See
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85650
# It's harmless to be suppressed in clang as well.
ASAN_CFLAGS="-fsanitize=address -Wno-stringop-truncation -fno-omit-frame-pointer"
ASAN_LDFLAGS="-fsanitize=address"
JVM_CFLAGS="$JVM_CFLAGS $ASAN_CFLAGS"
JVM_LDFLAGS="$JVM_LDFLAGS $ASAN_LDFLAGS"
CFLAGS_JDKLIB="$CFLAGS_JDKLIB $ASAN_CFLAGS"
CFLAGS_JDKEXE="$CFLAGS_JDKEXE $ASAN_CFLAGS"
CXXFLAGS_JDKLIB="$CXXFLAGS_JDKLIB $ASAN_CFLAGS"
CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $ASAN_CFLAGS"
LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $ASAN_LDFLAGS"
LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $ASAN_LDFLAGS"
ASAN_ENABLED="yes"
],
IF_DISABLED: [
ASAN_ENABLED="no"
])
AC_SUBST(ASAN_ENABLED)
])
################################################################################
#
# Static build support. When enabled will generate static
# libraries instead of shared libraries for all JDK libs.
#
AC_DEFUN_ONCE([JDKOPT_SETUP_STATIC_BUILD],
[
UTIL_ARG_ENABLE(NAME: static-build, DEFAULT: false, RESULT: STATIC_BUILD,
DESC: [enable static library build],
CHECKING_MSG: [if static build is enabled],
CHECK_AVAILABLE: [
AC_MSG_CHECKING([if static build is available])
if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AVAILABLE=false
fi
],
IF_ENABLED: [
STATIC_BUILD_CFLAGS="-DSTATIC_BUILD=1"
CFLAGS_JDKLIB_EXTRA="$CFLAGS_JDKLIB_EXTRA $STATIC_BUILD_CFLAGS"
CXXFLAGS_JDKLIB_EXTRA="$CXXFLAGS_JDKLIB_EXTRA $STATIC_BUILD_CFLAGS"
])
AC_SUBST(STATIC_BUILD)
])
################################################################################
#
# jlink options.
# We always keep packaged modules in JDK image.
#
AC_DEFUN_ONCE([JDKOPT_SETUP_JLINK_OPTIONS],
[
UTIL_ARG_ENABLE(NAME: keep-packaged-modules, DEFAULT: true,
RESULT: JLINK_KEEP_PACKAGED_MODULES,
DESC: [enable keeping of packaged modules in jdk image],
CHECKING_MSG: [if packaged modules are kept])
AC_SUBST(JLINK_KEEP_PACKAGED_MODULES)
])
################################################################################
#
# Enable or disable generation of the classlist at build time
#
AC_DEFUN_ONCE([JDKOPT_ENABLE_DISABLE_GENERATE_CLASSLIST],
[
# In GenerateLinkOptData.gmk, DumpLoadedClassList is used to generate the
# classlist file. It never will work if CDS is disabled, since the VM will report
# an error for DumpLoadedClassList.
UTIL_ARG_ENABLE(NAME: generate-classlist, DEFAULT: auto,
RESULT: ENABLE_GENERATE_CLASSLIST, AVAILABLE: $ENABLE_CDS,
DESC: [enable generation of a CDS classlist at build time],
DEFAULT_DESC: [enabled if the JVM feature 'cds' is enabled for all JVM variants],
CHECKING_MSG: [if the CDS classlist generation should be enabled])
AC_SUBST(ENABLE_GENERATE_CLASSLIST)
])
################################################################################
#
# Optionally filter resource translations
#
AC_DEFUN([JDKOPT_EXCLUDE_TRANSLATIONS],
[
AC_ARG_WITH([exclude-translations], [AS_HELP_STRING([--with-exclude-translations],
[a comma separated list of locales to exclude translations for. Default is
to include all translations present in the source.])])
EXCLUDE_TRANSLATIONS=""
AC_MSG_CHECKING([if any translations should be excluded])
if test "x$with_exclude_translations" != "x"; then
EXCLUDE_TRANSLATIONS="${with_exclude_translations//,/ }"
AC_MSG_RESULT([yes: $EXCLUDE_TRANSLATIONS])
else
AC_MSG_RESULT([no])
fi
AC_SUBST(EXCLUDE_TRANSLATIONS)
])
################################################################################
#
# Optionally disable man pages
#
AC_DEFUN([JDKOPT_ENABLE_DISABLE_MANPAGES],
[
UTIL_ARG_ENABLE(NAME: manpages, DEFAULT: true, RESULT: BUILD_MANPAGES,
DESC: [enable copying of static man pages],
CHECKING_MSG: [if static man pages should be copied])
AC_SUBST(BUILD_MANPAGES)
])
################################################################################
#
# Disable the default CDS archive generation
#
AC_DEFUN([JDKOPT_ENABLE_DISABLE_CDS_ARCHIVE],
[
UTIL_ARG_ENABLE(NAME: cds-archive, DEFAULT: auto, RESULT: BUILD_CDS_ARCHIVE,
DESC: [enable generation of a default CDS archive in the product image],
DEFAULT_DESC: [enabled if possible],
CHECKING_MSG: [if a default CDS archive should be generated],
CHECK_AVAILABLE: [
AC_MSG_CHECKING([if CDS archive is available])
if test "x$ENABLE_CDS" = "xfalse"; then
AC_MSG_RESULT([no (CDS is disabled)])
AVAILABLE=false
elif test "x$COMPILE_TYPE" = "xcross"; then
AC_MSG_RESULT([no (not possible with cross compilation)])
AVAILABLE=false
else
AC_MSG_RESULT([yes])
fi
])
AC_SUBST(BUILD_CDS_ARCHIVE)
])
################################################################################
#
# Enable the alternative CDS core region alignment
#
AC_DEFUN([JDKOPT_ENABLE_DISABLE_COMPATIBLE_CDS_ALIGNMENT],
[
UTIL_ARG_ENABLE(NAME: compatible-cds-alignment, DEFAULT: $COMPATIBLE_CDS_ALIGNMENT_DEFAULT,
RESULT: ENABLE_COMPATIBLE_CDS_ALIGNMENT,
DESC: [enable use alternative compatible cds core region alignment],
DEFAULT_DESC: [disabled except on linux-aarch64],
CHECKING_MSG: [if compatible cds region alignment enabled],
CHECK_AVAILABLE: [
AC_MSG_CHECKING([if CDS archive is available])
if test "x$ENABLE_CDS" = "xfalse"; then
AVAILABLE=false
AC_MSG_RESULT([no (CDS is disabled)])
else
AVAILABLE=true
AC_MSG_RESULT([yes])
fi
])
AC_SUBST(ENABLE_COMPATIBLE_CDS_ALIGNMENT)
])
################################################################################
#
# Disallow any output from containing absolute paths from the build system.
# This setting defaults to allowed on debug builds and not allowed on release
# builds.
#
AC_DEFUN([JDKOPT_ALLOW_ABSOLUTE_PATHS_IN_OUTPUT],
[
AC_ARG_ENABLE([absolute-paths-in-output],
[AS_HELP_STRING([--disable-absolute-paths-in-output],
[Set to disable to prevent any absolute paths from the build to end up in
any of the build output. @<:@disabled in release builds, otherwise enabled@:>@])
])
AC_MSG_CHECKING([if absolute paths should be allowed in the build output])
if test "x$enable_absolute_paths_in_output" = "xno"; then
AC_MSG_RESULT([no, forced])
ALLOW_ABSOLUTE_PATHS_IN_OUTPUT="false"
elif test "x$enable_absolute_paths_in_output" = "xyes"; then
AC_MSG_RESULT([yes, forced])
ALLOW_ABSOLUTE_PATHS_IN_OUTPUT="true"
elif test "x$DEBUG_LEVEL" = "xrelease"; then
AC_MSG_RESULT([no, release build])
ALLOW_ABSOLUTE_PATHS_IN_OUTPUT="false"
else
AC_MSG_RESULT([yes, debug build])
ALLOW_ABSOLUTE_PATHS_IN_OUTPUT="true"
fi
AC_SUBST(ALLOW_ABSOLUTE_PATHS_IN_OUTPUT)
])
################################################################################
#
# Check and set options related to reproducible builds.
#
AC_DEFUN_ONCE([JDKOPT_SETUP_REPRODUCIBLE_BUILD],
[
AC_ARG_WITH([source-date], [AS_HELP_STRING([--with-source-date],
[how to set SOURCE_DATE_EPOCH ('updated', 'current', 'version' a timestamp or an ISO-8601 date) @<:@updated@:>@])],
[with_source_date_present=true], [with_source_date_present=false])
AC_MSG_CHECKING([what source date to use])
if test "x$with_source_date" = xyes; then
AC_MSG_ERROR([--with-source-date must have a value])
elif test "x$with_source_date" = xupdated || test "x$with_source_date" = x; then
# Tell the makefiles to update at each build
SOURCE_DATE=updated
AC_MSG_RESULT([determined at build time, from 'updated'])
elif test "x$with_source_date" = xcurrent; then
# Set the current time
SOURCE_DATE=$($DATE +"%s")
AC_MSG_RESULT([$SOURCE_DATE, from 'current'])
elif test "x$with_source_date" = xversion; then
# Use the date from version-numbers.conf
UTIL_GET_EPOCH_TIMESTAMP(SOURCE_DATE, $DEFAULT_VERSION_DATE)
if test "x$SOURCE_DATE" = x; then
AC_MSG_RESULT([unavailable])
AC_MSG_ERROR([Cannot convert DEFAULT_VERSION_DATE to timestamp])
fi
AC_MSG_RESULT([$SOURCE_DATE, from 'version'])
else
# It's a timestamp, an ISO-8601 date, or an invalid string
# Additional [] needed to keep m4 from mangling shell constructs.
if [ [[ "$with_source_date" =~ ^[0-9][0-9]*$ ]] ] ; then
SOURCE_DATE=$with_source_date
AC_MSG_RESULT([$SOURCE_DATE, from timestamp on command line])
else
UTIL_GET_EPOCH_TIMESTAMP(SOURCE_DATE, $with_source_date)
if test "x$SOURCE_DATE" != x; then
AC_MSG_RESULT([$SOURCE_DATE, from ISO-8601 date on command line])
else
AC_MSG_RESULT([unavailable])
AC_MSG_ERROR([Cannot parse date string "$with_source_date"])
fi
fi
fi
REPRODUCIBLE_BUILD_DEFAULT=$with_source_date_present
if test "x$OPENJDK_BUILD_OS" = xwindows && \
test "x$ALLOW_ABSOLUTE_PATHS_IN_OUTPUT" = xfalse; then
# To support banning absolute paths on Windows, we must use the -pathmap
# method, which requires reproducible builds.
REPRODUCIBLE_BUILD_DEFAULT=true
fi
UTIL_ARG_ENABLE(NAME: reproducible-build, DEFAULT: $REPRODUCIBLE_BUILD_DEFAULT,
RESULT: ENABLE_REPRODUCIBLE_BUILD,
DESC: [enable reproducible builds (not yet fully functional)],
DEFAULT_DESC: [enabled if --with-source-date is given or on Windows without absolute paths])
if test "x$OPENJDK_BUILD_OS" = xwindows && \
test "x$ALLOW_ABSOLUTE_PATHS_IN_OUTPUT" = xfalse && \
test "x$ENABLE_REPRODUCIBLE_BUILD" = xfalse; then
AC_MSG_NOTICE([On Windows it is not possible to combine --disable-reproducible-builds])
AC_MSG_NOTICE([with --disable-absolute-paths-in-output.])
AC_MSG_ERROR([Cannot continue])
fi
AC_SUBST(SOURCE_DATE)
AC_SUBST(ENABLE_REPRODUCIBLE_BUILD)
])
################################################################################
#
# Setup signing on macOS. This can either be setup to sign with a real identity
# and enabling the hardened runtime, or it can simply add the debug entitlement
# com.apple.security.get-task-allow without actually signing any binaries. The
# latter is needed to be able to debug processes and dump core files on modern
# versions of macOS. It can also be skipped completely.
#
# Check if codesign will run with the given parameters
# $1: Parameters to run with
# $2: Checking message
# Sets CODESIGN_SUCCESS=true/false
AC_DEFUN([JDKOPT_CHECK_CODESIGN_PARAMS],
[
PARAMS="$1"
MESSAGE="$2"
CODESIGN_TESTFILE="$CONFIGURESUPPORT_OUTPUTDIR/codesign-testfile"
$RM "$CODESIGN_TESTFILE"
$TOUCH "$CODESIGN_TESTFILE"
CODESIGN_SUCCESS=false
$ECHO "check codesign, calling $CODESIGN $PARAMS $CODESIGN_TESTFILE" >&AS_MESSAGE_LOG_FD
eval \"$CODESIGN\" $PARAMS \"$CODESIGN_TESTFILE\" 2>&AS_MESSAGE_LOG_FD \
>&AS_MESSAGE_LOG_FD && CODESIGN_SUCCESS=true
$RM "$CODESIGN_TESTFILE"
AC_MSG_CHECKING([$MESSAGE])
if test "x$CODESIGN_SUCCESS" = "xtrue"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
])
AC_DEFUN([JDKOPT_CHECK_CODESIGN_HARDENED],
[
JDKOPT_CHECK_CODESIGN_PARAMS([-s \"$MACOSX_CODESIGN_IDENTITY\" --option runtime],
[if codesign with hardened runtime is possible])
])
AC_DEFUN([JDKOPT_CHECK_CODESIGN_DEBUG],
[
JDKOPT_CHECK_CODESIGN_PARAMS([-s -], [if debug mode codesign is possible])
])
AC_DEFUN([JDKOPT_SETUP_MACOSX_SIGNING],
[
ENABLE_CODESIGN=false
if test "x$OPENJDK_TARGET_OS" = "xmacosx" && test "x$CODESIGN" != "x"; then
UTIL_ARG_WITH(NAME: macosx-codesign, TYPE: literal, OPTIONAL: true,
VALID_VALUES: [hardened debug auto], DEFAULT: auto,
ENABLED_DEFAULT: true,
CHECKING_MSG: [for macosx code signing mode],
DESC: [set the macosx code signing mode (hardened, debug, auto)]
)
MACOSX_CODESIGN_MODE=disabled
if test "x$MACOSX_CODESIGN_ENABLED" = "xtrue"; then
# Check for user provided code signing identity.
UTIL_ARG_WITH(NAME: macosx-codesign-identity, TYPE: string,
DEFAULT: openjdk_codesign, CHECK_VALUE: UTIL_CHECK_STRING_NON_EMPTY,
DESC: [specify the macosx code signing identity],
CHECKING_MSG: [for macosx code signing identity]
)
AC_SUBST(MACOSX_CODESIGN_IDENTITY)
if test "x$MACOSX_CODESIGN" = "xauto"; then
# Only try to default to hardened signing on release builds
if test "x$DEBUG_LEVEL" = "xrelease"; then
JDKOPT_CHECK_CODESIGN_HARDENED
if test "x$CODESIGN_SUCCESS" = "xtrue"; then
MACOSX_CODESIGN_MODE=hardened
fi
fi
if test "x$MACOSX_CODESIGN_MODE" = "xdisabled"; then
JDKOPT_CHECK_CODESIGN_DEBUG
if test "x$CODESIGN_SUCCESS" = "xtrue"; then
MACOSX_CODESIGN_MODE=debug
fi
fi
AC_MSG_CHECKING([for macosx code signing mode])
AC_MSG_RESULT([$MACOSX_CODESIGN_MODE])
elif test "x$MACOSX_CODESIGN" = "xhardened"; then
JDKOPT_CHECK_CODESIGN_HARDENED
if test "x$CODESIGN_SUCCESS" = "xfalse"; then
AC_MSG_ERROR([Signing with hardened runtime is not possible])
fi
MACOSX_CODESIGN_MODE=hardened
elif test "x$MACOSX_CODESIGN" = "xdebug"; then
JDKOPT_CHECK_CODESIGN_DEBUG
if test "x$CODESIGN_SUCCESS" = "xfalse"; then
AC_MSG_ERROR([Signing in debug mode is not possible])
fi
MACOSX_CODESIGN_MODE=debug
else
AC_MSG_ERROR([unknown value for --with-macosx-codesign: $MACOSX_CODESIGN])
fi
fi
AC_SUBST(MACOSX_CODESIGN_IDENTITY)
AC_SUBST(MACOSX_CODESIGN_MODE)
fi
])
|