1 #
  2 # Copyright (c) 2011, 2023, 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])
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])
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=true
201   fi
202   AC_SUBST(COMPATIBLE_CDS_ALIGNMENT_DEFAULT)
203 
204   # Compress jars
205   COMPRESS_JARS=false
206 
207   AC_SUBST(COMPRESS_JARS)
208 
209   # Setup default copyright year. Mostly overridden when building close to a new year.
210   AC_ARG_WITH(copyright-year, [AS_HELP_STRING([--with-copyright-year],
211       [Set copyright year value for build @<:@current year/source-date@:>@])])
212   if test "x$with_copyright_year" = xyes; then
213     AC_MSG_ERROR([Copyright year must have a value])
214   elif test "x$with_copyright_year" != x; then
215     COPYRIGHT_YEAR="$with_copyright_year"
216   elif test "x$SOURCE_DATE" != xupdated; then
217     if test "x$IS_GNU_DATE" = xyes; then
218       COPYRIGHT_YEAR=`$DATE --date=@$SOURCE_DATE +%Y`
219     else
220       COPYRIGHT_YEAR=`$DATE -j -f %s $SOURCE_DATE +%Y`
221     fi
222   else
223     COPYRIGHT_YEAR=`$DATE +'%Y'`
224   fi
225   AC_SUBST(COPYRIGHT_YEAR)
226 
227   # Override default library path
228   AC_ARG_WITH([jni-libpath], [AS_HELP_STRING([--with-jni-libpath],
229       [override default JNI library search path])])
230   AC_MSG_CHECKING([for jni library path])
231   if test "x${with_jni_libpath}" = "x" || test "x${with_jni_libpath}" = "xno"; then
232     AC_MSG_RESULT([default])
233   elif test "x${with_jni_libpath}" = "xyes"; then
234     AC_MSG_RESULT([invalid])
235     AC_MSG_ERROR([The --with-jni-libpath option requires an argument.])
236   else
237     HOTSPOT_OVERRIDE_LIBPATH=${with_jni_libpath}
238     if test "x$OPENJDK_TARGET_OS" != "xlinux" &&
239          test "x$OPENJDK_TARGET_OS" != "xbsd" &&
240          test "x$OPENJDK_TARGET_OS" != "xaix"; then
241       AC_MSG_RESULT([fail])
242       AC_MSG_ERROR([Overriding JNI library path is supported only on Linux, BSD and AIX.])
243     fi
244     AC_MSG_RESULT(${HOTSPOT_OVERRIDE_LIBPATH})
245   fi
246   AC_SUBST(HOTSPOT_OVERRIDE_LIBPATH)
247 
248 ])
249 
250 ###############################################################################
251 
252 AC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_SYMBOLS],
253 [
254   #
255   # Native debug symbols.
256   # This must be done after the toolchain is setup, since we're looking at objcopy.
257   #
258   AC_MSG_CHECKING([what type of native debug symbols to use])
259   AC_ARG_WITH([native-debug-symbols],
260       [AS_HELP_STRING([--with-native-debug-symbols],
261       [set the native debug symbol configuration (none, internal, external, zipped) @<:@varying@:>@])],
262       [
263         if test "x$OPENJDK_TARGET_OS" = xwindows; then
264           if test "x$withval" = xinternal; then
265             AC_MSG_ERROR([Windows does not support the parameter 'internal' for --with-native-debug-symbols])
266           fi
267         fi
268       ],
269       [
270         if test "x$STATIC_BUILD" = xtrue; then
271           with_native_debug_symbols="none"
272         else
273           with_native_debug_symbols="external"
274         fi
275       ])
276   AC_MSG_RESULT([$with_native_debug_symbols])
277 
278   if test "x$with_native_debug_symbols" = xnone; then
279     COMPILE_WITH_DEBUG_SYMBOLS=false
280     COPY_DEBUG_SYMBOLS=false
281     ZIP_EXTERNAL_DEBUG_SYMBOLS=false
282   elif test "x$with_native_debug_symbols" = xinternal; then
283     COMPILE_WITH_DEBUG_SYMBOLS=true
284     COPY_DEBUG_SYMBOLS=false
285     ZIP_EXTERNAL_DEBUG_SYMBOLS=false
286   elif test "x$with_native_debug_symbols" = xexternal; then
287 
288     if test "x$OPENJDK_TARGET_OS" = xlinux; then
289       if test "x$OBJCOPY" = x; then
290         # enabling of enable-debug-symbols and can't find objcopy
291         # this is an error
292         AC_MSG_ERROR([Unable to find objcopy, cannot enable native debug symbols])
293       fi
294     fi
295 
296     COMPILE_WITH_DEBUG_SYMBOLS=true
297     COPY_DEBUG_SYMBOLS=true
298     ZIP_EXTERNAL_DEBUG_SYMBOLS=false
299   elif test "x$with_native_debug_symbols" = xzipped; then
300 
301     if test "x$OPENJDK_TARGET_OS" = xlinux; then
302       if test "x$OBJCOPY" = x; then
303         # enabling of enable-debug-symbols and can't find objcopy
304         # this is an error
305         AC_MSG_ERROR([Unable to find objcopy, cannot enable native debug symbols])
306       fi
307     fi
308 
309     COMPILE_WITH_DEBUG_SYMBOLS=true
310     COPY_DEBUG_SYMBOLS=true
311     ZIP_EXTERNAL_DEBUG_SYMBOLS=true
312   else
313     AC_MSG_ERROR([Allowed native debug symbols are: none, internal, external, zipped])
314   fi
315 
316   AC_SUBST(COMPILE_WITH_DEBUG_SYMBOLS)
317   AC_SUBST(COPY_DEBUG_SYMBOLS)
318   AC_SUBST(ZIP_EXTERNAL_DEBUG_SYMBOLS)
319 
320   # Should we add external native debug symbols to the shipped bundles?
321   AC_MSG_CHECKING([if we should add external native debug symbols to the shipped bundles])
322   AC_ARG_WITH([external-symbols-in-bundles],
323       [AS_HELP_STRING([--with-external-symbols-in-bundles],
324       [which type of external native debug symbol information shall be shipped in product bundles (none, public, full)
325       (e.g. ship full/stripped pdbs on Windows) @<:@none@:>@])])
326 
327   if test "x$with_external_symbols_in_bundles" = x || test "x$with_external_symbols_in_bundles" = xnone ; then
328     AC_MSG_RESULT([no])
329   elif test "x$with_external_symbols_in_bundles" = xfull || test "x$with_external_symbols_in_bundles" = xpublic ; then
330     if test "x$OPENJDK_TARGET_OS" != xwindows ; then
331       AC_MSG_ERROR([--with-external-symbols-in-bundles currently only works on windows!])
332     elif test "x$COPY_DEBUG_SYMBOLS" != xtrue ; then
333       AC_MSG_ERROR([--with-external-symbols-in-bundles only works when --with-native-debug-symbols=external is used!])
334     elif test "x$with_external_symbols_in_bundles" = xfull ; then
335       AC_MSG_RESULT([full])
336       SHIP_DEBUG_SYMBOLS=full
337     else
338       AC_MSG_RESULT([public])
339       SHIP_DEBUG_SYMBOLS=public
340     fi
341   else
342     AC_MSG_ERROR([$with_external_symbols_in_bundles is an unknown value for --with-external-symbols-in-bundles])
343   fi
344 
345   AC_SUBST(SHIP_DEBUG_SYMBOLS)
346 ])
347 
348 ################################################################################
349 #
350 # Native and Java code coverage
351 #
352 AC_DEFUN_ONCE([JDKOPT_SETUP_CODE_COVERAGE],
353 [
354   UTIL_ARG_ENABLE(NAME: native-coverage, DEFAULT: false, RESULT: GCOV_ENABLED,
355       DESC: [enable native compilation with code coverage data],
356       CHECK_AVAILABLE: [
357         AC_MSG_CHECKING([if native coverage is available])
358         if test "x$TOOLCHAIN_TYPE" = "xgcc" ||
359             test "x$TOOLCHAIN_TYPE" = "xclang"; then
360           AC_MSG_RESULT([yes])
361         else
362           AC_MSG_RESULT([no])
363           AVAILABLE=false
364         fi
365       ],
366       IF_ENABLED: [
367         GCOV_CFLAGS="-fprofile-arcs -ftest-coverage -fno-inline"
368         GCOV_LDFLAGS="-fprofile-arcs"
369         JVM_CFLAGS="$JVM_CFLAGS $GCOV_CFLAGS"
370         JVM_LDFLAGS="$JVM_LDFLAGS $GCOV_LDFLAGS"
371         CFLAGS_JDKLIB="$CFLAGS_JDKLIB $GCOV_CFLAGS"
372         CFLAGS_JDKEXE="$CFLAGS_JDKEXE $GCOV_CFLAGS"
373         CXXFLAGS_JDKLIB="$CXXFLAGS_JDKLIB $GCOV_CFLAGS"
374         CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $GCOV_CFLAGS"
375         LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $GCOV_LDFLAGS"
376         LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $GCOV_LDFLAGS"
377       ])
378   AC_SUBST(GCOV_ENABLED)
379 
380   AC_ARG_WITH(jcov, [AS_HELP_STRING([--with-jcov],
381       [jcov library location])])
382   AC_ARG_WITH(jcov-input-jdk, [AS_HELP_STRING([--with-jcov-input-jdk],
383       [jdk image to instrument])])
384   AC_ARG_WITH(jcov-filters, [AS_HELP_STRING([--with-jcov-filters],
385       [filters to limit code for jcov instrumentation and report generation])])
386   JCOV_HOME=
387   JCOV_INPUT_JDK=
388   JCOV_ENABLED=
389   JCOV_FILTERS=
390   if test "x$with_jcov" = "x" ; then
391     JCOV_ENABLED="false"
392   else
393     JCOV_HOME="$with_jcov"
394     if test ! -f "$JCOV_HOME/lib/jcov.jar"; then
395       AC_MSG_RESULT([fail])
396       AC_MSG_ERROR([Invalid JCov bundle: "$JCOV_HOME/lib/jcov.jar" does not exist])
397     fi
398     JCOV_ENABLED="true"
399     UTIL_FIXUP_PATH(JCOV_HOME)
400     if test "x$with_jcov_input_jdk" != "x" ; then
401       JCOV_INPUT_JDK="$with_jcov_input_jdk"
402       if test ! -f "$JCOV_INPUT_JDK/bin/java" && test ! -f "$JCOV_INPUT_JDK/bin/java.exe"; then
403         AC_MSG_RESULT([fail])
404         AC_MSG_ERROR([Invalid JDK bundle: "$JCOV_INPUT_JDK/bin/java" does not exist])
405       fi
406       UTIL_FIXUP_PATH(JCOV_INPUT_JDK)
407     fi
408     if test "x$with_jcov_filters" != "x" ; then
409       JCOV_FILTERS="$with_jcov_filters"
410     fi
411   fi
412   AC_SUBST(JCOV_ENABLED)
413   AC_SUBST(JCOV_HOME)
414   AC_SUBST(JCOV_INPUT_JDK)
415   AC_SUBST(JCOV_FILTERS)
416 ])
417 
418 ###############################################################################
419 #
420 # AddressSanitizer
421 #
422 AC_DEFUN_ONCE([JDKOPT_SETUP_ADDRESS_SANITIZER],
423 [
424   UTIL_ARG_ENABLE(NAME: asan, DEFAULT: false, RESULT: ASAN_ENABLED,
425       DESC: [enable AddressSanitizer],
426       CHECK_AVAILABLE: [
427         AC_MSG_CHECKING([if AddressSanitizer (asan) is available])
428         if test "x$TOOLCHAIN_TYPE" = "xgcc" ||
429            test "x$TOOLCHAIN_TYPE" = "xclang" ||
430            test "x$TOOLCHAIN_TYPE" = "xmicrosoft"; then
431           AC_MSG_RESULT([yes])
432         else
433           AC_MSG_RESULT([no])
434           AVAILABLE=false
435         fi
436       ],
437       IF_ENABLED: [
438         if test "x$TOOLCHAIN_TYPE" = "xgcc" ||
439            test "x$TOOLCHAIN_TYPE" = "xclang"; then
440           # ASan is simply incompatible with gcc -Wstringop-truncation. See
441           # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85650
442           # It's harmless to be suppressed in clang as well.
443           ASAN_CFLAGS="-fsanitize=address -Wno-stringop-truncation -fno-omit-frame-pointer -fno-common -DADDRESS_SANITIZER"
444           ASAN_LDFLAGS="-fsanitize=address"
445         elif test "x$TOOLCHAIN_TYPE" = "xmicrosoft"; then
446           # -Oy- is equivalent to -fno-omit-frame-pointer in GCC/Clang.
447           ASAN_CFLAGS="-fsanitize=address -Oy- -DADDRESS_SANITIZER"
448           # MSVC produces a warning if you pass -fsanitize=address to the linker. It also complains
449           $ if -DEBUG is not passed to the linker when building with ASan.
450           ASAN_LDFLAGS="-debug"
451         fi
452         JVM_CFLAGS="$JVM_CFLAGS $ASAN_CFLAGS"
453         JVM_LDFLAGS="$JVM_LDFLAGS $ASAN_LDFLAGS"
454         CFLAGS_JDKLIB="$CFLAGS_JDKLIB $ASAN_CFLAGS"
455         CFLAGS_JDKEXE="$CFLAGS_JDKEXE $ASAN_CFLAGS"
456         CXXFLAGS_JDKLIB="$CXXFLAGS_JDKLIB $ASAN_CFLAGS"
457         CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $ASAN_CFLAGS"
458         LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $ASAN_LDFLAGS"
459         LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $ASAN_LDFLAGS"
460       ])
461   AC_SUBST(ASAN_ENABLED)
462 ])
463 
464 ###############################################################################
465 #
466 # LeakSanitizer
467 #
468 AC_DEFUN_ONCE([JDKOPT_SETUP_LEAK_SANITIZER],
469 [
470   UTIL_ARG_ENABLE(NAME: lsan, DEFAULT: false, RESULT: LSAN_ENABLED,
471       DESC: [enable LeakSanitizer],
472       CHECK_AVAILABLE: [
473         AC_MSG_CHECKING([if LeakSanitizer (lsan) is available])
474         if test "x$TOOLCHAIN_TYPE" = "xgcc" ||
475             test "x$TOOLCHAIN_TYPE" = "xclang"; then
476           AC_MSG_RESULT([yes])
477         else
478           AC_MSG_RESULT([no])
479           AVAILABLE=false
480         fi
481       ],
482       IF_ENABLED: [
483         LSAN_CFLAGS="-fsanitize=leak -fno-omit-frame-pointer -DLEAK_SANITIZER"
484         LSAN_LDFLAGS="-fsanitize=leak"
485         JVM_CFLAGS="$JVM_CFLAGS $LSAN_CFLAGS"
486         JVM_LDFLAGS="$JVM_LDFLAGS $LSAN_LDFLAGS"
487         CFLAGS_JDKLIB="$CFLAGS_JDKLIB $LSAN_CFLAGS"
488         CFLAGS_JDKEXE="$CFLAGS_JDKEXE $LSAN_CFLAGS"
489         CXXFLAGS_JDKLIB="$CXXFLAGS_JDKLIB $LSAN_CFLAGS"
490         CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $LSAN_CFLAGS"
491         LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $LSAN_LDFLAGS"
492         LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $LSAN_LDFLAGS"
493       ])
494   AC_SUBST(LSAN_ENABLED)
495 ])
496 
497 ###############################################################################
498 #
499 # UndefinedBehaviorSanitizer
500 #
501 AC_DEFUN_ONCE([JDKOPT_SETUP_UNDEFINED_BEHAVIOR_SANITIZER],
502 [
503   UTIL_ARG_WITH(NAME: additional-ubsan-checks, TYPE: string,
504       DEFAULT: [],
505       DESC: [Customizes the ubsan checks],
506       OPTIONAL: true)
507 
508   # GCC reports lots of likely false positives for stringop-truncation and format-overflow.
509   # Silence them for now.
510   UBSAN_CHECKS="-fsanitize=undefined -fsanitize=float-divide-by-zero -fno-sanitize=shift-base -fno-sanitize=alignment \
511       $ADDITIONAL_UBSAN_CHECKS"
512   UBSAN_CFLAGS="$UBSAN_CHECKS -Wno-stringop-truncation -Wno-format-overflow -fno-omit-frame-pointer -DUNDEFINED_BEHAVIOR_SANITIZER"
513   UBSAN_LDFLAGS="$UBSAN_CHECKS"
514   UTIL_ARG_ENABLE(NAME: ubsan, DEFAULT: false, RESULT: UBSAN_ENABLED,
515       DESC: [enable UndefinedBehaviorSanitizer],
516       CHECK_AVAILABLE: [
517         AC_MSG_CHECKING([if UndefinedBehaviorSanitizer (ubsan) is available])
518         if test "x$TOOLCHAIN_TYPE" = "xgcc" ||
519             test "x$TOOLCHAIN_TYPE" = "xclang"; then
520           AC_MSG_RESULT([yes])
521         else
522           AC_MSG_RESULT([no])
523           AVAILABLE=false
524         fi
525       ],
526       IF_ENABLED: [
527         JVM_CFLAGS="$JVM_CFLAGS $UBSAN_CFLAGS"
528         JVM_LDFLAGS="$JVM_LDFLAGS $UBSAN_LDFLAGS"
529         CFLAGS_JDKLIB="$CFLAGS_JDKLIB $UBSAN_CFLAGS"
530         CFLAGS_JDKEXE="$CFLAGS_JDKEXE $UBSAN_CFLAGS"
531         CXXFLAGS_JDKLIB="$CXXFLAGS_JDKLIB $UBSAN_CFLAGS"
532         CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $UBSAN_CFLAGS"
533         LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $UBSAN_LDFLAGS"
534         LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $UBSAN_LDFLAGS"
535       ])
536   if test "x$UBSAN_ENABLED" = xfalse; then
537     UBSAN_CFLAGS=""
538     UBSAN_LDFLAGS=""
539   fi
540   AC_SUBST(UBSAN_CFLAGS)
541   AC_SUBST(UBSAN_LDFLAGS)
542   AC_SUBST(UBSAN_ENABLED)
543 ])
544 
545 ################################################################################
546 #
547 # Static build support.  When enabled will generate static
548 # libraries instead of shared libraries for all JDK libs.
549 #
550 AC_DEFUN_ONCE([JDKOPT_SETUP_STATIC_BUILD],
551 [
552   UTIL_ARG_ENABLE(NAME: static-build, DEFAULT: false, RESULT: STATIC_BUILD,
553       DESC: [enable static library build],
554       CHECKING_MSG: [if static build is enabled],
555       CHECK_AVAILABLE: [
556         AC_MSG_CHECKING([if static build is available])
557         if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
558           AC_MSG_RESULT([yes])
559         else
560           AC_MSG_RESULT([no])
561           AVAILABLE=false
562         fi
563       ],
564       IF_ENABLED: [
565         STATIC_BUILD_CFLAGS="-DSTATIC_BUILD=1"
566         CFLAGS_JDKLIB_EXTRA="$CFLAGS_JDKLIB_EXTRA $STATIC_BUILD_CFLAGS"
567         CXXFLAGS_JDKLIB_EXTRA="$CXXFLAGS_JDKLIB_EXTRA $STATIC_BUILD_CFLAGS"
568       ])
569   AC_SUBST(STATIC_BUILD)
570 ])
571 
572 ################################################################################
573 #
574 # jmod options.
575 #
576 AC_DEFUN_ONCE([JDKOPT_SETUP_JMOD_OPTIONS],
577 [
578   # Final JMODs are recompiled often during development, and java.base JMOD
579   # includes the JVM libraries. In release mode, prefer to compress JMODs fully.
580   # In debug mode, pay with a little extra space, but win a lot of CPU time back
581   # with the lightest (but still some) compression.
582   if test "x$DEBUG_LEVEL" = xrelease; then
583     DEFAULT_JMOD_COMPRESS="zip-6"
584   else
585     DEFAULT_JMOD_COMPRESS="zip-1"
586   fi
587 
588   UTIL_ARG_WITH(NAME: jmod-compress, TYPE: literal,
589     VALID_VALUES: [zip-0 zip-1 zip-2 zip-3 zip-4 zip-5 zip-6 zip-7 zip-8 zip-9],
590     DEFAULT: $DEFAULT_JMOD_COMPRESS,
591     CHECKING_MSG: [for JMOD compression type],
592     DESC: [specify JMOD compression type (zip-[0-9])]
593   )
594   AC_SUBST(JMOD_COMPRESS)
595 ])
596 
597 ################################################################################
598 #
599 # jlink options.
600 # We always keep packaged modules in JDK image.
601 #
602 AC_DEFUN_ONCE([JDKOPT_SETUP_JLINK_OPTIONS],
603 [
604   UTIL_ARG_ENABLE(NAME: keep-packaged-modules, DEFAULT: true,
605       RESULT: JLINK_KEEP_PACKAGED_MODULES,
606       DESC: [enable keeping of packaged modules in jdk image],
607       CHECKING_MSG: [if packaged modules are kept])
608   AC_SUBST(JLINK_KEEP_PACKAGED_MODULES)
609 ])
610 
611 ################################################################################
612 #
613 # Enable or disable generation of the classlist at build time
614 #
615 AC_DEFUN_ONCE([JDKOPT_ENABLE_DISABLE_GENERATE_CLASSLIST],
616 [
617   # In GenerateLinkOptData.gmk, DumpLoadedClassList is used to generate the
618   # classlist file. It never will work if CDS is disabled, since the VM will report
619   # an error for DumpLoadedClassList.
620   UTIL_ARG_ENABLE(NAME: generate-classlist, DEFAULT: auto,
621       RESULT: ENABLE_GENERATE_CLASSLIST, AVAILABLE: $ENABLE_CDS,
622       DESC: [enable generation of a CDS classlist at build time],
623       DEFAULT_DESC: [enabled if the JVM feature 'cds' is enabled for all JVM variants],
624       CHECKING_MSG: [if the CDS classlist generation should be enabled])
625   AC_SUBST(ENABLE_GENERATE_CLASSLIST)
626 ])
627 
628 ################################################################################
629 #
630 # Optionally filter resource translations
631 #
632 AC_DEFUN([JDKOPT_EXCLUDE_TRANSLATIONS],
633 [
634   AC_ARG_WITH([exclude-translations], [AS_HELP_STRING([--with-exclude-translations],
635       [a comma separated list of locales to exclude translations for. Default is
636       to include all translations present in the source.])])
637 
638   EXCLUDE_TRANSLATIONS=""
639   AC_MSG_CHECKING([if any translations should be excluded])
640   if test "x$with_exclude_translations" != "x"; then
641     EXCLUDE_TRANSLATIONS="${with_exclude_translations//,/ }"
642     AC_MSG_RESULT([yes: $EXCLUDE_TRANSLATIONS])
643   else
644     AC_MSG_RESULT([no])
645   fi
646 
647   AC_SUBST(EXCLUDE_TRANSLATIONS)
648 ])
649 
650 ################################################################################
651 #
652 # Optionally disable man pages
653 #
654 AC_DEFUN([JDKOPT_ENABLE_DISABLE_MANPAGES],
655 [
656   UTIL_ARG_ENABLE(NAME: manpages, DEFAULT: true, RESULT: BUILD_MANPAGES,
657       DESC: [enable copying of static man pages],
658       CHECKING_MSG: [if static man pages should be copied])
659   AC_SUBST(BUILD_MANPAGES)
660 ])
661 
662 ################################################################################
663 #
664 # Disable the default CDS archive generation
665 #
666 AC_DEFUN([JDKOPT_ENABLE_DISABLE_CDS_ARCHIVE],
667 [
668   UTIL_ARG_ENABLE(NAME: cds-archive, DEFAULT: auto, RESULT: BUILD_CDS_ARCHIVE,
669       DESC: [enable generation of a default CDS archive in the product image],
670       DEFAULT_DESC: [enabled if possible],
671       CHECKING_MSG: [if a default CDS archive should be generated],
672       CHECK_AVAILABLE: [
673         AC_MSG_CHECKING([if CDS archive is available])
674         if test "x$ENABLE_CDS" = "xfalse"; then
675           AC_MSG_RESULT([no (CDS is disabled)])
676           AVAILABLE=false
677         elif test "x$COMPILE_TYPE" = "xcross"; then
678           AC_MSG_RESULT([no (not possible with cross compilation)])
679           AVAILABLE=false
680         else
681           AC_MSG_RESULT([yes])
682         fi
683       ])
684   AC_SUBST(BUILD_CDS_ARCHIVE)
685 ])
686 
687 ################################################################################
688 #
689 # Enable or disable the default CDS archive generation for Compact Object Headers
690 #
691 AC_DEFUN([JDKOPT_ENABLE_DISABLE_CDS_ARCHIVE_COH],
692 [
693   UTIL_ARG_ENABLE(NAME: cds-archive-coh, DEFAULT: auto, RESULT: BUILD_CDS_ARCHIVE_COH,
694       DESC: [enable generation of default CDS archives for compact object headers (requires --enable-cds-archive)],
695       DEFAULT_DESC: [auto],
696       CHECKING_MSG: [if default CDS archives for compact object headers should be generated],
697       CHECK_AVAILABLE: [
698         AC_MSG_CHECKING([if CDS archive with compact object headers is available])
699         if test "x$BUILD_CDS_ARCHIVE" = "xfalse"; then
700           AC_MSG_RESULT([no (CDS default archive generation is disabled)])
701           AVAILABLE=false
702         elif test "x$OPENJDK_TARGET_CPU" != "xx86_64" &&
703              test "x$OPENJDK_TARGET_CPU" != "xaarch64"; then
704           AC_MSG_RESULT([no (compact object headers not supported for this platform)])
705           AVAILABLE=false
706         else
707           AC_MSG_RESULT([yes])
708           AVAILABLE=true
709         fi
710       ])
711   AC_SUBST(BUILD_CDS_ARCHIVE_COH)
712 ])
713 
714 ################################################################################
715 #
716 # Enable the alternative CDS core region alignment
717 #
718 AC_DEFUN([JDKOPT_ENABLE_DISABLE_COMPATIBLE_CDS_ALIGNMENT],
719 [
720   UTIL_ARG_ENABLE(NAME: compatible-cds-alignment, DEFAULT: $COMPATIBLE_CDS_ALIGNMENT_DEFAULT,
721       RESULT: ENABLE_COMPATIBLE_CDS_ALIGNMENT,
722       DESC: [enable use alternative compatible cds core region alignment],
723       DEFAULT_DESC: [disabled],
724       CHECKING_MSG: [if compatible cds region alignment enabled],
725       CHECK_AVAILABLE: [
726         AC_MSG_CHECKING([if CDS archive is available])
727         if test "x$ENABLE_CDS" = "xfalse"; then
728           AVAILABLE=false
729           AC_MSG_RESULT([no (CDS is disabled)])
730         else
731           AVAILABLE=true
732           AC_MSG_RESULT([yes])
733         fi
734       ])
735   AC_SUBST(ENABLE_COMPATIBLE_CDS_ALIGNMENT)
736 ])
737 
738 ################################################################################
739 #
740 # Disallow any output from containing absolute paths from the build system.
741 # This setting defaults to allowed on debug builds and not allowed on release
742 # builds.
743 #
744 AC_DEFUN([JDKOPT_ALLOW_ABSOLUTE_PATHS_IN_OUTPUT],
745 [
746   AC_ARG_ENABLE([absolute-paths-in-output],
747       [AS_HELP_STRING([--disable-absolute-paths-in-output],
748        [Set to disable to prevent any absolute paths from the build to end up in
749         any of the build output. @<:@disabled in release builds, otherwise enabled@:>@])
750       ])
751 
752   AC_MSG_CHECKING([if absolute paths should be allowed in the build output])
753   if test "x$enable_absolute_paths_in_output" = "xno"; then
754     AC_MSG_RESULT([no, forced])
755     ALLOW_ABSOLUTE_PATHS_IN_OUTPUT="false"
756   elif test "x$enable_absolute_paths_in_output" = "xyes"; then
757     AC_MSG_RESULT([yes, forced])
758     ALLOW_ABSOLUTE_PATHS_IN_OUTPUT="true"
759   elif test "x$DEBUG_LEVEL" = "xrelease"; then
760     AC_MSG_RESULT([no, release build])
761     ALLOW_ABSOLUTE_PATHS_IN_OUTPUT="false"
762   else
763     AC_MSG_RESULT([yes, debug build])
764     ALLOW_ABSOLUTE_PATHS_IN_OUTPUT="true"
765   fi
766 
767   AC_SUBST(ALLOW_ABSOLUTE_PATHS_IN_OUTPUT)
768 ])
769 
770 ################################################################################
771 #
772 # Check and set options related to reproducible builds.
773 #
774 AC_DEFUN_ONCE([JDKOPT_SETUP_REPRODUCIBLE_BUILD],
775 [
776   AC_ARG_WITH([source-date], [AS_HELP_STRING([--with-source-date],
777       [how to set SOURCE_DATE_EPOCH ('updated', 'current', 'version' a timestamp or an ISO-8601 date) @<:@current/value of SOURCE_DATE_EPOCH@:>@])],
778       [with_source_date_present=true], [with_source_date_present=false])
779 
780   if test "x$SOURCE_DATE_EPOCH" != x && test "x$with_source_date" != x; then
781     AC_MSG_WARN([--with-source-date will override SOURCE_DATE_EPOCH])
782   fi
783 
784   AC_MSG_CHECKING([what source date to use])
785 
786   if test "x$with_source_date" = xyes; then
787     AC_MSG_ERROR([--with-source-date must have a value])
788   elif test "x$with_source_date" = x; then
789     if test "x$SOURCE_DATE_EPOCH" != x; then
790       SOURCE_DATE=$SOURCE_DATE_EPOCH
791       with_source_date_present=true
792       AC_MSG_RESULT([$SOURCE_DATE, from SOURCE_DATE_EPOCH])
793     else
794       # Tell makefiles to take the time from configure
795       SOURCE_DATE=$($DATE +"%s")
796       AC_MSG_RESULT([$SOURCE_DATE, from 'current' (default)])
797     fi
798   elif test "x$with_source_date" = xupdated; then
799     SOURCE_DATE=updated
800     AC_MSG_RESULT([determined at build time, from 'updated'])
801   elif test "x$with_source_date" = xcurrent; then
802     # Set the current time
803     SOURCE_DATE=$($DATE +"%s")
804     AC_MSG_RESULT([$SOURCE_DATE, from 'current'])
805   elif test "x$with_source_date" = xversion; then
806     # Use the date from version-numbers.conf
807     UTIL_GET_EPOCH_TIMESTAMP(SOURCE_DATE, $DEFAULT_VERSION_DATE)
808     if test "x$SOURCE_DATE" = x; then
809       AC_MSG_RESULT([unavailable])
810       AC_MSG_ERROR([Cannot convert DEFAULT_VERSION_DATE to timestamp])
811     fi
812     AC_MSG_RESULT([$SOURCE_DATE, from 'version'])
813   else
814     # It's a timestamp, an ISO-8601 date, or an invalid string
815     # Additional [] needed to keep m4 from mangling shell constructs.
816     if [ [[ "$with_source_date" =~ ^[0-9][0-9]*$ ]] ] ; then
817       SOURCE_DATE=$with_source_date
818       AC_MSG_RESULT([$SOURCE_DATE, from timestamp on command line])
819     else
820       UTIL_GET_EPOCH_TIMESTAMP(SOURCE_DATE, $with_source_date)
821       if test "x$SOURCE_DATE" != x; then
822         AC_MSG_RESULT([$SOURCE_DATE, from ISO-8601 date on command line])
823       else
824         AC_MSG_RESULT([unavailable])
825         AC_MSG_ERROR([Cannot parse date string "$with_source_date"])
826       fi
827     fi
828   fi
829 
830   ISO_8601_FORMAT_STRING="%Y-%m-%dT%H:%M:%SZ"
831   if test "x$SOURCE_DATE" != xupdated; then
832     # If we have a fixed value for SOURCE_DATE, we need to set SOURCE_DATE_EPOCH
833     # for the rest of configure.
834     SOURCE_DATE_EPOCH="$SOURCE_DATE"
835     if test "x$IS_GNU_DATE" = xyes; then
836       SOURCE_DATE_ISO_8601=`$DATE --utc --date="@$SOURCE_DATE" +"$ISO_8601_FORMAT_STRING" 2> /dev/null`
837     else
838       SOURCE_DATE_ISO_8601=`$DATE -u -j -f "%s" "$SOURCE_DATE" +"$ISO_8601_FORMAT_STRING" 2> /dev/null`
839     fi
840   fi
841 
842   AC_SUBST(SOURCE_DATE)
843   AC_SUBST(ISO_8601_FORMAT_STRING)
844   AC_SUBST(SOURCE_DATE_ISO_8601)
845 
846   UTIL_DEPRECATED_ARG_ENABLE(reproducible-build)
847 ])
848 
849 ################################################################################
850 #
851 # Setup signing on macOS. This can either be setup to sign with a real identity
852 # and enabling the hardened runtime, or it can simply add the debug entitlement
853 # com.apple.security.get-task-allow without actually signing any binaries. The
854 # latter is needed to be able to debug processes and dump core files on modern
855 # versions of macOS. It can also be skipped completely.
856 #
857 # Check if codesign will run with the given parameters
858 # $1: Parameters to run with
859 # $2: Checking message
860 # Sets CODESIGN_SUCCESS=true/false
861 AC_DEFUN([JDKOPT_CHECK_CODESIGN_PARAMS],
862 [
863   PARAMS="$1"
864   MESSAGE="$2"
865   CODESIGN_TESTFILE="$CONFIGURESUPPORT_OUTPUTDIR/codesign-testfile"
866   $RM "$CODESIGN_TESTFILE"
867   $TOUCH "$CODESIGN_TESTFILE"
868   CODESIGN_SUCCESS=false
869 
870   $ECHO "check codesign, calling $CODESIGN $PARAMS $CODESIGN_TESTFILE" >&AS_MESSAGE_LOG_FD
871 
872   eval \"$CODESIGN\" $PARAMS \"$CODESIGN_TESTFILE\" 2>&AS_MESSAGE_LOG_FD \
873       >&AS_MESSAGE_LOG_FD && CODESIGN_SUCCESS=true
874   $RM "$CODESIGN_TESTFILE"
875   AC_MSG_CHECKING([$MESSAGE])
876   if test "x$CODESIGN_SUCCESS" = "xtrue"; then
877     AC_MSG_RESULT([yes])
878   else
879     AC_MSG_RESULT([no])
880   fi
881 ])
882 
883 AC_DEFUN([JDKOPT_CHECK_CODESIGN_HARDENED],
884 [
885   JDKOPT_CHECK_CODESIGN_PARAMS([-s \"$MACOSX_CODESIGN_IDENTITY\" --option runtime],
886       [if codesign with hardened runtime is possible])
887 ])
888 
889 AC_DEFUN([JDKOPT_CHECK_CODESIGN_DEBUG],
890 [
891   JDKOPT_CHECK_CODESIGN_PARAMS([-s -], [if debug mode codesign is possible])
892 ])
893 
894 AC_DEFUN([JDKOPT_SETUP_MACOSX_SIGNING],
895 [
896   ENABLE_CODESIGN=false
897   if test "x$OPENJDK_TARGET_OS" = "xmacosx" && test "x$CODESIGN" != "x"; then
898 
899     UTIL_ARG_WITH(NAME: macosx-codesign, TYPE: literal, OPTIONAL: true,
900         VALID_VALUES: [hardened debug auto], DEFAULT: auto,
901         ENABLED_DEFAULT: true,
902         CHECKING_MSG: [for macosx code signing mode],
903         DESC: [set the macosx code signing mode (hardened, debug, auto)]
904     )
905 
906     MACOSX_CODESIGN_MODE=disabled
907     if test "x$MACOSX_CODESIGN_ENABLED" = "xtrue"; then
908 
909       # Check for user provided code signing identity.
910       UTIL_ARG_WITH(NAME: macosx-codesign-identity, TYPE: string,
911           DEFAULT: openjdk_codesign, CHECK_VALUE: [UTIL_CHECK_STRING_NON_EMPTY],
912           DESC: [specify the macosx code signing identity],
913           CHECKING_MSG: [for macosx code signing identity]
914       )
915       AC_SUBST(MACOSX_CODESIGN_IDENTITY)
916 
917       if test "x$MACOSX_CODESIGN" = "xauto"; then
918         # Only try to default to hardened signing on release builds
919         if test "x$DEBUG_LEVEL" = "xrelease"; then
920           JDKOPT_CHECK_CODESIGN_HARDENED
921           if test "x$CODESIGN_SUCCESS" = "xtrue"; then
922             MACOSX_CODESIGN_MODE=hardened
923           fi
924         fi
925         if test "x$MACOSX_CODESIGN_MODE" = "xdisabled"; then
926           JDKOPT_CHECK_CODESIGN_DEBUG
927           if test "x$CODESIGN_SUCCESS" = "xtrue"; then
928             MACOSX_CODESIGN_MODE=debug
929           fi
930         fi
931         AC_MSG_CHECKING([for macosx code signing mode])
932         AC_MSG_RESULT([$MACOSX_CODESIGN_MODE])
933       elif test "x$MACOSX_CODESIGN" = "xhardened"; then
934         JDKOPT_CHECK_CODESIGN_HARDENED
935         if test "x$CODESIGN_SUCCESS" = "xfalse"; then
936           AC_MSG_ERROR([Signing with hardened runtime is not possible])
937         fi
938         MACOSX_CODESIGN_MODE=hardened
939       elif test "x$MACOSX_CODESIGN" = "xdebug"; then
940         JDKOPT_CHECK_CODESIGN_DEBUG
941         if test "x$CODESIGN_SUCCESS" = "xfalse"; then
942           AC_MSG_ERROR([Signing in debug mode is not possible])
943         fi
944         MACOSX_CODESIGN_MODE=debug
945       else
946         AC_MSG_ERROR([unknown value for --with-macosx-codesign: $MACOSX_CODESIGN])
947       fi
948     fi
949     AC_SUBST(MACOSX_CODESIGN_IDENTITY)
950     AC_SUBST(MACOSX_CODESIGN_MODE)
951   fi
952 ])
953 
954 ################################################################################
955 #
956 # fallback linker
957 #
958 AC_DEFUN_ONCE([JDKOPT_SETUP_FALLBACK_LINKER],
959 [
960   FALLBACK_LINKER_DEFAULT=false
961 
962   if HOTSPOT_CHECK_JVM_VARIANT(zero); then
963     FALLBACK_LINKER_DEFAULT=true
964   fi
965 
966   UTIL_ARG_ENABLE(NAME: fallback-linker, DEFAULT: $FALLBACK_LINKER_DEFAULT,
967       RESULT: ENABLE_FALLBACK_LINKER,
968       DESC: [enable libffi-based fallback implementation of java.lang.foreign.Linker],
969       CHECKING_MSG: [if fallback linker enabled])
970   AC_SUBST(ENABLE_FALLBACK_LINKER)
971 ])
--- EOF ---