2014-02-24 11:16:58 +00:00
|
|
|
#
|
2016-02-08 10:28:38 +00:00
|
|
|
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
|
2014-02-24 11:16:58 +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.
|
|
|
|
#
|
|
|
|
|
2015-10-05 11:44:40 +00:00
|
|
|
# Reset the global CFLAGS/LDFLAGS variables and initialize them with the
|
|
|
|
# corresponding configure arguments instead
|
|
|
|
AC_DEFUN_ONCE([FLAGS_SETUP_USER_SUPPLIED_FLAGS],
|
|
|
|
[
|
|
|
|
if test "x$CFLAGS" != "x${ADDED_CFLAGS}"; then
|
|
|
|
AC_MSG_WARN([Ignoring CFLAGS($CFLAGS) found in environment. Use --with-extra-cflags])
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test "x$CXXFLAGS" != "x${ADDED_CXXFLAGS}"; then
|
|
|
|
AC_MSG_WARN([Ignoring CXXFLAGS($CXXFLAGS) found in environment. Use --with-extra-cxxflags])
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test "x$LDFLAGS" != "x${ADDED_LDFLAGS}"; then
|
|
|
|
AC_MSG_WARN([Ignoring LDFLAGS($LDFLAGS) found in environment. Use --with-extra-ldflags])
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_ARG_WITH(extra-cflags, [AS_HELP_STRING([--with-extra-cflags],
|
|
|
|
[extra flags to be used when compiling jdk c-files])])
|
|
|
|
|
|
|
|
AC_ARG_WITH(extra-cxxflags, [AS_HELP_STRING([--with-extra-cxxflags],
|
|
|
|
[extra flags to be used when compiling jdk c++-files])])
|
|
|
|
|
|
|
|
AC_ARG_WITH(extra-ldflags, [AS_HELP_STRING([--with-extra-ldflags],
|
|
|
|
[extra flags to be used when linking jdk])])
|
|
|
|
|
|
|
|
EXTRA_CFLAGS="$with_extra_cflags"
|
|
|
|
EXTRA_CXXFLAGS="$with_extra_cxxflags"
|
|
|
|
EXTRA_LDFLAGS="$with_extra_ldflags"
|
|
|
|
|
|
|
|
# Hotspot needs these set in their legacy form
|
|
|
|
LEGACY_EXTRA_CFLAGS="$LEGACY_EXTRA_CFLAGS $EXTRA_CFLAGS"
|
|
|
|
LEGACY_EXTRA_CXXFLAGS="$LEGACY_EXTRA_CXXFLAGS $EXTRA_CXXFLAGS"
|
|
|
|
LEGACY_EXTRA_LDFLAGS="$LEGACY_EXTRA_LDFLAGS $EXTRA_LDFLAGS"
|
|
|
|
|
|
|
|
AC_SUBST(LEGACY_EXTRA_CFLAGS)
|
|
|
|
AC_SUBST(LEGACY_EXTRA_CXXFLAGS)
|
|
|
|
AC_SUBST(LEGACY_EXTRA_LDFLAGS)
|
|
|
|
|
2016-04-08 11:14:23 +00:00
|
|
|
AC_SUBST(EXTRA_CFLAGS)
|
|
|
|
AC_SUBST(EXTRA_CXXFLAGS)
|
|
|
|
AC_SUBST(EXTRA_LDFLAGS)
|
|
|
|
|
2015-10-05 11:44:40 +00:00
|
|
|
# The global CFLAGS and LDLAGS variables are used by configure tests and
|
|
|
|
# should include the extra parameters
|
|
|
|
CFLAGS="$EXTRA_CFLAGS"
|
|
|
|
CXXFLAGS="$EXTRA_CXXFLAGS"
|
|
|
|
LDFLAGS="$EXTRA_LDFLAGS"
|
|
|
|
CPPFLAGS=""
|
|
|
|
])
|
|
|
|
|
|
|
|
# Setup the sysroot flags and add them to global CFLAGS and LDFLAGS so
|
|
|
|
# that configure can use them while detecting compilers.
|
|
|
|
# TOOLCHAIN_TYPE is available here.
|
2015-10-29 16:11:55 +00:00
|
|
|
# Param 1 - Optional prefix to all variables. (e.g BUILD_)
|
|
|
|
AC_DEFUN([FLAGS_SETUP_SYSROOT_FLAGS],
|
2015-10-05 11:44:40 +00:00
|
|
|
[
|
2015-10-29 16:11:55 +00:00
|
|
|
if test "x[$]$1SYSROOT" != "x"; then
|
2015-10-05 11:44:40 +00:00
|
|
|
if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
|
|
|
|
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
|
|
|
|
# Solaris Studio does not have a concept of sysroot. Instead we must
|
|
|
|
# make sure the default include and lib dirs are appended to each
|
2016-02-05 08:41:16 +00:00
|
|
|
# compile and link command line. Must also add -I-xbuiltin to enable
|
|
|
|
# inlining of system functions and intrinsics.
|
|
|
|
$1SYSROOT_CFLAGS="-I-xbuiltin -I[$]$1SYSROOT/usr/include"
|
2015-10-29 16:11:55 +00:00
|
|
|
$1SYSROOT_LDFLAGS="-L[$]$1SYSROOT/usr/lib$OPENJDK_TARGET_CPU_ISADIR \
|
2016-09-21 12:20:27 +00:00
|
|
|
-L[$]$1SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR"
|
2015-10-05 11:44:40 +00:00
|
|
|
fi
|
|
|
|
elif test "x$TOOLCHAIN_TYPE" = xgcc; then
|
2015-10-29 16:11:55 +00:00
|
|
|
$1SYSROOT_CFLAGS="--sysroot=[$]$1SYSROOT"
|
|
|
|
$1SYSROOT_LDFLAGS="--sysroot=[$]$1SYSROOT"
|
2015-10-05 11:44:40 +00:00
|
|
|
elif test "x$TOOLCHAIN_TYPE" = xclang; then
|
2015-10-29 16:11:55 +00:00
|
|
|
$1SYSROOT_CFLAGS="-isysroot [$]$1SYSROOT"
|
|
|
|
$1SYSROOT_LDFLAGS="-isysroot [$]$1SYSROOT"
|
2015-10-05 11:44:40 +00:00
|
|
|
fi
|
|
|
|
# Propagate the sysroot args to hotspot
|
2015-10-29 16:11:55 +00:00
|
|
|
$1LEGACY_EXTRA_CFLAGS="[$]$1LEGACY_EXTRA_CFLAGS [$]$1SYSROOT_CFLAGS"
|
|
|
|
$1LEGACY_EXTRA_CXXFLAGS="[$]$1LEGACY_EXTRA_CXXFLAGS [$]$1SYSROOT_CFLAGS"
|
|
|
|
$1LEGACY_EXTRA_LDFLAGS="[$]$1LEGACY_EXTRA_LDFLAGS [$]$1SYSROOT_LDFLAGS"
|
2015-10-05 11:44:40 +00:00
|
|
|
# The global CFLAGS and LDFLAGS variables need these for configure to function
|
2015-10-29 16:11:55 +00:00
|
|
|
$1CFLAGS="[$]$1CFLAGS [$]$1SYSROOT_CFLAGS"
|
|
|
|
$1CPPFLAGS="[$]$1CPPFLAGS [$]$1SYSROOT_CFLAGS"
|
|
|
|
$1CXXFLAGS="[$]$1CXXFLAGS [$]$1SYSROOT_CFLAGS"
|
|
|
|
$1LDFLAGS="[$]$1LDFLAGS [$]$1SYSROOT_LDFLAGS"
|
2015-10-05 11:44:40 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
|
|
|
# We also need -iframework<path>/System/Library/Frameworks
|
2015-10-29 16:11:55 +00:00
|
|
|
$1SYSROOT_CFLAGS="[$]$1SYSROOT_CFLAGS -iframework [$]$1SYSROOT/System/Library/Frameworks"
|
|
|
|
$1SYSROOT_LDFLAGS="[$]$1SYSROOT_LDFLAGS -iframework [$]$1SYSROOT/System/Library/Frameworks"
|
2015-10-05 11:44:40 +00:00
|
|
|
# These always need to be set, or we can't find the frameworks embedded in JavaVM.framework
|
|
|
|
# set this here so it doesn't have to be peppered throughout the forest
|
2015-10-29 16:11:55 +00:00
|
|
|
$1SYSROOT_CFLAGS="[$]$1SYSROOT_CFLAGS -F [$]$1SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks"
|
|
|
|
$1SYSROOT_LDFLAGS="[$]$1SYSROOT_LDFLAGS -F [$]$1SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks"
|
2015-10-05 11:44:40 +00:00
|
|
|
fi
|
|
|
|
|
2015-10-29 16:11:55 +00:00
|
|
|
AC_SUBST($1SYSROOT_CFLAGS)
|
|
|
|
AC_SUBST($1SYSROOT_LDFLAGS)
|
2015-10-05 11:44:40 +00:00
|
|
|
])
|
|
|
|
|
2014-02-24 11:16:58 +00:00
|
|
|
AC_DEFUN_ONCE([FLAGS_SETUP_INIT_FLAGS],
|
|
|
|
[
|
2015-12-15 10:02:03 +00:00
|
|
|
# COMPILER_TARGET_BITS_FLAG : option for selecting 32- or 64-bit output
|
|
|
|
# COMPILER_COMMAND_FILE_FLAG : option for passing a command file to the compiler
|
2016-02-22 10:27:09 +00:00
|
|
|
# COMPILER_BINDCMD_FILE_FLAG : option for specifying a file which saves the binder
|
|
|
|
# commands produced by the link step (currently AIX only)
|
2014-02-24 11:16:58 +00:00
|
|
|
if test "x$TOOLCHAIN_TYPE" = xxlc; then
|
|
|
|
COMPILER_TARGET_BITS_FLAG="-q"
|
2015-12-15 10:02:03 +00:00
|
|
|
COMPILER_COMMAND_FILE_FLAG="-f"
|
2016-02-22 10:27:09 +00:00
|
|
|
COMPILER_BINDCMD_FILE_FLAG="-bloadmap:"
|
2014-02-24 11:16:58 +00:00
|
|
|
else
|
|
|
|
COMPILER_TARGET_BITS_FLAG="-m"
|
2015-12-15 10:02:03 +00:00
|
|
|
COMPILER_COMMAND_FILE_FLAG="@"
|
2016-02-22 10:27:09 +00:00
|
|
|
COMPILER_BINDCMD_FILE_FLAG=""
|
2016-01-08 08:46:02 +00:00
|
|
|
|
|
|
|
# The solstudio linker does not support @-files.
|
|
|
|
if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
|
|
|
|
COMPILER_COMMAND_FILE_FLAG=
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Check if @file is supported by gcc
|
|
|
|
if test "x$TOOLCHAIN_TYPE" = xgcc; then
|
|
|
|
AC_MSG_CHECKING([if @file is supported by gcc])
|
|
|
|
# Extra emtpy "" to prevent ECHO from interpreting '--version' as argument
|
|
|
|
$ECHO "" "--version" > command.file
|
|
|
|
if $CXX @command.file 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD; then
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
COMPILER_COMMAND_FILE_FLAG="@"
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
COMPILER_COMMAND_FILE_FLAG=
|
|
|
|
fi
|
2016-06-07 13:42:20 +00:00
|
|
|
$RM command.file
|
2016-01-08 08:46:02 +00:00
|
|
|
fi
|
2014-02-24 11:16:58 +00:00
|
|
|
fi
|
|
|
|
AC_SUBST(COMPILER_TARGET_BITS_FLAG)
|
2015-12-15 10:02:03 +00:00
|
|
|
AC_SUBST(COMPILER_COMMAND_FILE_FLAG)
|
2016-02-22 10:27:09 +00:00
|
|
|
AC_SUBST(COMPILER_BINDCMD_FILE_FLAG)
|
2014-02-24 11:16:58 +00:00
|
|
|
|
|
|
|
# FIXME: figure out if we should select AR flags depending on OS or toolchain.
|
|
|
|
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
|
|
|
ARFLAGS="-r"
|
|
|
|
elif test "x$OPENJDK_TARGET_OS" = xaix; then
|
|
|
|
ARFLAGS="-X64"
|
|
|
|
elif test "x$OPENJDK_TARGET_OS" = xwindows; then
|
|
|
|
# lib.exe is used as AR to create static libraries.
|
|
|
|
ARFLAGS="-nologo -NODEFAULTLIB:MSVCRT"
|
|
|
|
else
|
|
|
|
ARFLAGS=""
|
|
|
|
fi
|
|
|
|
AC_SUBST(ARFLAGS)
|
|
|
|
|
|
|
|
## Setup strip.
|
|
|
|
# FIXME: should this really be per platform, or should it be per toolchain type?
|
|
|
|
# strip is not provided by clang or solstudio; so guessing platform makes most sense.
|
|
|
|
# FIXME: we should really only export STRIPFLAGS from here, not POST_STRIP_CMD.
|
|
|
|
if test "x$OPENJDK_TARGET_OS" = xlinux; then
|
|
|
|
STRIPFLAGS="-g"
|
|
|
|
elif test "x$OPENJDK_TARGET_OS" = xsolaris; then
|
|
|
|
STRIPFLAGS="-x"
|
|
|
|
elif test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
|
|
|
STRIPFLAGS="-S"
|
|
|
|
elif test "x$OPENJDK_TARGET_OS" = xaix; then
|
|
|
|
STRIPFLAGS="-X32_64"
|
|
|
|
fi
|
|
|
|
|
2015-09-28 13:51:29 +00:00
|
|
|
AC_SUBST(STRIPFLAGS)
|
2014-02-24 11:16:58 +00:00
|
|
|
|
|
|
|
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
|
|
|
CC_OUT_OPTION=-Fo
|
|
|
|
EXE_OUT_OPTION=-out:
|
|
|
|
LD_OUT_OPTION=-out:
|
|
|
|
AR_OUT_OPTION=-out:
|
|
|
|
else
|
|
|
|
# The option used to specify the target .o,.a or .so file.
|
|
|
|
# When compiling, how to specify the to be created object file.
|
|
|
|
CC_OUT_OPTION='-o$(SPACE)'
|
|
|
|
# When linking, how to specify the to be created executable.
|
|
|
|
EXE_OUT_OPTION='-o$(SPACE)'
|
|
|
|
# When linking, how to specify the to be created dynamically linkable library.
|
|
|
|
LD_OUT_OPTION='-o$(SPACE)'
|
|
|
|
# When archiving, how to specify the to be create static archive for object files.
|
|
|
|
AR_OUT_OPTION='rcs$(SPACE)'
|
|
|
|
fi
|
|
|
|
AC_SUBST(CC_OUT_OPTION)
|
|
|
|
AC_SUBST(EXE_OUT_OPTION)
|
|
|
|
AC_SUBST(LD_OUT_OPTION)
|
|
|
|
AC_SUBST(AR_OUT_OPTION)
|
|
|
|
|
|
|
|
# On Windows, we need to set RC flags.
|
|
|
|
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
2014-11-26 14:14:14 +00:00
|
|
|
RC_FLAGS="-nologo -l0x409"
|
2016-04-08 11:14:23 +00:00
|
|
|
JVM_RCFLAGS="-nologo"
|
2016-02-12 10:07:35 +00:00
|
|
|
if test "x$DEBUG_LEVEL" = xrelease; then
|
2014-11-26 14:14:14 +00:00
|
|
|
RC_FLAGS="$RC_FLAGS -DNDEBUG"
|
2016-04-08 11:14:23 +00:00
|
|
|
JVM_RCFLAGS="$JVM_RCFLAGS -DNDEBUG"
|
2014-02-24 11:16:58 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# The version variables used to create RC_FLAGS may be overridden
|
|
|
|
# in a custom configure script, or possibly the command line.
|
|
|
|
# Let those variables be expanded at make time in spec.gmk.
|
|
|
|
# The \$ are escaped to the shell, and the $(...) variables
|
|
|
|
# are evaluated by make.
|
|
|
|
RC_FLAGS="$RC_FLAGS \
|
2015-06-10 22:21:56 +00:00
|
|
|
-D\"JDK_VERSION_STRING=\$(VERSION_STRING)\" \
|
2014-11-26 14:14:14 +00:00
|
|
|
-D\"JDK_COMPANY=\$(COMPANY_NAME)\" \
|
|
|
|
-D\"JDK_COMPONENT=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) binary\" \
|
2015-09-10 07:04:42 +00:00
|
|
|
-D\"JDK_VER=\$(VERSION_NUMBER)\" \
|
2014-11-26 14:14:14 +00:00
|
|
|
-D\"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \
|
2015-06-10 22:21:56 +00:00
|
|
|
-D\"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(VERSION_MAJOR)\" \
|
|
|
|
-D\"JDK_FVER=\$(subst .,\$(COMMA),\$(VERSION_NUMBER_FOUR_POSITIONS))\""
|
2016-04-08 11:14:23 +00:00
|
|
|
|
|
|
|
JVM_RCFLAGS="$JVM_RCFLAGS \
|
|
|
|
-D\"HS_BUILD_ID=\$(VERSION_STRING)\" \
|
|
|
|
-D\"HS_COMPANY=\$(COMPANY_NAME)\" \
|
|
|
|
-D\"JDK_DOTVER=\$(VERSION_NUMBER_FOUR_POSITIONS)\" \
|
|
|
|
-D\"HS_COPYRIGHT=Copyright $COPYRIGHT_YEAR\" \
|
|
|
|
-D\"HS_NAME=\$(PRODUCT_NAME) \$(VERSION_SHORT)\" \
|
|
|
|
-D\"JDK_VER=\$(subst .,\$(COMMA),\$(VERSION_NUMBER_FOUR_POSITIONS))\" \
|
|
|
|
-D\"HS_FNAME=jvm.dll\" \
|
|
|
|
-D\"HS_INTERNAL_NAME=jvm\""
|
2014-02-24 11:16:58 +00:00
|
|
|
fi
|
|
|
|
AC_SUBST(RC_FLAGS)
|
2016-04-08 11:14:23 +00:00
|
|
|
AC_SUBST(JVM_RCFLAGS)
|
2014-02-24 11:16:58 +00:00
|
|
|
|
|
|
|
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
2014-06-12 23:33:32 +00:00
|
|
|
# silence copyright notice and other headers.
|
|
|
|
COMMON_CCXXFLAGS="$COMMON_CCXXFLAGS -nologo"
|
2014-02-24 11:16:58 +00:00
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2016-04-08 11:14:23 +00:00
|
|
|
AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_LIBS],
|
2014-02-24 11:16:58 +00:00
|
|
|
[
|
|
|
|
###############################################################################
|
|
|
|
#
|
|
|
|
# How to compile shared libraries.
|
|
|
|
#
|
|
|
|
|
|
|
|
if test "x$TOOLCHAIN_TYPE" = xgcc; then
|
|
|
|
PICFLAG="-fPIC"
|
|
|
|
C_FLAG_REORDER=''
|
|
|
|
CXX_FLAG_REORDER=''
|
|
|
|
|
2014-02-26 07:38:52 +00:00
|
|
|
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
|
|
|
# Linking is different on MacOSX
|
2015-10-19 17:21:27 +00:00
|
|
|
if test "x$STATIC_BUILD" = xtrue; then
|
|
|
|
SHARED_LIBRARY_FLAGS ='-undefined dynamic_lookup'
|
|
|
|
else
|
|
|
|
SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG"
|
2016-04-08 11:14:23 +00:00
|
|
|
JVM_CFLAGS="$JVM_CFLAGS $PICFLAG"
|
2015-10-19 17:21:27 +00:00
|
|
|
fi
|
2015-12-15 10:02:03 +00:00
|
|
|
SET_EXECUTABLE_ORIGIN='-Wl,-rpath,@loader_path/.'
|
2014-02-26 07:38:52 +00:00
|
|
|
SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
|
2015-12-15 10:02:03 +00:00
|
|
|
SET_SHARED_LIBRARY_NAME='-Wl,-install_name,@rpath/[$]1'
|
2016-02-12 10:07:35 +00:00
|
|
|
SET_SHARED_LIBRARY_MAPFILE='-Wl,-exported_symbols_list,[$]1'
|
2014-02-26 07:38:52 +00:00
|
|
|
else
|
|
|
|
# Default works for linux, might work on other platforms as well.
|
|
|
|
SHARED_LIBRARY_FLAGS='-shared'
|
2016-11-07 13:15:49 +00:00
|
|
|
SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$ORIGIN[$]1'
|
2015-12-15 10:02:03 +00:00
|
|
|
SET_SHARED_LIBRARY_ORIGIN="-Wl,-z,origin $SET_EXECUTABLE_ORIGIN"
|
|
|
|
SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
|
|
|
|
SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=[$]1'
|
2014-02-26 07:38:52 +00:00
|
|
|
fi
|
|
|
|
elif test "x$TOOLCHAIN_TYPE" = xclang; then
|
|
|
|
C_FLAG_REORDER=''
|
|
|
|
CXX_FLAG_REORDER=''
|
|
|
|
|
2014-02-24 11:16:58 +00:00
|
|
|
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
|
|
|
# Linking is different on MacOSX
|
2015-12-15 10:02:03 +00:00
|
|
|
PICFLAG=''
|
2014-02-24 11:16:58 +00:00
|
|
|
SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG"
|
2015-12-15 10:02:03 +00:00
|
|
|
SET_EXECUTABLE_ORIGIN='-Wl,-rpath,@loader_path/.'
|
2014-02-24 11:16:58 +00:00
|
|
|
SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
|
2015-12-15 10:02:03 +00:00
|
|
|
SET_SHARED_LIBRARY_NAME='-Wl,-install_name,@rpath/[$]1'
|
2016-02-12 10:07:35 +00:00
|
|
|
SET_SHARED_LIBRARY_MAPFILE='-Wl,-exported_symbols_list,[$]1'
|
2016-04-08 11:14:23 +00:00
|
|
|
|
|
|
|
if test "x$STATIC_BUILD" = xfalse; then
|
|
|
|
JVM_CFLAGS="$JVM_CFLAGS -fPIC"
|
|
|
|
fi
|
2014-02-24 11:16:58 +00:00
|
|
|
else
|
|
|
|
# Default works for linux, might work on other platforms as well.
|
2015-12-15 10:02:03 +00:00
|
|
|
PICFLAG='-fPIC'
|
2014-02-24 11:16:58 +00:00
|
|
|
SHARED_LIBRARY_FLAGS='-shared'
|
2016-11-07 13:15:49 +00:00
|
|
|
SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$ORIGIN[$]1'
|
2015-12-15 10:02:03 +00:00
|
|
|
SET_SHARED_LIBRARY_ORIGIN="-Wl,-z,origin $SET_EXECUTABLE_ORIGIN"
|
|
|
|
SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
|
|
|
|
SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=[$]1'
|
2014-02-24 11:16:58 +00:00
|
|
|
fi
|
|
|
|
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
|
2016-11-24 14:32:14 +00:00
|
|
|
if test "x$OPENJDK_TARGET_CPU" = xsparcv9; then
|
|
|
|
PICFLAG="-xcode=pic32"
|
|
|
|
else
|
|
|
|
PICFLAG="-KPIC"
|
|
|
|
fi
|
2014-02-24 11:16:58 +00:00
|
|
|
C_FLAG_REORDER='-xF'
|
|
|
|
CXX_FLAG_REORDER='-xF'
|
|
|
|
SHARED_LIBRARY_FLAGS="-G"
|
2016-11-07 13:15:49 +00:00
|
|
|
SET_EXECUTABLE_ORIGIN='-R\$$ORIGIN[$]1'
|
2014-02-24 11:16:58 +00:00
|
|
|
SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
|
2015-12-15 10:02:03 +00:00
|
|
|
SET_SHARED_LIBRARY_NAME='-h [$]1'
|
2014-02-24 11:16:58 +00:00
|
|
|
SET_SHARED_LIBRARY_MAPFILE='-M[$]1'
|
|
|
|
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
|
2016-02-22 10:27:09 +00:00
|
|
|
# '-qpic' defaults to 'qpic=small'. This means that the compiler generates only
|
|
|
|
# one instruction for accessing the TOC. If the TOC grows larger than 64K, the linker
|
|
|
|
# will have to patch this single instruction with a call to some out-of-order code which
|
|
|
|
# does the load from the TOC. This is of course slow. But in that case we also would have
|
|
|
|
# to use '-bbigtoc' for linking anyway so we could also change the PICFLAG to 'qpic=large'.
|
|
|
|
# With 'qpic=large' the compiler will by default generate a two-instruction sequence which
|
|
|
|
# can be patched directly by the linker and does not require a jump to out-of-order code.
|
|
|
|
# Another alternative instead of using 'qpic=large -bbigtoc' may be to use '-qminimaltoc'
|
|
|
|
# instead. This creates a distinct TOC for every compilation unit (and thus requires two
|
|
|
|
# loads for accessing a global variable). But there are rumors that this may be seen as a
|
|
|
|
# 'performance feature' because of improved code locality of the symbols used in a
|
|
|
|
# compilation unit.
|
|
|
|
PICFLAG="-qpic"
|
|
|
|
JVM_CFLAGS="$JVM_CFLAGS $PICFLAG"
|
2014-02-24 11:16:58 +00:00
|
|
|
C_FLAG_REORDER=''
|
|
|
|
CXX_FLAG_REORDER=''
|
2016-02-22 10:27:09 +00:00
|
|
|
SHARED_LIBRARY_FLAGS="-qmkshrobj -bM:SRE -bnoentry"
|
2014-02-24 11:16:58 +00:00
|
|
|
SET_EXECUTABLE_ORIGIN=""
|
|
|
|
SET_SHARED_LIBRARY_ORIGIN=''
|
|
|
|
SET_SHARED_LIBRARY_NAME=''
|
|
|
|
SET_SHARED_LIBRARY_MAPFILE=''
|
|
|
|
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
|
|
|
PICFLAG=""
|
|
|
|
C_FLAG_REORDER=''
|
|
|
|
CXX_FLAG_REORDER=''
|
2015-12-15 10:02:03 +00:00
|
|
|
SHARED_LIBRARY_FLAGS="-dll"
|
2014-02-24 11:16:58 +00:00
|
|
|
SET_EXECUTABLE_ORIGIN=''
|
|
|
|
SET_SHARED_LIBRARY_ORIGIN=''
|
|
|
|
SET_SHARED_LIBRARY_NAME=''
|
2016-02-12 10:07:35 +00:00
|
|
|
SET_SHARED_LIBRARY_MAPFILE='-def:[$]1'
|
2014-02-24 11:16:58 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
AC_SUBST(C_FLAG_REORDER)
|
|
|
|
AC_SUBST(CXX_FLAG_REORDER)
|
|
|
|
AC_SUBST(SET_EXECUTABLE_ORIGIN)
|
|
|
|
AC_SUBST(SET_SHARED_LIBRARY_ORIGIN)
|
|
|
|
AC_SUBST(SET_SHARED_LIBRARY_NAME)
|
|
|
|
AC_SUBST(SET_SHARED_LIBRARY_MAPFILE)
|
2015-12-15 10:02:03 +00:00
|
|
|
AC_SUBST(SHARED_LIBRARY_FLAGS)
|
2014-02-24 11:16:58 +00:00
|
|
|
|
|
|
|
# The (cross) compiler is now configured, we can now test capabilities
|
|
|
|
# of the target platform.
|
|
|
|
])
|
|
|
|
|
|
|
|
# Documentation on common flags used for solstudio in HIGHEST.
|
|
|
|
#
|
|
|
|
# WARNING: Use of OPTIMIZATION_LEVEL=HIGHEST in your Makefile needs to be
|
|
|
|
# done with care, there are some assumptions below that need to
|
|
|
|
# be understood about the use of pointers, and IEEE behavior.
|
|
|
|
#
|
|
|
|
# -fns: Use non-standard floating point mode (not IEEE 754)
|
|
|
|
# -fsimple: Do some simplification of floating point arithmetic (not IEEE 754)
|
|
|
|
# -fsingle: Use single precision floating point with 'float'
|
|
|
|
# -xalias_level=basic: Assume memory references via basic pointer types do not alias
|
|
|
|
# (Source with excessing pointer casting and data access with mixed
|
|
|
|
# pointer types are not recommended)
|
|
|
|
# -xbuiltin=%all: Use intrinsic or inline versions for math/std functions
|
|
|
|
# (If you expect perfect errno behavior, do not use this)
|
|
|
|
# -xdepend: Loop data dependency optimizations (need -xO3 or higher)
|
|
|
|
# -xrestrict: Pointer parameters to functions do not overlap
|
|
|
|
# (Similar to -xalias_level=basic usage, but less obvious sometimes.
|
|
|
|
# If you pass in multiple pointers to the same data, do not use this)
|
|
|
|
# -xlibmil: Inline some library routines
|
|
|
|
# (If you expect perfect errno behavior, do not use this)
|
|
|
|
# -xlibmopt: Use optimized math routines (CURRENTLY DISABLED)
|
|
|
|
# (If you expect perfect errno behavior, do not use this)
|
|
|
|
# Can cause undefined external on Solaris 8 X86 on __sincos, removing for now
|
|
|
|
|
|
|
|
# FIXME: this will never happen since sparc != sparcv9, ie 32 bit, which we don't build anymore.
|
|
|
|
# Bug?
|
|
|
|
#if test "x$OPENJDK_TARGET_CPU" = xsparc; then
|
|
|
|
# CFLAGS_JDK="${CFLAGS_JDK} -xmemalign=4s"
|
|
|
|
# CXXFLAGS_JDK="${CXXFLAGS_JDK} -xmemalign=4s"
|
|
|
|
#fi
|
|
|
|
|
|
|
|
AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_OPTIMIZATION],
|
|
|
|
[
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
#
|
|
|
|
# Setup the opt flags for different compilers
|
|
|
|
# and different operating systems.
|
|
|
|
#
|
|
|
|
|
|
|
|
# FIXME: this was indirectly the old default, but just inherited.
|
|
|
|
# if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
|
|
|
# C_FLAG_DEPS="-MMD -MF"
|
|
|
|
# fi
|
|
|
|
|
|
|
|
# Generate make dependency files
|
|
|
|
if test "x$TOOLCHAIN_TYPE" = xgcc; then
|
|
|
|
C_FLAG_DEPS="-MMD -MF"
|
2014-02-26 07:38:52 +00:00
|
|
|
elif test "x$TOOLCHAIN_TYPE" = xclang; then
|
|
|
|
C_FLAG_DEPS="-MMD -MF"
|
2014-02-24 11:16:58 +00:00
|
|
|
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
|
|
|
|
C_FLAG_DEPS="-xMMD -xMF"
|
|
|
|
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
|
|
|
|
C_FLAG_DEPS="-qmakedep=gcc -MF"
|
|
|
|
fi
|
|
|
|
CXX_FLAG_DEPS="$C_FLAG_DEPS"
|
|
|
|
AC_SUBST(C_FLAG_DEPS)
|
|
|
|
AC_SUBST(CXX_FLAG_DEPS)
|
|
|
|
|
|
|
|
# Debug symbols
|
|
|
|
if test "x$TOOLCHAIN_TYPE" = xgcc; then
|
|
|
|
if test "x$OPENJDK_TARGET_CPU_BITS" = "x64" && test "x$DEBUG_LEVEL" = "xfastdebug"; then
|
2014-06-12 23:33:32 +00:00
|
|
|
# reduce from default "-g2" option to save space
|
2014-02-24 11:16:58 +00:00
|
|
|
CFLAGS_DEBUG_SYMBOLS="-g1"
|
|
|
|
CXXFLAGS_DEBUG_SYMBOLS="-g1"
|
|
|
|
else
|
|
|
|
CFLAGS_DEBUG_SYMBOLS="-g"
|
|
|
|
CXXFLAGS_DEBUG_SYMBOLS="-g"
|
|
|
|
fi
|
2014-02-26 07:38:52 +00:00
|
|
|
elif test "x$TOOLCHAIN_TYPE" = xclang; then
|
|
|
|
CFLAGS_DEBUG_SYMBOLS="-g"
|
|
|
|
CXXFLAGS_DEBUG_SYMBOLS="-g"
|
2014-02-24 11:16:58 +00:00
|
|
|
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
|
|
|
|
CFLAGS_DEBUG_SYMBOLS="-g -xs"
|
2016-01-20 08:53:52 +00:00
|
|
|
# -g0 enables debug symbols without disabling inlining.
|
2014-02-24 11:16:58 +00:00
|
|
|
CXXFLAGS_DEBUG_SYMBOLS="-g0 -xs"
|
|
|
|
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
|
|
|
|
CFLAGS_DEBUG_SYMBOLS="-g"
|
|
|
|
CXXFLAGS_DEBUG_SYMBOLS="-g"
|
2016-03-14 11:00:24 +00:00
|
|
|
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
|
|
|
CFLAGS_DEBUG_SYMBOLS="-Zi"
|
|
|
|
CXXFLAGS_DEBUG_SYMBOLS="-Zi"
|
2014-02-24 11:16:58 +00:00
|
|
|
fi
|
|
|
|
AC_SUBST(CFLAGS_DEBUG_SYMBOLS)
|
|
|
|
AC_SUBST(CXXFLAGS_DEBUG_SYMBOLS)
|
|
|
|
|
2016-04-08 11:14:23 +00:00
|
|
|
# Debug symbols for JVM_CFLAGS
|
|
|
|
if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
|
|
|
|
JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -xs"
|
|
|
|
if test "x$DEBUG_LEVEL" = xslowdebug; then
|
|
|
|
JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -g"
|
|
|
|
else
|
|
|
|
# -g0 does not disable inlining, which -g does.
|
|
|
|
JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -g0"
|
|
|
|
fi
|
|
|
|
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
|
|
|
JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -Z7 -d2Zi+"
|
|
|
|
else
|
|
|
|
JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -g"
|
|
|
|
fi
|
|
|
|
AC_SUBST(JVM_CFLAGS_SYMBOLS)
|
|
|
|
|
2014-06-12 23:33:32 +00:00
|
|
|
# bounds, memory and behavior checking options
|
|
|
|
if test "x$TOOLCHAIN_TYPE" = xgcc; then
|
|
|
|
case $DEBUG_LEVEL in
|
|
|
|
release )
|
|
|
|
# no adjustment
|
|
|
|
;;
|
|
|
|
fastdebug )
|
2014-08-13 19:39:05 +00:00
|
|
|
# no adjustment
|
2014-06-12 23:33:32 +00:00
|
|
|
;;
|
|
|
|
slowdebug )
|
2016-04-08 11:14:23 +00:00
|
|
|
# FIXME: By adding this to C(XX)FLAGS_DEBUG_OPTIONS/JVM_CFLAGS_SYMBOLS it
|
2016-02-12 10:07:35 +00:00
|
|
|
# get's added conditionally on whether we produce debug symbols or not.
|
|
|
|
# This is most likely not really correct.
|
|
|
|
|
2015-06-03 13:20:25 +00:00
|
|
|
# Add runtime stack smashing and undefined behavior checks.
|
|
|
|
# Not all versions of gcc support -fstack-protector
|
|
|
|
STACK_PROTECTOR_CFLAG="-fstack-protector-all"
|
2016-02-08 10:28:38 +00:00
|
|
|
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$STACK_PROTECTOR_CFLAG -Werror], IF_FALSE: [STACK_PROTECTOR_CFLAG=""])
|
2015-06-03 13:20:25 +00:00
|
|
|
|
|
|
|
CFLAGS_DEBUG_OPTIONS="$STACK_PROTECTOR_CFLAG --param ssp-buffer-size=1"
|
|
|
|
CXXFLAGS_DEBUG_OPTIONS="$STACK_PROTECTOR_CFLAG --param ssp-buffer-size=1"
|
2016-04-08 11:14:23 +00:00
|
|
|
if test "x$STACK_PROTECTOR_CFLAG" != x; then
|
|
|
|
JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS $STACK_PROTECTOR_CFLAG --param ssp-buffer-size=1"
|
|
|
|
fi
|
2014-06-12 23:33:32 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2016-04-08 11:14:23 +00:00
|
|
|
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
|
|
|
if test "x$DEBUG_LEVEL" != xrelease; then
|
|
|
|
if test "x$OPENJDK_TARGET_CPU" = xx86_64; then
|
|
|
|
JVM_CFLAGS="$JVM_CFLAGS -homeparams"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2014-02-24 11:16:58 +00:00
|
|
|
# Optimization levels
|
|
|
|
if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
|
2014-03-05 09:21:38 +00:00
|
|
|
CC_HIGHEST="$CC_HIGHEST -fns -fsimple -fsingle -xbuiltin=%all -xdepend -xrestrict -xlibmil"
|
2014-02-24 11:16:58 +00:00
|
|
|
|
|
|
|
if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86"; then
|
|
|
|
# FIXME: seems we always set -xregs=no%frameptr; put it elsewhere more global?
|
2016-04-08 11:14:23 +00:00
|
|
|
C_O_FLAG_HIGHEST_JVM="-xO4"
|
2014-03-05 09:21:38 +00:00
|
|
|
C_O_FLAG_HIGHEST="-xO4 -Wu,-O4~yz $CC_HIGHEST -xalias_level=basic -xregs=no%frameptr"
|
2014-02-24 11:16:58 +00:00
|
|
|
C_O_FLAG_HI="-xO4 -Wu,-O4~yz -xregs=no%frameptr"
|
|
|
|
C_O_FLAG_NORM="-xO2 -Wu,-O2~yz -xregs=no%frameptr"
|
2014-06-12 23:33:32 +00:00
|
|
|
C_O_FLAG_DEBUG="-xregs=no%frameptr"
|
2016-04-08 11:14:23 +00:00
|
|
|
C_O_FLAG_DEBUG_JVM=""
|
2014-02-24 11:16:58 +00:00
|
|
|
C_O_FLAG_NONE="-xregs=no%frameptr"
|
2016-04-08 11:14:23 +00:00
|
|
|
CXX_O_FLAG_HIGHEST_JVM="-xO4"
|
2014-02-24 11:16:58 +00:00
|
|
|
CXX_O_FLAG_HIGHEST="-xO4 -Qoption ube -O4~yz $CC_HIGHEST -xregs=no%frameptr"
|
|
|
|
CXX_O_FLAG_HI="-xO4 -Qoption ube -O4~yz -xregs=no%frameptr"
|
|
|
|
CXX_O_FLAG_NORM="-xO2 -Qoption ube -O2~yz -xregs=no%frameptr"
|
2014-06-12 23:33:32 +00:00
|
|
|
CXX_O_FLAG_DEBUG="-xregs=no%frameptr"
|
2016-04-08 11:14:23 +00:00
|
|
|
CXX_O_FLAG_DEBUG_JVM=""
|
2014-02-24 11:16:58 +00:00
|
|
|
CXX_O_FLAG_NONE="-xregs=no%frameptr"
|
|
|
|
if test "x$OPENJDK_TARGET_CPU_BITS" = "x32"; then
|
|
|
|
C_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST -xchip=pentium"
|
|
|
|
CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_HIGHEST -xchip=pentium"
|
|
|
|
fi
|
|
|
|
elif test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then
|
2016-04-08 11:14:23 +00:00
|
|
|
C_O_FLAG_HIGHEST_JVM="-xO4"
|
2014-03-05 09:21:38 +00:00
|
|
|
C_O_FLAG_HIGHEST="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0 $CC_HIGHEST -xalias_level=basic -xprefetch=auto,explicit -xchip=ultra"
|
2014-02-24 11:16:58 +00:00
|
|
|
C_O_FLAG_HI="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0"
|
|
|
|
C_O_FLAG_NORM="-xO2 -Wc,-Qrm-s -Wc,-Qiselect-T0"
|
2014-06-12 23:33:32 +00:00
|
|
|
C_O_FLAG_DEBUG=""
|
2016-04-08 11:14:23 +00:00
|
|
|
C_O_FLAG_DEBUG_JVM=""
|
2014-02-24 11:16:58 +00:00
|
|
|
C_O_FLAG_NONE=""
|
2016-04-08 11:14:23 +00:00
|
|
|
CXX_O_FLAG_HIGHEST_JVM="-xO4"
|
2014-02-24 11:16:58 +00:00
|
|
|
CXX_O_FLAG_HIGHEST="-xO4 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0 $CC_HIGHEST -xprefetch=auto,explicit -xchip=ultra"
|
|
|
|
CXX_O_FLAG_HI="-xO4 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0"
|
|
|
|
CXX_O_FLAG_NORM="-xO2 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0"
|
2016-02-12 10:07:35 +00:00
|
|
|
CXX_O_FLAG_DEBUG=""
|
2016-04-08 11:14:23 +00:00
|
|
|
CXX_O_FLAG_DEBUG_JVM=""
|
2014-02-24 11:16:58 +00:00
|
|
|
CXX_O_FLAG_NONE=""
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
# The remaining toolchains share opt flags between CC and CXX;
|
|
|
|
# setup for C and duplicate afterwards.
|
|
|
|
if test "x$TOOLCHAIN_TYPE" = xgcc; then
|
|
|
|
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
|
|
|
# On MacOSX we optimize for size, something
|
|
|
|
# we should do for all platforms?
|
2016-04-08 11:14:23 +00:00
|
|
|
C_O_FLAG_HIGHEST_JVM="-Os"
|
2014-02-24 11:16:58 +00:00
|
|
|
C_O_FLAG_HIGHEST="-Os"
|
|
|
|
C_O_FLAG_HI="-Os"
|
|
|
|
C_O_FLAG_NORM="-Os"
|
2016-04-08 11:14:23 +00:00
|
|
|
C_O_FLAG_SIZE="-Os"
|
2014-02-24 11:16:58 +00:00
|
|
|
else
|
2016-04-08 11:14:23 +00:00
|
|
|
C_O_FLAG_HIGHEST_JVM="-O3"
|
2014-02-24 11:16:58 +00:00
|
|
|
C_O_FLAG_HIGHEST="-O3"
|
|
|
|
C_O_FLAG_HI="-O3"
|
|
|
|
C_O_FLAG_NORM="-O2"
|
2016-04-08 11:14:23 +00:00
|
|
|
C_O_FLAG_SIZE="-Os"
|
2014-02-24 11:16:58 +00:00
|
|
|
fi
|
2014-07-09 21:55:52 +00:00
|
|
|
C_O_FLAG_DEBUG="-O0"
|
2016-04-08 11:14:23 +00:00
|
|
|
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
|
|
|
C_O_FLAG_DEBUG_JVM=""
|
|
|
|
elif test "x$OPENJDK_TARGET_OS" = xlinux; then
|
|
|
|
C_O_FLAG_DEBUG_JVM="-O0"
|
|
|
|
fi
|
2014-06-12 23:33:32 +00:00
|
|
|
C_O_FLAG_NONE="-O0"
|
2014-02-26 07:38:52 +00:00
|
|
|
elif test "x$TOOLCHAIN_TYPE" = xclang; then
|
|
|
|
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
|
|
|
# On MacOSX we optimize for size, something
|
|
|
|
# we should do for all platforms?
|
2016-04-08 11:14:23 +00:00
|
|
|
C_O_FLAG_HIGHEST_JVM="-Os"
|
2014-02-26 07:38:52 +00:00
|
|
|
C_O_FLAG_HIGHEST="-Os"
|
|
|
|
C_O_FLAG_HI="-Os"
|
|
|
|
C_O_FLAG_NORM="-Os"
|
2016-04-08 11:14:23 +00:00
|
|
|
C_O_FLAG_SIZE="-Os"
|
2014-02-26 07:38:52 +00:00
|
|
|
else
|
2016-04-08 11:14:23 +00:00
|
|
|
C_O_FLAG_HIGHEST_JVM="-O3"
|
2014-02-26 07:38:52 +00:00
|
|
|
C_O_FLAG_HIGHEST="-O3"
|
|
|
|
C_O_FLAG_HI="-O3"
|
|
|
|
C_O_FLAG_NORM="-O2"
|
2016-04-08 11:14:23 +00:00
|
|
|
C_O_FLAG_SIZE="-Os"
|
2014-02-26 07:38:52 +00:00
|
|
|
fi
|
2014-06-12 23:33:32 +00:00
|
|
|
C_O_FLAG_DEBUG="-O0"
|
2016-04-08 11:14:23 +00:00
|
|
|
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
|
|
|
C_O_FLAG_DEBUG_JVM=""
|
|
|
|
elif test "x$OPENJDK_TARGET_OS" = xlinux; then
|
|
|
|
C_O_FLAG_DEBUG_JVM="-O0"
|
|
|
|
fi
|
2014-06-12 23:33:32 +00:00
|
|
|
C_O_FLAG_NONE="-O0"
|
2014-02-24 11:16:58 +00:00
|
|
|
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
|
2016-06-07 16:25:53 +00:00
|
|
|
C_O_FLAG_HIGHEST_JVM="-O3 -qhot=level=1 -qinline -qinlglue"
|
|
|
|
C_O_FLAG_HIGHEST="-O3 -qhot=level=1 -qinline -qinlglue"
|
|
|
|
C_O_FLAG_HI="-O3 -qinline -qinlglue"
|
2014-02-24 11:16:58 +00:00
|
|
|
C_O_FLAG_NORM="-O2"
|
2014-06-12 23:33:32 +00:00
|
|
|
C_O_FLAG_DEBUG="-qnoopt"
|
2016-04-08 11:14:23 +00:00
|
|
|
# FIXME: Value below not verified.
|
|
|
|
C_O_FLAG_DEBUG_JVM=""
|
2015-12-16 06:16:49 +00:00
|
|
|
C_O_FLAG_NONE="-qnoopt"
|
2014-02-24 11:16:58 +00:00
|
|
|
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
2016-04-08 11:14:23 +00:00
|
|
|
C_O_FLAG_HIGHEST_JVM="-O2 -Oy-"
|
2014-02-24 11:16:58 +00:00
|
|
|
C_O_FLAG_HIGHEST="-O2"
|
|
|
|
C_O_FLAG_HI="-O1"
|
|
|
|
C_O_FLAG_NORM="-O1"
|
2014-06-12 23:33:32 +00:00
|
|
|
C_O_FLAG_DEBUG="-Od"
|
2016-04-08 11:14:23 +00:00
|
|
|
C_O_FLAG_DEBUG_JVM=""
|
2014-02-24 11:16:58 +00:00
|
|
|
C_O_FLAG_NONE="-Od"
|
2016-04-08 11:14:23 +00:00
|
|
|
C_O_FLAG_SIZE="-Os"
|
2014-02-24 11:16:58 +00:00
|
|
|
fi
|
2016-04-08 11:14:23 +00:00
|
|
|
CXX_O_FLAG_HIGHEST_JVM="$C_O_FLAG_HIGHEST_JVM"
|
2014-02-24 11:16:58 +00:00
|
|
|
CXX_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST"
|
|
|
|
CXX_O_FLAG_HI="$C_O_FLAG_HI"
|
|
|
|
CXX_O_FLAG_NORM="$C_O_FLAG_NORM"
|
2014-06-12 23:33:32 +00:00
|
|
|
CXX_O_FLAG_DEBUG="$C_O_FLAG_DEBUG"
|
2016-04-08 11:14:23 +00:00
|
|
|
CXX_O_FLAG_DEBUG_JVM="$C_O_FLAG_DEBUG_JVM"
|
2014-02-24 11:16:58 +00:00
|
|
|
CXX_O_FLAG_NONE="$C_O_FLAG_NONE"
|
2016-04-08 11:14:23 +00:00
|
|
|
CXX_O_FLAG_SIZE="$C_O_FLAG_SIZE"
|
2014-02-24 11:16:58 +00:00
|
|
|
fi
|
|
|
|
|
2014-06-12 23:33:32 +00:00
|
|
|
# Adjust optimization flags according to debug level.
|
|
|
|
case $DEBUG_LEVEL in
|
|
|
|
release )
|
|
|
|
# no adjustment
|
|
|
|
;;
|
|
|
|
fastdebug )
|
|
|
|
# Not quite so much optimization
|
|
|
|
C_O_FLAG_HI="$C_O_FLAG_NORM"
|
|
|
|
CXX_O_FLAG_HI="$CXX_O_FLAG_NORM"
|
|
|
|
;;
|
|
|
|
slowdebug )
|
|
|
|
# Disable optimization
|
2016-04-08 11:14:23 +00:00
|
|
|
C_O_FLAG_HIGHEST_JVM="$C_O_FLAG_DEBUG_JVM"
|
2014-06-12 23:33:32 +00:00
|
|
|
C_O_FLAG_HIGHEST="$C_O_FLAG_DEBUG"
|
|
|
|
C_O_FLAG_HI="$C_O_FLAG_DEBUG"
|
|
|
|
C_O_FLAG_NORM="$C_O_FLAG_DEBUG"
|
2016-04-08 11:14:23 +00:00
|
|
|
C_O_FLAG_SIZE="$C_O_FLAG_DEBUG"
|
|
|
|
CXX_O_FLAG_HIGHEST_JVM="$CXX_O_FLAG_DEBUG_JVM"
|
2014-06-12 23:33:32 +00:00
|
|
|
CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_DEBUG"
|
|
|
|
CXX_O_FLAG_HI="$CXX_O_FLAG_DEBUG"
|
|
|
|
CXX_O_FLAG_NORM="$CXX_O_FLAG_DEBUG"
|
2016-04-08 11:14:23 +00:00
|
|
|
CXX_O_FLAG_SIZE="$CXX_O_FLAG_DEBUG"
|
2014-06-12 23:33:32 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2016-04-08 11:14:23 +00:00
|
|
|
AC_SUBST(C_O_FLAG_HIGHEST_JVM)
|
2014-02-24 11:16:58 +00:00
|
|
|
AC_SUBST(C_O_FLAG_HIGHEST)
|
|
|
|
AC_SUBST(C_O_FLAG_HI)
|
|
|
|
AC_SUBST(C_O_FLAG_NORM)
|
2014-06-12 23:33:32 +00:00
|
|
|
AC_SUBST(C_O_FLAG_DEBUG)
|
2014-02-24 11:16:58 +00:00
|
|
|
AC_SUBST(C_O_FLAG_NONE)
|
2016-04-08 11:14:23 +00:00
|
|
|
AC_SUBST(C_O_FLAG_SIZE)
|
|
|
|
AC_SUBST(CXX_O_FLAG_HIGHEST_JVM)
|
2014-02-24 11:16:58 +00:00
|
|
|
AC_SUBST(CXX_O_FLAG_HIGHEST)
|
|
|
|
AC_SUBST(CXX_O_FLAG_HI)
|
|
|
|
AC_SUBST(CXX_O_FLAG_NORM)
|
2014-06-12 23:33:32 +00:00
|
|
|
AC_SUBST(CXX_O_FLAG_DEBUG)
|
2014-02-24 11:16:58 +00:00
|
|
|
AC_SUBST(CXX_O_FLAG_NONE)
|
2016-04-08 11:14:23 +00:00
|
|
|
AC_SUBST(CXX_O_FLAG_SIZE)
|
2014-02-24 11:16:58 +00:00
|
|
|
])
|
|
|
|
|
2016-04-08 11:14:23 +00:00
|
|
|
|
|
|
|
AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK],
|
|
|
|
[
|
|
|
|
|
|
|
|
FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER([TARGET])
|
|
|
|
FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER([BUILD], [OPENJDK_BUILD_])
|
|
|
|
|
|
|
|
# Tests are only ever compiled for TARGET
|
|
|
|
# Flags for compiling test libraries
|
|
|
|
CFLAGS_TESTLIB="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA"
|
|
|
|
CXXFLAGS_TESTLIB="$COMMON_CCXXFLAGS_JDK $CXXFLAGS_JDK $PICFLAG $CXXFLAGS_JDKLIB_EXTRA"
|
|
|
|
|
|
|
|
# Flags for compiling test executables
|
|
|
|
CFLAGS_TESTEXE="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK"
|
|
|
|
CXXFLAGS_TESTEXE="$COMMON_CCXXFLAGS_JDK $CXXFLAGS_JDK"
|
|
|
|
|
|
|
|
AC_SUBST(CFLAGS_TESTLIB)
|
|
|
|
AC_SUBST(CFLAGS_TESTEXE)
|
|
|
|
AC_SUBST(CXXFLAGS_TESTLIB)
|
|
|
|
AC_SUBST(CXXFLAGS_TESTEXE)
|
|
|
|
|
|
|
|
LDFLAGS_TESTLIB="$LDFLAGS_JDKLIB"
|
2016-07-15 23:52:33 +00:00
|
|
|
LDFLAGS_TESTEXE="$LDFLAGS_JDKEXE $JAVA_BASE_LDFLAGS"
|
2016-04-08 11:14:23 +00:00
|
|
|
|
|
|
|
AC_SUBST(LDFLAGS_TESTLIB)
|
|
|
|
AC_SUBST(LDFLAGS_TESTEXE)
|
|
|
|
|
|
|
|
])
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# $1 - Either BUILD or TARGET to pick the correct OS/CPU variables to check
|
|
|
|
# conditionals against.
|
|
|
|
# $2 - Optional prefix for each variable defined.
|
|
|
|
AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER],
|
2014-02-24 11:16:58 +00:00
|
|
|
[
|
|
|
|
# Special extras...
|
|
|
|
if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
|
2016-04-08 11:14:23 +00:00
|
|
|
if test "x$OPENJDK_$1_CPU_ARCH" = "xsparc"; then
|
|
|
|
$2CFLAGS_JDKLIB_EXTRA="${$2CFLAGS_JDKLIB_EXTRA} -xregs=no%appl"
|
|
|
|
$2CXXFLAGS_JDKLIB_EXTRA="${$2CXXFLAGS_JDKLIB_EXTRA} -xregs=no%appl"
|
2014-02-24 11:16:58 +00:00
|
|
|
fi
|
2016-04-08 11:14:23 +00:00
|
|
|
$2CFLAGS_JDKLIB_EXTRA="${$2CFLAGS_JDKLIB_EXTRA} -errtags=yes -errfmt"
|
|
|
|
$2CXXFLAGS_JDKLIB_EXTRA="${$2CXXFLAGS_JDKLIB_EXTRA} -errtags=yes -errfmt"
|
2014-02-24 11:16:58 +00:00
|
|
|
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
|
2016-04-08 11:14:23 +00:00
|
|
|
$2CFLAGS_JDK="${$2CFLAGS_JDK} -qchars=signed -qfullpath -qsaveopt"
|
|
|
|
$2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} -qchars=signed -qfullpath -qsaveopt"
|
|
|
|
elif test "x$TOOLCHAIN_TYPE" = xgcc; then
|
|
|
|
$2CXXSTD_CXXFLAG="-std=gnu++98"
|
|
|
|
FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [[$]$2CXXSTD_CXXFLAG -Werror],
|
|
|
|
IF_FALSE: [$2CXXSTD_CXXFLAG=""])
|
|
|
|
$2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} ${$2CXXSTD_CXXFLAG}"
|
2016-07-10 21:00:03 +00:00
|
|
|
$2JVM_CFLAGS="${$2JVM_CFLAGS} ${$2CXXSTD_CXXFLAG}"
|
2016-04-08 11:14:23 +00:00
|
|
|
AC_SUBST([$2CXXSTD_CXXFLAG])
|
|
|
|
fi
|
|
|
|
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
|
|
|
|
$2CFLAGS_JDK="${$2CFLAGS_JDK} -D__solaris__"
|
|
|
|
$2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} -D__solaris__"
|
2014-02-24 11:16:58 +00:00
|
|
|
fi
|
|
|
|
|
2016-04-08 11:14:23 +00:00
|
|
|
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
|
|
|
|
$2CFLAGS_JDK="${$2CFLAGS_JDK} -D__solaris__"
|
|
|
|
$2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} -D__solaris__"
|
|
|
|
fi
|
|
|
|
|
|
|
|
$2CFLAGS_JDK="${$2CFLAGS_JDK} ${$2EXTRA_CFLAGS}"
|
|
|
|
$2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} ${$2EXTRA_CXXFLAGS}"
|
|
|
|
$2LDFLAGS_JDK="${$2LDFLAGS_JDK} ${$2EXTRA_LDFLAGS}"
|
2014-02-24 11:16:58 +00:00
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
#
|
|
|
|
# Now setup the CFLAGS and LDFLAGS for the JDK build.
|
|
|
|
# Later we will also have CFLAGS and LDFLAGS for the hotspot subrepo build.
|
|
|
|
#
|
|
|
|
|
2014-06-12 23:33:32 +00:00
|
|
|
# Setup compiler/platform specific flags into
|
2016-04-08 11:14:23 +00:00
|
|
|
# $2CFLAGS_JDK - C Compiler flags
|
|
|
|
# $2CXXFLAGS_JDK - C++ Compiler flags
|
|
|
|
# $2COMMON_CCXXFLAGS_JDK - common to C and C++
|
2014-02-24 11:16:58 +00:00
|
|
|
if test "x$TOOLCHAIN_TYPE" = xgcc; then
|
2016-04-08 11:14:23 +00:00
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_GNU_SOURCE"
|
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_REENTRANT"
|
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -fcheck-new"
|
|
|
|
if test "x$OPENJDK_$1_CPU" = xx86; then
|
2015-05-12 07:08:03 +00:00
|
|
|
# Force compatibility with i586 on 32 bit intel platforms.
|
2016-04-08 11:14:23 +00:00
|
|
|
$2COMMON_CCXXFLAGS="${$2COMMON_CCXXFLAGS} -march=i586"
|
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -march=i586"
|
2015-05-12 07:08:03 +00:00
|
|
|
fi
|
2016-04-08 11:14:23 +00:00
|
|
|
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS [$]$2COMMON_CCXXFLAGS_JDK -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2 \
|
2014-02-24 11:16:58 +00:00
|
|
|
-pipe -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
|
2016-04-08 11:14:23 +00:00
|
|
|
case $OPENJDK_$1_CPU_ARCH in
|
2014-02-24 11:16:58 +00:00
|
|
|
arm )
|
|
|
|
# on arm we don't prevent gcc to omit frame pointer but do prevent strict aliasing
|
2016-04-08 11:14:23 +00:00
|
|
|
$2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
|
2014-02-24 11:16:58 +00:00
|
|
|
;;
|
|
|
|
ppc )
|
2014-04-22 00:17:00 +00:00
|
|
|
# on ppc we don't prevent gcc to omit frame pointer but do prevent strict aliasing
|
2016-04-08 11:14:23 +00:00
|
|
|
$2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
|
2014-02-24 11:16:58 +00:00
|
|
|
;;
|
2016-10-06 11:41:43 +00:00
|
|
|
s390 )
|
|
|
|
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer -mbackchain -march=z10"
|
|
|
|
$2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
|
|
|
|
;;
|
2014-02-24 11:16:58 +00:00
|
|
|
* )
|
2016-04-08 11:14:23 +00:00
|
|
|
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer"
|
|
|
|
$2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
|
2014-02-24 11:16:58 +00:00
|
|
|
;;
|
|
|
|
esac
|
2016-07-10 21:00:03 +00:00
|
|
|
TOOLCHAIN_CHECK_COMPILER_VERSION(VERSION: 6, PREFIX: $2, IF_AT_LEAST: FLAGS_SETUP_GCC6_COMPILER_FLAGS($2))
|
2015-12-15 10:02:03 +00:00
|
|
|
elif test "x$TOOLCHAIN_TYPE" = xclang; then
|
2016-04-08 11:14:23 +00:00
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_GNU_SOURCE"
|
|
|
|
|
|
|
|
# Restrict the debug information created by Clang to avoid
|
|
|
|
# too big object files and speed the build up a little bit
|
|
|
|
# (see http://llvm.org/bugs/show_bug.cgi?id=7554)
|
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -flimit-debug-info"
|
|
|
|
if test "x$OPENJDK_$1_OS" = xlinux; then
|
|
|
|
if test "x$OPENJDK_$1_CPU" = xx86; then
|
2016-02-02 14:02:55 +00:00
|
|
|
# Force compatibility with i586 on 32 bit intel platforms.
|
2016-04-08 11:14:23 +00:00
|
|
|
$2COMMON_CCXXFLAGS="${$2COMMON_CCXXFLAGS} -march=i586"
|
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -march=i586"
|
2016-02-02 14:02:55 +00:00
|
|
|
fi
|
2016-04-08 11:14:23 +00:00
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -Wno-sometimes-uninitialized"
|
|
|
|
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS [$]$2COMMON_CCXXFLAGS_JDK -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2 \
|
2016-02-02 14:02:55 +00:00
|
|
|
-pipe -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
|
2016-04-08 11:14:23 +00:00
|
|
|
case $OPENJDK_$1_CPU_ARCH in
|
2016-02-02 14:02:55 +00:00
|
|
|
ppc )
|
|
|
|
# on ppc we don't prevent gcc to omit frame pointer but do prevent strict aliasing
|
2016-04-08 11:14:23 +00:00
|
|
|
$2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
|
2016-02-02 14:02:55 +00:00
|
|
|
;;
|
|
|
|
* )
|
2016-04-08 11:14:23 +00:00
|
|
|
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer"
|
|
|
|
$2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
|
2016-02-02 14:02:55 +00:00
|
|
|
;;
|
|
|
|
esac
|
2015-12-15 10:02:03 +00:00
|
|
|
fi
|
2014-02-24 11:16:58 +00:00
|
|
|
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
|
2016-04-08 11:14:23 +00:00
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -DSPARC_WORKS"
|
|
|
|
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS [$]$2COMMON_CCXXFLAGS_JDK -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS"
|
|
|
|
if test "x$OPENJDK_$1_CPU_ARCH" = xx86; then
|
|
|
|
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -DcpuIntel -Di586 -D$OPENJDK_$1_CPU_LEGACY_LIB"
|
2014-02-24 11:16:58 +00:00
|
|
|
fi
|
2014-06-12 23:33:32 +00:00
|
|
|
|
2016-04-08 11:14:23 +00:00
|
|
|
$2CFLAGS_JDK="[$]$2CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -W0,-noglobal"
|
|
|
|
$2CXXFLAGS_JDK="[$]$2CXXFLAGS_JDK -errtags=yes +w -mt -features=no%except -DCC_NOEX -norunpath -xnolib"
|
2014-02-24 11:16:58 +00:00
|
|
|
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
|
2016-04-08 11:14:23 +00:00
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_REENTRANT -D__STDC_FORMAT_MACROS"
|
|
|
|
$2CFLAGS_JDK="[$]$2CFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
|
|
|
|
$2CXXFLAGS_JDK="[$]$2CXXFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
|
2014-02-24 11:16:58 +00:00
|
|
|
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
2016-04-08 11:14:23 +00:00
|
|
|
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS [$]$2COMMON_CCXXFLAGS_JDK \
|
2016-03-14 11:00:24 +00:00
|
|
|
-MD -Zc:wchar_t- -W3 -wd4800 \
|
2015-01-15 15:36:24 +00:00
|
|
|
-DWIN32_LEAN_AND_MEAN \
|
|
|
|
-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \
|
2015-05-26 08:43:56 +00:00
|
|
|
-D_WINSOCK_DEPRECATED_NO_WARNINGS \
|
2015-01-15 15:36:24 +00:00
|
|
|
-DWIN32 -DIAL"
|
2016-04-08 11:14:23 +00:00
|
|
|
if test "x$OPENJDK_$1_CPU" = xx86_64; then
|
|
|
|
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_AMD64_ -Damd64"
|
2014-02-24 11:16:58 +00:00
|
|
|
else
|
2016-04-08 11:14:23 +00:00
|
|
|
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_X86_ -Dx86"
|
2014-02-24 11:16:58 +00:00
|
|
|
fi
|
2015-01-15 15:36:24 +00:00
|
|
|
# If building with Visual Studio 2010, we can still use _STATIC_CPPLIB to
|
|
|
|
# avoid bundling msvcpNNN.dll. Doesn't work with newer versions of visual
|
|
|
|
# studio.
|
|
|
|
if test "x$TOOLCHAIN_VERSION" = "x2010"; then
|
2016-02-12 10:07:35 +00:00
|
|
|
STATIC_CPPLIB_FLAGS="-D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB"
|
2016-04-08 11:14:23 +00:00
|
|
|
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK $STATIC_CPPLIB_FLAGS"
|
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS $STATIC_CPPLIB_FLAGS"
|
2015-01-15 15:36:24 +00:00
|
|
|
fi
|
2014-02-24 11:16:58 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
# Adjust flags according to debug level.
|
|
|
|
case $DEBUG_LEVEL in
|
2014-06-12 23:33:32 +00:00
|
|
|
fastdebug | slowdebug )
|
2016-04-08 11:14:23 +00:00
|
|
|
$2CFLAGS_JDK="[$]$2CFLAGS_JDK $CFLAGS_DEBUG_SYMBOLS $CFLAGS_DEBUG_OPTIONS"
|
|
|
|
$2CXXFLAGS_JDK="[$]$2CXXFLAGS_JDK $CXXFLAGS_DEBUG_SYMBOLS $CXXFLAGS_DEBUG_OPTIONS"
|
2014-02-24 11:16:58 +00:00
|
|
|
;;
|
2014-06-12 23:33:32 +00:00
|
|
|
release )
|
|
|
|
;;
|
|
|
|
* )
|
|
|
|
AC_MSG_ERROR([Unrecognized \$DEBUG_LEVEL: $DEBUG_LEVEL])
|
2014-02-24 11:16:58 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# Set some common defines. These works for all compilers, but assume
|
|
|
|
# -D is universally accepted.
|
|
|
|
|
|
|
|
# Setup endianness
|
2016-04-08 11:14:23 +00:00
|
|
|
if test "x$OPENJDK_$1_CPU_ENDIAN" = xlittle; then
|
2014-02-24 11:16:58 +00:00
|
|
|
# The macro _LITTLE_ENDIAN needs to be defined the same to avoid the
|
|
|
|
# Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN
|
|
|
|
# (The Solaris X86 system defines this in file /usr/include/sys/isa_defs.h).
|
|
|
|
# Note: -Dmacro is the same as #define macro 1
|
|
|
|
# -Dmacro= is the same as #define macro
|
2016-04-08 11:14:23 +00:00
|
|
|
if test "x$OPENJDK_$1_OS" = xsolaris; then
|
|
|
|
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_LITTLE_ENDIAN="
|
2014-02-24 11:16:58 +00:00
|
|
|
else
|
2016-04-08 11:14:23 +00:00
|
|
|
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_LITTLE_ENDIAN"
|
2014-02-24 11:16:58 +00:00
|
|
|
fi
|
|
|
|
else
|
2014-03-28 13:59:56 +00:00
|
|
|
# Same goes for _BIG_ENDIAN. Do we really need to set *ENDIAN on Solaris if they
|
|
|
|
# are defined in the system?
|
2016-04-08 11:14:23 +00:00
|
|
|
if test "x$OPENJDK_$1_OS" = xsolaris; then
|
|
|
|
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_BIG_ENDIAN="
|
2014-03-28 13:59:56 +00:00
|
|
|
else
|
2016-04-08 11:14:23 +00:00
|
|
|
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_BIG_ENDIAN"
|
2014-03-28 13:59:56 +00:00
|
|
|
fi
|
2014-02-24 11:16:58 +00:00
|
|
|
fi
|
2014-06-12 23:33:32 +00:00
|
|
|
|
2014-02-24 11:16:58 +00:00
|
|
|
# Setup target OS define. Use OS target name but in upper case.
|
2016-04-08 11:14:23 +00:00
|
|
|
OPENJDK_$1_OS_UPPERCASE=`$ECHO $OPENJDK_$1_OS | $TR 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
|
|
|
|
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D$OPENJDK_$1_OS_UPPERCASE"
|
2014-02-24 11:16:58 +00:00
|
|
|
|
|
|
|
# Setup target CPU
|
2016-04-08 11:14:23 +00:00
|
|
|
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK \
|
|
|
|
$OPENJDK_$1_ADD_LP64 \
|
|
|
|
-DARCH='\"$OPENJDK_$1_CPU_LEGACY\"' -D$OPENJDK_$1_CPU_LEGACY"
|
2014-06-12 23:33:32 +00:00
|
|
|
|
2014-02-24 11:16:58 +00:00
|
|
|
# Setup debug/release defines
|
|
|
|
if test "x$DEBUG_LEVEL" = xrelease; then
|
2016-04-08 11:14:23 +00:00
|
|
|
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -DNDEBUG"
|
|
|
|
if test "x$OPENJDK_$1_OS" = xsolaris; then
|
|
|
|
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -DTRIMMED"
|
2014-02-24 11:16:58 +00:00
|
|
|
fi
|
|
|
|
else
|
2016-04-08 11:14:23 +00:00
|
|
|
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -DDEBUG"
|
2014-02-24 11:16:58 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Set some additional per-OS defines.
|
2016-04-08 11:14:23 +00:00
|
|
|
if test "x$OPENJDK_$1_OS" = xlinux; then
|
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -DLINUX"
|
2016-11-24 14:32:14 +00:00
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -pipe $PICFLAG -fno-rtti -fno-exceptions \
|
2016-04-08 11:14:23 +00:00
|
|
|
-fvisibility=hidden -fno-strict-aliasing -fno-omit-frame-pointer"
|
|
|
|
elif test "x$OPENJDK_$1_OS" = xsolaris; then
|
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -DSOLARIS"
|
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -template=no%extdef -features=no%split_init \
|
2016-11-24 14:32:14 +00:00
|
|
|
-D_Crun_inline_placement -library=%none $PICFLAG -mt -features=no%except"
|
2016-04-08 11:14:23 +00:00
|
|
|
elif test "x$OPENJDK_$1_OS" = xmacosx; then
|
|
|
|
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
|
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_ALLBSD_SOURCE"
|
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_DARWIN_C_SOURCE -D_XOPEN_SOURCE"
|
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -fno-rtti -fno-exceptions -fvisibility=hidden \
|
|
|
|
-mno-omit-leaf-frame-pointer -mstack-alignment=16 -pipe -fno-strict-aliasing \
|
|
|
|
-DMAC_OS_X_VERSION_MAX_ALLOWED=1070 -mmacosx-version-min=10.7.0 \
|
|
|
|
-fno-omit-frame-pointer"
|
|
|
|
elif test "x$OPENJDK_$1_OS" = xaix; then
|
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -DAIX"
|
|
|
|
# We may need '-qminimaltoc' or '-qpic=large -bbigtoc' if the TOC overflows.
|
2016-06-07 16:25:53 +00:00
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -qtune=balanced \
|
|
|
|
-qalias=noansi -qstrict -qtls=default -qlanglvl=c99vla \
|
2016-04-08 11:14:23 +00:00
|
|
|
-qlanglvl=noredefmac -qnortti -qnoeh -qignerrno"
|
|
|
|
elif test "x$OPENJDK_$1_OS" = xbsd; then
|
|
|
|
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_ALLBSD_SOURCE"
|
|
|
|
elif test "x$OPENJDK_$1_OS" = xwindows; then
|
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_WINDOWS -DWIN32 -D_JNI_IMPLEMENTATION_"
|
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -nologo -W3 -MD -MP"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Set some additional per-CPU defines.
|
|
|
|
if test "x$OPENJDK_$1_OS-$OPENJDK_$1_CPU" = xwindows-x86; then
|
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -arch:IA32"
|
|
|
|
elif test "x$OPENJDK_$1_CPU" = xsparcv9; then
|
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -xarch=sparc"
|
|
|
|
elif test "x$OPENJDK_$1_CPU" = xppc64; then
|
|
|
|
if test "x$OPENJDK_$1_OS" = xlinux; then
|
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -minsert-sched-nops=regroup_exact -mno-multiple -mno-string"
|
2016-04-13 09:13:14 +00:00
|
|
|
# fixes `relocation truncated to fit' error for gcc 4.1.
|
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -mminimal-toc"
|
|
|
|
# Use ppc64 instructions, but schedule for power5
|
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -mcpu=powerpc64 -mtune=power5"
|
2016-04-08 11:14:23 +00:00
|
|
|
elif test "x$OPENJDK_$1_OS" = xaix; then
|
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -qarch=ppc64"
|
2016-04-13 09:13:14 +00:00
|
|
|
fi
|
|
|
|
elif test "x$OPENJDK_$1_CPU" = xppc64le; then
|
|
|
|
if test "x$OPENJDK_$1_OS" = xlinux; then
|
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -minsert-sched-nops=regroup_exact -mno-multiple -mno-string"
|
|
|
|
# Little endian machine uses ELFv2 ABI.
|
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -DABI_ELFv2"
|
|
|
|
# Use Power8, this is the first CPU to support PPC64 LE with ELFv2 ABI.
|
2016-11-14 10:48:43 +00:00
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -mcpu=power8 -mtune=power8"
|
2016-04-13 09:13:14 +00:00
|
|
|
fi
|
2016-10-06 11:41:43 +00:00
|
|
|
elif test "x$OPENJDK_$1_CPU" = xs390x; then
|
|
|
|
if test "x$OPENJDK_$1_OS" = xlinux; then
|
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -mbackchain -march=z10"
|
|
|
|
fi
|
2016-04-08 11:14:23 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if test "x$OPENJDK_$1_CPU_ENDIAN" = xlittle; then
|
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -DVM_LITTLE_ENDIAN"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test "x$OPENJDK_$1_CPU_BITS" = x64; then
|
|
|
|
if test "x$OPENJDK_$1_OS" != xsolaris && test "x$OPENJDK_$1_OS" != xaix; then
|
|
|
|
# Solaris does not have _LP64=1 in the old build.
|
|
|
|
# xlc on AIX defines _LP64=1 by default and issues a warning if we redefine it.
|
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_LP64=1"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Set $2JVM_CFLAGS warning handling
|
|
|
|
if test "x$OPENJDK_$1_OS" = xlinux; then
|
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -Wpointer-arith -Wsign-compare -Wunused-function \
|
|
|
|
-Wunused-value -Woverloaded-virtual"
|
|
|
|
|
|
|
|
if test "x$TOOLCHAIN_TYPE" = xgcc; then
|
2016-05-11 12:48:30 +00:00
|
|
|
TOOLCHAIN_CHECK_COMPILER_VERSION(VERSION: [4.8], PREFIX: $2,
|
2016-04-08 11:14:23 +00:00
|
|
|
IF_AT_LEAST: [
|
|
|
|
# These flags either do not work or give spurious warnings prior to gcc 4.8.
|
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -Wno-format-zero-length -Wtype-limits -Wuninitialized"
|
|
|
|
]
|
|
|
|
)
|
|
|
|
fi
|
|
|
|
if ! HOTSPOT_CHECK_JVM_VARIANT(zero) && ! HOTSPOT_CHECK_JVM_VARIANT(zeroshark); then
|
|
|
|
# Non-zero builds have stricter warnings
|
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -Wreturn-type -Wundef -Wformat=2"
|
|
|
|
else
|
|
|
|
if test "x$TOOLCHAIN_TYPE" = xclang; then
|
|
|
|
# Some versions of llvm do not like -Wundef
|
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -Wno-undef"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
elif test "x$OPENJDK_$1_OS" = xmacosx; then
|
|
|
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -Wno-deprecated -Wpointer-arith \
|
|
|
|
-Wsign-compare -Wundef -Wunused-function -Wformat=2"
|
2014-02-24 11:16:58 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Additional macosx handling
|
2016-04-08 11:14:23 +00:00
|
|
|
if test "x$OPENJDK_$1_OS" = xmacosx; then
|
2014-06-18 19:52:13 +00:00
|
|
|
# Setting these parameters makes it an error to link to macosx APIs that are
|
|
|
|
# newer than the given OS version and makes the linked binaries compatible
|
|
|
|
# even if built on a newer version of the OS.
|
|
|
|
# The expected format is X.Y.Z
|
|
|
|
MACOSX_VERSION_MIN=10.7.0
|
|
|
|
AC_SUBST(MACOSX_VERSION_MIN)
|
|
|
|
|
|
|
|
# The macro takes the version with no dots, ex: 1070
|
|
|
|
# Let the flags variables get resolved in make for easier override on make
|
|
|
|
# command line.
|
2016-04-08 11:14:23 +00:00
|
|
|
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
|
|
|
|
$2LDFLAGS_JDK="[$]$2LDFLAGS_JDK -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
|
2014-02-24 11:16:58 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Setup some hard coded includes
|
2016-04-08 11:14:23 +00:00
|
|
|
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK \
|
2016-11-02 09:43:03 +00:00
|
|
|
-I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
|
2014-08-17 14:51:37 +00:00
|
|
|
-I${JDK_TOPDIR}/src/java.base/share/native/include \
|
2016-04-08 11:14:23 +00:00
|
|
|
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_$1_OS/native/include \
|
|
|
|
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_$1_OS_TYPE/native/include \
|
2016-01-14 10:58:32 +00:00
|
|
|
-I${JDK_TOPDIR}/src/java.base/share/native/libjava \
|
2016-04-08 11:14:23 +00:00
|
|
|
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_$1_OS_TYPE/native/libjava"
|
2014-02-24 11:16:58 +00:00
|
|
|
|
|
|
|
# The shared libraries are compiled using the picflag.
|
2016-04-08 11:14:23 +00:00
|
|
|
$2CFLAGS_JDKLIB="[$]$2COMMON_CCXXFLAGS_JDK \
|
|
|
|
[$]$2CFLAGS_JDK [$]$2EXTRA_CFLAGS_JDK $PICFLAG [$]$2CFLAGS_JDKLIB_EXTRA"
|
|
|
|
$2CXXFLAGS_JDKLIB="[$]$2COMMON_CCXXFLAGS_JDK \
|
|
|
|
[$]$2CXXFLAGS_JDK [$]$2EXTRA_CXXFLAGS_JDK $PICFLAG [$]$2CXXFLAGS_JDKLIB_EXTRA"
|
2014-02-24 11:16:58 +00:00
|
|
|
|
|
|
|
# Executable flags
|
2016-04-08 11:14:23 +00:00
|
|
|
$2CFLAGS_JDKEXE="[$]$2COMMON_CCXXFLAGS_JDK [$]$2CFLAGS_JDK [$]$2EXTRA_CFLAGS_JDK"
|
|
|
|
$2CXXFLAGS_JDKEXE="[$]$2COMMON_CCXXFLAGS_JDK [$]$2CXXFLAGS_JDK [$]$2EXTRA_CXXFLAGS_JDK"
|
2014-02-24 11:16:58 +00:00
|
|
|
|
2016-04-08 11:14:23 +00:00
|
|
|
AC_SUBST($2CFLAGS_JDKLIB)
|
|
|
|
AC_SUBST($2CFLAGS_JDKEXE)
|
|
|
|
AC_SUBST($2CXXFLAGS_JDKLIB)
|
|
|
|
AC_SUBST($2CXXFLAGS_JDKEXE)
|
2015-03-10 13:36:56 +00:00
|
|
|
|
2014-02-24 11:16:58 +00:00
|
|
|
# Setup LDFLAGS et al.
|
|
|
|
#
|
2014-06-12 23:33:32 +00:00
|
|
|
|
2014-02-24 11:16:58 +00:00
|
|
|
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
2016-02-12 10:07:35 +00:00
|
|
|
LDFLAGS_MICROSOFT="-nologo -opt:ref"
|
2016-04-08 11:14:23 +00:00
|
|
|
$2LDFLAGS_JDK="[$]$2LDFLAGS_JDK $LDFLAGS_MICROSOFT -incremental:no"
|
|
|
|
$2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LDFLAGS_MICROSOFT -opt:icf,8 -subsystem:windows -base:0x8000000"
|
|
|
|
if test "x$OPENJDK_$1_CPU_BITS" = "x32"; then
|
2016-02-12 10:07:35 +00:00
|
|
|
LDFLAGS_SAFESH="-safeseh"
|
2016-04-08 11:14:23 +00:00
|
|
|
$2LDFLAGS_JDK="[$]$2LDFLAGS_JDK $LDFLAGS_SAFESH"
|
|
|
|
$2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LDFLAGS_SAFESH"
|
|
|
|
# NOTE: Old build added -machine. Probably not needed.
|
|
|
|
$2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -machine:I386"
|
|
|
|
else
|
|
|
|
$2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -machine:AMD64"
|
|
|
|
fi
|
|
|
|
elif test "x$TOOLCHAIN_TYPE" = xclang; then
|
|
|
|
$2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -mno-omit-leaf-frame-pointer -mstack-alignment=16 -stdlib=libstdc++ -fPIC"
|
|
|
|
if test "x$OPENJDK_$1_OS" = xmacosx; then
|
|
|
|
# FIXME: We should really generalize SET_SHARED_LIBRARY_ORIGIN instead.
|
|
|
|
$2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/.."
|
2014-02-24 11:16:58 +00:00
|
|
|
fi
|
2014-06-12 23:33:32 +00:00
|
|
|
elif test "x$TOOLCHAIN_TYPE" = xgcc; then
|
|
|
|
# If this is a --hash-style=gnu system, use --hash-style=both, why?
|
|
|
|
# We have previously set HAS_GNU_HASH if this is the case
|
|
|
|
if test -n "$HAS_GNU_HASH"; then
|
2016-04-08 11:14:23 +00:00
|
|
|
$2LDFLAGS_HASH_STYLE="-Wl,--hash-style=both"
|
|
|
|
$2LDFLAGS_JDK="${$2LDFLAGS_JDK} [$]$2LDFLAGS_HASH_STYLE"
|
|
|
|
$2JVM_LDFLAGS="[$]$2JVM_LDFLAGS [$]$2LDFLAGS_HASH_STYLE"
|
2014-02-24 11:16:58 +00:00
|
|
|
fi
|
2016-04-08 11:14:23 +00:00
|
|
|
if test "x$OPENJDK_$1_OS" = xmacosx; then
|
|
|
|
$2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/.."
|
|
|
|
fi
|
|
|
|
if test "x$OPENJDK_$1_OS" = xlinux; then
|
2014-06-12 23:33:32 +00:00
|
|
|
# And since we now know that the linker is gnu, then add -z defs, to forbid
|
|
|
|
# undefined symbols in object files.
|
2016-02-12 10:07:35 +00:00
|
|
|
LDFLAGS_NO_UNDEF_SYM="-Wl,-z,defs"
|
2016-04-08 11:14:23 +00:00
|
|
|
$2LDFLAGS_JDK="${$2LDFLAGS_JDK} $LDFLAGS_NO_UNDEF_SYM"
|
|
|
|
$2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LDFLAGS_NO_UNDEF_SYM"
|
|
|
|
LDFLAGS_NO_EXEC_STACK="-Wl,-z,noexecstack"
|
|
|
|
$2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LDFLAGS_NO_EXEC_STACK"
|
|
|
|
if test "x$OPENJDK_$1_CPU" = xx86; then
|
|
|
|
$2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -march=i586"
|
|
|
|
fi
|
2014-06-12 23:33:32 +00:00
|
|
|
case $DEBUG_LEVEL in
|
|
|
|
release )
|
|
|
|
# tell linker to optimize libraries.
|
2014-02-24 11:16:58 +00:00
|
|
|
# Should this be supplied to the OSS linker as well?
|
2016-02-12 10:07:35 +00:00
|
|
|
LDFLAGS_DEBUGLEVEL_release="-Wl,-O1"
|
2016-04-08 11:14:23 +00:00
|
|
|
$2LDFLAGS_JDK="${$2LDFLAGS_JDK} $LDFLAGS_DEBUGLEVEL_release"
|
|
|
|
$2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LDFLAGS_DEBUGLEVEL_release"
|
|
|
|
if test "x$HAS_LINKER_RELRO" = "xtrue"; then
|
|
|
|
$2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LINKER_RELRO_FLAG"
|
|
|
|
fi
|
2014-06-12 23:33:32 +00:00
|
|
|
;;
|
|
|
|
slowdebug )
|
2016-04-08 11:14:23 +00:00
|
|
|
# Hotspot always let the linker optimize
|
|
|
|
$2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -Wl,-O1"
|
2014-06-12 23:33:32 +00:00
|
|
|
if test "x$HAS_LINKER_NOW" = "xtrue"; then
|
|
|
|
# do relocations at load
|
2016-04-08 11:14:23 +00:00
|
|
|
$2LDFLAGS_JDK="[$]$2LDFLAGS_JDK $LINKER_NOW_FLAG"
|
|
|
|
$2LDFLAGS_CXX_JDK="[$]$2LDFLAGS_CXX_JDK $LINKER_NOW_FLAG"
|
|
|
|
$2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LINKER_NOW_FLAG"
|
2014-06-12 23:33:32 +00:00
|
|
|
fi
|
|
|
|
if test "x$HAS_LINKER_RELRO" = "xtrue"; then
|
|
|
|
# mark relocations read only
|
2016-04-08 11:14:23 +00:00
|
|
|
$2LDFLAGS_JDK="[$]$2LDFLAGS_JDK $LINKER_RELRO_FLAG"
|
|
|
|
$2LDFLAGS_CXX_JDK="[$]$2LDFLAGS_CXX_JDK $LINKER_RELRO_FLAG"
|
|
|
|
$2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LINKER_RELRO_FLAG"
|
2014-06-12 23:33:32 +00:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
fastdebug )
|
2016-04-08 11:14:23 +00:00
|
|
|
# Hotspot always let the linker optimize
|
|
|
|
$2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -Wl,-O1"
|
2014-06-12 23:33:32 +00:00
|
|
|
if test "x$HAS_LINKER_RELRO" = "xtrue"; then
|
|
|
|
# mark relocations read only
|
2016-04-08 11:14:23 +00:00
|
|
|
$2LDFLAGS_JDK="[$]$2LDFLAGS_JDK $LINKER_RELRO_FLAG"
|
|
|
|
$2LDFLAGS_CXX_JDK="[$]$2LDFLAGS_CXX_JDK $LINKER_RELRO_FLAG"
|
|
|
|
$2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LINKER_RELRO_FLAG"
|
2014-06-12 23:33:32 +00:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
* )
|
|
|
|
AC_MSG_ERROR([Unrecognized \$DEBUG_LEVEL: $DEBUG_LEVEL])
|
|
|
|
;;
|
|
|
|
esac
|
2014-02-24 11:16:58 +00:00
|
|
|
fi
|
2014-06-12 23:33:32 +00:00
|
|
|
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
|
2016-02-12 10:07:35 +00:00
|
|
|
LDFLAGS_SOLSTUDIO="-Wl,-z,defs"
|
2016-07-20 19:52:45 +00:00
|
|
|
$2LDFLAGS_JDK="[$]$2LDFLAGS_JDK $LDFLAGS_SOLSTUDIO -ztext"
|
2016-02-12 10:07:35 +00:00
|
|
|
LDFLAGS_CXX_SOLSTUDIO="-norunpath"
|
2016-04-08 11:14:23 +00:00
|
|
|
$2LDFLAGS_CXX_JDK="[$]$2LDFLAGS_CXX_JDK $LDFLAGS_CXX_SOLSTUDIO -xnolib"
|
|
|
|
$2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LDFLAGS_SOLSTUDIO -library=%none -mt $LDFLAGS_CXX_SOLSTUDIO -z noversion"
|
|
|
|
if test "x$OPENJDK_$1_CPU_ARCH" = "xsparc"; then
|
|
|
|
$2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -xarch=sparc"
|
|
|
|
fi
|
2015-03-19 14:28:22 +00:00
|
|
|
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
|
2016-02-22 10:27:09 +00:00
|
|
|
LDFLAGS_XLC="-b64 -brtl -bnolibpath -bexpall -bernotok"
|
2016-04-08 11:14:23 +00:00
|
|
|
$2LDFLAGS_JDK="${$2LDFLAGS_JDK} $LDFLAGS_XLC"
|
|
|
|
$2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LDFLAGS_XLC"
|
2014-06-12 23:33:32 +00:00
|
|
|
fi
|
2014-02-24 11:16:58 +00:00
|
|
|
|
2014-06-12 23:33:32 +00:00
|
|
|
# Customize LDFLAGS for executables
|
|
|
|
|
2016-04-08 11:14:23 +00:00
|
|
|
$2LDFLAGS_JDKEXE="${$2LDFLAGS_JDK}"
|
2014-06-12 23:33:32 +00:00
|
|
|
|
|
|
|
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
2016-04-08 11:14:23 +00:00
|
|
|
if test "x$OPENJDK_$1_CPU_BITS" = "x64"; then
|
2014-06-12 23:33:32 +00:00
|
|
|
LDFLAGS_STACK_SIZE=1048576
|
|
|
|
else
|
|
|
|
LDFLAGS_STACK_SIZE=327680
|
2014-02-24 11:16:58 +00:00
|
|
|
fi
|
2016-04-08 11:14:23 +00:00
|
|
|
$2LDFLAGS_JDKEXE="${$2LDFLAGS_JDKEXE} /STACK:$LDFLAGS_STACK_SIZE"
|
|
|
|
elif test "x$OPENJDK_$1_OS" = xlinux; then
|
|
|
|
$2LDFLAGS_JDKEXE="[$]$2LDFLAGS_JDKEXE -Wl,--allow-shlib-undefined"
|
2014-06-12 23:33:32 +00:00
|
|
|
fi
|
2014-02-24 11:16:58 +00:00
|
|
|
|
2016-04-08 11:14:23 +00:00
|
|
|
$2LDFLAGS_JDKEXE="${$2LDFLAGS_JDKEXE} ${$2EXTRA_LDFLAGS_JDK}"
|
2016-03-17 19:03:53 +00:00
|
|
|
|
2014-06-12 23:33:32 +00:00
|
|
|
# Customize LDFLAGS for libs
|
2016-04-08 11:14:23 +00:00
|
|
|
$2LDFLAGS_JDKLIB="${$2LDFLAGS_JDK}"
|
2014-06-12 23:33:32 +00:00
|
|
|
|
2016-04-08 11:14:23 +00:00
|
|
|
$2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} ${SHARED_LIBRARY_FLAGS}"
|
2014-06-12 23:33:32 +00:00
|
|
|
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
2016-07-15 23:52:33 +00:00
|
|
|
$2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} \
|
2015-12-15 10:02:03 +00:00
|
|
|
-libpath:${OUTPUT_ROOT}/support/modules_libs/java.base"
|
2016-04-08 11:14:23 +00:00
|
|
|
$2JDKLIB_LIBS=""
|
2014-06-12 23:33:32 +00:00
|
|
|
else
|
2016-07-15 23:52:33 +00:00
|
|
|
$2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} \
|
2016-12-05 16:55:59 +00:00
|
|
|
-L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base"
|
2014-02-24 11:16:58 +00:00
|
|
|
|
2016-04-08 11:14:23 +00:00
|
|
|
if test "x$1" = "xTARGET"; then
|
2016-11-24 14:27:33 +00:00
|
|
|
# On some platforms (mac) the linker warns about non existing -L dirs.
|
|
|
|
# For any of the variants server, client or minimal, the dir matches the
|
|
|
|
# variant name. The "main" variant should be used for linking. For the
|
|
|
|
# rest, the dir is just server.
|
|
|
|
if HOTSPOT_CHECK_JVM_VARIANT(server) || HOTSPOT_CHECK_JVM_VARIANT(client) \
|
|
|
|
|| HOTSPOT_CHECK_JVM_VARIANT(minimal); then
|
|
|
|
$2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} \
|
2016-12-05 16:55:59 +00:00
|
|
|
-L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/$JVM_VARIANT_MAIN"
|
2016-11-24 14:27:33 +00:00
|
|
|
else
|
|
|
|
$2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} \
|
2016-12-05 16:55:59 +00:00
|
|
|
-L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/server"
|
2016-11-24 14:27:33 +00:00
|
|
|
fi
|
2016-04-08 11:14:23 +00:00
|
|
|
elif test "x$1" = "xBUILD"; then
|
|
|
|
# When building a buildjdk, it's always only the server variant
|
2016-07-15 23:52:33 +00:00
|
|
|
$2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} \
|
2016-12-05 16:55:59 +00:00
|
|
|
-L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/server"
|
2014-02-24 11:16:58 +00:00
|
|
|
fi
|
|
|
|
|
2016-04-08 11:14:23 +00:00
|
|
|
$2JDKLIB_LIBS="-ljava -ljvm"
|
2014-02-24 11:16:58 +00:00
|
|
|
if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
|
2016-04-08 11:14:23 +00:00
|
|
|
$2JDKLIB_LIBS="[$]$2JDKLIB_LIBS -lc"
|
2014-02-24 11:16:58 +00:00
|
|
|
fi
|
2016-03-17 19:03:53 +00:00
|
|
|
|
2014-02-24 11:16:58 +00:00
|
|
|
fi
|
2014-06-12 23:33:32 +00:00
|
|
|
|
2016-07-15 23:52:33 +00:00
|
|
|
$2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} ${$2JAVA_BASE_LDFLAGS}"
|
|
|
|
|
2016-04-08 11:14:23 +00:00
|
|
|
# Set $2JVM_LIBS (per os)
|
|
|
|
if test "x$OPENJDK_$1_OS" = xlinux; then
|
|
|
|
$2JVM_LIBS="[$]$2JVM_LIBS -lm -ldl -lpthread"
|
|
|
|
elif test "x$OPENJDK_$1_OS" = xsolaris; then
|
|
|
|
# FIXME: This hard-coded path is not really proper.
|
|
|
|
if test "x$OPENJDK_$1_CPU" = xx86_64; then
|
|
|
|
$2SOLARIS_LIBM_LIBS="/usr/lib/amd64/libm.so.1"
|
|
|
|
elif test "x$OPENJDK_$1_CPU" = xsparcv9; then
|
|
|
|
$2SOLARIS_LIBM_LIBS="/usr/lib/sparcv9/libm.so.1"
|
|
|
|
fi
|
|
|
|
$2JVM_LIBS="[$]$2JVM_LIBS -lsocket -lsched -ldl $SOLARIS_LIBM_LIBS -lCrun \
|
|
|
|
-lthread -ldoor -lc -ldemangle -lnsl -lkstat -lrt"
|
|
|
|
elif test "x$OPENJDK_$1_OS" = xmacosx; then
|
|
|
|
$2JVM_LIBS="[$]$2JVM_LIBS -lm"
|
|
|
|
elif test "x$OPENJDK_$1_OS" = xaix; then
|
|
|
|
$2JVM_LIBS="[$]$2JVM_LIBS -Wl,-lC_r -lm -ldl -lpthread"
|
|
|
|
elif test "x$OPENJDK_$1_OS" = xbsd; then
|
|
|
|
$2JVM_LIBS="[$]$2JVM_LIBS -lm"
|
|
|
|
elif test "x$OPENJDK_$1_OS" = xwindows; then
|
|
|
|
$2JVM_LIBS="[$]$2JVM_LIBS kernel32.lib user32.lib gdi32.lib winspool.lib \
|
|
|
|
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib \
|
|
|
|
wsock32.lib winmm.lib version.lib psapi.lib"
|
|
|
|
fi
|
2016-03-17 19:03:53 +00:00
|
|
|
|
2016-04-08 11:14:23 +00:00
|
|
|
# Set $2JVM_ASFLAGS
|
|
|
|
if test "x$OPENJDK_$1_OS" = xlinux; then
|
|
|
|
if test "x$OPENJDK_$1_CPU" = xx86; then
|
|
|
|
$2JVM_ASFLAGS="[$]$2JVM_ASFLAGS -march=i586"
|
|
|
|
fi
|
|
|
|
elif test "x$OPENJDK_$1_OS" = xmacosx; then
|
|
|
|
$2JVM_ASFLAGS="[$]$2JVM_ASFLAGS -x assembler-with-cpp -mno-omit-leaf-frame-pointer -mstack-alignment=16"
|
|
|
|
fi
|
2015-03-10 13:36:56 +00:00
|
|
|
|
2016-04-08 11:14:23 +00:00
|
|
|
$2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} ${$2EXTRA_LDFLAGS_JDK}"
|
|
|
|
|
|
|
|
AC_SUBST($2LDFLAGS_JDKLIB)
|
|
|
|
AC_SUBST($2LDFLAGS_JDKEXE)
|
|
|
|
AC_SUBST($2JDKLIB_LIBS)
|
|
|
|
AC_SUBST($2JDKEXE_LIBS)
|
|
|
|
AC_SUBST($2LDFLAGS_CXX_JDK)
|
|
|
|
AC_SUBST($2LDFLAGS_HASH_STYLE)
|
|
|
|
|
|
|
|
AC_SUBST($2JVM_CFLAGS)
|
|
|
|
AC_SUBST($2JVM_LDFLAGS)
|
|
|
|
AC_SUBST($2JVM_ASFLAGS)
|
|
|
|
AC_SUBST($2JVM_LIBS)
|
2015-03-10 13:36:56 +00:00
|
|
|
|
2014-02-24 11:16:58 +00:00
|
|
|
])
|
|
|
|
|
2016-03-19 01:28:49 +00:00
|
|
|
# FLAGS_C_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
|
|
|
|
# IF_FALSE: [RUN-IF-FALSE])
|
2014-02-24 11:16:58 +00:00
|
|
|
# ------------------------------------------------------------
|
2016-03-19 01:28:49 +00:00
|
|
|
# Check that the C compiler supports an argument
|
|
|
|
BASIC_DEFUN_NAMED([FLAGS_C_COMPILER_CHECK_ARGUMENTS],
|
2016-01-14 10:58:32 +00:00
|
|
|
[*ARGUMENT IF_TRUE IF_FALSE], [$@],
|
2014-02-24 11:16:58 +00:00
|
|
|
[
|
2016-03-19 01:28:49 +00:00
|
|
|
AC_MSG_CHECKING([if the C compiler supports "ARG_ARGUMENT"])
|
2014-02-24 11:16:58 +00:00
|
|
|
supports=yes
|
|
|
|
|
|
|
|
saved_cflags="$CFLAGS"
|
2016-01-14 10:58:32 +00:00
|
|
|
CFLAGS="$CFLAGS ARG_ARGUMENT"
|
2014-02-24 11:16:58 +00:00
|
|
|
AC_LANG_PUSH([C])
|
2014-06-12 23:33:32 +00:00
|
|
|
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
|
2014-02-24 11:16:58 +00:00
|
|
|
[supports=no])
|
|
|
|
AC_LANG_POP([C])
|
|
|
|
CFLAGS="$saved_cflags"
|
|
|
|
|
2016-03-19 01:28:49 +00:00
|
|
|
AC_MSG_RESULT([$supports])
|
|
|
|
if test "x$supports" = "xyes" ; then
|
|
|
|
:
|
|
|
|
ARG_IF_TRUE
|
|
|
|
else
|
|
|
|
:
|
|
|
|
ARG_IF_FALSE
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
# FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
|
|
|
|
# IF_FALSE: [RUN-IF-FALSE])
|
|
|
|
# ------------------------------------------------------------
|
|
|
|
# Check that the C++ compiler supports an argument
|
|
|
|
BASIC_DEFUN_NAMED([FLAGS_CXX_COMPILER_CHECK_ARGUMENTS],
|
|
|
|
[*ARGUMENT IF_TRUE IF_FALSE], [$@],
|
|
|
|
[
|
|
|
|
AC_MSG_CHECKING([if the C++ compiler supports "ARG_ARGUMENT"])
|
|
|
|
supports=yes
|
|
|
|
|
2014-02-24 11:16:58 +00:00
|
|
|
saved_cxxflags="$CXXFLAGS"
|
2016-01-14 10:58:32 +00:00
|
|
|
CXXFLAGS="$CXXFLAG ARG_ARGUMENT"
|
2014-02-24 11:16:58 +00:00
|
|
|
AC_LANG_PUSH([C++])
|
2014-06-12 23:33:32 +00:00
|
|
|
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
|
2014-02-24 11:16:58 +00:00
|
|
|
[supports=no])
|
|
|
|
AC_LANG_POP([C++])
|
|
|
|
CXXFLAGS="$saved_cxxflags"
|
|
|
|
|
|
|
|
AC_MSG_RESULT([$supports])
|
|
|
|
if test "x$supports" = "xyes" ; then
|
2016-01-14 10:58:32 +00:00
|
|
|
:
|
|
|
|
ARG_IF_TRUE
|
2014-02-24 11:16:58 +00:00
|
|
|
else
|
2016-01-14 10:58:32 +00:00
|
|
|
:
|
|
|
|
ARG_IF_FALSE
|
2014-02-24 11:16:58 +00:00
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2016-03-19 01:28:49 +00:00
|
|
|
# FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
|
|
|
|
# IF_FALSE: [RUN-IF-FALSE])
|
|
|
|
# ------------------------------------------------------------
|
|
|
|
# Check that the C and C++ compilers support an argument
|
|
|
|
BASIC_DEFUN_NAMED([FLAGS_COMPILER_CHECK_ARGUMENTS],
|
|
|
|
[*ARGUMENT IF_TRUE IF_FALSE], [$@],
|
|
|
|
[
|
|
|
|
FLAGS_C_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARG_ARGUMENT],
|
|
|
|
IF_TRUE: [C_COMP_SUPPORTS="yes"],
|
|
|
|
IF_FALSE: [C_COMP_SUPPORTS="no"])
|
|
|
|
FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARG_ARGUMENT],
|
|
|
|
IF_TRUE: [CXX_COMP_SUPPORTS="yes"],
|
|
|
|
IF_FALSE: [CXX_COMP_SUPPORTS="no"])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([if both compilers support "ARG_ARGUMENT"])
|
|
|
|
supports=no
|
|
|
|
if test "x$C_COMP_SUPPORTS" = "xyes" -a "x$CXX_COMP_SUPPORTS" = "xyes"; then supports=yes; fi
|
2016-11-24 14:32:14 +00:00
|
|
|
|
2016-03-19 01:28:49 +00:00
|
|
|
AC_MSG_RESULT([$supports])
|
|
|
|
if test "x$supports" = "xyes" ; then
|
|
|
|
:
|
|
|
|
ARG_IF_TRUE
|
|
|
|
else
|
|
|
|
:
|
|
|
|
ARG_IF_FALSE
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2016-01-14 10:58:32 +00:00
|
|
|
# FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
|
|
|
|
# IF_FALSE: [RUN-IF-FALSE])
|
2014-06-12 23:33:32 +00:00
|
|
|
# ------------------------------------------------------------
|
|
|
|
# Check that the linker support an argument
|
2016-01-14 10:58:32 +00:00
|
|
|
BASIC_DEFUN_NAMED([FLAGS_LINKER_CHECK_ARGUMENTS],
|
|
|
|
[*ARGUMENT IF_TRUE IF_FALSE], [$@],
|
2014-06-12 23:33:32 +00:00
|
|
|
[
|
2016-01-14 10:58:32 +00:00
|
|
|
AC_MSG_CHECKING([if linker supports "ARG_ARGUMENT"])
|
2014-06-12 23:33:32 +00:00
|
|
|
supports=yes
|
|
|
|
|
|
|
|
saved_ldflags="$LDFLAGS"
|
2016-01-14 10:58:32 +00:00
|
|
|
LDFLAGS="$LDFLAGS ARG_ARGUMENT"
|
2014-06-12 23:33:32 +00:00
|
|
|
AC_LANG_PUSH([C])
|
|
|
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
|
|
|
|
[], [supports=no])
|
|
|
|
AC_LANG_POP([C])
|
|
|
|
LDFLAGS="$saved_ldflags"
|
|
|
|
|
|
|
|
AC_MSG_RESULT([$supports])
|
|
|
|
if test "x$supports" = "xyes" ; then
|
2016-01-14 10:58:32 +00:00
|
|
|
:
|
|
|
|
ARG_IF_TRUE
|
2014-06-12 23:33:32 +00:00
|
|
|
else
|
2016-01-14 10:58:32 +00:00
|
|
|
:
|
|
|
|
ARG_IF_FALSE
|
2014-06-12 23:33:32 +00:00
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2014-02-24 11:16:58 +00:00
|
|
|
AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_MISC],
|
|
|
|
[
|
|
|
|
# Some Zero and Shark settings.
|
|
|
|
# ZERO_ARCHFLAG tells the compiler which mode to build for
|
|
|
|
case "${OPENJDK_TARGET_CPU}" in
|
|
|
|
s390)
|
|
|
|
ZERO_ARCHFLAG="${COMPILER_TARGET_BITS_FLAG}31"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
ZERO_ARCHFLAG="${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
|
|
|
|
esac
|
2016-01-14 10:58:32 +00:00
|
|
|
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$ZERO_ARCHFLAG], IF_FALSE: [ZERO_ARCHFLAG=""])
|
2014-02-24 11:16:58 +00:00
|
|
|
AC_SUBST(ZERO_ARCHFLAG)
|
|
|
|
|
|
|
|
# Check that the compiler supports -mX (or -qX on AIX) flags
|
|
|
|
# Set COMPILER_SUPPORTS_TARGET_BITS_FLAG to 'true' if it does
|
2016-01-14 10:58:32 +00:00
|
|
|
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}],
|
|
|
|
IF_TRUE: [COMPILER_SUPPORTS_TARGET_BITS_FLAG=true],
|
|
|
|
IF_FALSE: [COMPILER_SUPPORTS_TARGET_BITS_FLAG=false])
|
2014-02-24 11:16:58 +00:00
|
|
|
AC_SUBST(COMPILER_SUPPORTS_TARGET_BITS_FLAG)
|
2014-03-21 08:35:43 +00:00
|
|
|
|
2015-05-08 08:37:13 +00:00
|
|
|
AC_ARG_ENABLE([warnings-as-errors], [AS_HELP_STRING([--disable-warnings-as-errors],
|
|
|
|
[do not consider native warnings to be an error @<:@enabled@:>@])])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([if native warnings are errors])
|
|
|
|
if test "x$enable_warnings_as_errors" = "xyes"; then
|
2016-12-02 15:17:52 +00:00
|
|
|
AC_MSG_RESULT([yes (explicitly set)])
|
2015-05-08 08:37:13 +00:00
|
|
|
WARNINGS_AS_ERRORS=true
|
|
|
|
elif test "x$enable_warnings_as_errors" = "xno"; then
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
WARNINGS_AS_ERRORS=false
|
|
|
|
elif test "x$enable_warnings_as_errors" = "x"; then
|
|
|
|
AC_MSG_RESULT([yes (default)])
|
|
|
|
WARNINGS_AS_ERRORS=true
|
|
|
|
else
|
|
|
|
AC_MSG_ERROR([--enable-warnings-as-errors accepts no argument])
|
|
|
|
fi
|
2015-11-05 16:32:57 +00:00
|
|
|
|
|
|
|
if test "x$WARNINGS_AS_ERRORS" = "xfalse"; then
|
|
|
|
# Set legacy hotspot variable
|
2015-11-05 22:25:33 +00:00
|
|
|
HOTSPOT_SET_WARNINGS_AS_ERRORS="WARNINGS_ARE_ERRORS="
|
2015-11-05 16:32:57 +00:00
|
|
|
else
|
2015-11-05 22:25:33 +00:00
|
|
|
HOTSPOT_SET_WARNINGS_AS_ERRORS=""
|
2015-11-05 16:32:57 +00:00
|
|
|
fi
|
|
|
|
|
2015-05-08 08:37:13 +00:00
|
|
|
AC_SUBST(WARNINGS_AS_ERRORS)
|
2015-11-05 16:32:57 +00:00
|
|
|
AC_SUBST(HOTSPOT_SET_WARNINGS_AS_ERRORS)
|
2015-05-08 08:37:13 +00:00
|
|
|
|
2014-03-21 08:35:43 +00:00
|
|
|
case "${TOOLCHAIN_TYPE}" in
|
|
|
|
microsoft)
|
2015-03-09 09:39:16 +00:00
|
|
|
DISABLE_WARNING_PREFIX="-wd"
|
2014-08-19 11:43:40 +00:00
|
|
|
CFLAGS_WARNINGS_ARE_ERRORS="-WX"
|
2014-03-21 08:35:43 +00:00
|
|
|
;;
|
|
|
|
solstudio)
|
2015-03-09 09:39:16 +00:00
|
|
|
DISABLE_WARNING_PREFIX="-erroff="
|
2014-03-21 08:35:43 +00:00
|
|
|
CFLAGS_WARNINGS_ARE_ERRORS="-errtags -errwarn=%all"
|
|
|
|
;;
|
|
|
|
gcc)
|
2015-03-09 09:39:16 +00:00
|
|
|
# Prior to gcc 4.4, a -Wno-X where X is unknown for that version of gcc will cause an error
|
2016-01-14 10:58:32 +00:00
|
|
|
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [-Wno-this-is-a-warning-that-do-not-exist],
|
|
|
|
IF_TRUE: [GCC_CAN_DISABLE_WARNINGS=true],
|
|
|
|
IF_FALSE: [GCC_CAN_DISABLE_WARNINGS=false]
|
2015-03-09 09:39:16 +00:00
|
|
|
)
|
|
|
|
if test "x$GCC_CAN_DISABLE_WARNINGS" = "xtrue"; then
|
|
|
|
DISABLE_WARNING_PREFIX="-Wno-"
|
|
|
|
else
|
|
|
|
DISABLE_WARNING_PREFIX=
|
|
|
|
fi
|
2014-03-21 08:35:43 +00:00
|
|
|
CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
|
2016-05-11 12:48:30 +00:00
|
|
|
# Repeate the check for the BUILD_CC and BUILD_CXX. Need to also reset
|
|
|
|
# CFLAGS since any target specific flags will likely not work with the
|
|
|
|
# build compiler
|
2015-11-24 14:46:04 +00:00
|
|
|
CC_OLD="$CC"
|
2016-05-11 12:48:30 +00:00
|
|
|
CXX_OLD="$CXX"
|
2015-11-24 14:46:04 +00:00
|
|
|
CC="$BUILD_CC"
|
2016-05-11 12:48:30 +00:00
|
|
|
CXX="$BUILD_CXX"
|
|
|
|
CFLAGS_OLD="$CFLAGS"
|
|
|
|
CFLAGS=""
|
2016-01-14 10:58:32 +00:00
|
|
|
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [-Wno-this-is-a-warning-that-do-not-exist],
|
|
|
|
IF_TRUE: [BUILD_CC_CAN_DISABLE_WARNINGS=true],
|
|
|
|
IF_FALSE: [BUILD_CC_CAN_DISABLE_WARNINGS=false]
|
2015-11-24 14:46:04 +00:00
|
|
|
)
|
|
|
|
if test "x$BUILD_CC_CAN_DISABLE_WARNINGS" = "xtrue"; then
|
|
|
|
BUILD_CC_DISABLE_WARNING_PREFIX="-Wno-"
|
|
|
|
else
|
|
|
|
BUILD_CC_DISABLE_WARNING_PREFIX=
|
|
|
|
fi
|
|
|
|
CC="$CC_OLD"
|
2016-05-11 12:48:30 +00:00
|
|
|
CXX="$CXX_OLD"
|
|
|
|
CFLAGS="$CFLAGS_OLD"
|
2014-03-21 08:35:43 +00:00
|
|
|
;;
|
|
|
|
clang)
|
2015-03-09 09:39:16 +00:00
|
|
|
DISABLE_WARNING_PREFIX="-Wno-"
|
2014-03-21 08:35:43 +00:00
|
|
|
CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
|
|
|
|
;;
|
2016-02-12 10:07:35 +00:00
|
|
|
xlc)
|
|
|
|
DISABLE_WARNING_PREFIX="-qsuppress="
|
|
|
|
CFLAGS_WARNINGS_ARE_ERRORS="-qhalt=w"
|
|
|
|
;;
|
2014-03-21 08:35:43 +00:00
|
|
|
esac
|
2015-03-09 09:39:16 +00:00
|
|
|
AC_SUBST(DISABLE_WARNING_PREFIX)
|
2016-03-17 19:03:53 +00:00
|
|
|
AC_SUBST(BUILD_CC_DISABLE_WARNING_PREFIX)
|
2014-03-21 08:35:43 +00:00
|
|
|
AC_SUBST(CFLAGS_WARNINGS_ARE_ERRORS)
|
2014-02-24 11:16:58 +00:00
|
|
|
])
|
2016-03-19 01:28:49 +00:00
|
|
|
|
2016-07-10 21:00:03 +00:00
|
|
|
# FLAGS_SETUP_GCC6_COMPILER_FLAGS([PREFIX])
|
|
|
|
# Arguments:
|
|
|
|
# $1 - Optional prefix for each variable defined.
|
|
|
|
AC_DEFUN([FLAGS_SETUP_GCC6_COMPILER_FLAGS],
|
2016-03-19 01:28:49 +00:00
|
|
|
[
|
|
|
|
# These flags are required for GCC 6 builds as undefined behaviour in OpenJDK code
|
|
|
|
# runs afoul of the more aggressive versions of these optimisations.
|
|
|
|
# Notably, value range propagation now assumes that the this pointer of C++
|
|
|
|
# member functions is non-null.
|
2016-07-10 21:00:03 +00:00
|
|
|
NO_DELETE_NULL_POINTER_CHECKS_CFLAG="-fno-delete-null-pointer-checks"
|
|
|
|
dnl Argument check is disabled until FLAGS_COMPILER_CHECK_ARGUMENTS handles cross-compilation
|
|
|
|
dnl FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_DELETE_NULL_POINTER_CHECKS_CFLAG -Werror],
|
|
|
|
dnl IF_FALSE: [NO_DELETE_NULL_POINTER_CHECKS_CFLAG=""])
|
2016-03-19 01:28:49 +00:00
|
|
|
NO_LIFETIME_DSE_CFLAG="-fno-lifetime-dse"
|
2016-07-10 21:00:03 +00:00
|
|
|
dnl Argument check is disabled until FLAGS_COMPILER_CHECK_ARGUMENTS handles cross-compilation
|
|
|
|
dnl FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_LIFETIME_DSE_CFLAG -Werror],
|
|
|
|
dnl IF_FALSE: [NO_LIFETIME_DSE_CFLAG=""])
|
|
|
|
AC_MSG_NOTICE([GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} and ${NO_LIFETIME_DSE_CFLAG}])
|
|
|
|
$1CFLAGS_JDK="[$]$1CFLAGS_JDK ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
|
|
|
|
$1JVM_CFLAGS="[$]$1JVM_CFLAGS ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
|
2016-03-19 01:28:49 +00:00
|
|
|
])
|