410 # Version: 11.01.0000.0015
411 COMPILER_VERSION_OUTPUT=`$COMPILER -qversion 2>&1`
412 # Check that this is likely to be the IBM XL C compiler.
413 $ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "IBM XL C" > /dev/null
414 if test $? -ne 0; then
415 ALT_VERSION_OUTPUT=`$COMPILER --version 2>&1`
416 AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler.])
417 AC_MSG_NOTICE([The result from running with -qversion was: "$COMPILER_VERSION_OUTPUT"])
418 AC_MSG_NOTICE([The result from running with --version was: "$ALT_VERSION_OUTPUT"])
419 AC_MSG_ERROR([A $TOOLCHAIN_TYPE compiler is required. Try setting --with-tools-dir.])
420 fi
421 # Collapse compiler output into a single line
422 COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT`
423 COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \
424 $SED -e 's/^.*, V\(@<:@1-9@:>@@<:@0-9.@:>@*\).*$/\1/'`
425 elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
426 # There is no specific version flag, but all output starts with a version string.
427 # First line typically looks something like:
428 # Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
429 # but the compiler name may vary depending on locale.
430 COMPILER_VERSION_OUTPUT=`"$COMPILER" 2>&1 | $GREP -v 'ERROR.*UtilTranslatePathList' | $HEAD -n 1 | $TR -d '\r'`
431 # Check that this is likely to be Microsoft CL.EXE.
432 $ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "Microsoft" > /dev/null
433 if test $? -ne 0; then
434 AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler.])
435 AC_MSG_NOTICE([The result from running it was: "$COMPILER_VERSION_OUTPUT"])
436 AC_MSG_ERROR([A $TOOLCHAIN_TYPE compiler is required. Try setting --with-tools-dir.])
437 fi
438 # Collapse compiler output into a single line
439 COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT`
440 COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \
441 $SED -e 's/^.*ersion.\(@<:@1-9@:>@@<:@0-9.@:>@*\) .*$/\1/'`
442 elif test "x$TOOLCHAIN_TYPE" = xgcc; then
443 # gcc --version output typically looks like
444 # gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
445 # Copyright (C) 2013 Free Software Foundation, Inc.
446 # This is free software; see the source for copying conditions. There is NO
447 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
448 COMPILER_VERSION_OUTPUT=`$COMPILER --version 2>&1`
449 # Check that this is likely to be GCC.
450 $ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "Free Software Foundation" > /dev/null
942
943 TOOLCHAIN_PREPARE_FOR_VERSION_COMPARISONS([], [OPENJDK_BUILD_], [build ])
944 TOOLCHAIN_PREPARE_FOR_LD_VERSION_COMPARISONS([BUILD_], [OPENJDK_BUILD_])
945 fi
946
947 AC_SUBST(BUILD_CC)
948 AC_SUBST(BUILD_CXX)
949 AC_SUBST(BUILD_LD)
950 AC_SUBST(BUILD_LDCXX)
951 AC_SUBST(BUILD_NM)
952 AC_SUBST(BUILD_AS)
953 AC_SUBST(BUILD_AR)
954 ])
955
956 # Do some additional checks on the detected tools.
957 AC_DEFUN_ONCE([TOOLCHAIN_MISC_CHECKS],
958 [
959 # Check for extra potential brokenness.
960 if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
961 # On Windows, double-check that we got the right compiler.
962 CC_VERSION_OUTPUT=`$CC 2>&1 | $GREP -v 'ERROR.*UtilTranslatePathList' | $HEAD -n 1 | $TR -d '\r'`
963 COMPILER_CPU_TEST=`$ECHO $CC_VERSION_OUTPUT | $SED -n "s/^.* \(.*\)$/\1/p"`
964 if test "x$OPENJDK_TARGET_CPU" = "xx86"; then
965 if test "x$COMPILER_CPU_TEST" != "x80x86" -a "x$COMPILER_CPU_TEST" != "xx86"; then
966 AC_MSG_ERROR([Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for "$COMPILER_CPU_TEST"; expected "80x86" or "x86".])
967 fi
968 elif test "x$OPENJDK_TARGET_CPU" = "xx86_64"; then
969 if test "x$COMPILER_CPU_TEST" != "xx64"; then
970 AC_MSG_ERROR([Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for "$COMPILER_CPU_TEST"; expected "x64".])
971 fi
972 fi
973 fi
974
975 if test "x$TOOLCHAIN_TYPE" = xgcc; then
976 # If this is a --hash-style=gnu system, use --hash-style=both, why?
977 HAS_GNU_HASH=`$CC -dumpspecs 2>/dev/null | $GREP 'hash-style=gnu'`
978 # This is later checked when setting flags.
979 fi
980
981 if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
982 # Check if linker has -z noexecstack.
|
410 # Version: 11.01.0000.0015
411 COMPILER_VERSION_OUTPUT=`$COMPILER -qversion 2>&1`
412 # Check that this is likely to be the IBM XL C compiler.
413 $ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "IBM XL C" > /dev/null
414 if test $? -ne 0; then
415 ALT_VERSION_OUTPUT=`$COMPILER --version 2>&1`
416 AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler.])
417 AC_MSG_NOTICE([The result from running with -qversion was: "$COMPILER_VERSION_OUTPUT"])
418 AC_MSG_NOTICE([The result from running with --version was: "$ALT_VERSION_OUTPUT"])
419 AC_MSG_ERROR([A $TOOLCHAIN_TYPE compiler is required. Try setting --with-tools-dir.])
420 fi
421 # Collapse compiler output into a single line
422 COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT`
423 COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \
424 $SED -e 's/^.*, V\(@<:@1-9@:>@@<:@0-9.@:>@*\).*$/\1/'`
425 elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
426 # There is no specific version flag, but all output starts with a version string.
427 # First line typically looks something like:
428 # Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
429 # but the compiler name may vary depending on locale.
430 COMPILER_VERSION_OUTPUT=`"$COMPILER" 2>&1 | $GREP 'Optimizing Compiler' | $HEAD -n 1 | $TR -d '\r'`
431 # Check that this is likely to be Microsoft CL.EXE.
432 $ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "Microsoft" > /dev/null
433 if test $? -ne 0; then
434 AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler.])
435 AC_MSG_NOTICE([The result from running it was: "$COMPILER_VERSION_OUTPUT"])
436 AC_MSG_ERROR([A $TOOLCHAIN_TYPE compiler is required. Try setting --with-tools-dir.])
437 fi
438 # Collapse compiler output into a single line
439 COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT`
440 COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \
441 $SED -e 's/^.*ersion.\(@<:@1-9@:>@@<:@0-9.@:>@*\) .*$/\1/'`
442 elif test "x$TOOLCHAIN_TYPE" = xgcc; then
443 # gcc --version output typically looks like
444 # gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
445 # Copyright (C) 2013 Free Software Foundation, Inc.
446 # This is free software; see the source for copying conditions. There is NO
447 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
448 COMPILER_VERSION_OUTPUT=`$COMPILER --version 2>&1`
449 # Check that this is likely to be GCC.
450 $ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "Free Software Foundation" > /dev/null
942
943 TOOLCHAIN_PREPARE_FOR_VERSION_COMPARISONS([], [OPENJDK_BUILD_], [build ])
944 TOOLCHAIN_PREPARE_FOR_LD_VERSION_COMPARISONS([BUILD_], [OPENJDK_BUILD_])
945 fi
946
947 AC_SUBST(BUILD_CC)
948 AC_SUBST(BUILD_CXX)
949 AC_SUBST(BUILD_LD)
950 AC_SUBST(BUILD_LDCXX)
951 AC_SUBST(BUILD_NM)
952 AC_SUBST(BUILD_AS)
953 AC_SUBST(BUILD_AR)
954 ])
955
956 # Do some additional checks on the detected tools.
957 AC_DEFUN_ONCE([TOOLCHAIN_MISC_CHECKS],
958 [
959 # Check for extra potential brokenness.
960 if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
961 # On Windows, double-check that we got the right compiler.
962 CC_VERSION_OUTPUT=`$CC 2>&1 | $GREP 'Optimizing Compiler' | $HEAD -n 1 | $TR -d '\r'`
963 COMPILER_CPU_TEST=`$ECHO $CC_VERSION_OUTPUT | $SED -n "s/^.* \(.*\)$/\1/p"`
964 if test "x$OPENJDK_TARGET_CPU" = "xx86"; then
965 if test "x$COMPILER_CPU_TEST" != "x80x86" -a "x$COMPILER_CPU_TEST" != "xx86"; then
966 AC_MSG_ERROR([Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for "$COMPILER_CPU_TEST"; expected "80x86" or "x86".])
967 fi
968 elif test "x$OPENJDK_TARGET_CPU" = "xx86_64"; then
969 if test "x$COMPILER_CPU_TEST" != "xx64"; then
970 AC_MSG_ERROR([Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for "$COMPILER_CPU_TEST"; expected "x64".])
971 fi
972 fi
973 fi
974
975 if test "x$TOOLCHAIN_TYPE" = xgcc; then
976 # If this is a --hash-style=gnu system, use --hash-style=both, why?
977 HAS_GNU_HASH=`$CC -dumpspecs 2>/dev/null | $GREP 'hash-style=gnu'`
978 # This is later checked when setting flags.
979 fi
980
981 if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
982 # Check if linker has -z noexecstack.
|