8240820: Replace AC_ARG_ENABLE with UTIL_ARG_ENABLE

Reviewed-by: erikj
This commit is contained in:
Magnus Ihse Bursie 2020-03-11 08:34:14 +01:00
parent 99b28daf56
commit 441e16e2db
8 changed files with 482 additions and 448 deletions

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -167,36 +167,38 @@ AC_DEFUN_ONCE([BPERF_SETUP_TEST_JOBS],
AC_DEFUN([BPERF_SETUP_CCACHE], AC_DEFUN([BPERF_SETUP_CCACHE],
[ [
AC_ARG_ENABLE([ccache], # Check if ccache is available
[AS_HELP_STRING([--enable-ccache], CCACHE_AVAILABLE=true
[enable using ccache to speed up recompilations @<:@disabled@:>@])])
CCACHE_STATUS=
AC_MSG_CHECKING([is ccache enabled])
if test "x$enable_ccache" = xyes; then
if test "x$TOOLCHAIN_TYPE" = "xgcc" -o "x$TOOLCHAIN_TYPE" = "xclang"; then
AC_MSG_RESULT([yes])
OLD_PATH="$PATH" OLD_PATH="$PATH"
if test "x$TOOLCHAIN_PATH" != x; then if test "x$TOOLCHAIN_PATH" != x; then
PATH=$TOOLCHAIN_PATH:$PATH PATH=$TOOLCHAIN_PATH:$PATH
fi fi
UTIL_REQUIRE_PROGS(CCACHE, ccache) UTIL_PATH_PROGS(CCACHE, ccache)
PATH="$OLD_PATH" PATH="$OLD_PATH"
AC_MSG_CHECKING([if ccache is available])
if test "x$TOOLCHAIN_TYPE" != "xgcc" && test "x$TOOLCHAIN_TYPE" != "xclang"; then
AC_MSG_RESULT([no, not supported for toolchain type $TOOLCHAIN_TYPE])
CCACHE_AVAILABLE=false
elif test "x$CCACHE" = "x"; then
AC_MSG_RESULT([no, ccache binary missing or not executable])
CCACHE_AVAILABLE=false
else
AC_MSG_RESULT([yes])
fi
CCACHE_STATUS=""
UTIL_ARG_ENABLE(NAME: ccache, DEFAULT: false, AVAILABLE: $CCACHE_AVAILABLE,
DESC: [enable using ccache to speed up recompilations],
CHECKING_MSG: [if ccache is enabled],
IF_ENABLED: [
CCACHE_VERSION=[`$CCACHE --version | head -n1 | $SED 's/[A-Za-z ]*//'`] CCACHE_VERSION=[`$CCACHE --version | head -n1 | $SED 's/[A-Za-z ]*//'`]
CCACHE_STATUS="Active ($CCACHE_VERSION)" CCACHE_STATUS="Active ($CCACHE_VERSION)"
else ],
AC_MSG_RESULT([no]) IF_DISABLED: [
AC_MSG_WARN([ccache is not supported with toolchain type $TOOLCHAIN_TYPE]) CCACHE=""
fi ])
elif test "x$enable_ccache" = xno; then
AC_MSG_RESULT([no, explicitly disabled])
CCACHE_STATUS="Disabled"
elif test "x$enable_ccache" = x; then
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([unknown])
AC_MSG_ERROR([--enable-ccache does not accept any parameters])
fi
AC_SUBST(CCACHE) AC_SUBST(CCACHE)
AC_ARG_WITH([ccache-dir], AC_ARG_WITH([ccache-dir],
@ -284,10 +286,10 @@ AC_DEFUN([BPERF_RUN_ICECC_CREATE_ENV],
# #
AC_DEFUN([BPERF_SETUP_ICECC], AC_DEFUN([BPERF_SETUP_ICECC],
[ [
AC_ARG_ENABLE([icecc], [AS_HELP_STRING([--enable-icecc], UTIL_ARG_ENABLE(NAME: icecc, DEFAULT: false, RESULT: ENABLE_ICECC,
[enable distribted compilation of native code using icecc/icecream @<:@disabled@:>@])]) DESC: [enable distributed compilation of native code using icecc/icecream])
if test "x${enable_icecc}" = "xyes"; then if test "x$ENABLE_ICECC" = "xtrue"; then
UTIL_REQUIRE_PROGS(ICECC_CMD, icecc) UTIL_REQUIRE_PROGS(ICECC_CMD, icecc)
old_path="$PATH" old_path="$PATH"
@ -349,56 +351,44 @@ AC_DEFUN([BPERF_SETUP_ICECC],
else else
BUILD_ICECC="${ICECC}" BUILD_ICECC="${ICECC}"
fi fi
fi
AC_SUBST(ICECC) AC_SUBST(ICECC)
AC_SUBST(BUILD_ICECC) AC_SUBST(BUILD_ICECC)
fi
]) ])
AC_DEFUN_ONCE([BPERF_SETUP_PRECOMPILED_HEADERS], AC_DEFUN_ONCE([BPERF_SETUP_PRECOMPILED_HEADERS],
[ [
# Are precompiled headers available?
############################################################################### PRECOMPILED_HEADERS_AVAILABLE=true
# AC_MSG_CHECKING([if precompiled headers are available])
# Can the C/C++ compiler use precompiled headers? if test "x$ICECC" != "x"; then
#
AC_ARG_ENABLE([precompiled-headers], [AS_HELP_STRING([--disable-precompiled-headers],
[disable using precompiled headers when compiling C++ @<:@enabled@:>@])],
[ENABLE_PRECOMPH=${enable_precompiled_headers}], [ENABLE_PRECOMPH=yes])
USE_PRECOMPILED_HEADER=true
AC_MSG_CHECKING([If precompiled header is enabled])
if test "x$ENABLE_PRECOMPH" = xno; then
AC_MSG_RESULT([no, forced])
USE_PRECOMPILED_HEADER=false
elif test "x$ICECC" != "x"; then
AC_MSG_RESULT([no, does not work effectively with icecc]) AC_MSG_RESULT([no, does not work effectively with icecc])
USE_PRECOMPILED_HEADER=false PRECOMPILED_HEADERS_AVAILABLE=false
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
AC_MSG_RESULT([no, does not work with Solaris Studio]) AC_MSG_RESULT([no, does not work with Solaris Studio])
USE_PRECOMPILED_HEADER=false PRECOMPILED_HEADERS_AVAILABLE=false
elif test "x$TOOLCHAIN_TYPE" = xxlc; then elif test "x$TOOLCHAIN_TYPE" = xxlc; then
AC_MSG_RESULT([no, does not work with xlc]) AC_MSG_RESULT([no, does not work with xlc])
USE_PRECOMPILED_HEADER=false PRECOMPILED_HEADERS_AVAILABLE=false
else elif test "x$TOOLCHAIN_TYPE" = xgcc; then
AC_MSG_RESULT([yes])
fi
if test "x$ENABLE_PRECOMPH" = xyes; then
# Check that the compiler actually supports precomp headers. # Check that the compiler actually supports precomp headers.
if test "x$TOOLCHAIN_TYPE" = xgcc; then
AC_MSG_CHECKING([that precompiled headers work])
echo "int alfa();" > conftest.h echo "int alfa();" > conftest.h
$CXX -x c++-header conftest.h -o conftest.hpp.gch 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD $CXX -x c++-header conftest.h -o conftest.hpp.gch 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD
if test ! -f conftest.hpp.gch; then if test ! -f conftest.hpp.gch; then
USE_PRECOMPILED_HEADER=false PRECOMPILED_HEADERS_AVAILABLE=false
AC_MSG_RESULT([no]) AC_MSG_RESULT([no, gcc fails to compile properly with -x c++-header])
else else
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
fi fi
$RM conftest.h conftest.hpp.gch $RM conftest.h conftest.hpp.gch
fi else
AC_MSG_RESULT([yes])
fi fi
UTIL_ARG_ENABLE(NAME: precompiled-headers, DEFAULT: auto,
RESULT: USE_PRECOMPILED_HEADER, AVAILABLE: $PRECOMPILED_HEADERS_AVAILABLE,
DESC: [enable using precompiled headers when compiling C++])
AC_SUBST(USE_PRECOMPILED_HEADER) AC_SUBST(USE_PRECOMPILED_HEADER)
]) ])
@ -442,30 +432,27 @@ AC_DEFUN_ONCE([BPERF_SETUP_SMART_JAVAC],
if test "$MX_VALUE" -lt "512"; then if test "$MX_VALUE" -lt "512"; then
MX_VALUE=512 MX_VALUE=512
fi fi
UTIL_ADD_JVM_ARG_IF_OK([-Xms${MS_VALUE}M -Xmx${MX_VALUE}M],SJAVAC_SERVER_JAVA_FLAGS,[$SJAVAC_SERVER_JAVA])
JAVAC_SERVER_AVAILABLE=true
SJAVAC_MEMORY_OPT=-Xms${MS_VALUE}M -Xmx${MX_VALUE}M
UTIL_ADD_JVM_ARG_IF_OK([$SJAVAC_MEMORY_OPT],SJAVAC_SERVER_JAVA_FLAGS,[$SJAVAC_SERVER_JAVA])
if test "x$JVM_ARG_OK" = "xfalse"; then
AC_MSG_WARN([Could not set '$SJAVAC_MEMORY_OPT' on bootjdk, disabling sjavac and javac server])
JAVAC_SERVER_AVAILABLE=false
fi
AC_SUBST(SJAVAC_SERVER_JAVA_FLAGS) AC_SUBST(SJAVAC_SERVER_JAVA_FLAGS)
AC_ARG_ENABLE([sjavac], [AS_HELP_STRING([--enable-sjavac], UTIL_ARG_ENABLE(NAME: sjavac, DEFAULT: false, AVAILABLE: $JAVAC_SERVER_AVAILABLE,
[use sjavac to do fast incremental compiles @<:@disabled@:>@])], DESC: [use sjavac to do fast incremental compiles],
[ENABLE_SJAVAC="${enableval}"], [ENABLE_SJAVAC="no"]) CHECKING_MSG: [whether to use sjavac],
if test "x$JVM_ARG_OK" = "xfalse"; then IF_ENABLED: [ ENABLE_SJAVAC="yes" ],
AC_MSG_WARN([Could not set -Xms${MS_VALUE}M -Xmx${MX_VALUE}M, disabling sjavac]) IF_DISABLED: [ ENABLE_SJAVAC="no" ])
ENABLE_SJAVAC="no"
fi
AC_MSG_CHECKING([whether to use sjavac])
AC_MSG_RESULT([$ENABLE_SJAVAC])
AC_SUBST(ENABLE_SJAVAC)
AC_ARG_ENABLE([javac-server], [AS_HELP_STRING([--disable-javac-server], UTIL_ARG_ENABLE(NAME: javac-server, DEFAULT: true, AVAILABLE: $JAVAC_SERVER_AVAILABLE,
[disable javac server @<:@enabled@:>@])], DESC: [enable javac server],
[ENABLE_JAVAC_SERVER="${enableval}"], [ENABLE_JAVAC_SERVER="yes"]) CHECKING_MSG: [whether to use javac server],
if test "x$JVM_ARG_OK" = "xfalse"; then IF_ENABLED: [ ENABLE_JAVAC_SERVER="yes" ],
AC_MSG_WARN([Could not set -Xms${MS_VALUE}M -Xmx${MX_VALUE}M, disabling javac server]) IF_DISABLED: [ ENABLE_JAVAC_SERVER="no" ])
ENABLE_JAVAC_SERVER="no"
fi
AC_MSG_CHECKING([whether to use javac server])
AC_MSG_RESULT([$ENABLE_JAVAC_SERVER])
AC_SUBST(ENABLE_JAVAC_SERVER)
if test "x$ENABLE_JAVAC_SERVER" = "xyes" || test "x$ENABLE_SJAVAC" = "xyes"; then if test "x$ENABLE_JAVAC_SERVER" = "xyes" || test "x$ENABLE_SJAVAC" = "xyes"; then
# When using a server javac, the small client instances do not need much # When using a server javac, the small client instances do not need much

View File

@ -132,29 +132,17 @@ AC_DEFUN([FLAGS_SETUP_DEBUG_SYMBOLS],
AC_DEFUN([FLAGS_SETUP_WARNINGS], AC_DEFUN([FLAGS_SETUP_WARNINGS],
[ [
AC_ARG_ENABLE([warnings-as-errors], [AS_HELP_STRING([--disable-warnings-as-errors],
[do not consider native warnings to be an error @<:@enabled@:>@])])
# Set default value. # Set default value.
if test "x$TOOLCHAIN_TYPE" = xxlc; then if test "x$TOOLCHAIN_TYPE" != xxlc; then
WARNINGS_AS_ERRORS=false WARNINGS_AS_ERRORS_DEFAULT=true
else else
WARNINGS_AS_ERRORS=true WARNINGS_AS_ERRORS_DEFAULT=false
fi
AC_MSG_CHECKING([if native warnings are errors])
if test "x$enable_warnings_as_errors" = "xyes"; then
AC_MSG_RESULT([yes (explicitly set)])
WARNINGS_AS_ERRORS=true
elif test "x$enable_warnings_as_errors" = "xno"; then
AC_MSG_RESULT([no (explicitly set)])
WARNINGS_AS_ERRORS=false
elif test "x$enable_warnings_as_errors" = "x"; then
AC_MSG_RESULT([${WARNINGS_AS_ERRORS} (default)])
else
AC_MSG_ERROR([--enable-warnings-as-errors accepts no argument])
fi fi
UTIL_ARG_ENABLE(NAME: warnings-as-errors, DEFAULT: $WARNINGS_AS_ERRORS_DEFAULT,
RESULT: WARNINGS_AS_ERRORS,
DEFAULT_DESC: [auto]
DESC: [consider native warnings to be an error])
AC_SUBST(WARNINGS_AS_ERRORS) AC_SUBST(WARNINGS_AS_ERRORS)
case "${TOOLCHAIN_TYPE}" in case "${TOOLCHAIN_TYPE}" in

View File

@ -116,50 +116,32 @@ AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_VARIANTS],
# #
AC_DEFUN_ONCE([HOTSPOT_ENABLE_DISABLE_GTEST], AC_DEFUN_ONCE([HOTSPOT_ENABLE_DISABLE_GTEST],
[ [
AC_ARG_ENABLE([hotspot-gtest], [AS_HELP_STRING([--disable-hotspot-gtest],
[Disables building of the Hotspot unit tests @<:@enabled@:>@])])
GTEST_AVAILABLE=true GTEST_AVAILABLE=true
AC_MSG_CHECKING([if Hotspot gtest test source is present]) AC_MSG_CHECKING([if Hotspot gtest test source is present])
if test -e "${TOPDIR}/test/hotspot/gtest"; then if test -e "${TOPDIR}/test/hotspot/gtest"; then
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
else else
AC_MSG_RESULT([no, cannot run gtest]) AC_MSG_RESULT([no, cannot build gtest])
GTEST_AVAILABLE=false GTEST_AVAILABLE=false
fi fi
# On solaris, we also must have the libstlport.so.1 library, setup in # On solaris, we also must have the libstlport.so.1 library, setup in
# LIB_SETUP_LIBRARIES. # LIB_SETUP_LIBRARIES.
if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
if test "x$STLPORT_LIB" = "x"; then AC_MSG_CHECKING([if the libstlport.so.1 library is present])
if test "x$STLPORT_LIB" != "x"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no, cannot build gtest])
GTEST_AVAILABLE=false GTEST_AVAILABLE=false
fi fi
fi fi
AC_MSG_CHECKING([if Hotspot gtest unit tests should be built]) UTIL_ARG_ENABLE(NAME: hotspot-gtest, DEFAULT: auto,
if test "x$enable_hotspot_gtest" = "xyes"; then RESULT: BUILD_GTEST, AVAILABLE: $GTEST_AVAILABLE,
if test "x$GTEST_AVAILABLE" = "xtrue"; then DEFAULT_DESC: [enabled if possible to build]
AC_MSG_RESULT([yes, forced]) DESC: [enable building of the Hotspot unit tests])
BUILD_GTEST="true"
else
AC_MSG_ERROR([Cannot build gtest with missing dependencies])
fi
elif test "x$enable_hotspot_gtest" = "xno"; then
AC_MSG_RESULT([no, forced])
BUILD_GTEST="false"
elif test "x$enable_hotspot_gtest" = "x"; then
if test "x$GTEST_AVAILABLE" = "xtrue"; then
AC_MSG_RESULT([yes])
BUILD_GTEST="true"
else
AC_MSG_RESULT([no])
BUILD_GTEST="false"
fi
else
AC_MSG_ERROR([--enable-gtest must be either yes or no])
fi
AC_SUBST(BUILD_GTEST) AC_SUBST(BUILD_GTEST)
]) ])

View File

@ -46,19 +46,17 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_VARIANT],
AC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_LEVEL], AC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_LEVEL],
[ [
DEBUG_LEVEL="release" DEBUG_LEVEL="release"
AC_MSG_CHECKING([which debug level to use])
AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug],
[set the debug level to fastdebug (shorthand for --with-debug-level=fastdebug) @<:@disabled@:>@])],
[
ENABLE_DEBUG="${enableval}"
DEBUG_LEVEL="fastdebug"
], [ENABLE_DEBUG="no"])
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], AC_ARG_WITH([debug-level], [AS_HELP_STRING([--with-debug-level],
[set the debug level (release, fastdebug, slowdebug, optimized) @<:@release@:>@])], [set the debug level (release, fastdebug, slowdebug, optimized) @<:@release@:>@])],
[ [
DEBUG_LEVEL="${withval}" DEBUG_LEVEL="${withval}"
if test "x$ENABLE_DEBUG" = xyes; then if test "x$ENABLE_DEBUG" = xtrue; then
AC_MSG_ERROR([You cannot use both --enable-debug and --with-debug-level at the same time.]) AC_MSG_ERROR([You cannot use both --enable-debug and --with-debug-level at the same time.])
fi fi
]) ])
@ -103,77 +101,42 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_LEVEL],
# #
AC_DEFUN_ONCE([JDKOPT_SETUP_OPEN_OR_CUSTOM], AC_DEFUN_ONCE([JDKOPT_SETUP_OPEN_OR_CUSTOM],
[ [
AC_ARG_ENABLE([openjdk-only], [AS_HELP_STRING([--enable-openjdk-only], UTIL_ARG_ENABLE(NAME: openjdk-only, DEFAULT: false,
[suppress building custom source even if present @<:@disabled@:>@])],,[enable_openjdk_only="no"]) RESULT: SUPPRESS_CUSTOM_EXTENSIONS,
DESC: [suppress building custom source even if present],
AC_MSG_CHECKING([if custom source is suppressed (openjdk-only)]) CHECKING_MSG: [if custom source is suppressed (openjdk-only)])
AC_MSG_RESULT([$enable_openjdk_only])
if test "x$enable_openjdk_only" = "xyes"; then
SUPPRESS_CUSTOM_EXTENSIONS="true"
elif test "x$enable_openjdk_only" = "xno"; then
SUPPRESS_CUSTOM_EXTENSIONS="false"
else
AC_MSG_ERROR([Invalid value for --enable-openjdk-only: $enable_openjdk_only])
fi
]) ])
AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS], AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS],
[ [
# Should we build a JDK without a graphical UI? # Should we build a JDK without a graphical UI?
AC_MSG_CHECKING([headless only]) UTIL_ARG_ENABLE(NAME: headless-only, DEFAULT: false,
AC_ARG_ENABLE([headless-only], [AS_HELP_STRING([--enable-headless-only], RESULT: ENABLE_HEADLESS_ONLY,
[only build headless (no GUI) support @<:@disabled@:>@])]) DESC: [only build headless (no GUI) support],
CHECKING_MSG: [if we should build headless-only (no GUI)])
if test "x$enable_headless_only" = "xyes"; then
ENABLE_HEADLESS_ONLY="true"
AC_MSG_RESULT([yes])
elif test "x$enable_headless_only" = "xno"; then
ENABLE_HEADLESS_ONLY="false"
AC_MSG_RESULT([no])
elif test "x$enable_headless_only" = "x"; then
ENABLE_HEADLESS_ONLY="false"
AC_MSG_RESULT([no])
else
AC_MSG_ERROR([--enable-headless-only can only take yes or no])
fi
AC_SUBST(ENABLE_HEADLESS_ONLY) AC_SUBST(ENABLE_HEADLESS_ONLY)
# should we linktime gc unused code sections in the JDK build ? # should we linktime gc unused code sections in the JDK build ?
AC_MSG_CHECKING([linktime gc]) if test "x$OPENJDK_TARGET_OS" = "xlinux" && test "x$OPENJDK_TARGET_CPU" = xs390x; then
AC_ARG_ENABLE([linktime-gc], [AS_HELP_STRING([--enable-linktime-gc], LINKTIME_GC_DEFAULT=true
[linktime gc unused code sections in the JDK build @<:@disabled@:>@])])
if test "x$enable_linktime_gc" = "xyes"; then
ENABLE_LINKTIME_GC="true"
AC_MSG_RESULT([yes])
elif test "x$enable_linktime_gc" = "xno"; then
ENABLE_LINKTIME_GC="false"
AC_MSG_RESULT([no])
elif test "x$OPENJDK_TARGET_OS" = "xlinux" && test "x$OPENJDK_TARGET_CPU" = xs390x; then
ENABLE_LINKTIME_GC="true"
AC_MSG_RESULT([yes])
elif test "x$enable_linktime_gc" = "x"; then
ENABLE_LINKTIME_GC="false"
AC_MSG_RESULT([no])
else else
AC_MSG_ERROR([--enable-linktime-gc can only take yes or no]) LINKTIME_GC_DEFAULT=false
fi 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) AC_SUBST(ENABLE_LINKTIME_GC)
# Check for full doc dependencies
# Should we build the complete docs, or just a lightweight version? FULL_DOCS_AVAILABLE=true
AC_ARG_ENABLE([full-docs], [AS_HELP_STRING([--enable-full-docs],
[build complete documentation @<:@enabled if all tools found@:>@])])
# Verify dependencies
AC_MSG_CHECKING([for graphviz dot]) AC_MSG_CHECKING([for graphviz dot])
if test "x$DOT" != "x"; then if test "x$DOT" != "x"; then
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
else else
AC_MSG_RESULT([no, cannot generate full docs]) AC_MSG_RESULT([no, cannot generate full docs])
FULL_DOCS_DEP_MISSING=true FULL_DOCS_AVAILABLE=false
fi fi
AC_MSG_CHECKING([for pandoc]) AC_MSG_CHECKING([for pandoc])
@ -181,35 +144,13 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS],
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
else else
AC_MSG_RESULT([no, cannot generate full docs]) AC_MSG_RESULT([no, cannot generate full docs])
FULL_DOCS_DEP_MISSING=true FULL_DOCS_AVAILABLE=false
fi
AC_MSG_CHECKING([full docs])
if test "x$enable_full_docs" = xyes; then
if test "x$FULL_DOCS_DEP_MISSING" = "xtrue"; then
AC_MSG_RESULT([no, missing dependencies])
HELP_MSG_MISSING_DEPENDENCY([dot])
AC_MSG_ERROR([Cannot enable full docs with missing dependencies. See above. $HELP_MSG])
else
ENABLE_FULL_DOCS=true
AC_MSG_RESULT([yes, forced])
fi
elif test "x$enable_full_docs" = xno; then
ENABLE_FULL_DOCS=false
AC_MSG_RESULT([no, forced])
elif test "x$enable_full_docs" = x; then
# Check for prerequisites
if test "x$FULL_DOCS_DEP_MISSING" = xtrue; then
ENABLE_FULL_DOCS=false
AC_MSG_RESULT([no, missing dependencies])
else
ENABLE_FULL_DOCS=true
AC_MSG_RESULT([yes, dependencies present])
fi
else
AC_MSG_ERROR([--enable-full-docs can only take yes or no])
fi 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) AC_SUBST(ENABLE_FULL_DOCS)
# Choose cacerts source file # Choose cacerts source file
@ -229,14 +170,8 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS],
AC_SUBST(CACERTS_FILE) AC_SUBST(CACERTS_FILE)
# Enable or disable unlimited crypto # Enable or disable unlimited crypto
AC_ARG_ENABLE(unlimited-crypto, [AS_HELP_STRING([--disable-unlimited-crypto], UTIL_ARG_ENABLE(NAME: unlimited-crypto, DEFAULT: true, RESULT: UNLIMITED_CRYPTO,
[Disable unlimited crypto policy @<:@enabled@:>@])],, DESC: [enable unlimited crypto policy])
[enable_unlimited_crypto=yes])
if test "x$enable_unlimited_crypto" = "xyes"; then
UNLIMITED_CRYPTO=true
else
UNLIMITED_CRYPTO=false
fi
AC_SUBST(UNLIMITED_CRYPTO) AC_SUBST(UNLIMITED_CRYPTO)
# Should we build the serviceability agent (SA)? # Should we build the serviceability agent (SA)?
@ -422,14 +357,19 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_SYMBOLS],
# #
AC_DEFUN_ONCE([JDKOPT_SETUP_CODE_COVERAGE], AC_DEFUN_ONCE([JDKOPT_SETUP_CODE_COVERAGE],
[ [
AC_ARG_ENABLE(native-coverage, [AS_HELP_STRING([--enable-native-coverage], UTIL_ARG_ENABLE(NAME: native-coverage, DEFAULT: false, RESULT: GCOV_ENABLED,
[enable native compilation with code coverage data@<:@disabled@:>@])]) DESC: [enable native compilation with code coverage data],
GCOV_ENABLED="false" CHECK_AVAILABLE: [
if test "x$enable_native_coverage" = "xyes"; then AC_MSG_CHECKING([if native coverage is available])
case $TOOLCHAIN_TYPE in if test "x$TOOLCHAIN_TYPE" = "xgcc" ||
gcc | clang) test "x$TOOLCHAIN_TYPE" = "xclang"; then
AC_MSG_CHECKING([if native coverage is enabled])
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AVAILABLE=false
fi
],
IF_ENABLED: [
GCOV_CFLAGS="-fprofile-arcs -ftest-coverage -fno-inline" GCOV_CFLAGS="-fprofile-arcs -ftest-coverage -fno-inline"
GCOV_LDFLAGS="-fprofile-arcs" GCOV_LDFLAGS="-fprofile-arcs"
JVM_CFLAGS="$JVM_CFLAGS $GCOV_CFLAGS" JVM_CFLAGS="$JVM_CFLAGS $GCOV_CFLAGS"
@ -440,18 +380,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_CODE_COVERAGE],
CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $GCOV_CFLAGS" CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $GCOV_CFLAGS"
LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $GCOV_LDFLAGS" LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $GCOV_LDFLAGS"
LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $GCOV_LDFLAGS" LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $GCOV_LDFLAGS"
GCOV_ENABLED="true" ])
;;
*)
AC_MSG_ERROR([--enable-native-coverage only works with toolchain type gcc or clang])
;;
esac
elif test "x$enable_native_coverage" = "xno"; then
AC_MSG_CHECKING([if native coverage is enabled])
AC_MSG_RESULT([no])
elif test "x$enable_native_coverage" != "x"; then
AC_MSG_ERROR([--enable-native-coverage can only be assigned "yes" or "no"])
fi
AC_SUBST(GCOV_ENABLED) AC_SUBST(GCOV_ENABLED)
AC_ARG_WITH(jcov, [AS_HELP_STRING([--with-jcov], AC_ARG_WITH(jcov, [AS_HELP_STRING([--with-jcov],
@ -498,14 +427,19 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_CODE_COVERAGE],
# #
AC_DEFUN_ONCE([JDKOPT_SETUP_ADDRESS_SANITIZER], AC_DEFUN_ONCE([JDKOPT_SETUP_ADDRESS_SANITIZER],
[ [
AC_ARG_ENABLE(asan, [AS_HELP_STRING([--enable-asan], UTIL_ARG_ENABLE(NAME: asan, DEFAULT: false,
[enable AddressSanitizer if possible @<:@disabled@:>@])]) DESC: [enable AddressSanitizer],
ASAN_ENABLED="no" CHECK_AVAILABLE: [
if test "x$enable_asan" = "xyes"; then AC_MSG_CHECKING([if AddressSanitizer (asan) is available])
case $TOOLCHAIN_TYPE in if test "x$TOOLCHAIN_TYPE" = "xgcc" ||
gcc | clang) test "x$TOOLCHAIN_TYPE" = "xclang"; then
AC_MSG_CHECKING([if asan is enabled])
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AVAILABLE=false
fi
],
IF_ENABLED: [
ASAN_CFLAGS="-fsanitize=address -fno-omit-frame-pointer" ASAN_CFLAGS="-fsanitize=address -fno-omit-frame-pointer"
ASAN_LDFLAGS="-fsanitize=address" ASAN_LDFLAGS="-fsanitize=address"
JVM_CFLAGS="$JVM_CFLAGS $ASAN_CFLAGS" JVM_CFLAGS="$JVM_CFLAGS $ASAN_CFLAGS"
@ -517,17 +451,10 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_ADDRESS_SANITIZER],
LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $ASAN_LDFLAGS" LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $ASAN_LDFLAGS"
LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $ASAN_LDFLAGS" LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $ASAN_LDFLAGS"
ASAN_ENABLED="yes" ASAN_ENABLED="yes"
;; ],
*) IF_DISABLED: [
AC_MSG_ERROR([--enable-asan only works with toolchain type gcc or clang]) ASAN_ENABLED="no"
;; ])
esac
elif test "x$enable_asan" = "xno"; then
AC_MSG_CHECKING([if asan is enabled])
AC_MSG_RESULT([no])
elif test "x$enable_asan" != "x"; then
AC_MSG_ERROR([--enable-asan can only be assigned "yes" or "no"])
fi
AC_SUBST(ASAN_ENABLED) AC_SUBST(ASAN_ENABLED)
]) ])
@ -539,26 +466,23 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_ADDRESS_SANITIZER],
# #
AC_DEFUN_ONCE([JDKOPT_SETUP_STATIC_BUILD], AC_DEFUN_ONCE([JDKOPT_SETUP_STATIC_BUILD],
[ [
AC_ARG_ENABLE([static-build], [AS_HELP_STRING([--enable-static-build], UTIL_ARG_ENABLE(NAME: static-build, DEFAULT: false, RESULT: STATIC_BUILD,
[enable static library build @<:@disabled@:>@])]) DESC: [enable static library build],
STATIC_BUILD=false CHECKING_MSG: [if static build is enabled],
if test "x$enable_static_build" = "xyes"; then CHECK_AVAILABLE: [
AC_MSG_CHECKING([if static build is enabled]) AC_MSG_CHECKING([if static build is available])
if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
if test "x$OPENJDK_TARGET_OS" != "xmacosx"; then else
AC_MSG_ERROR([--enable-static-build is only supported for macosx builds]) AC_MSG_RESULT([no])
AVAILABLE=false
fi fi
],
IF_ENABLED: [
STATIC_BUILD_CFLAGS="-DSTATIC_BUILD=1" STATIC_BUILD_CFLAGS="-DSTATIC_BUILD=1"
CFLAGS_JDKLIB_EXTRA="$CFLAGS_JDKLIB_EXTRA $STATIC_BUILD_CFLAGS" CFLAGS_JDKLIB_EXTRA="$CFLAGS_JDKLIB_EXTRA $STATIC_BUILD_CFLAGS"
CXXFLAGS_JDKLIB_EXTRA="$CXXFLAGS_JDKLIB_EXTRA $STATIC_BUILD_CFLAGS" CXXFLAGS_JDKLIB_EXTRA="$CXXFLAGS_JDKLIB_EXTRA $STATIC_BUILD_CFLAGS"
STATIC_BUILD=true ])
elif test "x$enable_static_build" = "xno"; then
AC_MSG_CHECKING([if static build is enabled])
AC_MSG_RESULT([no])
elif test "x$enable_static_build" != "x"; then
AC_MSG_ERROR([--enable-static-build can only be assigned "yes" or "no"])
fi
AC_SUBST(STATIC_BUILD) AC_SUBST(STATIC_BUILD)
]) ])
@ -569,24 +493,10 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_STATIC_BUILD],
# #
AC_DEFUN_ONCE([JDKOPT_SETUP_JLINK_OPTIONS], AC_DEFUN_ONCE([JDKOPT_SETUP_JLINK_OPTIONS],
[ [
AC_ARG_ENABLE([keep-packaged-modules], [AS_HELP_STRING([--disable-keep-packaged-modules], UTIL_ARG_ENABLE(NAME: keep-packaged-modules, DEFAULT: true,
[Do not keep packaged modules in jdk image @<:@enable@:>@])]) RESULT: JLINK_KEEP_PACKAGED_MODULES,
DESC: [enable keeping of packaged modules in jdk image],
AC_MSG_CHECKING([if packaged modules are kept]) CHECKING_MSG: [if packaged modules are kept])
if test "x$enable_keep_packaged_modules" = "xyes"; then
AC_MSG_RESULT([yes])
JLINK_KEEP_PACKAGED_MODULES=true
elif test "x$enable_keep_packaged_modules" = "xno"; then
AC_MSG_RESULT([no])
JLINK_KEEP_PACKAGED_MODULES=false
elif test "x$enable_keep_packaged_modules" = "x"; then
AC_MSG_RESULT([yes (default)])
JLINK_KEEP_PACKAGED_MODULES=true
else
AC_MSG_RESULT([error])
AC_MSG_ERROR([--enable-keep-packaged-modules accepts no argument])
fi
AC_SUBST(JLINK_KEEP_PACKAGED_MODULES) AC_SUBST(JLINK_KEEP_PACKAGED_MODULES)
]) ])
@ -596,36 +506,20 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JLINK_OPTIONS],
# #
AC_DEFUN_ONCE([JDKOPT_ENABLE_DISABLE_FAILURE_HANDLER], AC_DEFUN_ONCE([JDKOPT_ENABLE_DISABLE_FAILURE_HANDLER],
[ [
AC_ARG_ENABLE([jtreg-failure-handler], [AS_HELP_STRING([--enable-jtreg-failure-handler], UTIL_ARG_ENABLE(NAME: jtreg-failure-handler, DEFAULT: auto,
[forces build of the jtreg failure handler to be enabled, missing dependencies RESULT: BUILD_FAILURE_HANDLER,
become fatal errors. Default is auto, where the failure handler is built if all DESC: [enable keeping of packaged modules in jdk image],
dependencies are present and otherwise just disabled.])]) DEFAULT_DESC: [enabled if jtreg is present],
CHECKING_MSG: [if the jtreg failure handler should be built],
AC_MSG_CHECKING([if jtreg failure handler should be built]) CHECK_AVAILABLE: [
AC_MSG_CHECKING([if the jtreg failure handler is available])
if test "x$enable_jtreg_failure_handler" = "xyes"; then if test "x$JT_HOME" != "x"; then
if test "x$JT_HOME" = "x"; then AC_MSG_RESULT([yes])
AC_MSG_ERROR([Cannot enable jtreg failure handler without jtreg.])
else else
BUILD_FAILURE_HANDLER=true AVAILABLE=false
AC_MSG_RESULT([yes, forced]) AC_MSG_RESULT([no (jtreg not present)])
fi fi
elif test "x$enable_jtreg_failure_handler" = "xno"; then ])
BUILD_FAILURE_HANDLER=false
AC_MSG_RESULT([no, forced])
elif test "x$enable_jtreg_failure_handler" = "xauto" \
|| test "x$enable_jtreg_failure_handler" = "x"; then
if test "x$JT_HOME" = "x"; then
BUILD_FAILURE_HANDLER=false
AC_MSG_RESULT([no, missing jtreg])
else
BUILD_FAILURE_HANDLER=true
AC_MSG_RESULT([yes, jtreg present])
fi
else
AC_MSG_ERROR([Invalid value for --enable-jtreg-failure-handler: $enable_jtreg_failure_handler])
fi
AC_SUBST(BUILD_FAILURE_HANDLER) AC_SUBST(BUILD_FAILURE_HANDLER)
]) ])
@ -635,39 +529,14 @@ AC_DEFUN_ONCE([JDKOPT_ENABLE_DISABLE_FAILURE_HANDLER],
# #
AC_DEFUN_ONCE([JDKOPT_ENABLE_DISABLE_GENERATE_CLASSLIST], AC_DEFUN_ONCE([JDKOPT_ENABLE_DISABLE_GENERATE_CLASSLIST],
[ [
AC_ARG_ENABLE([generate-classlist], [AS_HELP_STRING([--disable-generate-classlist],
[forces enabling or disabling of the generation of a CDS classlist at build time.
Default is to generate it when either the server or client JVMs are built and
enable-cds is true.])])
# In jvm-features.m4 ENABLE_CDS is set to true iff all JVM variants has cds
# enabled.
AC_MSG_CHECKING([if the CDS classlist generation should be enabled])
if test "x$enable_generate_classlist" = "xyes"; then
AC_MSG_RESULT([yes, forced])
ENABLE_GENERATE_CLASSLIST="true"
if test "x$ENABLE_CDS" = "xfalse"; then
# In GenerateLinkOptData.gmk, DumpLoadedClassList is used to generate the # In GenerateLinkOptData.gmk, DumpLoadedClassList is used to generate the
# classlist file. It never will work in this case since the VM will report # classlist file. It never will work if CDS is disabled, since the VM will report
# an error for DumpLoadedClassList when CDS is disabled. # an error for DumpLoadedClassList.
AC_MSG_ERROR([Generation of classlist is not possible without JVM feature 'cds']) UTIL_ARG_ENABLE(NAME: generate-classlist, DEFAULT: auto,
fi RESULT: ENABLE_GENERATE_CLASSLIST, AVAILABLE: $ENABLE_CDS,
elif test "x$enable_generate_classlist" = "xno"; then DESC: [enable generation of a CDS classlist at build time],
AC_MSG_RESULT([no, forced]) DEFAULT_DESC: [enabled if the JVM feature 'cds' is enabled for all JVM variants],
ENABLE_GENERATE_CLASSLIST="false" CHECKING_MSG: [if the CDS classlist generation should be enabled])
elif test "x$enable_generate_classlist" = "x"; then
if test "x$ENABLE_CDS" = "xtrue"; then
AC_MSG_RESULT([yes])
ENABLE_GENERATE_CLASSLIST="true"
else
AC_MSG_RESULT([no])
ENABLE_GENERATE_CLASSLIST="false"
fi
else
AC_MSG_ERROR([Invalid value for --enable-generate-classlist: $enable_generate_classlist])
fi
AC_SUBST(ENABLE_GENERATE_CLASSLIST) AC_SUBST(ENABLE_GENERATE_CLASSLIST)
]) ])
@ -699,56 +568,33 @@ AC_DEFUN([JDKOPT_EXCLUDE_TRANSLATIONS],
# #
AC_DEFUN([JDKOPT_ENABLE_DISABLE_MANPAGES], AC_DEFUN([JDKOPT_ENABLE_DISABLE_MANPAGES],
[ [
AC_ARG_ENABLE([manpages], [AS_HELP_STRING([--disable-manpages], UTIL_ARG_ENABLE(NAME: manpages, DEFAULT: true, RESULT: BUILD_MANPAGES,
[Set to disable copy of static man pages @<:@enabled@:>@])]) DESC: [enable copying of static man pages],
CHECKING_MSG: [if static man pages should be copied])
BUILD_MANPAGES="true"
AC_MSG_CHECKING([if static man pages should be copied])
if test "x$enable_manpages" = "x"; then
AC_MSG_RESULT([yes])
elif test "x$enable_manpages" = "xyes"; then
AC_MSG_RESULT([yes, forced])
elif test "x$enable_manpages" = "xno"; then
AC_MSG_RESULT([no, forced])
BUILD_MANPAGES="false"
else
AC_MSG_RESULT([no])
AC_MSG_ERROR([--enable-manpages can only yes/no or empty])
fi
AC_SUBST(BUILD_MANPAGES) AC_SUBST(BUILD_MANPAGES)
]) ])
################################################################################ ################################################################################
# #
# Disable the default CDS archive generation # Disable the default CDS archive generation
# cross compilation - disabled
# #
AC_DEFUN([JDKOPT_ENABLE_DISABLE_CDS_ARCHIVE], AC_DEFUN([JDKOPT_ENABLE_DISABLE_CDS_ARCHIVE],
[ [
AC_ARG_ENABLE([cds-archive], [AS_HELP_STRING([--disable-cds-archive], UTIL_ARG_ENABLE(NAME: cds-archive, DEFAULT: auto, RESULT: BUILD_CDS_ARCHIVE,
[Set to disable generation of a default CDS archive in the product image @<:@enabled@:>@])]) DESC: [enable generation of a default CDS archive in the product image],
DEFAULT_DESC: [enabled if possible],
AC_MSG_CHECKING([if a default CDS archive should be generated]) 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 if test "x$ENABLE_CDS" = "xfalse"; then
AC_MSG_RESULT([no, because CDS is disabled]) AC_MSG_RESULT([no (CDS is disabled)])
BUILD_CDS_ARCHIVE="false" AVAILABLE=false
elif test "x$COMPILE_TYPE" = "xcross"; then elif test "x$COMPILE_TYPE" = "xcross"; then
AC_MSG_RESULT([no, not possible with cross compilation]) AC_MSG_RESULT([no (not possible with cross compilation)])
BUILD_CDS_ARCHIVE="false" AVAILABLE=false
elif test "x$enable_cds_archive" = "xyes"; then
AC_MSG_RESULT([yes, forced])
BUILD_CDS_ARCHIVE="true"
elif test "x$enable_cds_archive" = "x"; then
AC_MSG_RESULT([yes])
BUILD_CDS_ARCHIVE="true"
elif test "x$enable_cds_archive" = "xno"; then
AC_MSG_RESULT([no, forced])
BUILD_CDS_ARCHIVE="false"
else else
AC_MSG_RESULT([no]) AC_MSG_RESULT([yes])
AC_MSG_ERROR([--enable-cds_archive can only be yes/no or empty])
fi fi
])
AC_SUBST(BUILD_CDS_ARCHIVE) AC_SUBST(BUILD_CDS_ARCHIVE)
]) ])

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -28,6 +28,10 @@
################################################################################ ################################################################################
AC_DEFUN_ONCE([LIB_SETUP_LIBFFI], AC_DEFUN_ONCE([LIB_SETUP_LIBFFI],
[ [
UTIL_ARG_ENABLE(NAME: libffi-bundling, DEFAULT: false,
RESULT: ENABLE_LIBFFI_BUNDLING,
DESC: [enable bundling of libffi.so to make the built JDK runnable on more systems])
AC_ARG_WITH(libffi, [AS_HELP_STRING([--with-libffi], AC_ARG_WITH(libffi, [AS_HELP_STRING([--with-libffi],
[specify prefix directory for the libffi package [specify prefix directory for the libffi package
(expecting the libraries under PATH/lib and the headers under PATH/include)])]) (expecting the libraries under PATH/lib and the headers under PATH/include)])])
@ -35,8 +39,6 @@ AC_DEFUN_ONCE([LIB_SETUP_LIBFFI],
[specify directory for the libffi include files])]) [specify directory for the libffi include files])])
AC_ARG_WITH(libffi-lib, [AS_HELP_STRING([--with-libffi-lib], AC_ARG_WITH(libffi-lib, [AS_HELP_STRING([--with-libffi-lib],
[specify directory for the libffi library])]) [specify directory for the libffi library])])
AC_ARG_ENABLE(libffi-bundling, [AS_HELP_STRING([--enable-libffi-bundling],
[enable bundling of libffi.so to make the built JDK runnable on more systems])])
if test "x$NEEDS_LIB_FFI" = xfalse; then if test "x$NEEDS_LIB_FFI" = xfalse; then
if (test "x${with_libffi}" != x && test "x${with_libffi}" != xno) || \ if (test "x${with_libffi}" != x && test "x${with_libffi}" != xno) || \
@ -114,20 +116,6 @@ AC_DEFUN_ONCE([LIB_SETUP_LIBFFI],
AC_MSG_ERROR([Found libffi but could not link and compile with it. $HELP_MSG]) AC_MSG_ERROR([Found libffi but could not link and compile with it. $HELP_MSG])
fi fi
AC_MSG_CHECKING([if libffi should be bundled])
if test "x$enable_libffi_bundling" = "x"; then
AC_MSG_RESULT([no])
ENABLE_LIBFFI_BUNDLING=false
elif test "x$enable_libffi_bundling" = "xno"; then
AC_MSG_RESULT([no, forced])
ENABLE_LIBFFI_BUNDLING=false
elif test "x$enable_libffi_bundling" = "xyes"; then
AC_MSG_RESULT([yes, forced])
ENABLE_LIBFFI_BUNDLING=true
else
AC_MSG_ERROR([Invalid value for --enable-libffi-bundling])
fi
# Find the libffi.so.X to bundle # Find the libffi.so.X to bundle
if test "x${ENABLE_LIBFFI_BUNDLING}" = "xtrue"; then if test "x${ENABLE_LIBFFI_BUNDLING}" = "xtrue"; then
AC_MSG_CHECKING([for libffi lib file location]) AC_MSG_CHECKING([for libffi lib file location])

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -563,11 +563,14 @@ AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_AND_TARGET],
AC_DEFUN([PLATFORM_CHECK_DEPRECATION], AC_DEFUN([PLATFORM_CHECK_DEPRECATION],
[ [
AC_ARG_ENABLE(deprecated-ports, [AS_HELP_STRING([--enable-deprecated-ports@<:@=yes/no@:>@], UTIL_ARG_ENABLE(NAME: deprecated-ports, DEFAULT: false,
[Suppress the error when configuring for a deprecated port @<:@no@:>@])]) RESULT: ENABLE_DEPRECATED_PORTS,
DESC: [suppress the error when configuring for a deprecated port])
if test "x$OPENJDK_TARGET_OS" = xsolaris || (test "x$OPENJDK_TARGET_CPU_ARCH" = xsparc && test "x$with_jvm_variants" != xzero); then if test "x$OPENJDK_TARGET_OS" = xsolaris || \
if test "x$enable_deprecated_ports" = "xyes"; then (test "x$OPENJDK_TARGET_CPU_ARCH" = xsparc && \
test "x$with_jvm_variants" != xzero); then
if test "x$ENABLE_DEPRECATED_PORTS" = "xtrue"; then
AC_MSG_WARN([The Solaris and SPARC ports are deprecated and may be removed in a future release.]) AC_MSG_WARN([The Solaris and SPARC ports are deprecated and may be removed in a future release.])
else else
AC_MSG_ERROR(m4_normalize([The Solaris and SPARC ports are deprecated and may be removed in a AC_MSG_ERROR(m4_normalize([The Solaris and SPARC ports are deprecated and may be removed in a

View File

@ -53,7 +53,7 @@ m4_include([util_windows.m4])
AC_DEFUN([UTIL_DEFUN_NAMED], AC_DEFUN([UTIL_DEFUN_NAMED],
[ [
AC_DEFUN($1, [ AC_DEFUN($1, [
m4_foreach(arg, m4_split($2), [ m4_foreach(arg, m4_split(m4_normalize($2)), [
m4_if(m4_bregexp(arg, [^\*]), -1, m4_if(m4_bregexp(arg, [^\*]), -1,
[ [
m4_set_add(legal_named_args, arg) m4_set_add(legal_named_args, arg)
@ -66,11 +66,12 @@ AC_DEFUN([UTIL_DEFUN_NAMED],
]) ])
m4_foreach([arg], [$3], [ m4_foreach([arg], [$3], [
m4_if(m4_bregexp(arg, [: ]), -1, m4_define([arg], m4_bpatsubst(arg, [:], [: ])))
m4_define(arg_name, m4_substr(arg, 0, m4_bregexp(arg, [: ]))) m4_define(arg_name, m4_substr(arg, 0, m4_bregexp(arg, [: ])))
m4_set_contains(legal_named_args, arg_name, [],[AC_MSG_ERROR([Internal error: arg_name is not a valid named argument to [$1]. Valid arguments are 'm4_set_contents(legal_named_args, [ ])'.])]) m4_set_contains(legal_named_args, arg_name, [],[AC_MSG_ERROR([Internal error: m4_if(arg_name, , arg, arg_name) is not a valid named argument to [$1]. Valid arguments are 'm4_set_contents(defined_args, [ ]) m4_set_contents(legal_named_args, [ ])'.])])
m4_set_remove(required_named_args, arg_name) m4_set_remove(required_named_args, arg_name)
m4_set_remove(legal_named_args, arg_name) m4_set_remove(legal_named_args, arg_name)
m4_pushdef([ARG_][]arg_name, m4_substr(arg, m4_incr(m4_incr(m4_bregexp(arg, [: ]))))) m4_pushdef([ARG_][]arg_name, m4_bpatsubst(m4_substr(arg, m4_incr(m4_incr(m4_bregexp(arg, [: ])))), [^\s*], []))
m4_set_add(defined_args, arg_name) m4_set_add(defined_args, arg_name)
m4_undefine([arg_name]) m4_undefine([arg_name])
]) ])
@ -95,6 +96,27 @@ AC_DEFUN([UTIL_DEFUN_NAMED],
]) ])
]) ])
###############################################################################
# Assert that a programmatic condition holds. If not, exit with an error message.
# Check that a shell expression gives return code 0
#
# $1: The shell expression to evaluate
# $2: A message to describe the expression in case of failure
# $2: An message to print in case of failure [optional]
#
AC_DEFUN([UTIL_ASSERT_SHELL_TEST],
[
ASSERTION_MSG="m4_normalize([$3])"
if $1; then
$ECHO Assertion failed: $2
if test "x$3" != x; then
$ECHO Assertion message: "$3"
fi
exit 1
fi
])
############################################################################### ###############################################################################
# Assert that a programmatic condition holds. If not, exit with an error message. # Assert that a programmatic condition holds. If not, exit with an error message.
# Check that two strings are equal. # Check that two strings are equal.
@ -105,15 +127,50 @@ AC_DEFUN([UTIL_DEFUN_NAMED],
# #
AC_DEFUN([UTIL_ASSERT_STRING_EQUALS], AC_DEFUN([UTIL_ASSERT_STRING_EQUALS],
[ [
ASSERTION_MSG="m4_normalize([$3])" UTIL_ASSERT_SHELL_TEST(
if test "x[$1]" != "x[$2]"; then [test "x[$1]" != "x[$2]"],
$ECHO Assertion failed: Actual value '[$1]' \("[$1]"\) did not match \ [Actual value '[$1]' \("[$1]"\) did not match expected value '[$2]' \("[$2]"\)],
expected value '[$2]' \("[$2]"\) $3)
if test "x$ASSERTION_MSG" != x; then ])
$ECHO Assertion message: "$ASSERTION_MSG"
fi ###############################################################################
exit 1 # Assert that a programmatic condition holds. If not, exit with an error message.
fi # Check that two strings not are equal.
#
# $1: The actual string found
# $2: The expected string
# $3: An message to print in case of failure [optional]
#
AC_DEFUN([UTIL_ASSERT_STRING_NOT_EQUALS],
[
UTIL_ASSERT_SHELL_TEST(
[test "x[$1]" = "x[$2]"],
[Actual value '[$1]' \("[$1]"\) unexpectedly matched '[$2]' \("[$2]"\)],
$3)
])
###############################################################################
# Assert that a programmatic condition holds. If not, exit with an error message.
# Check that the given expression evaluates to the string 'true'
#
# $1: The expression to evaluate
# $2: An message to print in case of failure [optional]
#
AC_DEFUN([UTIL_ASSERT_TRUE],
[
UTIL_ASSERT_STRING_EQUALS($1, true, $3)
])
###############################################################################
# Assert that a programmatic condition holds. If not, exit with an error message.
# Check that the given expression does not evaluate to the string 'true'
#
# $1: The expression to evaluate
# $2: An message to print in case of failure [optional]
#
AC_DEFUN([UTIL_ASSERT_NOT_TRUE],
[
UTIL_ASSERT_STRING_NOT_EQUALS($1, true, $3)
]) ])
############################################################################### ###############################################################################
@ -249,6 +306,143 @@ AC_DEFUN([UTIL_ALIASED_ARG_ENABLE],
]) ])
]) ])
###############################################################################
# Creates a command-line option using the --enable-* pattern. Will return a
# value of 'true' or 'false' in the RESULT variable, depending on whether the
# option was enabled or not by the user. The option can not be turned on if it
# is not available, as specified by AVAILABLE and/or AVAILABLE_CHECK.
#
# Arguments:
# NAME: The base name of this option (i.e. what follows --enable-). Required.
# RESULT: The name of the variable to set to the result. Defaults to
# <NAME in uppercase>_RESULT.
# DEFAULT: The default value for this option. Can be true, false or auto.
# Defaults to true.
# AVAILABLE: If true, this option is allowed to be selected. Defaults to true.
# DESC: A description of this option. Defaults to a generic and unhelpful
# string.
# DEFAULT_DESC: A message describing the default value, for the help. Defaults
# to the literal value of DEFAULT.
# CHECKING_MSG: The message to present to user when checking this option.
# Defaults to a generic message.
# CHECK_AVAILABLE: An optional code block to execute to determine if the
# option should be available. Must set AVAILABLE to 'false' if not.
# IF_GIVEN: An optional code block to execute if the option was given on the
# command line (regardless of the value).
# IF_ENABLED: An optional code block to execute if the option is turned on.
# IF_DISABLED: An optional code block to execute if the option is turned off.
#
UTIL_DEFUN_NAMED([UTIL_ARG_ENABLE],
[*NAME RESULT DEFAULT AVAILABLE DESC DEFAULT_DESC CHECKING_MSG
CHECK_AVAILABLE IF_GIVEN IF_ENABLED IF_DISABLED], [$@],
[
##########################
# Part 1: Set up m4 macros
##########################
# If DEFAULT is not specified, set it to 'true'.
m4_define([ARG_DEFAULT], m4_if(ARG_DEFAULT, , true, ARG_DEFAULT))
# If AVAILABLE is not specified, set it to 'true'.
m4_define([ARG_AVAILABLE], m4_if(ARG_AVAILABLE, , true, ARG_AVAILABLE))
# If DEFAULT_DESC is not specified, calculate it from DEFAULT.
m4_define([ARG_DEFAULT_DESC], m4_if(ARG_DEFAULT_DESC, , m4_if(ARG_DEFAULT, true, enabled, m4_if(ARG_DEFAULT, false, disabled, ARG_DEFAULT)), ARG_DEFAULT_DESC))
# If RESULT is not specified, set it to 'ARG_NAME[_ENABLED]'.
m4_define([ARG_RESULT], m4_if(ARG_RESULT, , m4_translit(ARG_NAME, [a-z-], [A-Z_])[_ENABLED], ARG_RESULT))
# Construct shell variable names for the option
m4_define(ARG_OPTION, [enable_]m4_translit(ARG_NAME, [-], [_]))
m4_define(ARG_GIVEN, m4_translit(ARG_NAME, [a-z-], [A-Z_])[_GIVEN])
# If DESC is not specified, set it to a generic description.
m4_define([ARG_DESC], m4_if(ARG_DESC, , [Enable the ARG_NAME feature], m4_normalize(ARG_DESC)))
# If CHECKING_MSG is not specified, set it to a generic description.
m4_define([ARG_CHECKING_MSG], m4_if(ARG_CHECKING_MSG, , [for --enable-ARG_NAME], ARG_CHECKING_MSG))
# If the code blocks are not given, set them to the empty statements to avoid
# tripping up bash.
m4_define([ARG_CHECK_AVAILABLE], m4_if(ARG_CHECK_AVAILABLE, , :, ARG_CHECK_AVAILABLE))
m4_define([ARG_IF_GIVEN], m4_if(ARG_IF_GIVEN, , :, ARG_IF_GIVEN))
m4_define([ARG_IF_ENABLED], m4_if(ARG_IF_ENABLED, , :, ARG_IF_ENABLED))
m4_define([ARG_IF_DISABLED], m4_if(ARG_IF_DISABLED, , :, ARG_IF_DISABLED))
##########################
# Part 2: Set up autoconf shell code
##########################
# Check that DEFAULT has a valid value
if test "[x]ARG_DEFAULT" != xtrue && test "[x]ARG_DEFAULT" != xfalse && \
test "[x]ARG_DEFAULT" != xauto ; then
AC_MSG_ERROR([Internal error: Argument DEFAULT to [UTIL_ARG_ENABLE] can only be true, false or auto, was: 'ARG_DEFAULT'])
fi
# Check that AVAILABLE has a valid value
if test "[x]ARG_AVAILABLE" != xtrue && test "[x]ARG_AVAILABLE" != xfalse; then
AC_MSG_ERROR([Internal error: Argument AVAILABLE to [UTIL_ARG_ENABLE] can only be true or false, was: 'ARG_AVAILABLE'])
fi
AC_ARG_ENABLE(ARG_NAME, AS_HELP_STRING([--enable-]ARG_NAME,
[ARG_DESC [ARG_DEFAULT_DESC]]), [ARG_GIVEN=true], [ARG_GIVEN=false])
# Check if the option is available
AVAILABLE=ARG_AVAILABLE
# Run the available check block (if any), which can overwrite AVAILABLE.
ARG_CHECK_AVAILABLE
# Check if the option should be turned on
AC_MSG_CHECKING(ARG_CHECKING_MSG)
if test x$ARG_GIVEN = xfalse; then
if test ARG_DEFAULT = auto; then
# If not given, and default is auto, set it to true iff it's available.
ARG_RESULT=$AVAILABLE
REASON="from default 'auto'"
else
ARG_RESULT=ARG_DEFAULT
REASON="default"
fi
else
if test x$ARG_OPTION = xyes; then
ARG_RESULT=true
REASON="from command line"
elif test x$ARG_OPTION = xno; then
ARG_RESULT=false
REASON="from command line"
elif test x$ARG_OPTION = xauto; then
if test ARG_DEFAULT = auto; then
# If both given and default is auto, set it to true iff it's available.
ARG_RESULT=$AVAILABLE
else
ARG_RESULT=ARG_DEFAULT
fi
REASON="from command line 'auto'"
else
AC_MSG_ERROR([Option [--enable-]ARG_NAME can only be 'yes', 'no' or 'auto'])
fi
fi
if test x$ARG_RESULT = xtrue; then
AC_MSG_RESULT([enabled, $REASON])
if test x$AVAILABLE = xfalse; then
AC_MSG_ERROR([Option [--enable-]ARG_NAME is not available])
fi
else
AC_MSG_RESULT([disabled, $REASON])
fi
# Execute result payloads, if present
if test x$ARG_GIVEN = xtrue; then
ARG_IF_GIVEN
fi
if test x$ARG_RESULT = xtrue; then
ARG_IF_ENABLED
else
ARG_IF_DISABLED
fi
])
############################################################################### ###############################################################################
# Test that variable $1 denoting a program is not empty. If empty, exit with an error. # Test that variable $1 denoting a program is not empty. If empty, exit with an error.
# $1: variable to check # $1: variable to check

View File

@ -46,6 +46,51 @@ AC_DEFUN([TEST_STRING_OPS],
[UTIL_GET_MATCHING_VALUES failed]) [UTIL_GET_MATCHING_VALUES failed])
]) ])
AC_DEFUN([TEST_ARG_ENABLE],
[
# fake '--enable-default-false=yes' on the command line
enable_default_false=yes
UTIL_ARG_ENABLE(NAME: default-false, DEFAULT: false, RESULT: TEST_RESULT)
UTIL_ASSERT_TRUE($TEST_RESULT)
# assume '--enable-default-true-but-unavailable=yes' not set
UTIL_ARG_ENABLE(NAME: default-true-but-unavailable, DEFAULT: auto, RESULT: TEST_RESULT, AVAILABLE: false)
UTIL_ASSERT_NOT_TRUE($TEST_RESULT)
enable_test_given_yes=yes
given=false
enabled=false
disabled=false
UTIL_ARG_ENABLE(NAME: test-given-yes, DEFAULT: false,
IF_GIVEN: [ given=true ], IF_ENABLED: [ enabled=true ],
IF_DISABLED: [ disabled=true ])
UTIL_ASSERT_TRUE($given)
UTIL_ASSERT_TRUE($enabled)
UTIL_ASSERT_NOT_TRUE($disabled)
enable_test_given_default=no
given=false
enabled=false
disabled=false
UTIL_ARG_ENABLE(NAME: test-given-default, DEFAULT: true,
IF_GIVEN: [ given=true ], IF_ENABLED: [ enabled=true ],
IF_DISABLED: [ disabled=true ])
UTIL_ASSERT_TRUE($given)
UTIL_ASSERT_NOT_TRUE($enabled)
UTIL_ASSERT_TRUE($disabled)
# assume '--enable-test-given-no' not set
given=false
enabled=false
disabled=false
UTIL_ARG_ENABLE(NAME: test-given-no, DEFAULT: true,
IF_GIVEN: [ given=true ], IF_ENABLED: [ enabled=true ],
IF_DISABLED: [ disabled=true ])
UTIL_ASSERT_NOT_TRUE($given)
UTIL_ASSERT_TRUE($enabled)
UTIL_ASSERT_NOT_TRUE($disabled)
])
# Use the CUSTOM_EARLY_HOOK to inject our test after basic init is done. # Use the CUSTOM_EARLY_HOOK to inject our test after basic init is done.
AC_DEFUN_ONCE([CUSTOM_EARLY_HOOK], AC_DEFUN_ONCE([CUSTOM_EARLY_HOOK],
[ [
@ -53,6 +98,7 @@ AC_DEFUN_ONCE([CUSTOM_EARLY_HOOK],
$PRINTF "==============================\n" $PRINTF "==============================\n"
TEST_STRING_OPS TEST_STRING_OPS
TEST_ARG_ENABLE
# If no assertions failed, report success # If no assertions failed, report success
$PRINTF "==============================\n" $PRINTF "==============================\n"