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