common/autoconf/toolchain.m4
changeset 22458 6a74da13c52f
parent 22179 59d2bd4620b0
child 22473 210fdf11f9df
equal deleted inserted replaced
22183:7979ec8adcbb 22458:6a74da13c52f
   111 # $2 = human readable name of compiler (C or C++)
   111 # $2 = human readable name of compiler (C or C++)
   112 # $3 = list of compiler names to search for
   112 # $3 = list of compiler names to search for
   113 AC_DEFUN([TOOLCHAIN_FIND_COMPILER],
   113 AC_DEFUN([TOOLCHAIN_FIND_COMPILER],
   114 [
   114 [
   115   COMPILER_NAME=$2
   115   COMPILER_NAME=$2
   116 
   116   SEARCH_LIST="$3"
   117   $1=
   117 
   118   # If TOOLS_DIR is set, check for all compiler names in there first
   118   if test "x[$]$1" != x; then
   119   # before checking the rest of the PATH.
   119     # User has supplied compiler name already, always let that override.
   120   if test -n "$TOOLS_DIR"; then
   120     AC_MSG_NOTICE([Will use user supplied compiler $1=[$]$1])
   121     PATH_save="$PATH"
   121     if test "x`basename [$]$1`" = "x[$]$1"; then
   122     PATH="$TOOLS_DIR"
   122       # A command without a complete path is provided, search $PATH.
   123     AC_PATH_PROGS(TOOLS_DIR_$1, $3)
   123       
   124     $1=$TOOLS_DIR_$1
   124       AC_PATH_PROGS(POTENTIAL_$1, [$]$1)
   125     PATH="$PATH_save"
   125       if test "x$POTENTIAL_$1" != x; then
   126   fi
   126         $1=$POTENTIAL_$1
   127 
   127       else
   128   # AC_PATH_PROGS can't be run multiple times with the same variable,
   128         AC_MSG_ERROR([User supplied compiler $1=[$]$1 could not be found])
   129   # so create a new name for this run.
   129       fi
   130   if test "x[$]$1" = x; then
   130     else
   131     AC_PATH_PROGS(POTENTIAL_$1, $3)
   131       # Otherwise it might already be a complete path
   132     $1=$POTENTIAL_$1
   132       if test ! -x "[$]$1"; then
   133   fi
   133         AC_MSG_ERROR([User supplied compiler $1=[$]$1 does not exist])
   134 
   134       fi
   135   if test "x[$]$1" = x; then
   135     fi
   136     HELP_MSG_MISSING_DEPENDENCY([devkit])
   136   else
   137     AC_MSG_ERROR([Could not find a $COMPILER_NAME compiler. $HELP_MSG])
   137     # No user supplied value. Locate compiler ourselves
   138   fi
   138     $1=
       
   139     # If TOOLS_DIR is set, check for all compiler names in there first
       
   140     # before checking the rest of the PATH.
       
   141     if test -n "$TOOLS_DIR"; then
       
   142       PATH_save="$PATH"
       
   143       PATH="$TOOLS_DIR"
       
   144       AC_PATH_PROGS(TOOLS_DIR_$1, $SEARCH_LIST)
       
   145       $1=$TOOLS_DIR_$1
       
   146       PATH="$PATH_save"
       
   147     fi
       
   148 
       
   149     # AC_PATH_PROGS can't be run multiple times with the same variable,
       
   150     # so create a new name for this run.
       
   151     if test "x[$]$1" = x; then
       
   152       AC_PATH_PROGS(POTENTIAL_$1, $SEARCH_LIST)
       
   153       $1=$POTENTIAL_$1
       
   154     fi
       
   155 
       
   156     if test "x[$]$1" = x; then
       
   157       HELP_MSG_MISSING_DEPENDENCY([devkit])
       
   158       AC_MSG_ERROR([Could not find a $COMPILER_NAME compiler. $HELP_MSG])
       
   159     fi
       
   160   fi
       
   161 
       
   162   # Now we have a compiler binary in $1. Make sure it's okay.
   139   BASIC_FIXUP_EXECUTABLE($1)
   163   BASIC_FIXUP_EXECUTABLE($1)
   140   AC_MSG_CHECKING([resolved symbolic links for $1])
   164   AC_MSG_CHECKING([resolved symbolic links for $1])
   141   TEST_COMPILER="[$]$1"
   165   TEST_COMPILER="[$]$1"
   142   BASIC_REMOVE_SYMBOLIC_LINKS(TEST_COMPILER)
   166   BASIC_REMOVE_SYMBOLIC_LINKS(TEST_COMPILER)
   143   AC_MSG_RESULT([$TEST_COMPILER])
   167   AC_MSG_RESULT([$TEST_COMPILER])
   246 
   270 
   247   # On windows, only cl.exe is supported.
   271   # On windows, only cl.exe is supported.
   248   # On Solaris, cc is preferred to gcc.
   272   # On Solaris, cc is preferred to gcc.
   249   # Elsewhere, gcc is preferred to cc.
   273   # Elsewhere, gcc is preferred to cc.
   250 
   274 
   251   if test "x$CC" != x; then
   275   if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
   252     COMPILER_CHECK_LIST="$CC"
       
   253   elif test "x$OPENJDK_TARGET_OS" = "xwindows"; then
       
   254     COMPILER_CHECK_LIST="cl"
   276     COMPILER_CHECK_LIST="cl"
   255   elif test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
   277   elif test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
   256     COMPILER_CHECK_LIST="cc gcc"
   278     COMPILER_CHECK_LIST="cc gcc"
   257   else
   279   else
   258     COMPILER_CHECK_LIST="gcc cc"
   280     COMPILER_CHECK_LIST="gcc cc"
   262   # Now that we have resolved CC ourself, let autoconf have its go at it
   284   # Now that we have resolved CC ourself, let autoconf have its go at it
   263   AC_PROG_CC([$CC])
   285   AC_PROG_CC([$CC])
   264 
   286 
   265   ### Locate C++ compiler (CXX)
   287   ### Locate C++ compiler (CXX)
   266 
   288 
   267   if test "x$CXX" != x; then
   289   if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
   268     COMPILER_CHECK_LIST="$CXX"
       
   269   elif test "x$OPENJDK_TARGET_OS" = "xwindows"; then
       
   270     COMPILER_CHECK_LIST="cl"
   290     COMPILER_CHECK_LIST="cl"
   271   elif test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
   291   elif test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
   272     COMPILER_CHECK_LIST="CC g++"
   292     COMPILER_CHECK_LIST="CC g++"
   273   else
   293   else
   274     COMPILER_CHECK_LIST="g++ CC"
   294     COMPILER_CHECK_LIST="g++ CC"