common/autoconf/toolchain.m4

Print this page




 185 
 186   # On Windows, we need to detect the visual studio installation first.
 187   # This will change the PATH, but we need to keep that new PATH even 
 188   # after toolchain detection is done, since the compiler (on x86) uses
 189   # it for DLL resolution in runtime.
 190   if test "x$OPENJDK_BUILD_OS" = "xwindows" && test "x$TOOLCHAIN_TYPE" = "xmicrosoft"; then
 191     TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV
 192   fi
 193 
 194   # autoconf magic only relies on PATH, so update it if tools dir is specified
 195   OLD_PATH="$PATH"
 196 
 197   # For solaris we really need solaris tools, and not the GNU equivalent.
 198   # The build tools on Solaris reside in /usr/ccs (C Compilation System),
 199   # so add that to path before starting to probe.
 200   # FIXME: This was originally only done for AS,NM,GNM,STRIP,MCS,OBJCOPY,OBJDUMP.
 201   if test "x$OPENJDK_BUILD_OS" = xsolaris; then
 202     PATH="/usr/ccs/bin:$PATH"
 203   fi
 204 
 205   # Finally add TOOLS_DIR at the beginning, to allow --with-tools-dir to 
 206   # override all other locations.
 207   if test "x$TOOLS_DIR" != x; then
 208     PATH=$TOOLS_DIR:$PATH
 209   fi
 210 
 211   # If a devkit is found on the builddeps server, then prepend its path to the
 212   # PATH variable. If there are cross compilers available in the devkit, these
 213   # will be found by AC_PROG_CC et al.
 214   DEVKIT=
 215   BDEPS_CHECK_MODULE(DEVKIT, devkit, xxx,
 216       [
 217         # Found devkit
 218         PATH="$DEVKIT/bin:$PATH"
 219         SYS_ROOT="$DEVKIT/${rewritten_target}/sys-root"
 220         if test "x$x_includes" = "xNONE"; then
 221           x_includes="$SYS_ROOT/usr/include/X11"
 222         fi
 223         if test "x$x_libraries" = "xNONE"; then
 224           x_libraries="$SYS_ROOT/usr/lib"
 225         fi
 226       ],
 227       [])
 228 ])
 229 
 230 # Restore path, etc
 231 AC_DEFUN_ONCE([TOOLCHAIN_POST_DETECTION],
 232 [
 233   # Restore old path.
 234   PATH="$OLD_PATH"
 235 
 236   # Restore the flags to the user specified values.
 237   # This is necessary since AC_PROG_CC defaults CFLAGS to "-g -O2"
 238   CFLAGS="$ORG_CFLAGS"
 239   CXXFLAGS="$ORG_CXXFLAGS"
 240   OBJCFLAGS="$ORG_OBJCFLAGS"
 241 ])
 242 
 243 # Check if a compiler is of the toolchain type we expect, and save the version
 244 # information from it. If the compiler does not match the expected type,
 245 # this function will abort using AC_MSG_ERROR. If it matches, the version will
 246 # be stored in CC_VERSION_NUMBER/CXX_VERSION_NUMBER (as a dotted number), and
 247 # the full version string in CC_VERSION_STRING/CXX_VERSION_STRING.


 379       else
 380         AC_MSG_ERROR([User supplied compiler $1=[$]$1 could not be found])
 381       fi
 382     else
 383       # Otherwise it might already be a complete path
 384       if test ! -x "[$]$1"; then
 385         AC_MSG_ERROR([User supplied compiler $1=[$]$1 does not exist])
 386       fi
 387     fi
 388   else
 389     # No user supplied value. Locate compiler ourselves.
 390     
 391     # If we are cross compiling, assume cross compilation tools follows the
 392     # cross compilation standard where they are prefixed with the autoconf
 393     # standard name for the target. For example the binary 
 394     # i686-sun-solaris2.10-gcc will cross compile for i686-sun-solaris2.10.
 395     # If we are not cross compiling, then the default compiler name will be 
 396     # used.
 397 
 398     $1=
 399     # If TOOLS_DIR is set, check for all compiler names in there first
 400     # before checking the rest of the PATH.
 401     # FIXME: Now that we prefix the TOOLS_DIR to the PATH in the PRE_DETECTION
 402     # step, this should not be necessary.
 403     if test -n "$TOOLS_DIR"; then
 404       PATH_save="$PATH"
 405       PATH="$TOOLS_DIR"
 406       AC_PATH_PROGS(TOOLS_DIR_$1, $SEARCH_LIST)
 407       $1=$TOOLS_DIR_$1
 408       PATH="$PATH_save"
 409     fi
 410 
 411     # AC_PATH_PROGS can't be run multiple times with the same variable,
 412     # so create a new name for this run.
 413     if test "x[$]$1" = x; then
 414       AC_PATH_PROGS(POTENTIAL_$1, $SEARCH_LIST)
 415       $1=$POTENTIAL_$1
 416     fi
 417 
 418     if test "x[$]$1" = x; then
 419       HELP_MSG_MISSING_DEPENDENCY([devkit])
 420       AC_MSG_ERROR([Could not find a $COMPILER_NAME compiler. $HELP_MSG])
 421     fi
 422   fi
 423 
 424   # Now we have a compiler binary in $1. Make sure it's okay.
 425   BASIC_FIXUP_EXECUTABLE($1)
 426   TEST_COMPILER="[$]$1"
 427   # Don't remove symbolic links on AIX because 'xlc_r' and 'xlC_r' may all be links




 185 
 186   # On Windows, we need to detect the visual studio installation first.
 187   # This will change the PATH, but we need to keep that new PATH even 
 188   # after toolchain detection is done, since the compiler (on x86) uses
 189   # it for DLL resolution in runtime.
 190   if test "x$OPENJDK_BUILD_OS" = "xwindows" && test "x$TOOLCHAIN_TYPE" = "xmicrosoft"; then
 191     TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV
 192   fi
 193 
 194   # autoconf magic only relies on PATH, so update it if tools dir is specified
 195   OLD_PATH="$PATH"
 196 
 197   # For solaris we really need solaris tools, and not the GNU equivalent.
 198   # The build tools on Solaris reside in /usr/ccs (C Compilation System),
 199   # so add that to path before starting to probe.
 200   # FIXME: This was originally only done for AS,NM,GNM,STRIP,MCS,OBJCOPY,OBJDUMP.
 201   if test "x$OPENJDK_BUILD_OS" = xsolaris; then
 202     PATH="/usr/ccs/bin:$PATH"
 203   fi
 204 
 205   # Finally add TOOLCHAIN_PATH at the beginning, to allow --with-tools-dir to 
 206   # override all other locations.
 207   if test "x$TOOLCHAIN_PATH" != x; then
 208     PATH=$TOOLCHAIN_PATH:$PATH
 209   fi


















 210 ])
 211 
 212 # Restore path, etc
 213 AC_DEFUN_ONCE([TOOLCHAIN_POST_DETECTION],
 214 [
 215   # Restore old path.
 216   PATH="$OLD_PATH"
 217 
 218   # Restore the flags to the user specified values.
 219   # This is necessary since AC_PROG_CC defaults CFLAGS to "-g -O2"
 220   CFLAGS="$ORG_CFLAGS"
 221   CXXFLAGS="$ORG_CXXFLAGS"
 222   OBJCFLAGS="$ORG_OBJCFLAGS"
 223 ])
 224 
 225 # Check if a compiler is of the toolchain type we expect, and save the version
 226 # information from it. If the compiler does not match the expected type,
 227 # this function will abort using AC_MSG_ERROR. If it matches, the version will
 228 # be stored in CC_VERSION_NUMBER/CXX_VERSION_NUMBER (as a dotted number), and
 229 # the full version string in CC_VERSION_STRING/CXX_VERSION_STRING.


 361       else
 362         AC_MSG_ERROR([User supplied compiler $1=[$]$1 could not be found])
 363       fi
 364     else
 365       # Otherwise it might already be a complete path
 366       if test ! -x "[$]$1"; then
 367         AC_MSG_ERROR([User supplied compiler $1=[$]$1 does not exist])
 368       fi
 369     fi
 370   else
 371     # No user supplied value. Locate compiler ourselves.
 372     
 373     # If we are cross compiling, assume cross compilation tools follows the
 374     # cross compilation standard where they are prefixed with the autoconf
 375     # standard name for the target. For example the binary 
 376     # i686-sun-solaris2.10-gcc will cross compile for i686-sun-solaris2.10.
 377     # If we are not cross compiling, then the default compiler name will be 
 378     # used.
 379 
 380     $1=
 381     # If TOOLCHAIN_PATH is set, check for all compiler names in there first
 382     # before checking the rest of the PATH.
 383     # FIXME: Now that we prefix the TOOLS_DIR to the PATH in the PRE_DETECTION
 384     # step, this should not be necessary.
 385     if test -n "$TOOLCHAIN_PATH"; then
 386       PATH_save="$PATH"
 387       PATH="$TOOLCHAIN_PATH"
 388       AC_PATH_PROGS(TOOLCHAIN_PATH_$1, $SEARCH_LIST)
 389       $1=$TOOLCHAIN_PATH_$1
 390       PATH="$PATH_save"
 391     fi
 392 
 393     # AC_PATH_PROGS can't be run multiple times with the same variable,
 394     # so create a new name for this run.
 395     if test "x[$]$1" = x; then
 396       AC_PATH_PROGS(POTENTIAL_$1, $SEARCH_LIST)
 397       $1=$POTENTIAL_$1
 398     fi
 399 
 400     if test "x[$]$1" = x; then
 401       HELP_MSG_MISSING_DEPENDENCY([devkit])
 402       AC_MSG_ERROR([Could not find a $COMPILER_NAME compiler. $HELP_MSG])
 403     fi
 404   fi
 405 
 406   # Now we have a compiler binary in $1. Make sure it's okay.
 407   BASIC_FIXUP_EXECUTABLE($1)
 408   TEST_COMPILER="[$]$1"
 409   # Don't remove symbolic links on AIX because 'xlc_r' and 'xlC_r' may all be links