Blob Blame History Raw
# HG changeset patch
# User ihse
# Date 1454642639 0
#      Fri Feb 05 03:23:59 2016 +0000
# Node ID 61798573efe5a9efa67e268a52cf61263abb4396
# Parent  842cc183c9f6d29270ff002238248978c08f0a66
8148351, PR2842: Only display resolved symlink for compiler, do not change path
Reviewed-by: erikj

diff --git a/common/autoconf/toolchain.m4 b/common/autoconf/toolchain.m4
--- openjdk///common/autoconf/toolchain.m4
+++ openjdk///common/autoconf/toolchain.m4
@@ -198,38 +198,22 @@
   fi
   BASIC_FIXUP_EXECUTABLE($1)
   TEST_COMPILER="[$]$1"
-  # Don't remove symbolic links on AIX because 'xlc_r' and 'xlC_r' may all be links
-  # to 'xlc' but it is crucial that we invoke the compiler with the right name!
-  if test "x$OPENJDK_BUILD_OS" != xaix; then
-    AC_MSG_CHECKING([resolved symbolic links for $1])
-    BASIC_REMOVE_SYMBOLIC_LINKS(TEST_COMPILER)
-    AC_MSG_RESULT([$TEST_COMPILER])
-  fi
-  AC_MSG_CHECKING([if $1 is disguised ccache])
 
-  COMPILER_BASENAME=`$BASENAME "$TEST_COMPILER"`
-  if test "x$COMPILER_BASENAME" = "xccache"; then
-    AC_MSG_RESULT([yes, trying to find proper $COMPILER_NAME compiler])
-    # We /usr/lib/ccache in the path, so cc is a symlink to /usr/bin/ccache.
-    # We want to control ccache invocation ourselves, so ignore this cc and try
-    # searching again.
+  AC_MSG_CHECKING([resolved symbolic links for $1])
+  SYMLINK_ORIGINAL="$TEST_COMPILER"
+  BASIC_REMOVE_SYMBOLIC_LINKS(SYMLINK_ORIGINAL)
+  if test "x$TEST_COMPILER" = "x$SYMLINK_ORIGINAL"; then
+    AC_MSG_RESULT([no symlink])
+  else
+    AC_MSG_RESULT([$SYMLINK_ORIGINAL])
 
-    # Remove the path to the fake ccache cc from the PATH
-    RETRY_COMPILER_SAVED_PATH="$PATH"
-    COMPILER_DIRNAME=`$DIRNAME [$]$1`
-    PATH="`$ECHO $PATH | $SED -e "s,$COMPILER_DIRNAME,,g" -e "s,::,:,g" -e "s,^:,,g"`"
-
-    # Try again looking for our compiler
-    AC_CHECK_TOOLS(PROPER_COMPILER_$1, $3)
-    BASIC_FIXUP_EXECUTABLE(PROPER_COMPILER_$1)
-    PATH="$RETRY_COMPILER_SAVED_PATH"
-
-    AC_MSG_CHECKING([for resolved symbolic links for $1])
-    BASIC_REMOVE_SYMBOLIC_LINKS(PROPER_COMPILER_$1)
-    AC_MSG_RESULT([$PROPER_COMPILER_$1])
-    $1="$PROPER_COMPILER_$1"
-  else
-    AC_MSG_RESULT([no, keeping $1])
+    # We can't handle ccache by gcc wrappers, since we need to know if we're
+    # using ccache. Instead ccache usage must be controlled by a configure option.
+    COMPILER_BASENAME=`$BASENAME "$SYMLINK_ORIGINAL"`
+    if test "x$COMPILER_BASENAME" = "xccache"; then
+      AC_MSG_NOTICE([Please use --enable-ccache instead of providing a wrapped compiler.])
+      AC_MSG_ERROR([$TEST_COMPILER is a symbolic link to ccache. This is not supported.])
+    fi
   fi
 
   TOOLCHAIN_EXTRACT_COMPILER_VERSION([$1], [$COMPILER_NAME])