1 # 2 # Copyright (c) 2011, 2025, 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 # Set the debug level 28 # release: no debug information, all optimizations, no asserts. 29 # optimized: no debug information, all optimizations, no asserts, HotSpot target is 'optimized'. 30 # fastdebug: debug information (-g), all optimizations, all asserts 31 # slowdebug: debug information (-g), no optimizations, all asserts 32 AC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_LEVEL], 33 [ 34 DEBUG_LEVEL="release" 35 36 UTIL_ARG_ENABLE(NAME: debug, DEFAULT: false, RESULT: ENABLE_DEBUG, 37 DESC: [enable debugging (shorthand for --with-debug-level=fastdebug)], 38 IF_ENABLED: [ DEBUG_LEVEL="fastdebug" ]) 39 40 AC_MSG_CHECKING([which debug level to use]) 41 AC_ARG_WITH([debug-level], [AS_HELP_STRING([--with-debug-level], 42 [set the debug level (release, fastdebug, slowdebug, optimized) @<:@release@:>@])], 43 [ 44 DEBUG_LEVEL="${withval}" 45 if test "x$ENABLE_DEBUG" = xtrue; then 46 AC_MSG_ERROR([You cannot use both --enable-debug and --with-debug-level at the same time.]) 47 fi 48 ]) 49 AC_MSG_RESULT([$DEBUG_LEVEL]) 50 51 if test "x$DEBUG_LEVEL" != xrelease && \ 52 test "x$DEBUG_LEVEL" != xoptimized && \ 53 test "x$DEBUG_LEVEL" != xfastdebug && \ 54 test "x$DEBUG_LEVEL" != xslowdebug; then 55 AC_MSG_ERROR([Allowed debug levels are: release, fastdebug, slowdebug and optimized]) 56 fi 57 58 # Translate DEBUG_LEVEL to debug level used by Hotspot 59 HOTSPOT_DEBUG_LEVEL="$DEBUG_LEVEL" 60 if test "x$DEBUG_LEVEL" = xrelease; then 61 HOTSPOT_DEBUG_LEVEL="product" 62 elif test "x$DEBUG_LEVEL" = xslowdebug; then 63 HOTSPOT_DEBUG_LEVEL="debug" 64 fi 65 66 if test "x$DEBUG_LEVEL" = xoptimized; then 67 # The debug level 'optimized' is a little special because it is currently only 68 # applicable to the HotSpot build where it means to build a completely 69 # optimized version of the VM without any debugging code (like for the 70 # 'release' debug level which is called 'product' in the HotSpot build) but 71 # with the exception that it can contain additional code which is otherwise 72 # protected by '#ifndef PRODUCT' macros. These 'optimized' builds are used to 73 # test new and/or experimental features which are not intended for customer 74 # shipment. Because these new features need to be tested and benchmarked in 75 # real world scenarios, we want to build the containing JDK at the 'release' 76 # debug level. 77 DEBUG_LEVEL="release" 78 fi 79 80 AC_SUBST(HOTSPOT_DEBUG_LEVEL) 81 AC_SUBST(DEBUG_LEVEL) 82 ]) 83 84 ################################################################################ 85 # 86 # Should we build only OpenJDK even if closed sources are present? 87 # 88 AC_DEFUN_ONCE([JDKOPT_SETUP_OPEN_OR_CUSTOM], 89 [ 90 UTIL_ARG_ENABLE(NAME: openjdk-only, DEFAULT: false, 91 RESULT: SUPPRESS_CUSTOM_EXTENSIONS, 92 DESC: [suppress building custom source even if present], 93 CHECKING_MSG: [if custom source is suppressed (openjdk-only)]) 94 ]) 95 96 AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS], 97 [ 98 # Should we build a JDK without a graphical UI? 99 UTIL_ARG_ENABLE(NAME: headless-only, DEFAULT: false, 100 RESULT: ENABLE_HEADLESS_ONLY, 101 DESC: [only build headless (no GUI) support], 102 CHECKING_MSG: [if we should build headless-only (no GUI)]) 103 AC_SUBST(ENABLE_HEADLESS_ONLY) 104 105 # should we linktime gc unused code sections in the JDK build ? 106 if test "x$OPENJDK_TARGET_OS" = "xlinux" && test "x$OPENJDK_TARGET_CPU" = xs390x; then 107 LINKTIME_GC_DEFAULT=true 108 else 109 LINKTIME_GC_DEFAULT=false 110 fi 111 112 UTIL_ARG_ENABLE(NAME: linktime-gc, DEFAULT: $LINKTIME_GC_DEFAULT, 113 DEFAULT_DESC: [auto], RESULT: ENABLE_LINKTIME_GC, 114 DESC: [use link time gc on unused code sections in the JDK build], 115 CHECKING_MSG: [if linker should clean out unused code (linktime-gc)]) 116 AC_SUBST(ENABLE_LINKTIME_GC) 117 118 # Check for full doc dependencies 119 FULL_DOCS_AVAILABLE=true 120 AC_MSG_CHECKING([for graphviz dot]) 121 if test "x$DOT" != "x"; then 122 AC_MSG_RESULT([yes]) 123 else 124 AC_MSG_RESULT([no, cannot generate full docs or man pages]) 125 FULL_DOCS_AVAILABLE=false 126 fi 127 128 AC_MSG_CHECKING([for pandoc]) 129 if test "x$ENABLE_PANDOC" = "xtrue"; then 130 AC_MSG_RESULT([yes]) 131 else 132 AC_MSG_RESULT([no, cannot generate full docs or man pages]) 133 FULL_DOCS_AVAILABLE=false 134 fi 135 136 # Should we build the complete docs, or just a lightweight version? 137 UTIL_ARG_ENABLE(NAME: full-docs, DEFAULT: auto, RESULT: ENABLE_FULL_DOCS, 138 AVAILABLE: $FULL_DOCS_AVAILABLE, DESC: [build complete documentation], 139 DEFAULT_DESC: [enabled if all tools found]) 140 AC_SUBST(ENABLE_FULL_DOCS) 141 142 # Choose cacerts source file 143 AC_ARG_WITH(cacerts-file, [AS_HELP_STRING([--with-cacerts-file], 144 [specify alternative cacerts file])]) 145 AC_MSG_CHECKING([for cacerts file]) 146 if test "x$with_cacerts_file" == x; then 147 AC_MSG_RESULT([default]) 148 else 149 CACERTS_FILE=$with_cacerts_file 150 if test ! -f "$CACERTS_FILE"; then 151 AC_MSG_RESULT([fail]) 152 AC_MSG_ERROR([Specified cacerts file "$CACERTS_FILE" does not exist]) 153 fi 154 AC_MSG_RESULT([$CACERTS_FILE]) 155 fi 156 AC_SUBST(CACERTS_FILE) 157 158 # Choose cacerts source folder for user provided PEM files 159 AC_ARG_WITH(cacerts-src, [AS_HELP_STRING([--with-cacerts-src], 160 [specify alternative cacerts source folder containing certificates])]) 161 CACERTS_SRC="" 162 AC_MSG_CHECKING([for cacerts source]) 163 if test "x$with_cacerts_src" == x; then 164 AC_MSG_RESULT([default]) 165 else 166 CACERTS_SRC=$with_cacerts_src 167 if test ! -d "$CACERTS_SRC"; then 168 AC_MSG_RESULT([fail]) 169 AC_MSG_ERROR([Specified cacerts source folder "$CACERTS_SRC" does not exist]) 170 fi 171 AC_MSG_RESULT([$CACERTS_SRC]) 172 fi 173 AC_SUBST(CACERTS_SRC) 174 175 # Enable or disable unlimited crypto 176 UTIL_ARG_ENABLE(NAME: unlimited-crypto, DEFAULT: true, RESULT: UNLIMITED_CRYPTO, 177 DESC: [enable unlimited crypto policy]) 178 AC_SUBST(UNLIMITED_CRYPTO) 179 180 # Should we build the serviceability agent (SA)? 181 INCLUDE_SA=true 182 if HOTSPOT_CHECK_JVM_VARIANT(zero); then 183 INCLUDE_SA=false 184 fi 185 if test "x$OPENJDK_TARGET_OS" = xaix ; then 186 INCLUDE_SA=false 187 fi 188 if test "x$OPENJDK_TARGET_CPU" = xs390x ; then 189 INCLUDE_SA=false 190 fi 191 AC_SUBST(INCLUDE_SA) 192 193 # Setup default CDS alignment. On platforms where one build may run on machines with different 194 # page sizes, the JVM choses a compatible alignment to fit all possible page sizes. This slightly 195 # increases archive size. 196 # The only platform having this problem at the moment is Linux on aarch64, which may encounter 197 # three different page sizes: 4K, 64K, and if run on Mac m1 hardware, 16K. 198 COMPATIBLE_CDS_ALIGNMENT_DEFAULT=false 199 if test "x$OPENJDK_TARGET_OS" = "xlinux" && test "x$OPENJDK_TARGET_CPU" = "xaarch64"; then 200 COMPATIBLE_CDS_ALIGNMENT_DEFAULT=auto 201 fi 202 203 # Compress jars 204 COMPRESS_JARS=false 205 206 AC_SUBST(COMPRESS_JARS) 207 208 # Setup default copyright year. Mostly overridden when building close to a new year. 209 AC_ARG_WITH(copyright-year, [AS_HELP_STRING([--with-copyright-year], 210 [Set copyright year value for build @<:@current year/source-date@:>@])]) 211 if test "x$with_copyright_year" = xyes; then 212 AC_MSG_ERROR([Copyright year must have a value]) 213 elif test "x$with_copyright_year" != x; then 214 COPYRIGHT_YEAR="$with_copyright_year" 215 elif test "x$SOURCE_DATE" != xupdated; then 216 if test "x$IS_GNU_DATE" = xyes; then 217 COPYRIGHT_YEAR=`$DATE --date=@$SOURCE_DATE +%Y` 218 else 219 COPYRIGHT_YEAR=`$DATE -j -f %s $SOURCE_DATE +%Y` 220 fi 221 else 222 COPYRIGHT_YEAR=`$DATE +'%Y'` 223 fi 224 AC_SUBST(COPYRIGHT_YEAR) 225 226 # Override default library path 227 AC_ARG_WITH([jni-libpath], [AS_HELP_STRING([--with-jni-libpath], 228 [override default JNI library search path])]) 229 AC_MSG_CHECKING([for jni library path]) 230 if test "x${with_jni_libpath}" = "x" || test "x${with_jni_libpath}" = "xno"; then 231 AC_MSG_RESULT([default]) 232 elif test "x${with_jni_libpath}" = "xyes"; then 233 AC_MSG_RESULT([invalid]) 234 AC_MSG_ERROR([The --with-jni-libpath option requires an argument.]) 235 else 236 HOTSPOT_OVERRIDE_LIBPATH=${with_jni_libpath} 237 if test "x$OPENJDK_TARGET_OS" != "xlinux" && 238 test "x$OPENJDK_TARGET_OS" != "xbsd" && 239 test "x$OPENJDK_TARGET_OS" != "xaix"; then 240 AC_MSG_RESULT([fail]) 241 AC_MSG_ERROR([Overriding JNI library path is supported only on Linux, BSD and AIX.]) 242 fi 243 AC_MSG_RESULT(${HOTSPOT_OVERRIDE_LIBPATH}) 244 fi 245 AC_SUBST(HOTSPOT_OVERRIDE_LIBPATH) 246 247 ]) 248 249 ################################################################################ 250 251 AC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_SYMBOLS], 252 [ 253 # 254 # Native debug symbols. 255 # This must be done after the toolchain is setup, since we're looking at objcopy. 256 # 257 AC_MSG_CHECKING([what type of native debug symbols to use]) 258 AC_ARG_WITH([native-debug-symbols], 259 [AS_HELP_STRING([--with-native-debug-symbols], 260 [set the native debug symbol configuration (none, internal, external, zipped) @<:@varying@:>@])], 261 [ 262 if test "x$OPENJDK_TARGET_OS" = xwindows; then 263 if test "x$withval" = xinternal; then 264 AC_MSG_ERROR([Windows does not support the parameter 'internal' for --with-native-debug-symbols]) 265 fi 266 fi 267 ], 268 [ 269 with_native_debug_symbols="external" 270 ]) 271 AC_MSG_RESULT([$with_native_debug_symbols]) 272 273 if test "x$with_native_debug_symbols" = xnone; then 274 COMPILE_WITH_DEBUG_SYMBOLS=false 275 COPY_DEBUG_SYMBOLS=false 276 ZIP_EXTERNAL_DEBUG_SYMBOLS=false 277 elif test "x$with_native_debug_symbols" = xinternal; then 278 COMPILE_WITH_DEBUG_SYMBOLS=true 279 COPY_DEBUG_SYMBOLS=false 280 ZIP_EXTERNAL_DEBUG_SYMBOLS=false 281 elif test "x$with_native_debug_symbols" = xexternal; then 282 283 if test "x$OPENJDK_TARGET_OS" = xlinux; then 284 if test "x$OBJCOPY" = x; then 285 # enabling of enable-debug-symbols and can't find objcopy 286 # this is an error 287 AC_MSG_ERROR([Unable to find objcopy, cannot enable native debug symbols]) 288 fi 289 fi 290 291 COMPILE_WITH_DEBUG_SYMBOLS=true 292 COPY_DEBUG_SYMBOLS=true 293 ZIP_EXTERNAL_DEBUG_SYMBOLS=false 294 elif test "x$with_native_debug_symbols" = xzipped; then 295 296 if test "x$OPENJDK_TARGET_OS" = xlinux; then 297 if test "x$OBJCOPY" = x; then 298 # enabling of enable-debug-symbols and can't find objcopy 299 # this is an error 300 AC_MSG_ERROR([Unable to find objcopy, cannot enable native debug symbols]) 301 fi 302 fi 303 304 COMPILE_WITH_DEBUG_SYMBOLS=true 305 COPY_DEBUG_SYMBOLS=true 306 ZIP_EXTERNAL_DEBUG_SYMBOLS=true 307 else 308 AC_MSG_ERROR([Allowed native debug symbols are: none, internal, external, zipped]) 309 fi 310 311 AC_SUBST(COMPILE_WITH_DEBUG_SYMBOLS) 312 AC_SUBST(COPY_DEBUG_SYMBOLS) 313 AC_SUBST(ZIP_EXTERNAL_DEBUG_SYMBOLS) 314 315 # Should we add external native debug symbols to the shipped bundles? 316 AC_MSG_CHECKING([if we should add external native debug symbols to the shipped bundles]) 317 AC_ARG_WITH([external-symbols-in-bundles], 318 [AS_HELP_STRING([--with-external-symbols-in-bundles], 319 [which type of external native debug symbol information shall be shipped in product bundles (none, public, full) 320 (e.g. ship full/stripped pdbs on Windows) @<:@none@:>@])]) 321 322 if test "x$with_external_symbols_in_bundles" = x || test "x$with_external_symbols_in_bundles" = xnone ; then 323 AC_MSG_RESULT([no]) 324 elif test "x$with_external_symbols_in_bundles" = xfull || test "x$with_external_symbols_in_bundles" = xpublic ; then 325 if test "x$OPENJDK_TARGET_OS" != xwindows ; then 326 AC_MSG_ERROR([--with-external-symbols-in-bundles currently only works on windows!]) 327 elif test "x$COPY_DEBUG_SYMBOLS" != xtrue ; then 328 AC_MSG_ERROR([--with-external-symbols-in-bundles only works when --with-native-debug-symbols=external is used!]) 329 elif test "x$with_external_symbols_in_bundles" = xfull ; then 330 AC_MSG_RESULT([full]) 331 SHIP_DEBUG_SYMBOLS=full 332 else 333 AC_MSG_RESULT([public]) 334 SHIP_DEBUG_SYMBOLS=public 335 fi 336 else 337 AC_MSG_ERROR([$with_external_symbols_in_bundles is an unknown value for --with-external-symbols-in-bundles]) 338 fi 339 340 AC_SUBST(SHIP_DEBUG_SYMBOLS) 341 ]) 342 343 ################################################################################ 344 # 345 # Native and Java code coverage 346 # 347 AC_DEFUN_ONCE([JDKOPT_SETUP_CODE_COVERAGE], 348 [ 349 UTIL_ARG_ENABLE(NAME: native-coverage, DEFAULT: false, RESULT: GCOV_ENABLED, 350 DESC: [enable native compilation with code coverage data], 351 CHECK_AVAILABLE: [ 352 AC_MSG_CHECKING([if native coverage is available]) 353 if test "x$TOOLCHAIN_TYPE" = "xgcc" || 354 test "x$TOOLCHAIN_TYPE" = "xclang"; then 355 AC_MSG_RESULT([yes]) 356 else 357 AC_MSG_RESULT([no]) 358 AVAILABLE=false 359 fi 360 ], 361 IF_ENABLED: [ 362 GCOV_CFLAGS="-fprofile-arcs -ftest-coverage -fno-inline" 363 GCOV_LDFLAGS="-fprofile-arcs" 364 JVM_CFLAGS="$JVM_CFLAGS $GCOV_CFLAGS" 365 JVM_LDFLAGS="$JVM_LDFLAGS $GCOV_LDFLAGS" 366 CFLAGS_JDKLIB="$CFLAGS_JDKLIB $GCOV_CFLAGS" 367 CFLAGS_JDKEXE="$CFLAGS_JDKEXE $GCOV_CFLAGS" 368 CXXFLAGS_JDKLIB="$CXXFLAGS_JDKLIB $GCOV_CFLAGS" 369 CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $GCOV_CFLAGS" 370 LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $GCOV_LDFLAGS" 371 LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $GCOV_LDFLAGS" 372 LDFLAGS_STATIC_JDK="$LDFLAGS_STATIC_JDK $GCOV_LDFLAGS" 373 ]) 374 AC_SUBST(GCOV_ENABLED) 375 376 AC_ARG_WITH(jcov, [AS_HELP_STRING([--with-jcov], 377 [jcov library location])]) 378 AC_ARG_WITH(jcov-input-jdk, [AS_HELP_STRING([--with-jcov-input-jdk], 379 [jdk image to instrument])]) 380 AC_ARG_WITH(jcov-filters, [AS_HELP_STRING([--with-jcov-filters], 381 [filters to limit code for jcov instrumentation and report generation])]) 382 JCOV_HOME= 383 JCOV_INPUT_JDK= 384 JCOV_ENABLED= 385 JCOV_FILTERS= 386 if test "x$with_jcov" = "x" ; then 387 JCOV_ENABLED="false" 388 else 389 JCOV_HOME="$with_jcov" 390 if test ! -f "$JCOV_HOME/lib/jcov.jar"; then 391 AC_MSG_RESULT([fail]) 392 AC_MSG_ERROR([Invalid JCov bundle: "$JCOV_HOME/lib/jcov.jar" does not exist]) 393 fi 394 JCOV_ENABLED="true" 395 UTIL_FIXUP_PATH(JCOV_HOME) 396 if test "x$with_jcov_input_jdk" != "x" ; then 397 JCOV_INPUT_JDK="$with_jcov_input_jdk" 398 if test ! -f "$JCOV_INPUT_JDK/bin/java" && test ! -f "$JCOV_INPUT_JDK/bin/java.exe"; then 399 AC_MSG_RESULT([fail]) 400 AC_MSG_ERROR([Invalid JDK bundle: "$JCOV_INPUT_JDK/bin/java" does not exist]) 401 fi 402 UTIL_FIXUP_PATH(JCOV_INPUT_JDK) 403 fi 404 if test "x$with_jcov_filters" != "x" ; then 405 JCOV_FILTERS="$with_jcov_filters" 406 fi 407 fi 408 409 UTIL_ARG_WITH(NAME: jcov-modules, TYPE: string, 410 DEFAULT: [], RESULT: JCOV_MODULES_COMMMA_SEPARATED, 411 DESC: [which modules to include in jcov (comma-separated)], 412 OPTIONAL: true) 413 414 # Replace "," with " ". 415 JCOV_MODULES=${JCOV_MODULES_COMMMA_SEPARATED//,/ } 416 AC_SUBST(JCOV_ENABLED) 417 AC_SUBST(JCOV_HOME) 418 AC_SUBST(JCOV_INPUT_JDK) 419 AC_SUBST(JCOV_FILTERS) 420 AC_SUBST(JCOV_MODULES) 421 ]) 422 423 ################################################################################ 424 # 425 # AddressSanitizer 426 # 427 AC_DEFUN_ONCE([JDKOPT_SETUP_ADDRESS_SANITIZER], 428 [ 429 UTIL_ARG_ENABLE(NAME: asan, DEFAULT: false, RESULT: ASAN_ENABLED, 430 DESC: [enable AddressSanitizer], 431 CHECK_AVAILABLE: [ 432 AC_MSG_CHECKING([if AddressSanitizer (asan) is available]) 433 if test "x$TOOLCHAIN_TYPE" = "xgcc" || 434 test "x$TOOLCHAIN_TYPE" = "xclang" || 435 test "x$TOOLCHAIN_TYPE" = "xmicrosoft"; then 436 AC_MSG_RESULT([yes]) 437 else 438 AC_MSG_RESULT([no]) 439 AVAILABLE=false 440 fi 441 ], 442 IF_ENABLED: [ 443 if test "x$TOOLCHAIN_TYPE" = "xgcc" || 444 test "x$TOOLCHAIN_TYPE" = "xclang"; then 445 # ASan is simply incompatible with gcc -Wstringop-truncation. See 446 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85650 447 # It's harmless to be suppressed in clang as well. 448 ASAN_CFLAGS="-fsanitize=address -Wno-stringop-truncation -fno-omit-frame-pointer -fno-common -DADDRESS_SANITIZER" 449 ASAN_LDFLAGS="-fsanitize=address" 450 # detect_stack_use_after_return causes ASAN to offload stack-local 451 # variables to c-heap and therefore breaks assumptions in hotspot 452 # that rely on data (e.g. Marks) living in thread stacks. 453 if test "x$TOOLCHAIN_TYPE" = "xgcc"; then 454 ASAN_CFLAGS="$ASAN_CFLAGS --param asan-use-after-return=0" 455 fi 456 if test "x$TOOLCHAIN_TYPE" = "xclang"; then 457 ASAN_CFLAGS="$ASAN_CFLAGS -fsanitize-address-use-after-return=never" 458 ASAN_LDFLAGS="$ASAN_LDFLAGS -shared-libasan" 459 fi 460 elif test "x$TOOLCHAIN_TYPE" = "xmicrosoft"; then 461 # -Oy- is equivalent to -fno-omit-frame-pointer in GCC/Clang. 462 ASAN_CFLAGS="-fsanitize=address -Oy- -DADDRESS_SANITIZER" 463 # MSVC produces a warning if you pass -fsanitize=address to the linker. It also complains 464 $ if -DEBUG is not passed to the linker when building with ASan. 465 ASAN_LDFLAGS="-debug" 466 # -fsanitize-address-use-after-return is off by default in MS Visual Studio 22 (19.37.32824). 467 # cl : Command line warning D9002 : ignoring unknown option '-fno-sanitize-address-use-after-return' 468 fi 469 JVM_CFLAGS="$JVM_CFLAGS $ASAN_CFLAGS" 470 JVM_LDFLAGS="$JVM_LDFLAGS $ASAN_LDFLAGS" 471 CFLAGS_JDKLIB="$CFLAGS_JDKLIB $ASAN_CFLAGS" 472 CFLAGS_JDKEXE="$CFLAGS_JDKEXE $ASAN_CFLAGS" 473 CXXFLAGS_JDKLIB="$CXXFLAGS_JDKLIB $ASAN_CFLAGS" 474 CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $ASAN_CFLAGS" 475 LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $ASAN_LDFLAGS" 476 LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $ASAN_LDFLAGS" 477 LDFLAGS_STATIC_JDK="$LDFLAGS_STATIC_JDK $ASAN_LDFLAGS" 478 ]) 479 AC_SUBST(ASAN_ENABLED) 480 ]) 481 482 ################################################################################ 483 # 484 # Static analyzer 485 # 486 AC_DEFUN_ONCE([JDKOPT_SETUP_STATIC_ANALYZER], 487 [ 488 UTIL_ARG_ENABLE(NAME: static-analyzer, DEFAULT: false, RESULT: STATIC_ANALYZER_ENABLED, 489 DESC: [enable the GCC static analyzer], 490 CHECK_AVAILABLE: [ 491 AC_MSG_CHECKING([if static analyzer is available]) 492 if test "x$TOOLCHAIN_TYPE" = "xgcc"; then 493 AC_MSG_RESULT([yes]) 494 else 495 AC_MSG_RESULT([no]) 496 AVAILABLE=false 497 fi 498 ], 499 IF_ENABLED: [ 500 STATIC_ANALYZER_CFLAGS="-fanalyzer -Wno-analyzer-fd-leak" 501 CFLAGS_JDKLIB="$CFLAGS_JDKLIB $STATIC_ANALYZER_CFLAGS" 502 CFLAGS_JDKEXE="$CFLAGS_JDKEXE $STATIC_ANALYZER_CFLAGS" 503 ]) 504 AC_SUBST(STATIC_ANALYZER_ENABLED) 505 ]) 506 507 ################################################################################ 508 # 509 # LeakSanitizer 510 # 511 AC_DEFUN_ONCE([JDKOPT_SETUP_LEAK_SANITIZER], 512 [ 513 UTIL_ARG_ENABLE(NAME: lsan, DEFAULT: false, RESULT: LSAN_ENABLED, 514 DESC: [enable LeakSanitizer], 515 CHECK_AVAILABLE: [ 516 AC_MSG_CHECKING([if LeakSanitizer (lsan) is available]) 517 if test "x$TOOLCHAIN_TYPE" = "xgcc" || 518 test "x$TOOLCHAIN_TYPE" = "xclang"; then 519 AC_MSG_RESULT([yes]) 520 else 521 AC_MSG_RESULT([no]) 522 AVAILABLE=false 523 fi 524 ], 525 IF_ENABLED: [ 526 LSAN_CFLAGS="-fsanitize=leak -fno-omit-frame-pointer -DLEAK_SANITIZER" 527 LSAN_LDFLAGS="-fsanitize=leak" 528 JVM_CFLAGS="$JVM_CFLAGS $LSAN_CFLAGS" 529 JVM_LDFLAGS="$JVM_LDFLAGS $LSAN_LDFLAGS" 530 CFLAGS_JDKLIB="$CFLAGS_JDKLIB $LSAN_CFLAGS" 531 CFLAGS_JDKEXE="$CFLAGS_JDKEXE $LSAN_CFLAGS" 532 CXXFLAGS_JDKLIB="$CXXFLAGS_JDKLIB $LSAN_CFLAGS" 533 CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $LSAN_CFLAGS" 534 LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $LSAN_LDFLAGS" 535 LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $LSAN_LDFLAGS" 536 LDFLAGS_STATIC_JDK="$LDFLAGS_STATIC_JDK $LSAN_LDFLAGS" 537 ]) 538 AC_SUBST(LSAN_ENABLED) 539 ]) 540 541 ################################################################################ 542 # 543 # UndefinedBehaviorSanitizer 544 # 545 AC_DEFUN_ONCE([JDKOPT_SETUP_UNDEFINED_BEHAVIOR_SANITIZER], 546 [ 547 UTIL_ARG_WITH(NAME: additional-ubsan-checks, TYPE: string, 548 DEFAULT: [], 549 DESC: [Customizes the ubsan checks], 550 OPTIONAL: true) 551 552 # GCC reports lots of likely false positives for stringop-truncation and format-overflow. 553 # GCC 13 also for array-bounds and stringop-overflow 554 # Silence them for now. 555 UBSAN_CHECKS="-fsanitize=undefined -fsanitize=float-divide-by-zero -fno-sanitize=shift-base -fno-sanitize=alignment \ 556 $ADDITIONAL_UBSAN_CHECKS" 557 UBSAN_CFLAGS="$UBSAN_CHECKS -Wno-array-bounds -fno-omit-frame-pointer -DUNDEFINED_BEHAVIOR_SANITIZER" 558 if test "x$TOOLCHAIN_TYPE" = "xgcc"; then 559 UBSAN_CFLAGS="$UBSAN_CFLAGS -Wno-format-overflow -Wno-stringop-overflow -Wno-stringop-truncation" 560 fi 561 UBSAN_LDFLAGS="$UBSAN_CHECKS" 562 # On AIX, the llvm_symbolizer is not found out of the box, so we have to provide the 563 # full qualified llvm_symbolizer path in the __ubsan_default_options() function in 564 # make/data/ubsan/ubsan_default_options.c. To get it there we compile our sources 565 # with an additional define LLVM_SYMBOLIZER, which we set here. 566 # To calculate the correct llvm_symbolizer path we can use the location of the compiler, because 567 # their relation is fixed. 568 if test "x$TOOLCHAIN_TYPE" = "xclang" && test "x$OPENJDK_TARGET_OS" = "xaix"; then 569 UBSAN_CFLAGS="$UBSAN_CFLAGS -fno-sanitize=function,vptr -DLLVM_SYMBOLIZER=$(dirname $(dirname $CC))/tools/ibm-llvm-symbolizer" 570 UBSAN_LDFLAGS="$UBSAN_LDFLAGS -fno-sanitize=function,vptr -Wl,-bbigtoc" 571 fi 572 UTIL_ARG_ENABLE(NAME: ubsan, DEFAULT: false, RESULT: UBSAN_ENABLED, 573 DESC: [enable UndefinedBehaviorSanitizer], 574 CHECK_AVAILABLE: [ 575 AC_MSG_CHECKING([if UndefinedBehaviorSanitizer (ubsan) is available]) 576 if test "x$TOOLCHAIN_TYPE" = "xgcc" || 577 test "x$TOOLCHAIN_TYPE" = "xclang"; then 578 AC_MSG_RESULT([yes]) 579 else 580 AC_MSG_RESULT([no]) 581 AVAILABLE=false 582 fi 583 ], 584 IF_ENABLED: [ 585 JVM_CFLAGS="$JVM_CFLAGS $UBSAN_CFLAGS" 586 JVM_LDFLAGS="$JVM_LDFLAGS $UBSAN_LDFLAGS" 587 CFLAGS_JDKLIB="$CFLAGS_JDKLIB $UBSAN_CFLAGS" 588 CFLAGS_JDKEXE="$CFLAGS_JDKEXE $UBSAN_CFLAGS" 589 CXXFLAGS_JDKLIB="$CXXFLAGS_JDKLIB $UBSAN_CFLAGS" 590 CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $UBSAN_CFLAGS" 591 LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $UBSAN_LDFLAGS" 592 LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $UBSAN_LDFLAGS" 593 LDFLAGS_STATIC_JDK="$LDFLAGS_STATIC_JDK $UBSAN_LDFLAGS" 594 ]) 595 if test "x$UBSAN_ENABLED" = xfalse; then 596 UBSAN_CFLAGS="" 597 UBSAN_LDFLAGS="" 598 fi 599 AC_SUBST(UBSAN_CFLAGS) 600 AC_SUBST(UBSAN_LDFLAGS) 601 AC_SUBST(UBSAN_ENABLED) 602 ]) 603 604 ################################################################################ 605 # 606 # jmod options. 607 # 608 AC_DEFUN_ONCE([JDKOPT_SETUP_JMOD_OPTIONS], 609 [ 610 # Final JMODs are recompiled often during development, and java.base JMOD 611 # includes the JVM libraries. In release mode, prefer to compress JMODs fully. 612 # In debug mode, pay with a little extra space, but win a lot of CPU time back 613 # with the lightest (but still some) compression. 614 if test "x$DEBUG_LEVEL" = xrelease; then 615 DEFAULT_JMOD_COMPRESS="zip-6" 616 else 617 DEFAULT_JMOD_COMPRESS="zip-1" 618 fi 619 620 UTIL_ARG_WITH(NAME: jmod-compress, TYPE: literal, 621 VALID_VALUES: [zip-0 zip-1 zip-2 zip-3 zip-4 zip-5 zip-6 zip-7 zip-8 zip-9], 622 DEFAULT: $DEFAULT_JMOD_COMPRESS, 623 CHECKING_MSG: [for JMOD compression type], 624 DESC: [specify JMOD compression type (zip-[0-9])] 625 ) 626 AC_SUBST(JMOD_COMPRESS) 627 ]) 628 629 ################################################################################ 630 # 631 # jlink options. 632 # 633 AC_DEFUN_ONCE([JDKOPT_SETUP_JLINK_OPTIONS], 634 [ 635 636 ################################################################################ 637 # 638 # Configure option for building a JDK that is suitable for linking from the 639 # run-time image without JMODs. 640 # 641 # Determines whether or not a suitable run-time image is being produced from 642 # packaged modules. If set to 'true, changes the *default* of packaged 643 # modules to 'false'. 644 # 645 UTIL_ARG_ENABLE(NAME: linkable-runtime, DEFAULT: false, 646 RESULT: JLINK_PRODUCE_LINKABLE_RUNTIME, 647 DESC: [enable a JDK build suitable for linking from the run-time image], 648 CHECKING_MSG: [whether or not a JDK suitable for linking from the run-time image should be produced]) 649 AC_SUBST(JLINK_PRODUCE_LINKABLE_RUNTIME) 650 651 if test "x$JLINK_PRODUCE_LINKABLE_RUNTIME" = xtrue; then 652 DEFAULT_PACKAGED_MODULES=false 653 else 654 DEFAULT_PACKAGED_MODULES=true 655 fi 656 657 ################################################################################ 658 # 659 # Configure option for packaged modules 660 # 661 # We keep packaged modules in the JDK image unless --enable-linkable-runtime is 662 # requested. 663 # 664 UTIL_ARG_ENABLE(NAME: keep-packaged-modules, DEFAULT: $DEFAULT_PACKAGED_MODULES, 665 RESULT: JLINK_KEEP_PACKAGED_MODULES, 666 DESC: [enable keeping of packaged modules in jdk image], 667 DEFAULT_DESC: [enabled by default unless --enable-linkable-runtime is set], 668 CHECKING_MSG: [if packaged modules are kept]) 669 AC_SUBST(JLINK_KEEP_PACKAGED_MODULES) 670 671 ################################################################################ 672 # 673 # Extra jlink options to be (optionally) passed to the JDK build 674 # 675 UTIL_ARG_WITH(NAME: extra-jlink-flags, TYPE: string, 676 DEFAULT: [], 677 DESC: [extra flags to be passed to jlink during the build], 678 OPTIONAL: true) 679 680 JLINK_USER_EXTRA_FLAGS="$EXTRA_JLINK_FLAGS" 681 AC_SUBST(JLINK_USER_EXTRA_FLAGS) 682 ]) 683 684 ################################################################################ 685 # 686 # Enable or disable generation of the classlist at build time 687 # 688 AC_DEFUN_ONCE([JDKOPT_ENABLE_DISABLE_GENERATE_CLASSLIST], 689 [ 690 # In GenerateLinkOptData.gmk, DumpLoadedClassList is used to generate the 691 # classlist file. It never will work if CDS is disabled, since the VM will report 692 # an error for DumpLoadedClassList. 693 UTIL_ARG_ENABLE(NAME: generate-classlist, DEFAULT: auto, 694 RESULT: ENABLE_GENERATE_CLASSLIST, AVAILABLE: $ENABLE_CDS, 695 DESC: [enable generation of a CDS classlist at build time], 696 DEFAULT_DESC: [enabled if the JVM feature 'cds' is enabled for all JVM variants], 697 CHECKING_MSG: [if the CDS classlist generation should be enabled]) 698 AC_SUBST(ENABLE_GENERATE_CLASSLIST) 699 ]) 700 701 ################################################################################ 702 # 703 # Optionally filter resource translations 704 # 705 AC_DEFUN([JDKOPT_EXCLUDE_TRANSLATIONS], 706 [ 707 AC_ARG_WITH([exclude-translations], [AS_HELP_STRING([--with-exclude-translations], 708 [a comma separated list of locales to exclude translations for. Default is 709 to include all translations present in the source.])]) 710 711 EXCLUDE_TRANSLATIONS="" 712 AC_MSG_CHECKING([if any translations should be excluded]) 713 if test "x$with_exclude_translations" != "x"; then 714 EXCLUDE_TRANSLATIONS="${with_exclude_translations//,/ }" 715 AC_MSG_RESULT([yes: $EXCLUDE_TRANSLATIONS]) 716 else 717 AC_MSG_RESULT([no]) 718 fi 719 720 AC_SUBST(EXCLUDE_TRANSLATIONS) 721 ]) 722 723 ################################################################################ 724 # 725 # Disable the default CDS archive generation 726 # 727 AC_DEFUN([JDKOPT_ENABLE_DISABLE_CDS_ARCHIVE], 728 [ 729 UTIL_ARG_ENABLE(NAME: cds-archive, DEFAULT: auto, RESULT: BUILD_CDS_ARCHIVE, 730 DESC: [enable generation of a default CDS archive in the product image], 731 DEFAULT_DESC: [enabled if possible], 732 CHECKING_MSG: [if a default CDS archive should be generated], 733 CHECK_AVAILABLE: [ 734 AC_MSG_CHECKING([if CDS archive is available]) 735 if test "x$ENABLE_CDS" = "xfalse"; then 736 AC_MSG_RESULT([no (CDS is disabled)]) 737 AVAILABLE=false 738 elif test "x$COMPILE_TYPE" = "xcross"; then 739 AC_MSG_RESULT([no (not possible with cross compilation)]) 740 AVAILABLE=false 741 else 742 AC_MSG_RESULT([yes]) 743 fi 744 ]) 745 AC_SUBST(BUILD_CDS_ARCHIVE) 746 ]) 747 748 ################################################################################ 749 # 750 # Enable or disable the default CDS archive generation for Compact Object Headers 751 # 752 # Default disabled within Valhalla until support added (JDK-8348568) 753 # 754 AC_DEFUN([JDKOPT_ENABLE_DISABLE_CDS_ARCHIVE_COH], 755 [ 756 UTIL_ARG_ENABLE(NAME: cds-archive-coh, DEFAULT: false, RESULT: BUILD_CDS_ARCHIVE_COH, 757 DESC: [enable generation of default CDS archives for compact object headers (requires --enable-cds-archive)], 758 DEFAULT_DESC: [auto], 759 CHECKING_MSG: [if default CDS archives for compact object headers should be generated], 760 CHECK_AVAILABLE: [ 761 AC_MSG_CHECKING([if CDS archive with compact object headers is available]) 762 if test "x$BUILD_CDS_ARCHIVE" = "xfalse"; then 763 AC_MSG_RESULT([no (CDS default archive generation is disabled)]) 764 AVAILABLE=false 765 elif test "x$OPENJDK_TARGET_CPU" != "xx86_64" && 766 test "x$OPENJDK_TARGET_CPU" != "xaarch64" && 767 test "x$OPENJDK_TARGET_CPU" != "xppc64" && 768 test "x$OPENJDK_TARGET_CPU" != "xppc64le" && 769 test "x$OPENJDK_TARGET_CPU" != "xriscv64" && 770 test "x$OPENJDK_TARGET_CPU" != "xs390x"; then 771 AC_MSG_RESULT([no (compact object headers not supported for this platform)]) 772 AVAILABLE=false 773 else 774 AC_MSG_RESULT([yes]) 775 AVAILABLE=true 776 fi 777 ]) 778 AC_SUBST(BUILD_CDS_ARCHIVE_COH) 779 ]) 780 781 ################################################################################ 782 # 783 # Enable the alternative CDS core region alignment 784 # 785 AC_DEFUN([JDKOPT_ENABLE_DISABLE_COMPATIBLE_CDS_ALIGNMENT], 786 [ 787 UTIL_ARG_ENABLE(NAME: compatible-cds-alignment, DEFAULT: $COMPATIBLE_CDS_ALIGNMENT_DEFAULT, 788 RESULT: ENABLE_COMPATIBLE_CDS_ALIGNMENT, 789 DESC: [enable use alternative compatible cds core region alignment], 790 DEFAULT_DESC: [disabled except on linux-aarch64], 791 CHECKING_MSG: [if compatible cds region alignment enabled], 792 CHECK_AVAILABLE: [ 793 AC_MSG_CHECKING([if CDS archive is available]) 794 if test "x$ENABLE_CDS" = "xfalse"; then 795 AVAILABLE=false 796 AC_MSG_RESULT([no (CDS is disabled)]) 797 else 798 AVAILABLE=true 799 AC_MSG_RESULT([yes]) 800 fi 801 ]) 802 AC_SUBST(ENABLE_COMPATIBLE_CDS_ALIGNMENT) 803 ]) 804 805 ################################################################################ 806 # 807 # Disallow any output from containing absolute paths from the build system. 808 # This setting defaults to allowed on debug builds and not allowed on release 809 # builds. 810 # 811 AC_DEFUN([JDKOPT_ALLOW_ABSOLUTE_PATHS_IN_OUTPUT], 812 [ 813 AC_ARG_ENABLE([absolute-paths-in-output], 814 [AS_HELP_STRING([--disable-absolute-paths-in-output], 815 [Set to disable to prevent any absolute paths from the build to end up in 816 any of the build output. @<:@disabled in release builds, otherwise enabled@:>@])]) 817 818 AC_MSG_CHECKING([if absolute paths should be allowed in the build output]) 819 if test "x$enable_absolute_paths_in_output" = "xno"; then 820 AC_MSG_RESULT([no, forced]) 821 ALLOW_ABSOLUTE_PATHS_IN_OUTPUT="false" 822 elif test "x$enable_absolute_paths_in_output" = "xyes"; then 823 AC_MSG_RESULT([yes, forced]) 824 ALLOW_ABSOLUTE_PATHS_IN_OUTPUT="true" 825 elif test "x$DEBUG_LEVEL" = "xrelease"; then 826 AC_MSG_RESULT([no, release build]) 827 ALLOW_ABSOLUTE_PATHS_IN_OUTPUT="false" 828 else 829 AC_MSG_RESULT([yes, debug build]) 830 ALLOW_ABSOLUTE_PATHS_IN_OUTPUT="true" 831 fi 832 833 AC_SUBST(ALLOW_ABSOLUTE_PATHS_IN_OUTPUT) 834 ]) 835 836 ################################################################################ 837 # 838 # Check and set options related to reproducible builds. 839 # 840 AC_DEFUN_ONCE([JDKOPT_SETUP_REPRODUCIBLE_BUILD], 841 [ 842 AC_ARG_WITH([source-date], [AS_HELP_STRING([--with-source-date], 843 [how to set SOURCE_DATE_EPOCH ('updated', 'current', 'version' a timestamp or an ISO-8601 date) @<:@current/value of SOURCE_DATE_EPOCH@:>@])], 844 [with_source_date_present=true], [with_source_date_present=false]) 845 846 if test "x$SOURCE_DATE_EPOCH" != x && test "x$with_source_date" != x; then 847 AC_MSG_WARN([--with-source-date will override SOURCE_DATE_EPOCH]) 848 fi 849 850 AC_MSG_CHECKING([what source date to use]) 851 852 if test "x$with_source_date" = xyes; then 853 AC_MSG_ERROR([--with-source-date must have a value]) 854 elif test "x$with_source_date" = x; then 855 if test "x$SOURCE_DATE_EPOCH" != x; then 856 SOURCE_DATE=$SOURCE_DATE_EPOCH 857 with_source_date_present=true 858 AC_MSG_RESULT([$SOURCE_DATE, from SOURCE_DATE_EPOCH]) 859 else 860 # Tell makefiles to take the time from configure 861 SOURCE_DATE=$($DATE +"%s") 862 AC_MSG_RESULT([$SOURCE_DATE, from 'current' (default)]) 863 fi 864 elif test "x$with_source_date" = xupdated; then 865 SOURCE_DATE=updated 866 AC_MSG_RESULT([determined at build time, from 'updated']) 867 elif test "x$with_source_date" = xcurrent; then 868 # Set the current time 869 SOURCE_DATE=$($DATE +"%s") 870 AC_MSG_RESULT([$SOURCE_DATE, from 'current']) 871 elif test "x$with_source_date" = xversion; then 872 # Use the date from version-numbers.conf 873 UTIL_GET_EPOCH_TIMESTAMP(SOURCE_DATE, $DEFAULT_VERSION_DATE) 874 if test "x$SOURCE_DATE" = x; then 875 AC_MSG_RESULT([unavailable]) 876 AC_MSG_ERROR([Cannot convert DEFAULT_VERSION_DATE to timestamp]) 877 fi 878 AC_MSG_RESULT([$SOURCE_DATE, from 'version']) 879 else 880 # It's a timestamp, an ISO-8601 date, or an invalid string 881 # Additional [] needed to keep m4 from mangling shell constructs. 882 if [ [[ "$with_source_date" =~ ^[0-9][0-9]*$ ]] ] ; then 883 SOURCE_DATE=$with_source_date 884 AC_MSG_RESULT([$SOURCE_DATE, from timestamp on command line]) 885 else 886 UTIL_GET_EPOCH_TIMESTAMP(SOURCE_DATE, $with_source_date) 887 if test "x$SOURCE_DATE" != x; then 888 AC_MSG_RESULT([$SOURCE_DATE, from ISO-8601 date on command line]) 889 else 890 AC_MSG_RESULT([unavailable]) 891 AC_MSG_ERROR([Cannot parse date string "$with_source_date"]) 892 fi 893 fi 894 fi 895 896 ISO_8601_FORMAT_STRING="%Y-%m-%dT%H:%M:%SZ" 897 if test "x$SOURCE_DATE" != xupdated; then 898 # If we have a fixed value for SOURCE_DATE, we need to set SOURCE_DATE_EPOCH 899 # for the rest of configure. 900 SOURCE_DATE_EPOCH="$SOURCE_DATE" 901 if test "x$IS_GNU_DATE" = xyes; then 902 SOURCE_DATE_ISO_8601=`$DATE --utc --date="@$SOURCE_DATE" +"$ISO_8601_FORMAT_STRING" 2> /dev/null` 903 else 904 SOURCE_DATE_ISO_8601=`$DATE -u -j -f "%s" "$SOURCE_DATE" +"$ISO_8601_FORMAT_STRING" 2> /dev/null` 905 fi 906 fi 907 908 AC_SUBST(SOURCE_DATE) 909 AC_SUBST(ISO_8601_FORMAT_STRING) 910 AC_SUBST(SOURCE_DATE_ISO_8601) 911 ]) 912 913 ################################################################################ 914 # 915 # Setup signing on macOS. This can either be setup to sign with a real identity 916 # and enabling the hardened runtime, or it can simply add the debug entitlement 917 # com.apple.security.get-task-allow without actually signing any binaries. The 918 # latter is needed to be able to debug processes and dump core files on modern 919 # versions of macOS. It can also be skipped completely. 920 # 921 # Check if codesign will run with the given parameters 922 # $1: Parameters to run with 923 # $2: Checking message 924 # Sets CODESIGN_SUCCESS=true/false 925 AC_DEFUN([JDKOPT_CHECK_CODESIGN_PARAMS], 926 [ 927 PARAMS="$1" 928 MESSAGE="$2" 929 CODESIGN_TESTFILE="$CONFIGURESUPPORT_OUTPUTDIR/codesign-testfile" 930 $RM "$CODESIGN_TESTFILE" 931 $TOUCH "$CODESIGN_TESTFILE" 932 CODESIGN_SUCCESS=false 933 934 $ECHO "check codesign, calling $CODESIGN $PARAMS $CODESIGN_TESTFILE" >&AS_MESSAGE_LOG_FD 935 936 eval \"$CODESIGN\" $PARAMS \"$CODESIGN_TESTFILE\" 2>&AS_MESSAGE_LOG_FD \ 937 >&AS_MESSAGE_LOG_FD && CODESIGN_SUCCESS=true 938 $RM "$CODESIGN_TESTFILE" 939 AC_MSG_CHECKING([$MESSAGE]) 940 if test "x$CODESIGN_SUCCESS" = "xtrue"; then 941 AC_MSG_RESULT([yes]) 942 else 943 AC_MSG_RESULT([no]) 944 fi 945 ]) 946 947 AC_DEFUN([JDKOPT_CHECK_CODESIGN_HARDENED], 948 [ 949 JDKOPT_CHECK_CODESIGN_PARAMS([-s \"$MACOSX_CODESIGN_IDENTITY\" --option runtime], 950 [if codesign with hardened runtime is possible]) 951 ]) 952 953 AC_DEFUN([JDKOPT_CHECK_CODESIGN_DEBUG], 954 [ 955 JDKOPT_CHECK_CODESIGN_PARAMS([-s -], [if debug mode codesign is possible]) 956 ]) 957 958 AC_DEFUN([JDKOPT_SETUP_MACOSX_SIGNING], 959 [ 960 MACOSX_CODESIGN_MODE=disabled 961 if test "x$OPENJDK_TARGET_OS" = "xmacosx" && test "x$CODESIGN" != "x"; then 962 963 UTIL_ARG_WITH(NAME: macosx-codesign, TYPE: literal, OPTIONAL: true, 964 VALID_VALUES: [hardened debug auto], DEFAULT: auto, 965 ENABLED_DEFAULT: true, 966 CHECKING_MSG: [for macosx code signing mode], 967 DESC: [set the macosx code signing mode (hardened, debug, auto)] 968 ) 969 970 if test "x$MACOSX_CODESIGN_ENABLED" = "xtrue"; then 971 972 # Check for user provided code signing identity. 973 UTIL_ARG_WITH(NAME: macosx-codesign-identity, TYPE: string, 974 DEFAULT: openjdk_codesign, CHECK_VALUE: [UTIL_CHECK_STRING_NON_EMPTY], 975 DESC: [specify the macosx code signing identity], 976 CHECKING_MSG: [for macosx code signing identity] 977 ) 978 AC_SUBST(MACOSX_CODESIGN_IDENTITY) 979 980 if test "x$MACOSX_CODESIGN" = "xauto"; then 981 # Only try to default to hardened signing on release builds 982 if test "x$DEBUG_LEVEL" = "xrelease"; then 983 JDKOPT_CHECK_CODESIGN_HARDENED 984 if test "x$CODESIGN_SUCCESS" = "xtrue"; then 985 MACOSX_CODESIGN_MODE=hardened 986 fi 987 fi 988 if test "x$MACOSX_CODESIGN_MODE" = "xdisabled"; then 989 JDKOPT_CHECK_CODESIGN_DEBUG 990 if test "x$CODESIGN_SUCCESS" = "xtrue"; then 991 MACOSX_CODESIGN_MODE=debug 992 fi 993 fi 994 AC_MSG_CHECKING([for macosx code signing mode]) 995 AC_MSG_RESULT([$MACOSX_CODESIGN_MODE]) 996 elif test "x$MACOSX_CODESIGN" = "xhardened"; then 997 JDKOPT_CHECK_CODESIGN_HARDENED 998 if test "x$CODESIGN_SUCCESS" = "xfalse"; then 999 AC_MSG_ERROR([Signing with hardened runtime is not possible]) 1000 fi 1001 MACOSX_CODESIGN_MODE=hardened 1002 elif test "x$MACOSX_CODESIGN" = "xdebug"; then 1003 JDKOPT_CHECK_CODESIGN_DEBUG 1004 if test "x$CODESIGN_SUCCESS" = "xfalse"; then 1005 AC_MSG_ERROR([Signing in debug mode is not possible]) 1006 fi 1007 MACOSX_CODESIGN_MODE=debug 1008 else 1009 AC_MSG_ERROR([unknown value for --with-macosx-codesign: $MACOSX_CODESIGN]) 1010 fi 1011 fi 1012 fi 1013 AC_SUBST(MACOSX_CODESIGN_IDENTITY) 1014 AC_SUBST(MACOSX_CODESIGN_MODE) 1015 ]) 1016 1017 ################################################################################ 1018 # 1019 # Setup a hook to invoke a script that runs for file produced by the native 1020 # compilation steps, after linking. 1021 # Parameter is the path to the script to be called. 1022 # 1023 AC_DEFUN([JDKOPT_SETUP_SIGNING_HOOK], 1024 [ 1025 UTIL_ARG_WITH(NAME: signing-hook, TYPE: executable, 1026 OPTIONAL: true, DEFAULT: "", 1027 DESC: [specify path to script used to code sign native binaries] 1028 ) 1029 1030 AC_MSG_CHECKING([for signing hook]) 1031 if test "x$SIGNING_HOOK" != x; then 1032 UTIL_FIXUP_EXECUTABLE(SIGNING_HOOK) 1033 AC_MSG_RESULT([$SIGNING_HOOK]) 1034 else 1035 AC_MSG_RESULT([none]) 1036 fi 1037 AC_SUBST(SIGNING_HOOK) 1038 ]) 1039 1040 ################################################################################ 1041 # 1042 # Setup how javac should handle warnings. 1043 # 1044 AC_DEFUN([JDKOPT_SETUP_JAVA_WARNINGS], 1045 [ 1046 UTIL_ARG_ENABLE(NAME: java-warnings-as-errors, DEFAULT: true, 1047 RESULT: JAVA_WARNINGS_AS_ERRORS, 1048 DESC: [consider java warnings to be an error]) 1049 AC_SUBST(JAVA_WARNINGS_AS_ERRORS) 1050 ]) 1051 1052 ################################################################################ 1053 # 1054 # fallback linker 1055 # 1056 AC_DEFUN_ONCE([JDKOPT_SETUP_FALLBACK_LINKER], 1057 [ 1058 FALLBACK_LINKER_DEFAULT=false 1059 1060 if HOTSPOT_CHECK_JVM_VARIANT(zero); then 1061 FALLBACK_LINKER_DEFAULT=true 1062 fi 1063 1064 UTIL_ARG_ENABLE(NAME: fallback-linker, DEFAULT: $FALLBACK_LINKER_DEFAULT, 1065 RESULT: ENABLE_FALLBACK_LINKER, 1066 DESC: [enable libffi-based fallback implementation of java.lang.foreign.Linker], 1067 CHECKING_MSG: [if fallback linker enabled]) 1068 AC_SUBST(ENABLE_FALLBACK_LINKER) 1069 ])