< prev index next >

common/autoconf/toolchain.m4

Print this page
@  rev 2182 : 8148351: Only display resolved symlink for compiler, do not change path
|  Reviewed-by: erikj
o  rev 2181 : 8031668: TOOLCHAIN_FIND_COMPILER unexpectedly resolves symbolic links
|  Reviewed-by: erikj, ihse
~


 517       $1=$TOOLCHAIN_PATH_$1
 518       PATH="$PATH_save"
 519     fi
 520 
 521     # AC_PATH_PROGS can't be run multiple times with the same variable,
 522     # so create a new name for this run.
 523     if test "x[$]$1" = x; then
 524       AC_PATH_PROGS(POTENTIAL_$1, $3)
 525       $1=$POTENTIAL_$1
 526     fi
 527 
 528     if test "x[$]$1" = x; then
 529       HELP_MSG_MISSING_DEPENDENCY([devkit])
 530       AC_MSG_ERROR([Could not find a $COMPILER_NAME compiler. $HELP_MSG])
 531     fi
 532   fi
 533 
 534   # Now we have a compiler binary in $1. Make sure it's okay.
 535   BASIC_FIXUP_EXECUTABLE($1)
 536   TEST_COMPILER="[$]$1"
 537   # Don't remove symbolic links on AIX because 'xlc_r' and 'xlC_r' may all be links
 538   # to 'xlc' but it is crucial that we invoke the compiler with the right name!
 539   if test "x$OPENJDK_BUILD_OS" != xaix; then
 540     # FIXME: This test should not be needed anymore; we don't do that for any platform.
 541     AC_MSG_CHECKING([resolved symbolic links for $1])
 542     BASIC_REMOVE_SYMBOLIC_LINKS(TEST_COMPILER)
 543     AC_MSG_RESULT([$TEST_COMPILER])
 544   fi
 545   AC_MSG_CHECKING([if $1 is disguised ccache])


 546 
 547   COMPILER_BASENAME=`$BASENAME "$TEST_COMPILER"`


 548   if test "x$COMPILER_BASENAME" = "xccache"; then
 549     AC_MSG_RESULT([yes, trying to find proper $COMPILER_NAME compiler])
 550     # We /usr/lib/ccache in the path, so cc is a symlink to /usr/bin/ccache.
 551     # We want to control ccache invocation ourselves, so ignore this cc and try
 552     # searching again.
 553 
 554     # Remove the path to the fake ccache cc from the PATH
 555     RETRY_COMPILER_SAVED_PATH="$PATH"
 556     COMPILER_DIRNAME=`$DIRNAME [$]$1`
 557     PATH="`$ECHO $PATH | $SED -e "s,$COMPILER_DIRNAME,,g" -e "s,::,:,g" -e "s,^:,,g"`"
 558 
 559     # Try again looking for our compiler
 560     AC_CHECK_TOOLS(PROPER_COMPILER_$1, $3)
 561     BASIC_FIXUP_EXECUTABLE(PROPER_COMPILER_$1)
 562     PATH="$RETRY_COMPILER_SAVED_PATH"
 563 
 564     AC_MSG_CHECKING([for resolved symbolic links for $1])
 565     BASIC_REMOVE_SYMBOLIC_LINKS(PROPER_COMPILER_$1)
 566     AC_MSG_RESULT([$PROPER_COMPILER_$1])
 567     $1="$PROPER_COMPILER_$1"
 568   else
 569     AC_MSG_RESULT([no, keeping $1])
 570   fi
 571 
 572   TOOLCHAIN_EXTRACT_COMPILER_VERSION([$1], [$COMPILER_NAME])
 573 ])
 574 
 575 # Detect the core components of the toolchain, i.e. the compilers (CC and CXX),
 576 # preprocessor (CPP and CXXCPP), the linker (LD), the assembler (AS) and the
 577 # archiver (AR). Verify that the compilers are correct according to the
 578 # toolchain type.
 579 AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_CORE],
 580 [
 581   #
 582   # Setup the compilers (CC and CXX)
 583   #
 584   TOOLCHAIN_FIND_COMPILER([CC], [C], $TOOLCHAIN_CC_BINARY)
 585   # Now that we have resolved CC ourself, let autoconf have its go at it
 586   AC_PROG_CC([$CC])
 587 
 588   TOOLCHAIN_FIND_COMPILER([CXX], [C++], $TOOLCHAIN_CXX_BINARY)
 589   # Now that we have resolved CXX ourself, let autoconf have its go at it




 517       $1=$TOOLCHAIN_PATH_$1
 518       PATH="$PATH_save"
 519     fi
 520 
 521     # AC_PATH_PROGS can't be run multiple times with the same variable,
 522     # so create a new name for this run.
 523     if test "x[$]$1" = x; then
 524       AC_PATH_PROGS(POTENTIAL_$1, $3)
 525       $1=$POTENTIAL_$1
 526     fi
 527 
 528     if test "x[$]$1" = x; then
 529       HELP_MSG_MISSING_DEPENDENCY([devkit])
 530       AC_MSG_ERROR([Could not find a $COMPILER_NAME compiler. $HELP_MSG])
 531     fi
 532   fi
 533 
 534   # Now we have a compiler binary in $1. Make sure it's okay.
 535   BASIC_FIXUP_EXECUTABLE($1)
 536   TEST_COMPILER="[$]$1"
 537 



 538   AC_MSG_CHECKING([resolved symbolic links for $1])
 539   SYMLINK_ORIGINAL="$TEST_COMPILER"
 540   BASIC_REMOVE_SYMBOLIC_LINKS(SYMLINK_ORIGINAL)
 541   if test "x$TEST_COMPILER" = "x$SYMLINK_ORIGINAL"; then
 542     AC_MSG_RESULT([no symlink])
 543   else
 544     AC_MSG_RESULT([$SYMLINK_ORIGINAL])
 545 
 546     # We can't handle ccache by gcc wrappers, since we need to know if we're
 547     # using ccache. Instead ccache usage must be controlled by a configure option.
 548     COMPILER_BASENAME=`$BASENAME "$SYMLINK_ORIGINAL"`
 549     if test "x$COMPILER_BASENAME" = "xccache"; then
 550       AC_MSG_NOTICE([Please use --enable-ccache instead of providing a wrapped compiler.])
 551       AC_MSG_ERROR([$TEST_COMPILER is a symbolic link to ccache. This is not supported.])
 552     fi


















 553   fi
 554 
 555   TOOLCHAIN_EXTRACT_COMPILER_VERSION([$1], [$COMPILER_NAME])
 556 ])
 557 
 558 # Detect the core components of the toolchain, i.e. the compilers (CC and CXX),
 559 # preprocessor (CPP and CXXCPP), the linker (LD), the assembler (AS) and the
 560 # archiver (AR). Verify that the compilers are correct according to the
 561 # toolchain type.
 562 AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_CORE],
 563 [
 564   #
 565   # Setup the compilers (CC and CXX)
 566   #
 567   TOOLCHAIN_FIND_COMPILER([CC], [C], $TOOLCHAIN_CC_BINARY)
 568   # Now that we have resolved CC ourself, let autoconf have its go at it
 569   AC_PROG_CC([$CC])
 570 
 571   TOOLCHAIN_FIND_COMPILER([CXX], [C++], $TOOLCHAIN_CXX_BINARY)
 572   # Now that we have resolved CXX ourself, let autoconf have its go at it


< prev index next >