diff --git a/make/autoconf/basic.m4 b/make/autoconf/basic.m4 index 6daba35547bd6..e595dbbd00332 100644 --- a/make/autoconf/basic.m4 +++ b/make/autoconf/basic.m4 @@ -194,17 +194,8 @@ AC_DEFUN([BASIC_SETUP_XCODE_SYSROOT], if test $? -ne 0; then AC_MSG_ERROR([The xcodebuild tool in the devkit reports an error: $XCODEBUILD_OUTPUT]) fi - elif test "x$TOOLCHAIN_PATH" != x; then - UTIL_LOOKUP_PROGS(XCODEBUILD, xcodebuild, $TOOLCHAIN_PATH) - if test "x$XCODEBUILD" != x; then - XCODEBUILD_OUTPUT=`"$XCODEBUILD" -version 2>&1` - if test $? -ne 0; then - AC_MSG_WARN([Ignoring the located xcodebuild tool $XCODEBUILD due to an error: $XCODEBUILD_OUTPUT]) - XCODEBUILD= - fi - fi else - UTIL_LOOKUP_PROGS(XCODEBUILD, xcodebuild) + UTIL_LOOKUP_TOOLCHAIN_PROGS(XCODEBUILD, xcodebuild) if test "x$XCODEBUILD" != x; then XCODEBUILD_OUTPUT=`"$XCODEBUILD" -version 2>&1` if test $? -ne 0; then @@ -332,21 +323,11 @@ AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT], # You can force the sysroot if the sysroot encoded into the compiler tools # is not correct. - AC_ARG_WITH(sys-root, [AS_HELP_STRING([--with-sys-root], - [alias for --with-sysroot for backwards compatibility])], - [SYSROOT=$with_sys_root] - ) - AC_ARG_WITH(sysroot, [AS_HELP_STRING([--with-sysroot], [use this directory as sysroot])], [SYSROOT=$with_sysroot] ) - AC_ARG_WITH([tools-dir], [AS_HELP_STRING([--with-tools-dir], - [alias for --with-toolchain-path for backwards compatibility])], - [UTIL_PREPEND_TO_PATH([TOOLCHAIN_PATH],$with_tools_dir)] - ) - AC_ARG_WITH([toolchain-path], [AS_HELP_STRING([--with-toolchain-path], [prepend these directories when searching for toolchain binaries (compilers etc)])], [UTIL_PREPEND_TO_PATH([TOOLCHAIN_PATH],$with_toolchain_path)] @@ -355,6 +336,9 @@ AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT], AC_ARG_WITH([xcode-path], [AS_HELP_STRING([--with-xcode-path], [set up toolchain on Mac OS using a path to an Xcode installation])]) + UTIL_DEPRECATED_ARG_WITH(sys-root) + UTIL_DEPRECATED_ARG_WITH(tools-dir) + if test "x$with_xcode_path" != x; then if test "x$OPENJDK_BUILD_OS" = "xmacosx"; then UTIL_PREPEND_TO_PATH([TOOLCHAIN_PATH], diff --git a/make/autoconf/basic_tools.m4 b/make/autoconf/basic_tools.m4 index eceb0ae6cc44f..7cb21cebc83a6 100644 --- a/make/autoconf/basic_tools.m4 +++ b/make/autoconf/basic_tools.m4 @@ -209,29 +209,14 @@ AC_DEFUN([BASIC_CHECK_GNU_MAKE], UTIL_SETUP_TOOL(MAKE, [ # Try our hardest to locate a correct version of GNU make - UTIL_LOOKUP_PROGS(CHECK_GMAKE, gmake) + UTIL_LOOKUP_TOOLCHAIN_PROGS(CHECK_GMAKE, gmake) BASIC_CHECK_MAKE_VERSION("$CHECK_GMAKE", [gmake in PATH]) if test "x$FOUND_MAKE" = x; then - UTIL_LOOKUP_PROGS(CHECK_MAKE, make) + UTIL_LOOKUP_TOOLCHAIN_PROGS(CHECK_MAKE, make) BASIC_CHECK_MAKE_VERSION("$CHECK_MAKE", [make in PATH]) fi - if test "x$FOUND_MAKE" = x; then - if test "x$TOOLCHAIN_PATH" != x; then - # We have a toolchain path, check that as well before giving up. - OLD_PATH=$PATH - PATH=$TOOLCHAIN_PATH:$PATH - UTIL_LOOKUP_PROGS(CHECK_TOOLSDIR_GMAKE, gmake) - BASIC_CHECK_MAKE_VERSION("$CHECK_TOOLSDIR_GMAKE", [gmake in tools-dir]) - if test "x$FOUND_MAKE" = x; then - UTIL_LOOKUP_PROGS(CHECK_TOOLSDIR_MAKE, make) - BASIC_CHECK_MAKE_VERSION("$CHECK_TOOLSDIR_MAKE", [make in tools-dir]) - fi - PATH=$OLD_PATH - fi - fi - if test "x$FOUND_MAKE" = x; then AC_MSG_ERROR([Cannot find GNU make $MAKE_REQUIRED_VERSION or newer! Please put it in the path, or add e.g. MAKE=/opt/gmake3.81/make as argument to configure.]) fi diff --git a/make/autoconf/build-performance.m4 b/make/autoconf/build-performance.m4 index 4414ea0d93c9d..5db4ded660b3d 100644 --- a/make/autoconf/build-performance.m4 +++ b/make/autoconf/build-performance.m4 @@ -161,12 +161,7 @@ AC_DEFUN([BPERF_SETUP_CCACHE], # Check if ccache is available CCACHE_AVAILABLE=true - OLD_PATH="$PATH" - if test "x$TOOLCHAIN_PATH" != x; then - PATH=$TOOLCHAIN_PATH:$PATH - fi - UTIL_LOOKUP_PROGS(CCACHE, ccache) - PATH="$OLD_PATH" + UTIL_LOOKUP_TOOLCHAIN_PROGS(CCACHE, ccache) AC_MSG_CHECKING([if ccache is available]) if test "x$TOOLCHAIN_TYPE" != "xgcc" && test "x$TOOLCHAIN_TYPE" != "xclang"; then diff --git a/make/autoconf/flags-ldflags.m4 b/make/autoconf/flags-ldflags.m4 index 509e0dd825f06..a12a6e7f9a60a 100644 --- a/make/autoconf/flags-ldflags.m4 +++ b/make/autoconf/flags-ldflags.m4 @@ -74,7 +74,7 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER], # Clang needs the lld linker to work correctly BASIC_LDFLAGS="-fuse-ld=lld -Wl,--exclude-libs,ALL" if test "x$CXX_IS_USER_SUPPLIED" = xfalse && test "x$CC_IS_USER_SUPPLIED" = xfalse; then - UTIL_REQUIRE_PROGS(LLD, lld, $TOOLCHAIN_PATH:$PATH) + UTIL_REQUIRE_TOOLCHAIN_PROGS(LLD, lld) fi fi if test "x$OPENJDK_TARGET_OS" = xaix; then diff --git a/make/autoconf/toolchain.m4 b/make/autoconf/toolchain.m4 index 9013f9cf9221f..7319939a77687 100644 --- a/make/autoconf/toolchain.m4 +++ b/make/autoconf/toolchain.m4 @@ -276,9 +276,6 @@ AC_DEFUN_ONCE([TOOLCHAIN_PRE_DETECTION], ORG_CFLAGS="$CFLAGS" ORG_CXXFLAGS="$CXXFLAGS" - # autoconf magic only relies on PATH, so update it if tools dir is specified - OLD_PATH="$PATH" - if test "x$OPENJDK_BUILD_OS" = "xmacosx"; then if test "x$XCODEBUILD" != x; then XCODE_VERSION_OUTPUT=`"$XCODEBUILD" -version 2> /dev/null | $HEAD -n 1` @@ -295,9 +292,10 @@ AC_DEFUN_ONCE([TOOLCHAIN_PRE_DETECTION], fi AC_SUBST(TOOLCHAIN_VERSION) - # Finally prepend TOOLCHAIN_PATH to the PATH, to allow --with-tools-dir to - # override all other locations. - if test "x$TOOLCHAIN_PATH" != x; then + # For the microsoft toolchain the toolchain path needs to be added to the + # normal path, or the compiler will not work in some situations in later + # configure checks. + if test "x$TOOLCHAIN_TYPE" = "xmicrosoft" && test "x$TOOLCHAIN_PATH" != x; then export PATH=$TOOLCHAIN_PATH:$PATH fi ]) @@ -305,13 +303,6 @@ AC_DEFUN_ONCE([TOOLCHAIN_PRE_DETECTION], # Restore path, etc AC_DEFUN_ONCE([TOOLCHAIN_POST_DETECTION], [ - # Restore old path, except for the microsoft toolchain, which requires the - # toolchain path to remain in place. Otherwise the compiler will not work in - # some situations in later configure checks. - if test "x$TOOLCHAIN_TYPE" != "xmicrosoft"; then - PATH="$OLD_PATH" - fi - # Restore the flags to the user specified values. # This is necessary since AC_PROG_CC defaults CFLAGS to "-g -O2" CFLAGS="$ORG_CFLAGS" diff --git a/make/autoconf/util_paths.m4 b/make/autoconf/util_paths.m4 index 9e3e5472c9e49..b79ae0f643fed 100644 --- a/make/autoconf/util_paths.m4 +++ b/make/autoconf/util_paths.m4 @@ -443,17 +443,18 @@ AC_DEFUN([UTIL_LOOKUP_PROGS], ################################################################################ # Call UTIL_SETUP_TOOL with AC_CHECK_TOOLS to locate the tool. This will look -# first for cross-compilation tools. +# first for tools using the cross-compilation prefix, and then for tools without +# this prefix. For each of these name variants, it will look first in the +# toolchain path, and then in the normal path. # $1: variable to set # $2: executable name (or list of names) to look for -# $3: [path] AC_DEFUN([UTIL_LOOKUP_TOOLCHAIN_PROGS], [ if test "x$ac_tool_prefix" = x; then - UTIL_LOOKUP_PROGS($1, $2, $3) + UTIL_LOOKUP_PROGS($1, $2, [$TOOLCHAIN_PATH:$PATH]) else prefixed_names=$(for name in $2; do echo ${ac_tool_prefix}${name} $name; done) - UTIL_LOOKUP_PROGS($1, $prefixed_names, $3) + UTIL_LOOKUP_PROGS($1, $prefixed_names, [$TOOLCHAIN_PATH:$PATH]) fi ]) @@ -482,10 +483,9 @@ AC_DEFUN([UTIL_REQUIRE_PROGS], # Like UTIL_LOOKUP_PROGS but fails if no tool was found. # $1: variable to set # $2: executable name (or list of names) to look for -# $3: [path] AC_DEFUN([UTIL_REQUIRE_TOOLCHAIN_PROGS], [ - UTIL_LOOKUP_TOOLCHAIN_PROGS($1, $2, $3) + UTIL_LOOKUP_TOOLCHAIN_PROGS($1, $2) UTIL_CHECK_NONEMPTY($1) ])