toolchain.m4 revision 2203:f3c27d6d4ad1
1# 2# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. 3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4# 5# This code is free software; you can redistribute it and/or modify it 6# under the terms of the GNU General Public License version 2 only, as 7# published by the Free Software Foundation. Oracle designates this 8# particular file as subject to the "Classpath" exception as provided 9# by Oracle in the LICENSE file that accompanied this code. 10# 11# This code is distributed in the hope that it will be useful, but WITHOUT 12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14# version 2 for more details (a copy is included in the LICENSE file that 15# accompanied this code). 16# 17# You should have received a copy of the GNU General Public License version 18# 2 along with this work; if not, write to the Free Software Foundation, 19# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20# 21# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22# or visit www.oracle.com if you need additional information or have any 23# questions. 24# 25 26######################################################################## 27# This file is responsible for detecting, verifying and setting up the 28# toolchain, i.e. the compiler, linker and related utilities. It will setup 29# proper paths to the binaries, but it will not setup any flags. 30# 31# The binaries used is determined by the toolchain type, which is the family of 32# compilers and related tools that are used. 33######################################################################## 34 35 36# All valid toolchains, regardless of platform (used by help.m4) 37VALID_TOOLCHAINS_all="gcc clang solstudio xlc microsoft" 38 39# These toolchains are valid on different platforms 40VALID_TOOLCHAINS_linux="gcc clang" 41VALID_TOOLCHAINS_solaris="solstudio" 42VALID_TOOLCHAINS_macosx="gcc clang" 43VALID_TOOLCHAINS_aix="xlc" 44VALID_TOOLCHAINS_windows="microsoft" 45 46# Toolchain descriptions 47TOOLCHAIN_DESCRIPTION_clang="clang/LLVM" 48TOOLCHAIN_DESCRIPTION_gcc="GNU Compiler Collection" 49TOOLCHAIN_DESCRIPTION_microsoft="Microsoft Visual Studio" 50TOOLCHAIN_DESCRIPTION_solstudio="Oracle Solaris Studio" 51TOOLCHAIN_DESCRIPTION_xlc="IBM XL C/C++" 52 53# Minimum supported versions, empty means unspecified 54TOOLCHAIN_MINIMUM_VERSION_clang="3.2" 55TOOLCHAIN_MINIMUM_VERSION_gcc="4.3" 56TOOLCHAIN_MINIMUM_VERSION_microsoft="" 57TOOLCHAIN_MINIMUM_VERSION_solstudio="5.13" 58TOOLCHAIN_MINIMUM_VERSION_xlc="" 59 60# Prepare the system so that TOOLCHAIN_CHECK_COMPILER_VERSION can be called. 61# Must have CC_VERSION_NUMBER and CXX_VERSION_NUMBER. 62# $1 - optional variable prefix for compiler and version variables (BUILD_) 63# $2 - optional variable prefix for comparable variable (OPENJDK_BUILD_) 64AC_DEFUN([TOOLCHAIN_PREPARE_FOR_VERSION_COMPARISONS], 65[ 66 if test "x[$]$1CC_VERSION_NUMBER" != "x[$]$1CXX_VERSION_NUMBER"; then 67 AC_MSG_WARN([C and C++ compiler have different version numbers, [$]$1CC_VERSION_NUMBER vs [$]$1CXX_VERSION_NUMBER.]) 68 AC_MSG_WARN([This typically indicates a broken setup, and is not supported]) 69 fi 70 71 # We only check CC_VERSION_NUMBER since we assume CXX_VERSION_NUMBER is equal. 72 if [ [[ "[$]$1CC_VERSION_NUMBER" =~ (.*\.){3} ]] ]; then 73 AC_MSG_WARN([C compiler version number has more than three parts (X.Y.Z): [$]$1CC_VERSION_NUMBER. Comparisons might be wrong.]) 74 fi 75 76 if [ [[ "[$]$1CC_VERSION_NUMBER" =~ [0-9]{6} ]] ]; then 77 AC_MSG_WARN([C compiler version number has a part larger than 99999: [$]$1CC_VERSION_NUMBER. Comparisons might be wrong.]) 78 fi 79 80 $2COMPARABLE_ACTUAL_VERSION=`$AWK -F. '{ printf("%05d%05d%05d\n", [$]1, [$]2, [$]3) }' <<< "[$]$1CC_VERSION_NUMBER"` 81]) 82 83# Check if the configured compiler (C and C++) is of a specific version or 84# newer. TOOLCHAIN_PREPARE_FOR_VERSION_COMPARISONS must have been called before. 85# 86# Arguments: 87# VERSION: The version string to check against the found version 88# IF_AT_LEAST: block to run if the compiler is at least this version (>=) 89# IF_OLDER_THAN: block to run if the compiler is older than this version (<) 90# PREFIX: Optional variable prefix for compiler to compare version for (OPENJDK_BUILD_) 91BASIC_DEFUN_NAMED([TOOLCHAIN_CHECK_COMPILER_VERSION], 92 [*VERSION PREFIX IF_AT_LEAST IF_OLDER_THAN], [$@], 93[ 94 # Need to assign to a variable since m4 is blocked from modifying parts in []. 95 REFERENCE_VERSION=ARG_VERSION 96 97 if [ [[ "$REFERENCE_VERSION" =~ (.*\.){3} ]] ]; then 98 AC_MSG_ERROR([Internal error: Cannot compare to ARG_VERSION, only three parts (X.Y.Z) is supported]) 99 fi 100 101 if [ [[ "$REFERENCE_VERSION" =~ [0-9]{6} ]] ]; then 102 AC_MSG_ERROR([Internal error: Cannot compare to ARG_VERSION, only parts < 99999 is supported]) 103 fi 104 105 # Version comparison method inspired by http://stackoverflow.com/a/24067243 106 COMPARABLE_REFERENCE_VERSION=`$AWK -F. '{ printf("%05d%05d%05d\n", [$]1, [$]2, [$]3) }' <<< "$REFERENCE_VERSION"` 107 108 if test [$]ARG_PREFIX[COMPARABLE_ACTUAL_VERSION] -ge $COMPARABLE_REFERENCE_VERSION ; then 109 : 110 ARG_IF_AT_LEAST 111 else 112 : 113 ARG_IF_OLDER_THAN 114 fi 115]) 116 117# Setup a number of variables describing how native output files are 118# named on this platform/toolchain. 119AC_DEFUN([TOOLCHAIN_SETUP_FILENAME_PATTERNS], 120[ 121 # Define filename patterns 122 if test "x$OPENJDK_TARGET_OS" = xwindows; then 123 LIBRARY_PREFIX= 124 SHARED_LIBRARY_SUFFIX='.dll' 125 STATIC_LIBRARY_SUFFIX='.lib' 126 SHARED_LIBRARY='[$]1.dll' 127 STATIC_LIBRARY='[$]1.lib' 128 OBJ_SUFFIX='.obj' 129 EXE_SUFFIX='.exe' 130 else 131 LIBRARY_PREFIX=lib 132 SHARED_LIBRARY_SUFFIX='.so' 133 STATIC_LIBRARY_SUFFIX='.a' 134 SHARED_LIBRARY='lib[$]1.so' 135 STATIC_LIBRARY='lib[$]1.a' 136 OBJ_SUFFIX='.o' 137 EXE_SUFFIX='' 138 if test "x$OPENJDK_TARGET_OS" = xmacosx; then 139 # For full static builds, we're overloading the SHARED_LIBRARY 140 # variables in order to limit the amount of changes required. 141 # It would be better to remove SHARED and just use LIBRARY and 142 # LIBRARY_SUFFIX for libraries that can be built either 143 # shared or static and use STATIC_* for libraries that are 144 # always built statically. 145 if test "x$STATIC_BUILD" = xtrue; then 146 SHARED_LIBRARY='lib[$]1.a' 147 SHARED_LIBRARY_SUFFIX='.a' 148 else 149 SHARED_LIBRARY='lib[$]1.dylib' 150 SHARED_LIBRARY_SUFFIX='.dylib' 151 fi 152 fi 153 fi 154 155 AC_SUBST(LIBRARY_PREFIX) 156 AC_SUBST(SHARED_LIBRARY_SUFFIX) 157 AC_SUBST(STATIC_LIBRARY_SUFFIX) 158 AC_SUBST(SHARED_LIBRARY) 159 AC_SUBST(STATIC_LIBRARY) 160 AC_SUBST(OBJ_SUFFIX) 161 AC_SUBST(EXE_SUFFIX) 162]) 163 164# Determine which toolchain type to use, and make sure it is valid for this 165# platform. Setup various information about the selected toolchain. 166AC_DEFUN_ONCE([TOOLCHAIN_DETERMINE_TOOLCHAIN_TYPE], 167[ 168 AC_ARG_WITH(toolchain-type, [AS_HELP_STRING([--with-toolchain-type], 169 [the toolchain type (or family) to use, use '--help' to show possible values @<:@platform dependent@:>@])]) 170 171 # Use indirect variable referencing 172 toolchain_var_name=VALID_TOOLCHAINS_$OPENJDK_BUILD_OS 173 VALID_TOOLCHAINS=${!toolchain_var_name} 174 175 if test "x$OPENJDK_TARGET_OS" = xmacosx; then 176 if test -n "$XCODEBUILD"; then 177 # On Mac OS X, default toolchain to clang after Xcode 5 178 XCODE_VERSION_OUTPUT=`"$XCODEBUILD" -version 2>&1 | $HEAD -n 1` 179 $ECHO "$XCODE_VERSION_OUTPUT" | $GREP "Xcode " > /dev/null 180 if test $? -ne 0; then 181 AC_MSG_ERROR([Failed to determine Xcode version.]) 182 fi 183 XCODE_MAJOR_VERSION=`$ECHO $XCODE_VERSION_OUTPUT | \ 184 $SED -e 's/^Xcode \(@<:@1-9@:>@@<:@0-9.@:>@*\)/\1/' | \ 185 $CUT -f 1 -d .` 186 AC_MSG_NOTICE([Xcode major version: $XCODE_MAJOR_VERSION]) 187 if test $XCODE_MAJOR_VERSION -ge 5; then 188 DEFAULT_TOOLCHAIN="clang" 189 else 190 DEFAULT_TOOLCHAIN="gcc" 191 fi 192 else 193 # If Xcode is not installed, but the command line tools are 194 # then we can't run xcodebuild. On these systems we should 195 # default to clang 196 DEFAULT_TOOLCHAIN="clang" 197 fi 198 else 199 # First toolchain type in the list is the default 200 DEFAULT_TOOLCHAIN=${VALID_TOOLCHAINS%% *} 201 fi 202 203 if test "x$with_toolchain_type" = xlist; then 204 # List all toolchains 205 AC_MSG_NOTICE([The following toolchains are valid on this platform:]) 206 for toolchain in $VALID_TOOLCHAINS; do 207 toolchain_var_name=TOOLCHAIN_DESCRIPTION_$toolchain 208 TOOLCHAIN_DESCRIPTION=${!toolchain_var_name} 209 $PRINTF " %-10s %s\n" $toolchain "$TOOLCHAIN_DESCRIPTION" 210 done 211 212 exit 0 213 elif test "x$with_toolchain_type" != x; then 214 # User override; check that it is valid 215 if test "x${VALID_TOOLCHAINS/$with_toolchain_type/}" = "x${VALID_TOOLCHAINS}"; then 216 AC_MSG_NOTICE([Toolchain type $with_toolchain_type is not valid on this platform.]) 217 AC_MSG_NOTICE([Valid toolchains: $VALID_TOOLCHAINS.]) 218 AC_MSG_ERROR([Cannot continue.]) 219 fi 220 TOOLCHAIN_TYPE=$with_toolchain_type 221 else 222 # No flag given, use default 223 TOOLCHAIN_TYPE=$DEFAULT_TOOLCHAIN 224 fi 225 AC_SUBST(TOOLCHAIN_TYPE) 226 227 TOOLCHAIN_CC_BINARY_clang="clang" 228 TOOLCHAIN_CC_BINARY_gcc="gcc" 229 TOOLCHAIN_CC_BINARY_microsoft="cl" 230 TOOLCHAIN_CC_BINARY_solstudio="cc" 231 TOOLCHAIN_CC_BINARY_xlc="xlc_r" 232 233 TOOLCHAIN_CXX_BINARY_clang="clang++" 234 TOOLCHAIN_CXX_BINARY_gcc="g++" 235 TOOLCHAIN_CXX_BINARY_microsoft="cl" 236 TOOLCHAIN_CXX_BINARY_solstudio="CC" 237 TOOLCHAIN_CXX_BINARY_xlc="xlC_r" 238 239 # Use indirect variable referencing 240 toolchain_var_name=TOOLCHAIN_DESCRIPTION_$TOOLCHAIN_TYPE 241 TOOLCHAIN_DESCRIPTION=${!toolchain_var_name} 242 toolchain_var_name=TOOLCHAIN_MINIMUM_VERSION_$TOOLCHAIN_TYPE 243 TOOLCHAIN_MINIMUM_VERSION=${!toolchain_var_name} 244 toolchain_var_name=TOOLCHAIN_CC_BINARY_$TOOLCHAIN_TYPE 245 TOOLCHAIN_CC_BINARY=${!toolchain_var_name} 246 toolchain_var_name=TOOLCHAIN_CXX_BINARY_$TOOLCHAIN_TYPE 247 TOOLCHAIN_CXX_BINARY=${!toolchain_var_name} 248 249 TOOLCHAIN_SETUP_FILENAME_PATTERNS 250 251 if test "x$TOOLCHAIN_TYPE" = "x$DEFAULT_TOOLCHAIN"; then 252 AC_MSG_NOTICE([Using default toolchain $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION)]) 253 else 254 AC_MSG_NOTICE([Using user selected toolchain $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION). Default toolchain is $DEFAULT_TOOLCHAIN.]) 255 fi 256]) 257 258# Before we start detecting the toolchain executables, we might need some 259# special setup, e.g. additional paths etc. 260AC_DEFUN_ONCE([TOOLCHAIN_PRE_DETECTION], 261[ 262 # FIXME: Is this needed? 263 AC_LANG(C++) 264 265 # Store the CFLAGS etc passed to the configure script. 266 ORG_CFLAGS="$CFLAGS" 267 ORG_CXXFLAGS="$CXXFLAGS" 268 269 # autoconf magic only relies on PATH, so update it if tools dir is specified 270 OLD_PATH="$PATH" 271 272 # On Windows, we need to detect the visual studio installation first. 273 # This will change the PATH, but we need to keep that new PATH even 274 # after toolchain detection is done, since the compiler (on x86) uses 275 # it for DLL resolution in runtime. 276 if test "x$OPENJDK_BUILD_OS" = "xwindows" \ 277 && test "x$TOOLCHAIN_TYPE" = "xmicrosoft"; then 278 TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV 279 # Reset path to VS_PATH. It will include everything that was on PATH at the time we 280 # ran TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV. 281 PATH="$VS_PATH" 282 # The microsoft toolchain also requires INCLUDE and LIB to be set. 283 export INCLUDE="$VS_INCLUDE" 284 export LIB="$VS_LIB" 285 else 286 if test "x$XCODE_VERSION_OUTPUT" != x; then 287 # For Xcode, we set the Xcode version as TOOLCHAIN_VERSION 288 TOOLCHAIN_VERSION=`$ECHO $XCODE_VERSION_OUTPUT | $CUT -f 2 -d ' '` 289 TOOLCHAIN_DESCRIPTION="$TOOLCHAIN_DESCRIPTION from Xcode" 290 else 291 # Currently we do not define this for other toolchains. This might change as the need arise. 292 TOOLCHAIN_VERSION= 293 fi 294 fi 295 AC_SUBST(TOOLCHAIN_VERSION) 296 297 # For solaris we really need solaris tools, and not the GNU equivalent. 298 # The build tools on Solaris reside in /usr/ccs (C Compilation System), 299 # so add that to path before starting to probe. 300 # FIXME: This was originally only done for AS,NM,GNM,STRIP,OBJCOPY,OBJDUMP. 301 if test "x$OPENJDK_BUILD_OS" = xsolaris; then 302 PATH="/usr/ccs/bin:$PATH" 303 fi 304 305 # Finally add TOOLCHAIN_PATH at the beginning, to allow --with-tools-dir to 306 # override all other locations. 307 if test "x$TOOLCHAIN_PATH" != x; then 308 PATH=$TOOLCHAIN_PATH:$PATH 309 fi 310]) 311 312# Restore path, etc 313AC_DEFUN_ONCE([TOOLCHAIN_POST_DETECTION], 314[ 315 # Restore old path. 316 PATH="$OLD_PATH" 317 318 # Restore the flags to the user specified values. 319 # This is necessary since AC_PROG_CC defaults CFLAGS to "-g -O2" 320 CFLAGS="$ORG_CFLAGS" 321 CXXFLAGS="$ORG_CXXFLAGS" 322]) 323 324# Check if a compiler is of the toolchain type we expect, and save the version 325# information from it. If the compiler does not match the expected type, 326# this function will abort using AC_MSG_ERROR. If it matches, the version will 327# be stored in CC_VERSION_NUMBER/CXX_VERSION_NUMBER (as a dotted number), and 328# the full version string in CC_VERSION_STRING/CXX_VERSION_STRING. 329# 330# $1 = compiler to test (CC or CXX) 331# $2 = human readable name of compiler (C or C++) 332AC_DEFUN([TOOLCHAIN_EXTRACT_COMPILER_VERSION], 333[ 334 COMPILER=[$]$1 335 COMPILER_NAME=$2 336 337 if test "x$TOOLCHAIN_TYPE" = xsolstudio; then 338 # cc -V output typically looks like 339 # cc: Sun C 5.12 Linux_i386 2011/11/16 340 COMPILER_VERSION_OUTPUT=`$COMPILER -V 2>&1` 341 # Check that this is likely to be the Solaris Studio cc. 342 $ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "^.*: Sun $COMPILER_NAME" > /dev/null 343 if test $? -ne 0; then 344 ALT_VERSION_OUTPUT=`$COMPILER --version 2>&1` 345 AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler.]) 346 AC_MSG_NOTICE([The result from running with -V was: "$COMPILER_VERSION_OUTPUT"]) 347 AC_MSG_NOTICE([The result from running with --version was: "$ALT_VERSION_OUTPUT"]) 348 AC_MSG_ERROR([A $TOOLCHAIN_TYPE compiler is required. Try setting --with-tools-dir.]) 349 fi 350 # Remove usage instructions (if present), and 351 # collapse compiler output into a single line 352 COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT | \ 353 $SED -e 's/ *@<:@Uu@:>@sage:.*//'` 354 COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \ 355 $SED -e "s/^.*@<:@ ,\t@:>@$COMPILER_NAME@<:@ ,\t@:>@\(@<:@1-9@:>@\.@<:@0-9@:>@@<:@0-9@:>@*\).*/\1/"` 356 elif test "x$TOOLCHAIN_TYPE" = xxlc; then 357 # xlc -qversion output typically looks like 358 # IBM XL C/C++ for AIX, V11.1 (5724-X13) 359 # Version: 11.01.0000.0015 360 COMPILER_VERSION_OUTPUT=`$COMPILER -qversion 2>&1` 361 # Check that this is likely to be the IBM XL C compiler. 362 $ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "IBM XL C" > /dev/null 363 if test $? -ne 0; then 364 ALT_VERSION_OUTPUT=`$COMPILER --version 2>&1` 365 AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler.]) 366 AC_MSG_NOTICE([The result from running with -qversion was: "$COMPILER_VERSION_OUTPUT"]) 367 AC_MSG_NOTICE([The result from running with --version was: "$ALT_VERSION_OUTPUT"]) 368 AC_MSG_ERROR([A $TOOLCHAIN_TYPE compiler is required. Try setting --with-tools-dir.]) 369 fi 370 # Collapse compiler output into a single line 371 COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT` 372 COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \ 373 $SED -e 's/^.*, V\(@<:@1-9@:>@@<:@0-9.@:>@*\).*$/\1/'` 374 elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then 375 # There is no specific version flag, but all output starts with a version string. 376 # First line typically looks something like: 377 # Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86 378 COMPILER_VERSION_OUTPUT=`$COMPILER 2>&1 | $HEAD -n 1 | $TR -d '\r'` 379 # Check that this is likely to be Microsoft CL.EXE. 380 $ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "Microsoft.*Compiler" > /dev/null 381 if test $? -ne 0; then 382 AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler.]) 383 AC_MSG_NOTICE([The result from running it was: "$COMPILER_VERSION_OUTPUT"]) 384 AC_MSG_ERROR([A $TOOLCHAIN_TYPE compiler is required. Try setting --with-tools-dir.]) 385 fi 386 # Collapse compiler output into a single line 387 COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT` 388 COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \ 389 $SED -e 's/^.*ersion.\(@<:@1-9@:>@@<:@0-9.@:>@*\) .*$/\1/'` 390 elif test "x$TOOLCHAIN_TYPE" = xgcc; then 391 # gcc --version output typically looks like 392 # gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1 393 # Copyright (C) 2013 Free Software Foundation, Inc. 394 # This is free software; see the source for copying conditions. There is NO 395 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 396 COMPILER_VERSION_OUTPUT=`$COMPILER --version 2>&1` 397 # Check that this is likely to be GCC. 398 $ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "Free Software Foundation" > /dev/null 399 if test $? -ne 0; then 400 AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler.]) 401 AC_MSG_NOTICE([The result from running with --version was: "$COMPILER_VERSION"]) 402 AC_MSG_ERROR([A $TOOLCHAIN_TYPE compiler is required. Try setting --with-tools-dir.]) 403 fi 404 # Remove Copyright and legalese from version string, and 405 # collapse into a single line 406 COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT | \ 407 $SED -e 's/ *Copyright .*//'` 408 COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \ 409 $SED -e 's/^.* \(@<:@1-9@:>@\.@<:@0-9.@:>@*\)@<:@^0-9.@:>@.*$/\1/'` 410 elif test "x$TOOLCHAIN_TYPE" = xclang; then 411 # clang --version output typically looks like 412 # Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn) 413 # clang version 3.3 (tags/RELEASE_33/final) 414 # or 415 # Debian clang version 3.2-7ubuntu1 (tags/RELEASE_32/final) (based on LLVM 3.2) 416 # Target: x86_64-pc-linux-gnu 417 # Thread model: posix 418 COMPILER_VERSION_OUTPUT=`$COMPILER --version 2>&1` 419 # Check that this is likely to be clang 420 $ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "clang" > /dev/null 421 if test $? -ne 0; then 422 AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler.]) 423 AC_MSG_NOTICE([The result from running with --version was: "$COMPILER_VERSION_OUTPUT"]) 424 AC_MSG_ERROR([A $TOOLCHAIN_TYPE compiler is required. Try setting --with-tools-dir.]) 425 fi 426 # Collapse compiler output into a single line 427 COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT` 428 COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \ 429 $SED -e 's/^.* version \(@<:@1-9@:>@@<:@0-9.@:>@*\).*$/\1/'` 430 else 431 AC_MSG_ERROR([Unknown toolchain type $TOOLCHAIN_TYPE.]) 432 fi 433 # This sets CC_VERSION_NUMBER or CXX_VERSION_NUMBER. (This comment is a grep marker) 434 $1_VERSION_NUMBER="$COMPILER_VERSION_NUMBER" 435 # This sets CC_VERSION_STRING or CXX_VERSION_STRING. (This comment is a grep marker) 436 $1_VERSION_STRING="$COMPILER_VERSION_STRING" 437 438 AC_MSG_NOTICE([Using $TOOLCHAIN_TYPE $COMPILER_NAME compiler version $COMPILER_VERSION_NUMBER @<:@$COMPILER_VERSION_STRING@:>@]) 439]) 440 441# Try to locate the given C or C++ compiler in the path, or otherwise. 442# 443# $1 = compiler to test (CC or CXX) 444# $2 = human readable name of compiler (C or C++) 445# $3 = list of compiler names to search for 446AC_DEFUN([TOOLCHAIN_FIND_COMPILER], 447[ 448 COMPILER_NAME=$2 449 SEARCH_LIST="$3" 450 451 if test "x[$]$1" != x; then 452 # User has supplied compiler name already, always let that override. 453 AC_MSG_NOTICE([Will use user supplied compiler $1=[$]$1]) 454 if test "x`basename [$]$1`" = "x[$]$1"; then 455 # A command without a complete path is provided, search $PATH. 456 457 AC_PATH_PROGS(POTENTIAL_$1, [$]$1) 458 if test "x$POTENTIAL_$1" != x; then 459 $1=$POTENTIAL_$1 460 else 461 AC_MSG_ERROR([User supplied compiler $1=[$]$1 could not be found]) 462 fi 463 else 464 # Otherwise it might already be a complete path 465 if test ! -x "[$]$1"; then 466 AC_MSG_ERROR([User supplied compiler $1=[$]$1 does not exist]) 467 fi 468 fi 469 else 470 # No user supplied value. Locate compiler ourselves. 471 472 # If we are cross compiling, assume cross compilation tools follows the 473 # cross compilation standard where they are prefixed with the autoconf 474 # standard name for the target. For example the binary 475 # i686-sun-solaris2.10-gcc will cross compile for i686-sun-solaris2.10. 476 # If we are not cross compiling, then the default compiler name will be 477 # used. 478 479 $1= 480 # If TOOLCHAIN_PATH is set, check for all compiler names in there first 481 # before checking the rest of the PATH. 482 # FIXME: Now that we prefix the TOOLS_DIR to the PATH in the PRE_DETECTION 483 # step, this should not be necessary. 484 if test -n "$TOOLCHAIN_PATH"; then 485 PATH_save="$PATH" 486 PATH="$TOOLCHAIN_PATH" 487 AC_PATH_PROGS(TOOLCHAIN_PATH_$1, $SEARCH_LIST) 488 $1=$TOOLCHAIN_PATH_$1 489 PATH="$PATH_save" 490 fi 491 492 # AC_PATH_PROGS can't be run multiple times with the same variable, 493 # so create a new name for this run. 494 if test "x[$]$1" = x; then 495 AC_PATH_PROGS(POTENTIAL_$1, $SEARCH_LIST) 496 $1=$POTENTIAL_$1 497 fi 498 499 if test "x[$]$1" = x; then 500 HELP_MSG_MISSING_DEPENDENCY([devkit]) 501 AC_MSG_ERROR([Could not find a $COMPILER_NAME compiler. $HELP_MSG]) 502 fi 503 fi 504 505 # Now we have a compiler binary in $1. Make sure it's okay. 506 BASIC_FIXUP_EXECUTABLE($1) 507 TEST_COMPILER="[$]$1" 508 509 AC_MSG_CHECKING([resolved symbolic links for $1]) 510 SYMLINK_ORIGINAL="$TEST_COMPILER" 511 BASIC_REMOVE_SYMBOLIC_LINKS(SYMLINK_ORIGINAL) 512 if test "x$TEST_COMPILER" = "x$SYMLINK_ORIGINAL"; then 513 AC_MSG_RESULT([no symlink]) 514 else 515 AC_MSG_RESULT([$SYMLINK_ORIGINAL]) 516 517 # We can't handle ccache by gcc wrappers, since we need to know if we're 518 # using ccache. Instead ccache usage must be controlled by a configure option. 519 COMPILER_BASENAME=`$BASENAME "$SYMLINK_ORIGINAL"` 520 if test "x$COMPILER_BASENAME" = "xccache"; then 521 AC_MSG_NOTICE([Please use --enable-ccache instead of providing a wrapped compiler.]) 522 AC_MSG_ERROR([$TEST_COMPILER is a symbolic link to ccache. This is not supported.]) 523 fi 524 fi 525 526 TOOLCHAIN_EXTRACT_COMPILER_VERSION([$1], [$COMPILER_NAME]) 527]) 528 529# Detect the core components of the toolchain, i.e. the compilers (CC and CXX), 530# preprocessor (CPP and CXXCPP), the linker (LD), the assembler (AS) and the 531# archiver (AR). Verify that the compilers are correct according to the 532# toolchain type. 533AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_CORE], 534[ 535 # 536 # Setup the compilers (CC and CXX) 537 # 538 TOOLCHAIN_FIND_COMPILER([CC], [C], $TOOLCHAIN_CC_BINARY) 539 # Now that we have resolved CC ourself, let autoconf have its go at it 540 AC_PROG_CC([$CC]) 541 542 TOOLCHAIN_FIND_COMPILER([CXX], [C++], $TOOLCHAIN_CXX_BINARY) 543 # Now that we have resolved CXX ourself, let autoconf have its go at it 544 AC_PROG_CXX([$CXX]) 545 546 # This is the compiler version number on the form X.Y[.Z] 547 AC_SUBST(CC_VERSION_NUMBER) 548 AC_SUBST(CXX_VERSION_NUMBER) 549 550 TOOLCHAIN_PREPARE_FOR_VERSION_COMPARISONS 551 552 if test "x$TOOLCHAIN_MINIMUM_VERSION" != x; then 553 TOOLCHAIN_CHECK_COMPILER_VERSION(VERSION: $TOOLCHAIN_MINIMUM_VERSION, 554 IF_OLDER_THAN: [ 555 AC_MSG_WARN([You are using $TOOLCHAIN_TYPE older than $TOOLCHAIN_MINIMUM_VERSION. This is not a supported configuration.]) 556 ] 557 ) 558 fi 559 560 # 561 # Setup the preprocessor (CPP and CXXCPP) 562 # 563 AC_PROG_CPP 564 BASIC_FIXUP_EXECUTABLE(CPP) 565 AC_PROG_CXXCPP 566 BASIC_FIXUP_EXECUTABLE(CXXCPP) 567 568 # 569 # Setup the linker (LD) 570 # 571 if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then 572 # In the Microsoft toolchain we have a separate LD command "link". 573 # Make sure we reject /usr/bin/link (as determined in CYGWIN_LINK), which is 574 # a cygwin program for something completely different. 575 AC_CHECK_PROG([LD], [link],[link],,, [$CYGWIN_LINK]) 576 BASIC_FIXUP_EXECUTABLE(LD) 577 # Verify that we indeed succeeded with this trick. 578 AC_MSG_CHECKING([if the found link.exe is actually the Visual Studio linker]) 579 "$LD" --version > /dev/null 580 if test $? -eq 0 ; then 581 AC_MSG_RESULT([no]) 582 AC_MSG_ERROR([This is the Cygwin link tool. Please check your PATH and rerun configure.]) 583 else 584 AC_MSG_RESULT([yes]) 585 fi 586 LDCXX="$LD" 587 else 588 # All other toolchains use the compiler to link. 589 LD="$CC" 590 LDCXX="$CXX" 591 fi 592 AC_SUBST(LD) 593 # FIXME: it should be CXXLD, according to standard (cf CXXCPP) 594 AC_SUBST(LDCXX) 595 596 # 597 # Setup the assembler (AS) 598 # 599 if test "x$OPENJDK_TARGET_OS" = xsolaris; then 600 BASIC_PATH_PROGS(AS, as) 601 BASIC_FIXUP_EXECUTABLE(AS) 602 if test "x$AS" = x; then 603 AC_MSG_ERROR([Solaris assembler (as) is required. Please install via "pkg install pkg:/developer/assembler".]) 604 fi 605 else 606 # FIXME: is this correct for microsoft? 607 AS="$CC -c" 608 fi 609 AC_SUBST(AS) 610 611 # 612 # Setup the archiver (AR) 613 # 614 if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then 615 # The corresponding ar tool is lib.exe (used to create static libraries) 616 AC_CHECK_PROG([AR], [lib],[lib],,,) 617 elif test "x$TOOLCHAIN_TYPE" = xgcc; then 618 BASIC_CHECK_TOOLS(AR, ar gcc-ar) 619 else 620 BASIC_CHECK_TOOLS(AR, ar) 621 fi 622 BASIC_FIXUP_EXECUTABLE(AR) 623]) 624 625# Setup additional tools that is considered a part of the toolchain, but not the 626# core part. Many of these are highly platform-specific and do not exist, 627# and/or are not needed on all platforms. 628AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_EXTRA], 629[ 630 if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then 631 BASIC_PATH_PROGS(LIPO, lipo) 632 BASIC_FIXUP_EXECUTABLE(LIPO) 633 fi 634 635 if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then 636 AC_CHECK_PROG([MT], [mt], [mt],,, [/usr/bin/mt]) 637 BASIC_FIXUP_EXECUTABLE(MT) 638 # Setup the resource compiler (RC) 639 AC_CHECK_PROG([RC], [rc], [rc],,, [/usr/bin/rc]) 640 BASIC_FIXUP_EXECUTABLE(RC) 641 AC_CHECK_PROG([DUMPBIN], [dumpbin], [dumpbin],,,) 642 BASIC_FIXUP_EXECUTABLE(DUMPBIN) 643 # We need to check for 'msbuild.exe' because at the place where we expect to 644 # find 'msbuild.exe' there's also a directory called 'msbuild' and configure 645 # won't find the 'msbuild.exe' executable in that case (and the 646 # 'ac_executable_extensions' is unusable due to performance reasons). 647 # Notice that we intentionally don't fix up the path to MSBUILD because we 648 # will call it in a DOS shell during freetype detection on Windows (see 649 # 'LIB_SETUP_FREETYPE' in "libraries.m4" 650 AC_CHECK_PROG([MSBUILD], [msbuild.exe], [msbuild.exe],,,) 651 fi 652 653 if test "x$OPENJDK_TARGET_OS" = xsolaris; then 654 BASIC_PATH_PROGS(STRIP, strip) 655 BASIC_FIXUP_EXECUTABLE(STRIP) 656 BASIC_PATH_PROGS(NM, nm) 657 BASIC_FIXUP_EXECUTABLE(NM) 658 BASIC_PATH_PROGS(GNM, gnm) 659 BASIC_FIXUP_EXECUTABLE(GNM) 660 elif test "x$OPENJDK_TARGET_OS" != xwindows; then 661 # FIXME: we should unify this with the solaris case above. 662 BASIC_CHECK_TOOLS(STRIP, strip) 663 BASIC_FIXUP_EXECUTABLE(STRIP) 664 if test "x$TOOLCHAIN_TYPE" = xgcc; then 665 BASIC_CHECK_TOOLS(NM, nm gcc-nm) 666 else 667 BASIC_CHECK_TOOLS(NM, nm) 668 fi 669 BASIC_FIXUP_EXECUTABLE(NM) 670 GNM="$NM" 671 AC_SUBST(GNM) 672 fi 673 674 # objcopy is used for moving debug symbols to separate files when 675 # full debug symbols are enabled. 676 if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xlinux; then 677 BASIC_CHECK_TOOLS(OBJCOPY, [gobjcopy objcopy]) 678 # Only call fixup if objcopy was found. 679 if test -n "$OBJCOPY"; then 680 BASIC_FIXUP_EXECUTABLE(OBJCOPY) 681 if test "x$OPENJDK_BUILD_OS" = xsolaris; then 682 # objcopy prior to 2.21.1 on solaris is broken and is not usable. 683 # Rewrite objcopy version output to VALID_VERSION or BAD_VERSION. 684 # - version number is last blank separate word on first line 685 # - version number formats that have been seen: 686 # - <major>.<minor> 687 # - <major>.<minor>.<micro> 688 OBJCOPY_VERSION=`$OBJCOPY --version | $HEAD -n 1` 689 # The outer [ ] is to prevent m4 from eating the [] in the sed expression. 690 [ OBJCOPY_VERSION_CHECK=`$ECHO $OBJCOPY_VERSION | $SED -n \ 691 -e 's/.* //' \ 692 -e '/^[01]\./b bad' \ 693 -e '/^2\./{' \ 694 -e ' s/^2\.//' \ 695 -e ' /^[0-9]$/b bad' \ 696 -e ' /^[0-9]\./b bad' \ 697 -e ' /^1[0-9]$/b bad' \ 698 -e ' /^1[0-9]\./b bad' \ 699 -e ' /^20\./b bad' \ 700 -e ' /^21\.0$/b bad' \ 701 -e ' /^21\.0\./b bad' \ 702 -e '}' \ 703 -e ':good' \ 704 -e 's/.*/VALID_VERSION/p' \ 705 -e 'q' \ 706 -e ':bad' \ 707 -e 's/.*/BAD_VERSION/p' \ 708 -e 'q'` ] 709 if test "x$OBJCOPY_VERSION_CHECK" = xBAD_VERSION; then 710 OBJCOPY= 711 AC_MSG_WARN([Ignoring found objcopy since it is broken (prior to 2.21.1). No debug symbols will be generated.]) 712 AC_MSG_NOTICE([objcopy reports version $OBJCOPY_VERSION]) 713 AC_MSG_NOTICE([Note: patch 149063-01 or newer contains the correct Solaris 10 SPARC version]) 714 AC_MSG_NOTICE([Note: patch 149064-01 or newer contains the correct Solaris 10 X86 version]) 715 AC_MSG_NOTICE([Note: Solaris 11 Update 1 contains the correct version]) 716 fi 717 fi 718 fi 719 fi 720 721 BASIC_CHECK_TOOLS(OBJDUMP, [gobjdump objdump]) 722 if test "x$OBJDUMP" != x; then 723 # Only used for compare.sh; we can live without it. BASIC_FIXUP_EXECUTABLE 724 # bails if argument is missing. 725 BASIC_FIXUP_EXECUTABLE(OBJDUMP) 726 fi 727]) 728 729# Setup the build tools (i.e, the compiler and linker used to build programs 730# that should be run on the build platform, not the target platform, as a build 731# helper). Since the non-cross-compile case uses the normal, target compilers 732# for this, we can only do this after these have been setup. 733AC_DEFUN_ONCE([TOOLCHAIN_SETUP_BUILD_COMPILERS], 734[ 735 if test "x$COMPILE_TYPE" = "xcross"; then 736 # Now we need to find a C/C++ compiler that can build executables for the 737 # build platform. We can't use the AC_PROG_CC macro, since it can only be 738 # used once. Also, we need to do this without adding a tools dir to the 739 # path, otherwise we might pick up cross-compilers which don't use standard 740 # naming. 741 742 OLDPATH="$PATH" 743 744 AC_ARG_WITH(build-devkit, [AS_HELP_STRING([--with-build-devkit], 745 [Devkit to use for the build platform toolchain])]) 746 if test "x$with_build_devkit" = "xyes"; then 747 AC_MSG_ERROR([--with-build-devkit must have a value]) 748 elif test -n "$with_build_devkit"; then 749 if test ! -d "$with_build_devkit"; then 750 AC_MSG_ERROR([--with-build-devkit points to non existing dir: $with_build_devkit]) 751 else 752 BASIC_FIXUP_PATH([with_build_devkit]) 753 BUILD_DEVKIT_ROOT="$with_build_devkit" 754 # Check for a meta data info file in the root of the devkit 755 if test -f "$BUILD_DEVKIT_ROOT/devkit.info"; then 756 # Process devkit.info so that existing devkit variables are not 757 # modified by this 758 $SED -e "s/^DEVKIT_/BUILD_DEVKIT_/g" \ 759 -e "s/\$DEVKIT_ROOT/\$BUILD_DEVKIT_ROOT/g" \ 760 -e "s/\$host/\$build/g" \ 761 $BUILD_DEVKIT_ROOT/devkit.info \ 762 > $CONFIGURESUPPORT_OUTPUTDIR/build-devkit.info 763 . $CONFIGURESUPPORT_OUTPUTDIR/build-devkit.info 764 # This potentially sets the following: 765 # A descriptive name of the devkit 766 BASIC_EVAL_DEVKIT_VARIABLE([BUILD_DEVKIT_NAME]) 767 # Corresponds to --with-extra-path 768 BASIC_EVAL_DEVKIT_VARIABLE([BUILD_DEVKIT_EXTRA_PATH]) 769 # Corresponds to --with-toolchain-path 770 BASIC_EVAL_DEVKIT_VARIABLE([BUILD_DEVKIT_TOOLCHAIN_PATH]) 771 # Corresponds to --with-sysroot 772 BASIC_EVAL_DEVKIT_VARIABLE([BUILD_DEVKIT_SYSROOT]) 773 # Skip the Window specific parts 774 fi 775 776 AC_MSG_CHECKING([for build platform devkit]) 777 if test "x$BUILD_DEVKIT_NAME" != x; then 778 AC_MSG_RESULT([$BUILD_DEVKIT_NAME in $BUILD_DEVKIT_ROOT]) 779 else 780 AC_MSG_RESULT([$BUILD_DEVKIT_ROOT]) 781 fi 782 783 BUILD_SYSROOT="$BUILD_DEVKIT_SYSROOT" 784 FLAGS_SETUP_SYSROOT_FLAGS([BUILD_]) 785 786 # Fallback default of just /bin if DEVKIT_PATH is not defined 787 if test "x$BUILD_DEVKIT_TOOLCHAIN_PATH" = x; then 788 BUILD_DEVKIT_TOOLCHAIN_PATH="$BUILD_DEVKIT_ROOT/bin" 789 fi 790 PATH="$BUILD_DEVKIT_TOOLCHAIN_PATH:$BUILD_DEVKIT_EXTRA_PATH" 791 fi 792 fi 793 794 # FIXME: we should list the discovered compilers as an exclude pattern! 795 # If we do that, we can do this detection before POST_DETECTION, and still 796 # find the build compilers in the tools dir, if needed. 797 BASIC_REQUIRE_PROGS(BUILD_CC, [cl cc gcc]) 798 BASIC_FIXUP_EXECUTABLE(BUILD_CC) 799 BASIC_REQUIRE_PROGS(BUILD_CXX, [cl CC g++]) 800 BASIC_FIXUP_EXECUTABLE(BUILD_CXX) 801 BASIC_PATH_PROGS(BUILD_NM, nm gcc-nm) 802 BASIC_FIXUP_EXECUTABLE(BUILD_NM) 803 BASIC_PATH_PROGS(BUILD_AR, ar gcc-ar) 804 BASIC_FIXUP_EXECUTABLE(BUILD_AR) 805 BASIC_PATH_PROGS(BUILD_OBJCOPY, objcopy) 806 BASIC_FIXUP_EXECUTABLE(BUILD_OBJCOPY) 807 BASIC_PATH_PROGS(BUILD_STRIP, strip) 808 BASIC_FIXUP_EXECUTABLE(BUILD_STRIP) 809 # Assume the C compiler is the assembler 810 BUILD_AS="$BUILD_CC -c" 811 # Just like for the target compiler, use the compiler as linker 812 BUILD_LD="$BUILD_CC" 813 BUILD_LDCXX="$BUILD_CXX" 814 815 PATH="$OLDPATH" 816 817 TOOLCHAIN_EXTRACT_COMPILER_VERSION(BUILD_CC, [BuildC]) 818 TOOLCHAIN_EXTRACT_COMPILER_VERSION(BUILD_CXX, [BuildC++]) 819 TOOLCHAIN_PREPARE_FOR_VERSION_COMPARISONS([BUILD_], [OPENJDK_BUILD_]) 820 else 821 # If we are not cross compiling, use the normal target compilers for 822 # building the build platform executables. 823 BUILD_CC="$CC" 824 BUILD_CXX="$CXX" 825 BUILD_LD="$LD" 826 BUILD_LDCXX="$LDCXX" 827 BUILD_NM="$NM" 828 BUILD_AS="$AS" 829 BUILD_OBJCOPY="$OBJCOPY" 830 BUILD_STRIP="$STRIP" 831 BUILD_SYSROOT_CFLAGS="$SYSROOT_CFLAGS" 832 BUILD_SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS" 833 BUILD_AR="$AR" 834 835 TOOLCHAIN_PREPARE_FOR_VERSION_COMPARISONS([], [OPENJDK_BUILD_]) 836 fi 837 838 AC_SUBST(BUILD_CC) 839 AC_SUBST(BUILD_CXX) 840 AC_SUBST(BUILD_LD) 841 AC_SUBST(BUILD_LDCXX) 842 AC_SUBST(BUILD_NM) 843 AC_SUBST(BUILD_AS) 844 AC_SUBST(BUILD_SYSROOT_CFLAGS) 845 AC_SUBST(BUILD_SYSROOT_LDFLAGS) 846 AC_SUBST(BUILD_AR) 847]) 848 849# Setup legacy variables that are still needed as alternative ways to refer to 850# parts of the toolchain. 851AC_DEFUN_ONCE([TOOLCHAIN_SETUP_LEGACY], 852[ 853 if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then 854 # For hotspot, we need these in Windows mixed path, 855 # so rewrite them all. Need added .exe suffix. 856 HOTSPOT_CXX="$CXX.exe" 857 HOTSPOT_LD="$LD.exe" 858 HOTSPOT_MT="$MT.exe" 859 HOTSPOT_RC="$RC.exe" 860 BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_CXX) 861 BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_LD) 862 BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_MT) 863 BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_RC) 864 AC_SUBST(HOTSPOT_MT) 865 AC_SUBST(HOTSPOT_RC) 866 else 867 HOTSPOT_CXX="$CXX" 868 HOTSPOT_LD="$LD" 869 fi 870 AC_SUBST(HOTSPOT_CXX) 871 AC_SUBST(HOTSPOT_LD) 872 873 if test "x$TOOLCHAIN_TYPE" = xclang; then 874 USE_CLANG=true 875 fi 876 AC_SUBST(USE_CLANG) 877]) 878 879# Do some additional checks on the detected tools. 880AC_DEFUN_ONCE([TOOLCHAIN_MISC_CHECKS], 881[ 882 # The package path is used only on macosx? 883 # FIXME: clean this up, and/or move it elsewhere. 884 PACKAGE_PATH=/opt/local 885 AC_SUBST(PACKAGE_PATH) 886 887 # Check for extra potential brokenness. 888 if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then 889 # On Windows, double-check that we got the right compiler. 890 CC_VERSION_OUTPUT=`$CC 2>&1 | $HEAD -n 1 | $TR -d '\r'` 891 COMPILER_CPU_TEST=`$ECHO $CC_VERSION_OUTPUT | $SED -n "s/^.* \(.*\)$/\1/p"` 892 if test "x$OPENJDK_TARGET_CPU" = "xx86"; then 893 if test "x$COMPILER_CPU_TEST" != "x80x86" -a "x$COMPILER_CPU_TEST" != "xx86"; then 894 AC_MSG_ERROR([Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for "$COMPILER_CPU_TEST"; expected "80x86" or "x86".]) 895 fi 896 elif test "x$OPENJDK_TARGET_CPU" = "xx86_64"; then 897 if test "x$COMPILER_CPU_TEST" != "xx64"; then 898 AC_MSG_ERROR([Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for "$COMPILER_CPU_TEST"; expected "x64".]) 899 fi 900 fi 901 fi 902 903 if test "x$TOOLCHAIN_TYPE" = xgcc; then 904 # If this is a --hash-style=gnu system, use --hash-style=both, why? 905 HAS_GNU_HASH=`$CC -dumpspecs 2>/dev/null | $GREP 'hash-style=gnu'` 906 # This is later checked when setting flags. 907 908 # "-Og" suppported for GCC 4.8 and later 909 CFLAG_OPTIMIZE_DEBUG_FLAG="-Og" 910 FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$CFLAG_OPTIMIZE_DEBUG_FLAG], 911 IF_TRUE: [HAS_CFLAG_OPTIMIZE_DEBUG=true], 912 IF_FALSE: [HAS_CFLAG_OPTIMIZE_DEBUG=false]) 913 914 # "-z relro" supported in GNU binutils 2.17 and later 915 LINKER_RELRO_FLAG="-Wl,-z,relro" 916 FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [$LINKER_RELRO_FLAG], 917 IF_TRUE: [HAS_LINKER_RELRO=true], 918 IF_FALSE: [HAS_LINKER_RELRO=false]) 919 920 # "-z now" supported in GNU binutils 2.11 and later 921 LINKER_NOW_FLAG="-Wl,-z,now" 922 FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [$LINKER_NOW_FLAG], 923 IF_TRUE: [HAS_LINKER_NOW=true], 924 IF_FALSE: [HAS_LINKER_NOW=false]) 925 fi 926 927 # Check for broken SuSE 'ld' for which 'Only anonymous version tag is allowed 928 # in executable.' 929 USING_BROKEN_SUSE_LD=no 930 if test "x$OPENJDK_TARGET_OS" = xlinux && test "x$TOOLCHAIN_TYPE" = xgcc; then 931 AC_MSG_CHECKING([for broken SuSE 'ld' which only understands anonymous version tags in executables]) 932 $ECHO "SUNWprivate_1.1 { local: *; };" > version-script.map 933 $ECHO "int main() { }" > main.c 934 if $CXX -Wl,-version-script=version-script.map main.c 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD; then 935 AC_MSG_RESULT(no) 936 USING_BROKEN_SUSE_LD=no 937 else 938 AC_MSG_RESULT(yes) 939 USING_BROKEN_SUSE_LD=yes 940 fi 941 $RM version-script.map main.c a.out 942 fi 943 AC_SUBST(USING_BROKEN_SUSE_LD) 944 945 # Setup hotspot lecagy names for toolchains 946 HOTSPOT_TOOLCHAIN_TYPE=$TOOLCHAIN_TYPE 947 if test "x$TOOLCHAIN_TYPE" = xclang; then 948 HOTSPOT_TOOLCHAIN_TYPE=gcc 949 elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then 950 HOTSPOT_TOOLCHAIN_TYPE=sparcWorks 951 elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then 952 HOTSPOT_TOOLCHAIN_TYPE=visCPP 953 fi 954 AC_SUBST(HOTSPOT_TOOLCHAIN_TYPE) 955]) 956 957# Setup the JTReg Regression Test Harness. 958AC_DEFUN_ONCE([TOOLCHAIN_SETUP_JTREG], 959[ 960 AC_ARG_WITH(jtreg, [AS_HELP_STRING([--with-jtreg], 961 [Regression Test Harness @<:@probed@:>@])], 962 [], 963 [with_jtreg=no]) 964 965 if test "x$with_jtreg" = xno; then 966 # jtreg disabled 967 AC_MSG_CHECKING([for jtreg]) 968 AC_MSG_RESULT(no) 969 else 970 if test "x$with_jtreg" != xyes; then 971 # with path specified. 972 JT_HOME="$with_jtreg" 973 fi 974 975 if test "x$JT_HOME" != x; then 976 AC_MSG_CHECKING([for jtreg]) 977 978 # use JT_HOME enviroment var. 979 BASIC_FIXUP_PATH([JT_HOME]) 980 981 # jtreg win32 script works for everybody 982 JTREGEXE="$JT_HOME/bin/jtreg" 983 984 if test ! -f "$JTREGEXE"; then 985 AC_MSG_ERROR([JTReg executable does not exist: $JTREGEXE]) 986 fi 987 988 AC_MSG_RESULT($JTREGEXE) 989 else 990 # try to find jtreg on path 991 BASIC_REQUIRE_PROGS(JTREGEXE, jtreg) 992 JT_HOME="`$DIRNAME $JTREGEXE`" 993 fi 994 fi 995 996 AC_SUBST(JT_HOME) 997 AC_SUBST(JTREGEXE) 998]) 999