2012-07-06 01:27:07 +00:00
|
|
|
#
|
2014-02-24 11:16:58 +00:00
|
|
|
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
2012-07-06 01:27:07 +00:00
|
|
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
#
|
|
|
|
# This code is free software; you can redistribute it and/or modify it
|
|
|
|
# under the terms of the GNU General Public License version 2 only, as
|
|
|
|
# published by the Free Software Foundation. Oracle designates this
|
|
|
|
# particular file as subject to the "Classpath" exception as provided
|
|
|
|
# by Oracle in the LICENSE file that accompanied this code.
|
|
|
|
#
|
|
|
|
# This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
# version 2 for more details (a copy is included in the LICENSE file that
|
|
|
|
# accompanied this code).
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License version
|
|
|
|
# 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
|
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
#
|
|
|
|
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
# or visit www.oracle.com if you need additional information or have any
|
|
|
|
# questions.
|
|
|
|
#
|
|
|
|
|
2014-02-24 11:16:58 +00:00
|
|
|
########################################################################
|
|
|
|
# This file is responsible for detecting, verifying and setting up the
|
|
|
|
# toolchain, i.e. the compiler, linker and related utilities. It will setup
|
|
|
|
# proper paths to the binaries, but it will not setup any flags.
|
|
|
|
#
|
|
|
|
# The binaries used is determined by the toolchain type, which is the family of
|
|
|
|
# compilers and related tools that are used.
|
|
|
|
########################################################################
|
|
|
|
|
|
|
|
|
|
|
|
# All valid toolchains, regardless of platform (used by help.m4)
|
|
|
|
VALID_TOOLCHAINS_all="gcc clang solstudio xlc microsoft"
|
|
|
|
|
|
|
|
# These toolchains are valid on different platforms
|
|
|
|
VALID_TOOLCHAINS_linux="gcc clang"
|
|
|
|
VALID_TOOLCHAINS_solaris="solstudio"
|
|
|
|
VALID_TOOLCHAINS_macosx="gcc clang"
|
|
|
|
VALID_TOOLCHAINS_aix="xlc"
|
|
|
|
VALID_TOOLCHAINS_windows="microsoft"
|
|
|
|
|
|
|
|
# Toolchain descriptions
|
|
|
|
TOOLCHAIN_DESCRIPTION_clang="clang/LLVM"
|
|
|
|
TOOLCHAIN_DESCRIPTION_gcc="GNU Compiler Collection"
|
|
|
|
TOOLCHAIN_DESCRIPTION_microsoft="Microsoft Visual Studio"
|
|
|
|
TOOLCHAIN_DESCRIPTION_solstudio="Oracle Solaris Studio"
|
|
|
|
TOOLCHAIN_DESCRIPTION_xlc="IBM XL C/C++"
|
|
|
|
|
|
|
|
# Setup a number of variables describing how native output files are
|
|
|
|
# named on this platform/toolchain.
|
|
|
|
AC_DEFUN([TOOLCHAIN_SETUP_FILENAME_PATTERNS],
|
|
|
|
[
|
|
|
|
# Define filename patterns
|
|
|
|
if test "x$OPENJDK_TARGET_OS" = xwindows; then
|
|
|
|
LIBRARY_PREFIX=
|
|
|
|
SHARED_LIBRARY_SUFFIX='.dll'
|
|
|
|
STATIC_LIBRARY_SUFFIX='.lib'
|
|
|
|
SHARED_LIBRARY='[$]1.dll'
|
|
|
|
STATIC_LIBRARY='[$]1.lib'
|
|
|
|
OBJ_SUFFIX='.obj'
|
|
|
|
EXE_SUFFIX='.exe'
|
|
|
|
else
|
|
|
|
LIBRARY_PREFIX=lib
|
|
|
|
SHARED_LIBRARY_SUFFIX='.so'
|
|
|
|
STATIC_LIBRARY_SUFFIX='.a'
|
|
|
|
SHARED_LIBRARY='lib[$]1.so'
|
|
|
|
STATIC_LIBRARY='lib[$]1.a'
|
|
|
|
OBJ_SUFFIX='.o'
|
|
|
|
EXE_SUFFIX=''
|
|
|
|
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
|
|
|
SHARED_LIBRARY='lib[$]1.dylib'
|
|
|
|
SHARED_LIBRARY_SUFFIX='.dylib'
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_SUBST(LIBRARY_PREFIX)
|
|
|
|
AC_SUBST(SHARED_LIBRARY_SUFFIX)
|
|
|
|
AC_SUBST(STATIC_LIBRARY_SUFFIX)
|
|
|
|
AC_SUBST(SHARED_LIBRARY)
|
|
|
|
AC_SUBST(STATIC_LIBRARY)
|
|
|
|
AC_SUBST(OBJ_SUFFIX)
|
|
|
|
AC_SUBST(EXE_SUFFIX)
|
|
|
|
])
|
|
|
|
|
|
|
|
# Determine which toolchain type to use, and make sure it is valid for this
|
|
|
|
# platform. Setup various information about the selected toolchain.
|
|
|
|
AC_DEFUN_ONCE([TOOLCHAIN_DETERMINE_TOOLCHAIN_TYPE],
|
|
|
|
[
|
|
|
|
AC_ARG_WITH(toolchain-type, [AS_HELP_STRING([--with-toolchain-type],
|
|
|
|
[the toolchain type (or family) to use, use '--help' to show possible values @<:@platform dependent@:>@])])
|
|
|
|
|
|
|
|
# Use indirect variable referencing
|
|
|
|
toolchain_var_name=VALID_TOOLCHAINS_$OPENJDK_BUILD_OS
|
|
|
|
VALID_TOOLCHAINS=${!toolchain_var_name}
|
2014-02-26 07:38:52 +00:00
|
|
|
|
|
|
|
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
|
|
|
# On Mac OS X, default toolchain to clang after Xcode 5
|
|
|
|
XCODE_VERSION_OUTPUT=`xcodebuild -version 2>&1 | $HEAD -n 1`
|
|
|
|
$ECHO "$XCODE_VERSION_OUTPUT" | $GREP "Xcode " > /dev/null
|
|
|
|
if test $? -ne 0; then
|
|
|
|
AC_MSG_ERROR([Failed to determine Xcode version.])
|
|
|
|
fi
|
|
|
|
XCODE_MAJOR_VERSION=`$ECHO $XCODE_VERSION_OUTPUT | \
|
|
|
|
$SED -e 's/^Xcode \(@<:@1-9@:>@@<:@0-9.@:>@*\)/\1/' | \
|
|
|
|
$CUT -f 1 -d .`
|
|
|
|
AC_MSG_NOTICE([Xcode major version: $XCODE_MAJOR_VERSION])
|
|
|
|
if test $XCODE_MAJOR_VERSION -ge 5; then
|
|
|
|
DEFAULT_TOOLCHAIN="clang"
|
|
|
|
else
|
|
|
|
DEFAULT_TOOLCHAIN="gcc"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
# First toolchain type in the list is the default
|
|
|
|
DEFAULT_TOOLCHAIN=${VALID_TOOLCHAINS%% *}
|
|
|
|
fi
|
2014-02-24 11:16:58 +00:00
|
|
|
|
|
|
|
if test "x$with_toolchain_type" = xlist; then
|
|
|
|
# List all toolchains
|
|
|
|
AC_MSG_NOTICE([The following toolchains are valid on this platform:])
|
|
|
|
for toolchain in $VALID_TOOLCHAINS; do
|
|
|
|
toolchain_var_name=TOOLCHAIN_DESCRIPTION_$toolchain
|
|
|
|
TOOLCHAIN_DESCRIPTION=${!toolchain_var_name}
|
|
|
|
$PRINTF " %-10s %s\n" $toolchain "$TOOLCHAIN_DESCRIPTION"
|
|
|
|
done
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
elif test "x$with_toolchain_type" != x; then
|
|
|
|
# User override; check that it is valid
|
|
|
|
if test "x${VALID_TOOLCHAINS/$with_toolchain_type/}" = "x${VALID_TOOLCHAINS}"; then
|
|
|
|
AC_MSG_NOTICE([Toolchain type $with_toolchain_type is not valid on this platform.])
|
|
|
|
AC_MSG_NOTICE([Valid toolchains: $VALID_TOOLCHAINS.])
|
|
|
|
AC_MSG_ERROR([Cannot continue.])
|
|
|
|
fi
|
|
|
|
TOOLCHAIN_TYPE=$with_toolchain_type
|
|
|
|
else
|
|
|
|
# No flag given, use default
|
|
|
|
TOOLCHAIN_TYPE=$DEFAULT_TOOLCHAIN
|
|
|
|
fi
|
|
|
|
AC_SUBST(TOOLCHAIN_TYPE)
|
|
|
|
|
|
|
|
TOOLCHAIN_CC_BINARY_clang="clang"
|
|
|
|
TOOLCHAIN_CC_BINARY_gcc="gcc"
|
|
|
|
TOOLCHAIN_CC_BINARY_microsoft="cl"
|
|
|
|
TOOLCHAIN_CC_BINARY_solstudio="cc"
|
|
|
|
TOOLCHAIN_CC_BINARY_xlc="xlc_r"
|
|
|
|
|
|
|
|
TOOLCHAIN_CXX_BINARY_clang="clang++"
|
|
|
|
TOOLCHAIN_CXX_BINARY_gcc="g++"
|
|
|
|
TOOLCHAIN_CXX_BINARY_microsoft="cl"
|
|
|
|
TOOLCHAIN_CXX_BINARY_solstudio="CC"
|
|
|
|
TOOLCHAIN_CXX_BINARY_xlc="xlC_r"
|
|
|
|
|
|
|
|
# Use indirect variable referencing
|
|
|
|
toolchain_var_name=TOOLCHAIN_DESCRIPTION_$TOOLCHAIN_TYPE
|
|
|
|
TOOLCHAIN_DESCRIPTION=${!toolchain_var_name}
|
|
|
|
toolchain_var_name=TOOLCHAIN_CC_BINARY_$TOOLCHAIN_TYPE
|
|
|
|
TOOLCHAIN_CC_BINARY=${!toolchain_var_name}
|
|
|
|
toolchain_var_name=TOOLCHAIN_CXX_BINARY_$TOOLCHAIN_TYPE
|
|
|
|
TOOLCHAIN_CXX_BINARY=${!toolchain_var_name}
|
|
|
|
|
|
|
|
TOOLCHAIN_SETUP_FILENAME_PATTERNS
|
|
|
|
|
|
|
|
if test "x$TOOLCHAIN_TYPE" = "x$DEFAULT_TOOLCHAIN"; then
|
|
|
|
AC_MSG_NOTICE([Using default toolchain $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION)])
|
|
|
|
else
|
|
|
|
AC_MSG_NOTICE([Using user selected toolchain $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION). Default toolchain is $DEFAULT_TOOLCHAIN.])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
# Before we start detecting the toolchain executables, we might need some
|
|
|
|
# special setup, e.g. additional paths etc.
|
|
|
|
AC_DEFUN_ONCE([TOOLCHAIN_PRE_DETECTION],
|
|
|
|
[
|
|
|
|
# FIXME: Is this needed?
|
|
|
|
AC_LANG(C++)
|
|
|
|
|
|
|
|
# Store the CFLAGS etc passed to the configure script.
|
|
|
|
ORG_CFLAGS="$CFLAGS"
|
|
|
|
ORG_CXXFLAGS="$CXXFLAGS"
|
|
|
|
ORG_OBJCFLAGS="$OBJCFLAGS"
|
|
|
|
|
2014-02-25 14:19:32 +00:00
|
|
|
# On Windows, we need to detect the visual studio installation first.
|
|
|
|
# This will change the PATH, but we need to keep that new PATH even
|
|
|
|
# after toolchain detection is done, since the compiler (on x86) uses
|
|
|
|
# it for DLL resolution in runtime.
|
|
|
|
if test "x$OPENJDK_BUILD_OS" = "xwindows" && test "x$TOOLCHAIN_TYPE" = "xmicrosoft"; then
|
|
|
|
TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV
|
|
|
|
fi
|
|
|
|
|
2014-02-24 11:16:58 +00:00
|
|
|
# autoconf magic only relies on PATH, so update it if tools dir is specified
|
|
|
|
OLD_PATH="$PATH"
|
|
|
|
|
|
|
|
# For solaris we really need solaris tools, and not the GNU equivalent.
|
|
|
|
# The build tools on Solaris reside in /usr/ccs (C Compilation System),
|
|
|
|
# so add that to path before starting to probe.
|
|
|
|
# FIXME: This was originally only done for AS,NM,GNM,STRIP,MCS,OBJCOPY,OBJDUMP.
|
|
|
|
if test "x$OPENJDK_BUILD_OS" = xsolaris; then
|
|
|
|
PATH="/usr/ccs/bin:$PATH"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Finally add TOOLS_DIR at the beginning, to allow --with-tools-dir to
|
|
|
|
# override all other locations.
|
|
|
|
if test "x$TOOLS_DIR" != x; then
|
|
|
|
PATH=$TOOLS_DIR:$PATH
|
|
|
|
fi
|
|
|
|
|
|
|
|
# If a devkit is found on the builddeps server, then prepend its path to the
|
|
|
|
# PATH variable. If there are cross compilers available in the devkit, these
|
|
|
|
# will be found by AC_PROG_CC et al.
|
|
|
|
DEVKIT=
|
|
|
|
BDEPS_CHECK_MODULE(DEVKIT, devkit, xxx,
|
|
|
|
[
|
|
|
|
# Found devkit
|
|
|
|
PATH="$DEVKIT/bin:$PATH"
|
|
|
|
SYS_ROOT="$DEVKIT/${rewritten_target}/sys-root"
|
|
|
|
if test "x$x_includes" = "xNONE"; then
|
|
|
|
x_includes="$SYS_ROOT/usr/include/X11"
|
|
|
|
fi
|
|
|
|
if test "x$x_libraries" = "xNONE"; then
|
|
|
|
x_libraries="$SYS_ROOT/usr/lib"
|
|
|
|
fi
|
|
|
|
],
|
|
|
|
[])
|
|
|
|
])
|
|
|
|
|
|
|
|
# Restore path, etc
|
|
|
|
AC_DEFUN_ONCE([TOOLCHAIN_POST_DETECTION],
|
|
|
|
[
|
|
|
|
# Restore old path.
|
|
|
|
PATH="$OLD_PATH"
|
|
|
|
|
|
|
|
# Restore the flags to the user specified values.
|
|
|
|
# This is necessary since AC_PROG_CC defaults CFLAGS to "-g -O2"
|
|
|
|
CFLAGS="$ORG_CFLAGS"
|
|
|
|
CXXFLAGS="$ORG_CXXFLAGS"
|
|
|
|
OBJCFLAGS="$ORG_OBJCFLAGS"
|
|
|
|
])
|
|
|
|
|
|
|
|
# Check if a compiler is of the toolchain type we expect, and save the version
|
|
|
|
# information from it. If the compiler does not match the expected type,
|
|
|
|
# this function will abort using AC_MSG_ERROR. If it matches, the version will
|
|
|
|
# be stored in CC_VERSION_NUMBER/CXX_VERSION_NUMBER (as a dotted number), and
|
|
|
|
# the full version string in CC_VERSION_STRING/CXX_VERSION_STRING.
|
|
|
|
#
|
2012-10-26 21:29:57 +00:00
|
|
|
# $1 = compiler to test (CC or CXX)
|
|
|
|
# $2 = human readable name of compiler (C or C++)
|
|
|
|
AC_DEFUN([TOOLCHAIN_CHECK_COMPILER_VERSION],
|
2012-07-06 01:27:07 +00:00
|
|
|
[
|
2012-10-26 21:29:57 +00:00
|
|
|
COMPILER=[$]$1
|
|
|
|
COMPILER_NAME=$2
|
|
|
|
|
2014-02-24 11:16:58 +00:00
|
|
|
if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
|
|
|
|
# cc -V output typically looks like
|
|
|
|
# cc: Sun C 5.12 Linux_i386 2011/11/16
|
|
|
|
COMPILER_VERSION_OUTPUT=`$COMPILER -V 2>&1`
|
|
|
|
# Check that this is likely to be the Solaris Studio cc.
|
|
|
|
$ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "^.*: Sun $COMPILER_NAME" > /dev/null
|
2012-10-26 21:29:57 +00:00
|
|
|
if test $? -ne 0; then
|
2014-02-24 11:16:58 +00:00
|
|
|
ALT_VERSION_OUTPUT=`$COMPILER --version 2>&1`
|
|
|
|
AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler.])
|
|
|
|
AC_MSG_NOTICE([The result from running with -V was: "$COMPILER_VERSION_OUTPUT"])
|
|
|
|
AC_MSG_NOTICE([The result from running with --version was: "$ALT_VERSION_OUTPUT"])
|
|
|
|
AC_MSG_ERROR([A $TOOLCHAIN_TYPE compiler is required. Try setting --with-tools-dir.])
|
2012-09-18 18:29:16 +00:00
|
|
|
fi
|
2014-02-24 11:16:58 +00:00
|
|
|
# Remove usage instructions (if present), and
|
|
|
|
# collapse compiler output into a single line
|
|
|
|
COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT | \
|
|
|
|
$SED -e 's/ *@<:@Uu@:>@sage:.*//'`
|
|
|
|
COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \
|
|
|
|
$SED -e "s/^.*@<:@ ,\t@:>@$COMPILER_NAME@<:@ ,\t@:>@\(@<:@1-9@:>@\.@<:@0-9@:>@@<:@0-9@:>@*\).*/\1/"`
|
|
|
|
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
|
|
|
|
# xlc -qversion output typically looks like
|
|
|
|
# IBM XL C/C++ for AIX, V11.1 (5724-X13)
|
|
|
|
# Version: 11.01.0000.0015
|
|
|
|
COMPILER_VERSION_OUTPUT=`$COMPILER -qversion 2>&1`
|
|
|
|
# Check that this is likely to be the IBM XL C compiler.
|
|
|
|
$ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "IBM XL C" > /dev/null
|
|
|
|
if test $? -ne 0; then
|
|
|
|
ALT_VERSION_OUTPUT=`$COMPILER --version 2>&1`
|
|
|
|
AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler.])
|
|
|
|
AC_MSG_NOTICE([The result from running with -qversion was: "$COMPILER_VERSION_OUTPUT"])
|
|
|
|
AC_MSG_NOTICE([The result from running with --version was: "$ALT_VERSION_OUTPUT"])
|
|
|
|
AC_MSG_ERROR([A $TOOLCHAIN_TYPE compiler is required. Try setting --with-tools-dir.])
|
|
|
|
fi
|
|
|
|
# Collapse compiler output into a single line
|
|
|
|
COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT`
|
|
|
|
COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \
|
|
|
|
$SED -e 's/^.*, V\(@<:@1-9@:>@@<:@0-9.@:>@*\).*$/\1/'`
|
|
|
|
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
|
|
|
# There is no specific version flag, but all output starts with a version string.
|
2012-10-26 21:29:57 +00:00
|
|
|
# First line typically looks something like:
|
2013-10-10 01:51:32 +00:00
|
|
|
# Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
|
2014-02-24 11:16:58 +00:00
|
|
|
COMPILER_VERSION_OUTPUT=`$COMPILER 2>&1 | $HEAD -n 1 | $TR -d '\r'`
|
|
|
|
# Check that this is likely to be Microsoft CL.EXE.
|
|
|
|
$ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "Microsoft.*Compiler" > /dev/null
|
|
|
|
if test $? -ne 0; then
|
|
|
|
AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler.])
|
|
|
|
AC_MSG_NOTICE([The result from running it was: "$COMPILER_VERSION_OUTPUT"])
|
|
|
|
AC_MSG_ERROR([A $TOOLCHAIN_TYPE compiler is required. Try setting --with-tools-dir.])
|
2012-07-06 01:27:07 +00:00
|
|
|
fi
|
2014-02-24 11:16:58 +00:00
|
|
|
# Collapse compiler output into a single line
|
|
|
|
COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT`
|
|
|
|
COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \
|
|
|
|
$SED -e 's/^.*ersion.\(@<:@1-9@:>@@<:@0-9.@:>@*\) .*$/\1/'`
|
|
|
|
elif test "x$TOOLCHAIN_TYPE" = xgcc; then
|
|
|
|
# gcc --version output typically looks like
|
|
|
|
# gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
|
|
|
|
# Copyright (C) 2013 Free Software Foundation, Inc.
|
|
|
|
# This is free software; see the source for copying conditions. There is NO
|
|
|
|
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
COMPILER_VERSION_OUTPUT=`$COMPILER --version 2>&1`
|
2012-10-26 21:29:57 +00:00
|
|
|
# Check that this is likely to be GCC.
|
2014-02-24 11:16:58 +00:00
|
|
|
$ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "Free Software Foundation" > /dev/null
|
2012-10-26 21:29:57 +00:00
|
|
|
if test $? -ne 0; then
|
2014-02-24 11:16:58 +00:00
|
|
|
AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler.])
|
|
|
|
AC_MSG_NOTICE([The result from running with --version was: "$COMPILER_VERSION"])
|
|
|
|
AC_MSG_ERROR([A $TOOLCHAIN_TYPE compiler is required. Try setting --with-tools-dir.])
|
2012-10-26 21:29:57 +00:00
|
|
|
fi
|
2014-02-24 11:16:58 +00:00
|
|
|
# Remove Copyright and legalese from version string, and
|
|
|
|
# collapse into a single line
|
|
|
|
COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT | \
|
|
|
|
$SED -e 's/ *Copyright .*//'`
|
|
|
|
COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \
|
|
|
|
$SED -e 's/^.* \(@<:@1-9@:>@\.@<:@0-9.@:>@*\) .*$/\1/'`
|
|
|
|
elif test "x$TOOLCHAIN_TYPE" = xclang; then
|
|
|
|
# clang --version output typically looks like
|
|
|
|
# Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
|
|
|
|
# clang version 3.3 (tags/RELEASE_33/final)
|
|
|
|
# or
|
|
|
|
# Debian clang version 3.2-7ubuntu1 (tags/RELEASE_32/final) (based on LLVM 3.2)
|
|
|
|
# Target: x86_64-pc-linux-gnu
|
|
|
|
# Thread model: posix
|
|
|
|
COMPILER_VERSION_OUTPUT=`$COMPILER --version 2>&1`
|
|
|
|
# Check that this is likely to be clang
|
|
|
|
$ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "clang" > /dev/null
|
|
|
|
if test $? -ne 0; then
|
|
|
|
AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler.])
|
|
|
|
AC_MSG_NOTICE([The result from running with --version was: "$COMPILER_VERSION_OUTPUT"])
|
|
|
|
AC_MSG_ERROR([A $TOOLCHAIN_TYPE compiler is required. Try setting --with-tools-dir.])
|
|
|
|
fi
|
|
|
|
# Collapse compiler output into a single line
|
|
|
|
COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT`
|
|
|
|
COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \
|
|
|
|
$SED -e 's/^.*clang version \(@<:@1-9@:>@@<:@0-9.@:>@*\).*$/\1/'`
|
|
|
|
else
|
|
|
|
AC_MSG_ERROR([Unknown toolchain type $TOOLCHAIN_TYPE.])
|
2012-10-26 21:29:57 +00:00
|
|
|
fi
|
2014-02-24 11:16:58 +00:00
|
|
|
# This sets CC_VERSION_NUMBER or CXX_VERSION_NUMBER. (This comment is a grep marker)
|
|
|
|
$1_VERSION_NUMBER="$COMPILER_VERSION_NUMBER"
|
|
|
|
# This sets CC_VERSION_STRING or CXX_VERSION_STRING. (This comment is a grep marker)
|
|
|
|
$1_VERSION_STRING="$COMPILER_VERSION_STRING"
|
2012-10-26 21:29:57 +00:00
|
|
|
|
2014-02-24 11:16:58 +00:00
|
|
|
AC_MSG_NOTICE([Using $TOOLCHAIN_TYPE $COMPILER_NAME compiler version $COMPILER_VERSION_NUMBER @<:@$COMPILER_VERSION_STRING@:>@])
|
2012-07-06 01:27:07 +00:00
|
|
|
])
|
|
|
|
|
2014-02-24 11:16:58 +00:00
|
|
|
# Try to locate the given C or C++ compiler in the path, or otherwise.
|
|
|
|
#
|
2012-10-26 21:29:57 +00:00
|
|
|
# $1 = compiler to test (CC or CXX)
|
|
|
|
# $2 = human readable name of compiler (C or C++)
|
|
|
|
# $3 = list of compiler names to search for
|
|
|
|
AC_DEFUN([TOOLCHAIN_FIND_COMPILER],
|
2012-07-06 01:27:07 +00:00
|
|
|
[
|
2012-10-26 21:29:57 +00:00
|
|
|
COMPILER_NAME=$2
|
2014-01-28 13:47:22 +00:00
|
|
|
SEARCH_LIST="$3"
|
|
|
|
|
|
|
|
if test "x[$]$1" != x; then
|
|
|
|
# User has supplied compiler name already, always let that override.
|
|
|
|
AC_MSG_NOTICE([Will use user supplied compiler $1=[$]$1])
|
|
|
|
if test "x`basename [$]$1`" = "x[$]$1"; then
|
|
|
|
# A command without a complete path is provided, search $PATH.
|
|
|
|
|
|
|
|
AC_PATH_PROGS(POTENTIAL_$1, [$]$1)
|
|
|
|
if test "x$POTENTIAL_$1" != x; then
|
|
|
|
$1=$POTENTIAL_$1
|
|
|
|
else
|
|
|
|
AC_MSG_ERROR([User supplied compiler $1=[$]$1 could not be found])
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
# Otherwise it might already be a complete path
|
|
|
|
if test ! -x "[$]$1"; then
|
|
|
|
AC_MSG_ERROR([User supplied compiler $1=[$]$1 does not exist])
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
else
|
2014-02-24 11:16:58 +00:00
|
|
|
# No user supplied value. Locate compiler ourselves.
|
|
|
|
|
|
|
|
# If we are cross compiling, assume cross compilation tools follows the
|
|
|
|
# cross compilation standard where they are prefixed with the autoconf
|
|
|
|
# standard name for the target. For example the binary
|
|
|
|
# i686-sun-solaris2.10-gcc will cross compile for i686-sun-solaris2.10.
|
|
|
|
# If we are not cross compiling, then the default compiler name will be
|
|
|
|
# used.
|
|
|
|
|
2014-01-28 13:47:22 +00:00
|
|
|
$1=
|
|
|
|
# If TOOLS_DIR is set, check for all compiler names in there first
|
|
|
|
# before checking the rest of the PATH.
|
2014-02-24 11:16:58 +00:00
|
|
|
# FIXME: Now that we prefix the TOOLS_DIR to the PATH in the PRE_DETECTION
|
|
|
|
# step, this should not be necessary.
|
2014-01-28 13:47:22 +00:00
|
|
|
if test -n "$TOOLS_DIR"; then
|
|
|
|
PATH_save="$PATH"
|
|
|
|
PATH="$TOOLS_DIR"
|
|
|
|
AC_PATH_PROGS(TOOLS_DIR_$1, $SEARCH_LIST)
|
|
|
|
$1=$TOOLS_DIR_$1
|
|
|
|
PATH="$PATH_save"
|
|
|
|
fi
|
2012-10-26 21:29:57 +00:00
|
|
|
|
2014-01-28 13:47:22 +00:00
|
|
|
# AC_PATH_PROGS can't be run multiple times with the same variable,
|
|
|
|
# so create a new name for this run.
|
|
|
|
if test "x[$]$1" = x; then
|
|
|
|
AC_PATH_PROGS(POTENTIAL_$1, $SEARCH_LIST)
|
|
|
|
$1=$POTENTIAL_$1
|
|
|
|
fi
|
2012-12-11 10:29:58 +00:00
|
|
|
|
2014-01-28 13:47:22 +00:00
|
|
|
if test "x[$]$1" = x; then
|
|
|
|
HELP_MSG_MISSING_DEPENDENCY([devkit])
|
|
|
|
AC_MSG_ERROR([Could not find a $COMPILER_NAME compiler. $HELP_MSG])
|
|
|
|
fi
|
2012-12-11 10:29:58 +00:00
|
|
|
fi
|
2012-10-26 21:29:57 +00:00
|
|
|
|
2014-01-28 13:47:22 +00:00
|
|
|
# Now we have a compiler binary in $1. Make sure it's okay.
|
2012-10-26 21:29:57 +00:00
|
|
|
BASIC_FIXUP_EXECUTABLE($1)
|
|
|
|
TEST_COMPILER="[$]$1"
|
2013-09-12 19:29:17 +00:00
|
|
|
# Don't remove symbolic links on AIX because 'xlc_r' and 'xlC_r' may all be links
|
|
|
|
# to 'xlc' but it is crucial that we invoke the compiler with the right name!
|
|
|
|
if test "x$OPENJDK_BUILD_OS" != xaix; then
|
2014-02-24 11:16:58 +00:00
|
|
|
# FIXME: This test should not be needed anymore; we don't do that for any platform.
|
2013-09-12 19:29:17 +00:00
|
|
|
AC_MSG_CHECKING([resolved symbolic links for $1])
|
|
|
|
BASIC_REMOVE_SYMBOLIC_LINKS(TEST_COMPILER)
|
|
|
|
AC_MSG_RESULT([$TEST_COMPILER])
|
|
|
|
fi
|
2012-10-26 21:29:57 +00:00
|
|
|
AC_MSG_CHECKING([if $1 is disguised ccache])
|
2013-06-04 08:36:00 +00:00
|
|
|
|
2012-10-26 21:29:57 +00:00
|
|
|
COMPILER_BASENAME=`$BASENAME "$TEST_COMPILER"`
|
|
|
|
if test "x$COMPILER_BASENAME" = "xccache"; then
|
|
|
|
AC_MSG_RESULT([yes, trying to find proper $COMPILER_NAME compiler])
|
|
|
|
# We /usr/lib/ccache in the path, so cc is a symlink to /usr/bin/ccache.
|
|
|
|
# We want to control ccache invocation ourselves, so ignore this cc and try
|
|
|
|
# searching again.
|
|
|
|
|
|
|
|
# Remove the path to the fake ccache cc from the PATH
|
|
|
|
RETRY_COMPILER_SAVED_PATH="$PATH"
|
|
|
|
COMPILER_DIRNAME=`$DIRNAME [$]$1`
|
|
|
|
PATH="`$ECHO $PATH | $SED -e "s,$COMPILER_DIRNAME,,g" -e "s,::,:,g" -e "s,^:,,g"`"
|
|
|
|
|
|
|
|
# Try again looking for our compiler
|
|
|
|
AC_CHECK_TOOLS(PROPER_COMPILER_$1, $3)
|
|
|
|
BASIC_FIXUP_EXECUTABLE(PROPER_COMPILER_$1)
|
|
|
|
PATH="$RETRY_COMPILER_SAVED_PATH"
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([for resolved symbolic links for $1])
|
|
|
|
BASIC_REMOVE_SYMBOLIC_LINKS(PROPER_COMPILER_$1)
|
|
|
|
AC_MSG_RESULT([$PROPER_COMPILER_$1])
|
|
|
|
$1="$PROPER_COMPILER_$1"
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([no, keeping $1])
|
|
|
|
fi
|
2014-01-14 18:25:22 +00:00
|
|
|
|
2012-10-26 21:29:57 +00:00
|
|
|
TOOLCHAIN_CHECK_COMPILER_VERSION([$1], [$COMPILER_NAME])
|
|
|
|
])
|
|
|
|
|
2014-02-24 11:16:58 +00:00
|
|
|
# Detect the core components of the toolchain, i.e. the compilers (CC and CXX),
|
|
|
|
# preprocessor (CPP and CXXCPP), the linker (LD), the assembler (AS) and the
|
|
|
|
# archiver (AR). Verify that the compilers are correct according to the
|
|
|
|
# toolchain type.
|
|
|
|
AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_CORE],
|
2012-10-26 21:29:57 +00:00
|
|
|
[
|
2014-02-24 11:16:58 +00:00
|
|
|
#
|
|
|
|
# Setup the compilers (CC and CXX)
|
|
|
|
#
|
|
|
|
TOOLCHAIN_FIND_COMPILER([CC], [C], $TOOLCHAIN_CC_BINARY)
|
2013-10-10 12:58:19 +00:00
|
|
|
# Now that we have resolved CC ourself, let autoconf have its go at it
|
|
|
|
AC_PROG_CC([$CC])
|
|
|
|
|
2014-02-24 11:16:58 +00:00
|
|
|
TOOLCHAIN_FIND_COMPILER([CXX], [C++], $TOOLCHAIN_CXX_BINARY)
|
2013-10-10 12:58:19 +00:00
|
|
|
# Now that we have resolved CXX ourself, let autoconf have its go at it
|
|
|
|
AC_PROG_CXX([$CXX])
|
|
|
|
|
2014-02-24 11:16:58 +00:00
|
|
|
#
|
|
|
|
# Setup the preprocessor (CPP and CXXCPP)
|
|
|
|
#
|
|
|
|
AC_PROG_CPP
|
|
|
|
BASIC_FIXUP_EXECUTABLE(CPP)
|
|
|
|
AC_PROG_CXXCPP
|
|
|
|
BASIC_FIXUP_EXECUTABLE(CXXCPP)
|
2013-10-10 12:58:19 +00:00
|
|
|
|
2014-02-24 11:16:58 +00:00
|
|
|
#
|
|
|
|
# Setup the linker (LD)
|
|
|
|
#
|
|
|
|
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
|
|
|
# In the Microsoft toolchain we have a separate LD command "link".
|
|
|
|
# Make sure we reject /usr/bin/link (as determined in CYGWIN_LINK), which is
|
|
|
|
# a cygwin program for something completely different.
|
|
|
|
AC_CHECK_PROG([LD], [link],[link],,, [$CYGWIN_LINK])
|
|
|
|
BASIC_FIXUP_EXECUTABLE(LD)
|
|
|
|
# Verify that we indeed succeeded with this trick.
|
2012-09-18 18:29:16 +00:00
|
|
|
AC_MSG_CHECKING([if the found link.exe is actually the Visual Studio linker])
|
2014-02-24 11:16:58 +00:00
|
|
|
"$LD" --version > /dev/null
|
2012-09-18 18:29:16 +00:00
|
|
|
if test $? -eq 0 ; then
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
AC_MSG_ERROR([This is the Cygwin link tool. Please check your PATH and rerun configure.])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
fi
|
2014-02-24 11:16:58 +00:00
|
|
|
LDCXX="$LD"
|
|
|
|
else
|
|
|
|
# All other toolchains use the compiler to link.
|
|
|
|
LD="$CC"
|
|
|
|
LDCXX="$CXX"
|
2013-10-10 12:58:19 +00:00
|
|
|
fi
|
2014-02-24 11:16:58 +00:00
|
|
|
AC_SUBST(LD)
|
|
|
|
# FIXME: it should be CXXLD, according to standard (cf CXXCPP)
|
|
|
|
AC_SUBST(LDCXX)
|
2012-07-06 01:27:07 +00:00
|
|
|
|
2013-10-10 12:58:19 +00:00
|
|
|
#
|
2014-02-24 11:16:58 +00:00
|
|
|
# Setup the assembler (AS)
|
|
|
|
#
|
2013-10-10 12:58:19 +00:00
|
|
|
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
|
2014-02-24 11:16:58 +00:00
|
|
|
# FIXME: should this really be solaris, or solstudio?
|
2014-01-29 10:21:54 +00:00
|
|
|
BASIC_PATH_PROGS(AS, as)
|
2012-10-26 21:29:57 +00:00
|
|
|
BASIC_FIXUP_EXECUTABLE(AS)
|
2013-10-10 12:58:19 +00:00
|
|
|
else
|
2014-02-24 11:16:58 +00:00
|
|
|
# FIXME: is this correct for microsoft?
|
2012-07-06 01:27:07 +00:00
|
|
|
AS="$CC -c"
|
2013-10-10 12:58:19 +00:00
|
|
|
fi
|
|
|
|
AC_SUBST(AS)
|
2012-07-06 01:27:07 +00:00
|
|
|
|
2014-02-24 11:16:58 +00:00
|
|
|
#
|
|
|
|
# Setup the archiver (AR)
|
|
|
|
#
|
|
|
|
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
|
|
|
# The corresponding ar tool is lib.exe (used to create static libraries)
|
|
|
|
AC_CHECK_PROG([AR], [lib],[lib],,,)
|
|
|
|
else
|
|
|
|
BASIC_CHECK_TOOLS(AR, ar)
|
|
|
|
fi
|
|
|
|
BASIC_FIXUP_EXECUTABLE(AR)
|
|
|
|
])
|
|
|
|
|
|
|
|
# Setup additional tools that is considered a part of the toolchain, but not the
|
|
|
|
# core part. Many of these are highly platform-specific and do not exist,
|
|
|
|
# and/or are not needed on all platforms.
|
|
|
|
AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_EXTRA],
|
|
|
|
[
|
|
|
|
if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
|
|
|
|
AC_PROG_OBJC
|
|
|
|
BASIC_FIXUP_EXECUTABLE(OBJC)
|
|
|
|
BASIC_PATH_PROGS(LIPO, lipo)
|
|
|
|
BASIC_FIXUP_EXECUTABLE(LIPO)
|
|
|
|
else
|
|
|
|
OBJC=
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
|
|
|
AC_CHECK_PROG([MT], [mt], [mt],,, [/usr/bin/mt])
|
|
|
|
BASIC_FIXUP_EXECUTABLE(MT)
|
|
|
|
# Setup the resource compiler (RC)
|
|
|
|
AC_CHECK_PROG([RC], [rc], [rc],,, [/usr/bin/rc])
|
|
|
|
BASIC_FIXUP_EXECUTABLE(RC)
|
|
|
|
AC_CHECK_PROG([DUMPBIN], [dumpbin], [dumpbin],,,)
|
|
|
|
BASIC_FIXUP_EXECUTABLE(DUMPBIN)
|
|
|
|
fi
|
|
|
|
|
2013-10-10 12:58:19 +00:00
|
|
|
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
|
2014-02-24 11:16:58 +00:00
|
|
|
BASIC_PATH_PROGS(STRIP, strip)
|
|
|
|
BASIC_FIXUP_EXECUTABLE(STRIP)
|
2014-01-29 10:21:54 +00:00
|
|
|
BASIC_PATH_PROGS(NM, nm)
|
2012-10-26 21:29:57 +00:00
|
|
|
BASIC_FIXUP_EXECUTABLE(NM)
|
2014-01-29 10:21:54 +00:00
|
|
|
BASIC_PATH_PROGS(GNM, gnm)
|
2013-04-09 07:42:20 +00:00
|
|
|
BASIC_FIXUP_EXECUTABLE(GNM)
|
2014-02-24 11:16:58 +00:00
|
|
|
|
2014-01-29 10:21:54 +00:00
|
|
|
BASIC_PATH_PROGS(MCS, mcs)
|
2012-10-26 21:29:57 +00:00
|
|
|
BASIC_FIXUP_EXECUTABLE(MCS)
|
2013-10-10 12:58:19 +00:00
|
|
|
elif test "x$OPENJDK_TARGET_OS" != xwindows; then
|
2014-02-24 11:16:58 +00:00
|
|
|
# FIXME: we should unify this with the solaris case above.
|
|
|
|
BASIC_CHECK_TOOLS(STRIP, strip)
|
|
|
|
BASIC_FIXUP_EXECUTABLE(STRIP)
|
2014-01-29 10:21:54 +00:00
|
|
|
BASIC_CHECK_TOOLS(NM, nm)
|
2012-10-26 21:29:57 +00:00
|
|
|
BASIC_FIXUP_EXECUTABLE(NM)
|
2013-04-09 07:42:20 +00:00
|
|
|
GNM="$NM"
|
|
|
|
AC_SUBST(GNM)
|
2013-10-10 12:58:19 +00:00
|
|
|
fi
|
2012-07-06 01:27:07 +00:00
|
|
|
|
2013-10-10 12:58:19 +00:00
|
|
|
# objcopy is used for moving debug symbols to separate files when
|
|
|
|
# full debug symbols are enabled.
|
|
|
|
if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xlinux; then
|
2014-01-29 10:21:54 +00:00
|
|
|
BASIC_CHECK_TOOLS(OBJCOPY, [gobjcopy objcopy])
|
2012-11-19 22:06:30 +00:00
|
|
|
# Only call fixup if objcopy was found.
|
|
|
|
if test -n "$OBJCOPY"; then
|
2013-10-10 12:58:19 +00:00
|
|
|
BASIC_FIXUP_EXECUTABLE(OBJCOPY)
|
2012-11-19 22:06:30 +00:00
|
|
|
fi
|
2013-10-10 12:58:19 +00:00
|
|
|
fi
|
2012-10-26 21:29:57 +00:00
|
|
|
|
2014-01-29 10:21:54 +00:00
|
|
|
BASIC_CHECK_TOOLS(OBJDUMP, [gobjdump objdump])
|
2013-10-10 12:58:19 +00:00
|
|
|
if test "x$OBJDUMP" != x; then
|
2014-02-24 11:16:58 +00:00
|
|
|
# Only used for compare.sh; we can live without it. BASIC_FIXUP_EXECUTABLE
|
|
|
|
# bails if argument is missing.
|
2013-10-10 12:58:19 +00:00
|
|
|
BASIC_FIXUP_EXECUTABLE(OBJDUMP)
|
|
|
|
fi
|
2012-07-06 01:27:07 +00:00
|
|
|
])
|
|
|
|
|
2014-02-24 11:16:58 +00:00
|
|
|
# Setup the build tools (i.e, the compiler and linker used to build programs
|
|
|
|
# that should be run on the build platform, not the target platform, as a build
|
|
|
|
# helper). Since the non-cross-compile case uses the normal, target compilers
|
|
|
|
# for this, we can only do this after these have been setup.
|
|
|
|
AC_DEFUN_ONCE([TOOLCHAIN_SETUP_BUILD_COMPILERS],
|
|
|
|
[
|
|
|
|
if test "x$COMPILE_TYPE" = "xcross"; then
|
|
|
|
# Now we need to find a C/C++ compiler that can build executables for the
|
|
|
|
# build platform. We can't use the AC_PROG_CC macro, since it can only be
|
|
|
|
# used once. Also, we need to do this without adding a tools dir to the
|
|
|
|
# path, otherwise we might pick up cross-compilers which don't use standard
|
|
|
|
# naming.
|
|
|
|
|
|
|
|
# FIXME: we should list the discovered compilers as an exclude pattern!
|
|
|
|
# If we do that, we can do this detection before POST_DETECTION, and still
|
|
|
|
# find the build compilers in the tools dir, if needed.
|
|
|
|
BASIC_PATH_PROGS(BUILD_CC, [cl cc gcc])
|
|
|
|
BASIC_FIXUP_EXECUTABLE(BUILD_CC)
|
|
|
|
BASIC_PATH_PROGS(BUILD_CXX, [cl CC g++])
|
|
|
|
BASIC_FIXUP_EXECUTABLE(BUILD_CXX)
|
|
|
|
BASIC_PATH_PROGS(BUILD_LD, ld)
|
|
|
|
BASIC_FIXUP_EXECUTABLE(BUILD_LD)
|
2013-10-10 12:58:19 +00:00
|
|
|
else
|
2014-02-24 11:16:58 +00:00
|
|
|
# If we are not cross compiling, use the normal target compilers for
|
|
|
|
# building the build platform executables.
|
|
|
|
BUILD_CC="$CC"
|
|
|
|
BUILD_CXX="$CXX"
|
|
|
|
BUILD_LD="$LD"
|
2013-10-10 12:58:19 +00:00
|
|
|
fi
|
|
|
|
|
2014-02-24 11:16:58 +00:00
|
|
|
AC_SUBST(BUILD_CC)
|
|
|
|
AC_SUBST(BUILD_CXX)
|
|
|
|
AC_SUBST(BUILD_LD)
|
2012-07-06 01:27:07 +00:00
|
|
|
])
|
|
|
|
|
2014-02-24 11:16:58 +00:00
|
|
|
# Setup legacy variables that are still needed as alternative ways to refer to
|
|
|
|
# parts of the toolchain.
|
|
|
|
AC_DEFUN_ONCE([TOOLCHAIN_SETUP_LEGACY],
|
2012-07-06 01:27:07 +00:00
|
|
|
[
|
2014-02-24 11:16:58 +00:00
|
|
|
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
|
|
|
# For hotspot, we need these in Windows mixed path,
|
|
|
|
# so rewrite them all. Need added .exe suffix.
|
|
|
|
HOTSPOT_CXX="$CXX.exe"
|
|
|
|
HOTSPOT_LD="$LD.exe"
|
|
|
|
HOTSPOT_MT="$MT.exe"
|
|
|
|
HOTSPOT_RC="$RC.exe"
|
|
|
|
BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_CXX)
|
|
|
|
BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_LD)
|
|
|
|
BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_MT)
|
|
|
|
BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_RC)
|
|
|
|
AC_SUBST(HOTSPOT_MT)
|
|
|
|
AC_SUBST(HOTSPOT_RC)
|
|
|
|
else
|
|
|
|
HOTSPOT_CXX="$CXX"
|
|
|
|
HOTSPOT_LD="$LD"
|
2013-10-10 12:58:19 +00:00
|
|
|
fi
|
2014-02-24 11:16:58 +00:00
|
|
|
AC_SUBST(HOTSPOT_CXX)
|
|
|
|
AC_SUBST(HOTSPOT_LD)
|
2012-07-06 01:27:07 +00:00
|
|
|
|
2014-02-24 11:16:58 +00:00
|
|
|
if test "x$TOOLCHAIN_TYPE" = xclang; then
|
|
|
|
USE_CLANG=true
|
2013-10-10 12:58:19 +00:00
|
|
|
fi
|
2014-02-24 11:16:58 +00:00
|
|
|
AC_SUBST(USE_CLANG)
|
2012-07-06 01:27:07 +00:00
|
|
|
|
2014-02-24 11:16:58 +00:00
|
|
|
# LDEXE is the linker to use, when creating executables. Not really used.
|
|
|
|
# FIXME: These should just be removed!
|
|
|
|
LDEXE="$LD"
|
|
|
|
LDEXECXX="$LDCXX"
|
|
|
|
AC_SUBST(LDEXE)
|
|
|
|
AC_SUBST(LDEXECXX)
|
2013-10-10 12:58:19 +00:00
|
|
|
])
|
2012-07-06 01:27:07 +00:00
|
|
|
|
2014-02-24 11:16:58 +00:00
|
|
|
# Do some additional checks on the detected tools.
|
|
|
|
AC_DEFUN_ONCE([TOOLCHAIN_MISC_CHECKS],
|
2013-10-10 12:58:19 +00:00
|
|
|
[
|
|
|
|
# The package path is used only on macosx?
|
2014-02-24 11:16:58 +00:00
|
|
|
# FIXME: clean this up, and/or move it elsewhere.
|
2013-10-10 12:58:19 +00:00
|
|
|
PACKAGE_PATH=/opt/local
|
|
|
|
AC_SUBST(PACKAGE_PATH)
|
2012-07-06 01:27:07 +00:00
|
|
|
|
2014-02-24 11:16:58 +00:00
|
|
|
# Check for extra potential brokenness.
|
|
|
|
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
|
|
|
# On Windows, double-check that we got the right compiler.
|
2014-02-25 14:19:32 +00:00
|
|
|
CC_VERSION_OUTPUT=`$CC 2>&1 | $HEAD -n 1 | $TR -d '\r'`
|
2014-02-24 11:16:58 +00:00
|
|
|
COMPILER_CPU_TEST=`$ECHO $CC_VERSION_OUTPUT | $SED -n "s/^.* \(.*\)$/\1/p"`
|
|
|
|
if test "x$OPENJDK_TARGET_CPU" = "xx86"; then
|
|
|
|
if test "x$COMPILER_CPU_TEST" != "x80x86"; then
|
|
|
|
AC_MSG_ERROR([Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for "$COMPILER_CPU_TEST"; expected "80x86".])
|
2013-10-10 12:58:19 +00:00
|
|
|
fi
|
2014-02-24 11:16:58 +00:00
|
|
|
elif test "x$OPENJDK_TARGET_CPU" = "xx86_64"; then
|
|
|
|
if test "x$COMPILER_CPU_TEST" != "xx64"; then
|
|
|
|
AC_MSG_ERROR([Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for "$COMPILER_CPU_TEST"; expected "x64".])
|
2013-10-10 12:58:19 +00:00
|
|
|
fi
|
2012-07-06 01:27:07 +00:00
|
|
|
fi
|
2013-10-10 12:58:19 +00:00
|
|
|
fi
|
2012-07-06 01:27:07 +00:00
|
|
|
|
2014-02-24 11:16:58 +00:00
|
|
|
if test "x$TOOLCHAIN_TYPE" = xgcc; then
|
|
|
|
# If this is a --hash-style=gnu system, use --hash-style=both, why?
|
|
|
|
HAS_GNU_HASH=`$CC -dumpspecs 2>/dev/null | $GREP 'hash-style=gnu'`
|
|
|
|
# This is later checked when setting flags.
|
2013-05-02 13:46:38 +00:00
|
|
|
fi
|
|
|
|
|
2014-02-24 11:16:58 +00:00
|
|
|
# Check for broken SuSE 'ld' for which 'Only anonymous version tag is allowed
|
|
|
|
# in executable.'
|
2013-07-03 00:38:10 +00:00
|
|
|
USING_BROKEN_SUSE_LD=no
|
2014-02-24 11:16:58 +00:00
|
|
|
if test "x$OPENJDK_TARGET_OS" = xlinux && test "x$TOOLCHAIN_TYPE" = xgcc; then
|
2013-07-03 00:38:10 +00:00
|
|
|
AC_MSG_CHECKING([for broken SuSE 'ld' which only understands anonymous version tags in executables])
|
|
|
|
echo "SUNWprivate_1.1 { local: *; };" > version-script.map
|
|
|
|
echo "int main() { }" > main.c
|
|
|
|
if $CXX -Xlinker -version-script=version-script.map main.c 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD; then
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
USING_BROKEN_SUSE_LD=no
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
USING_BROKEN_SUSE_LD=yes
|
|
|
|
fi
|
2014-02-11 09:44:23 +00:00
|
|
|
rm -rf version-script.map main.c a.out
|
2013-07-03 00:38:10 +00:00
|
|
|
fi
|
|
|
|
AC_SUBST(USING_BROKEN_SUSE_LD)
|
2013-05-02 13:46:38 +00:00
|
|
|
])
|
2013-05-28 06:50:52 +00:00
|
|
|
|
2014-02-24 11:16:58 +00:00
|
|
|
# Setup the JTReg Regression Test Harness.
|
2013-06-04 08:36:00 +00:00
|
|
|
AC_DEFUN_ONCE([TOOLCHAIN_SETUP_JTREG],
|
|
|
|
[
|
|
|
|
AC_ARG_WITH(jtreg, [AS_HELP_STRING([--with-jtreg],
|
2013-10-10 12:58:19 +00:00
|
|
|
[Regression Test Harness @<:@probed@:>@])],
|
|
|
|
[],
|
|
|
|
[with_jtreg=no])
|
2013-06-04 08:36:00 +00:00
|
|
|
|
|
|
|
if test "x$with_jtreg" = xno; then
|
|
|
|
# jtreg disabled
|
|
|
|
AC_MSG_CHECKING([for jtreg])
|
2013-05-28 06:50:52 +00:00
|
|
|
AC_MSG_RESULT(no)
|
2013-06-04 08:36:00 +00:00
|
|
|
else
|
|
|
|
if test "x$with_jtreg" != xyes; then
|
|
|
|
# with path specified.
|
|
|
|
JT_HOME="$with_jtreg"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test "x$JT_HOME" != x; then
|
|
|
|
AC_MSG_CHECKING([for jtreg])
|
|
|
|
|
|
|
|
# use JT_HOME enviroment var.
|
|
|
|
BASIC_FIXUP_PATH([JT_HOME])
|
|
|
|
|
|
|
|
# jtreg win32 script works for everybody
|
|
|
|
JTREGEXE="$JT_HOME/win32/bin/jtreg"
|
|
|
|
|
|
|
|
if test ! -f "$JTREGEXE"; then
|
|
|
|
AC_MSG_ERROR([JTReg executable does not exist: $JTREGEXE])
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_MSG_RESULT($JTREGEXE)
|
|
|
|
else
|
|
|
|
# try to find jtreg on path
|
2014-01-29 10:21:54 +00:00
|
|
|
BASIC_REQUIRE_PROGS(JTREGEXE, jtreg)
|
2013-06-04 08:36:00 +00:00
|
|
|
JT_HOME="`$DIRNAME $JTREGEXE`"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_SUBST(JT_HOME)
|
|
|
|
AC_SUBST(JTREGEXE)
|
2013-05-28 06:50:52 +00:00
|
|
|
])
|