common/autoconf/flags.m4
author duke
Wed, 05 Jul 2017 21:51:42 +0200
changeset 39088 69bb31538c06
parent 38843 2b141e8e916f
child 39194 d56b54bc6437
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     1
#
35451
d0b71f2375d0 8129395: Configure should verify that -fstack-protector is valid - take 2
ihse
parents: 35450
diff changeset
     2
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     4
#
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    10
#
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    15
# accompanied this code).
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    16
#
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    20
#
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    23
# questions.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    24
#
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    25
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    26
# Reset the global CFLAGS/LDFLAGS variables and initialize them with the
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    27
# corresponding configure arguments instead
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    28
AC_DEFUN_ONCE([FLAGS_SETUP_USER_SUPPLIED_FLAGS],
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    29
[
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    30
  if test "x$CFLAGS" != "x${ADDED_CFLAGS}"; then
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    31
    AC_MSG_WARN([Ignoring CFLAGS($CFLAGS) found in environment. Use --with-extra-cflags])
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    32
  fi
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    33
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    34
  if test "x$CXXFLAGS" != "x${ADDED_CXXFLAGS}"; then
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    35
    AC_MSG_WARN([Ignoring CXXFLAGS($CXXFLAGS) found in environment. Use --with-extra-cxxflags])
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    36
  fi
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    37
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    38
  if test "x$LDFLAGS" != "x${ADDED_LDFLAGS}"; then
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    39
    AC_MSG_WARN([Ignoring LDFLAGS($LDFLAGS) found in environment. Use --with-extra-ldflags])
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    40
  fi
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    41
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    42
  AC_ARG_WITH(extra-cflags, [AS_HELP_STRING([--with-extra-cflags],
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    43
      [extra flags to be used when compiling jdk c-files])])
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    44
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    45
  AC_ARG_WITH(extra-cxxflags, [AS_HELP_STRING([--with-extra-cxxflags],
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    46
      [extra flags to be used when compiling jdk c++-files])])
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    47
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    48
  AC_ARG_WITH(extra-ldflags, [AS_HELP_STRING([--with-extra-ldflags],
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    49
      [extra flags to be used when linking jdk])])
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    50
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    51
  EXTRA_CFLAGS="$with_extra_cflags"
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    52
  EXTRA_CXXFLAGS="$with_extra_cxxflags"
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    53
  EXTRA_LDFLAGS="$with_extra_ldflags"
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    54
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    55
  # Hotspot needs these set in their legacy form
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    56
  LEGACY_EXTRA_CFLAGS="$LEGACY_EXTRA_CFLAGS $EXTRA_CFLAGS"
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    57
  LEGACY_EXTRA_CXXFLAGS="$LEGACY_EXTRA_CXXFLAGS $EXTRA_CXXFLAGS"
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    58
  LEGACY_EXTRA_LDFLAGS="$LEGACY_EXTRA_LDFLAGS $EXTRA_LDFLAGS"
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    59
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    60
  AC_SUBST(LEGACY_EXTRA_CFLAGS)
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    61
  AC_SUBST(LEGACY_EXTRA_CXXFLAGS)
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    62
  AC_SUBST(LEGACY_EXTRA_LDFLAGS)
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    63
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
    64
  AC_SUBST(EXTRA_CFLAGS)
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
    65
  AC_SUBST(EXTRA_CXXFLAGS)
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
    66
  AC_SUBST(EXTRA_LDFLAGS)
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
    67
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    68
  # The global CFLAGS and LDLAGS variables are used by configure tests and
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    69
  # should include the extra parameters
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    70
  CFLAGS="$EXTRA_CFLAGS"
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    71
  CXXFLAGS="$EXTRA_CXXFLAGS"
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    72
  LDFLAGS="$EXTRA_LDFLAGS"
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    73
  CPPFLAGS=""
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    74
])
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    75
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    76
# Setup the sysroot flags and add them to global CFLAGS and LDFLAGS so
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    77
# that configure can use them while detecting compilers.
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    78
# TOOLCHAIN_TYPE is available here.
33395
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
    79
# Param 1 - Optional prefix to all variables. (e.g BUILD_)
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
    80
AC_DEFUN([FLAGS_SETUP_SYSROOT_FLAGS],
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    81
[
33395
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
    82
  if test "x[$]$1SYSROOT" != "x"; then
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    83
    if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    84
      if test "x$OPENJDK_TARGET_OS" = xsolaris; then
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    85
        # Solaris Studio does not have a concept of sysroot. Instead we must
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    86
        # make sure the default include and lib dirs are appended to each
35450
0124e2c9ef64 8148929: Suboptimal code generated when setting sysroot include with Solaris Studio
erikj
parents: 35444
diff changeset
    87
        # compile and link command line. Must also add -I-xbuiltin to enable
0124e2c9ef64 8148929: Suboptimal code generated when setting sysroot include with Solaris Studio
erikj
parents: 35444
diff changeset
    88
        # inlining of system functions and intrinsics.
0124e2c9ef64 8148929: Suboptimal code generated when setting sysroot include with Solaris Studio
erikj
parents: 35444
diff changeset
    89
        $1SYSROOT_CFLAGS="-I-xbuiltin -I[$]$1SYSROOT/usr/include"
33395
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
    90
        $1SYSROOT_LDFLAGS="-L[$]$1SYSROOT/usr/lib$OPENJDK_TARGET_CPU_ISADIR \
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
    91
            -L[$]$1SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR \
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
    92
            -L[$]$1SYSROOT/usr/ccs/lib$OPENJDK_TARGET_CPU_ISADIR"
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    93
      fi
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    94
    elif test "x$TOOLCHAIN_TYPE" = xgcc; then
33395
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
    95
      $1SYSROOT_CFLAGS="--sysroot=[$]$1SYSROOT"
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
    96
      $1SYSROOT_LDFLAGS="--sysroot=[$]$1SYSROOT"
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    97
    elif test "x$TOOLCHAIN_TYPE" = xclang; then
33395
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
    98
      $1SYSROOT_CFLAGS="-isysroot [$]$1SYSROOT"
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
    99
      $1SYSROOT_LDFLAGS="-isysroot [$]$1SYSROOT"
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   100
    fi
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   101
    # Propagate the sysroot args to hotspot
33395
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   102
    $1LEGACY_EXTRA_CFLAGS="[$]$1LEGACY_EXTRA_CFLAGS [$]$1SYSROOT_CFLAGS"
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   103
    $1LEGACY_EXTRA_CXXFLAGS="[$]$1LEGACY_EXTRA_CXXFLAGS [$]$1SYSROOT_CFLAGS"
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   104
    $1LEGACY_EXTRA_LDFLAGS="[$]$1LEGACY_EXTRA_LDFLAGS [$]$1SYSROOT_LDFLAGS"
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   105
    # The global CFLAGS and LDFLAGS variables need these for configure to function
33395
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   106
    $1CFLAGS="[$]$1CFLAGS [$]$1SYSROOT_CFLAGS"
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   107
    $1CPPFLAGS="[$]$1CPPFLAGS [$]$1SYSROOT_CFLAGS"
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   108
    $1CXXFLAGS="[$]$1CXXFLAGS [$]$1SYSROOT_CFLAGS"
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   109
    $1LDFLAGS="[$]$1LDFLAGS [$]$1SYSROOT_LDFLAGS"
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   110
  fi
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   111
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   112
  if test "x$OPENJDK_TARGET_OS" = xmacosx; then
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   113
    # We also need -iframework<path>/System/Library/Frameworks
33395
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   114
    $1SYSROOT_CFLAGS="[$]$1SYSROOT_CFLAGS -iframework [$]$1SYSROOT/System/Library/Frameworks"
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   115
    $1SYSROOT_LDFLAGS="[$]$1SYSROOT_LDFLAGS -iframework [$]$1SYSROOT/System/Library/Frameworks"
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   116
    # These always need to be set, or we can't find the frameworks embedded in JavaVM.framework
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   117
    # set this here so it doesn't have to be peppered throughout the forest
33395
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   118
    $1SYSROOT_CFLAGS="[$]$1SYSROOT_CFLAGS -F [$]$1SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks"
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   119
    $1SYSROOT_LDFLAGS="[$]$1SYSROOT_LDFLAGS -F [$]$1SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks"
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   120
  fi
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   121
33395
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   122
  AC_SUBST($1SYSROOT_CFLAGS)
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   123
  AC_SUBST($1SYSROOT_LDFLAGS)
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   124
])
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   125
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   126
AC_DEFUN_ONCE([FLAGS_SETUP_INIT_FLAGS],
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   127
[
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   128
  # COMPILER_TARGET_BITS_FLAG  : option for selecting 32- or 64-bit output
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   129
  # COMPILER_COMMAND_FILE_FLAG : option for passing a command file to the compiler
36051
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   130
  # COMPILER_BINDCMD_FILE_FLAG : option for specifying a file which saves the binder
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   131
  #                              commands produced by the link step (currently AIX only)
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   132
  if test "x$TOOLCHAIN_TYPE" = xxlc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   133
    COMPILER_TARGET_BITS_FLAG="-q"
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   134
    COMPILER_COMMAND_FILE_FLAG="-f"
36051
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   135
    COMPILER_BINDCMD_FILE_FLAG="-bloadmap:"
22458
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   136
  else
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   137
    COMPILER_TARGET_BITS_FLAG="-m"
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   138
    COMPILER_COMMAND_FILE_FLAG="@"
36051
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   139
    COMPILER_BINDCMD_FILE_FLAG=""
34864
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   140
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   141
    # The solstudio linker does not support @-files.
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   142
    if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   143
      COMPILER_COMMAND_FILE_FLAG=
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   144
    fi
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   145
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   146
    # Check if @file is supported by gcc
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   147
    if test "x$TOOLCHAIN_TYPE" = xgcc; then
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   148
      AC_MSG_CHECKING([if @file is supported by gcc])
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   149
      # Extra emtpy "" to prevent ECHO from interpreting '--version' as argument
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   150
      $ECHO "" "--version" > command.file
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   151
      if $CXX @command.file 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD; then
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   152
        AC_MSG_RESULT(yes)
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   153
        COMPILER_COMMAND_FILE_FLAG="@"
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   154
      else
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   155
        AC_MSG_RESULT(no)
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   156
        COMPILER_COMMAND_FILE_FLAG=
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   157
      fi
38843
2b141e8e916f 8158535: Configure script uses basic tools directly in many places
erikj
parents: 37864
diff changeset
   158
      $RM command.file
34864
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   159
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   160
  fi
22467
kvn
parents: 22466 21055
diff changeset
   161
  AC_SUBST(COMPILER_TARGET_BITS_FLAG)
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   162
  AC_SUBST(COMPILER_COMMAND_FILE_FLAG)
36051
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   163
  AC_SUBST(COMPILER_BINDCMD_FILE_FLAG)
22466
25aaf85d1ada 8024265: Enable new build on AIX
simonis
parents: 22465
diff changeset
   164
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   165
  # FIXME: figure out if we should select AR flags depending on OS or toolchain.
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   166
  if test "x$OPENJDK_TARGET_OS" = xmacosx; then
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   167
    ARFLAGS="-r"
22467
kvn
parents: 22466 21055
diff changeset
   168
  elif test "x$OPENJDK_TARGET_OS" = xaix; then
22466
25aaf85d1ada 8024265: Enable new build on AIX
simonis
parents: 22465
diff changeset
   169
    ARFLAGS="-X64"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   170
  elif test "x$OPENJDK_TARGET_OS" = xwindows; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   171
    # lib.exe is used as AR to create static libraries.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   172
    ARFLAGS="-nologo -NODEFAULTLIB:MSVCRT"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   173
  else
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   174
    ARFLAGS=""
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   175
  fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   176
  AC_SUBST(ARFLAGS)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   177
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   178
  ## Setup strip.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   179
  # FIXME: should this really be per platform, or should it be per toolchain type?
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   180
  # strip is not provided by clang or solstudio; so guessing platform makes most sense.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   181
  # FIXME: we should really only export STRIPFLAGS from here, not POST_STRIP_CMD.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   182
  if test "x$OPENJDK_TARGET_OS" = xlinux; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   183
    STRIPFLAGS="-g"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   184
  elif test "x$OPENJDK_TARGET_OS" = xsolaris; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   185
    STRIPFLAGS="-x"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   186
  elif test "x$OPENJDK_TARGET_OS" = xmacosx; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   187
    STRIPFLAGS="-S"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   188
  elif test "x$OPENJDK_TARGET_OS" = xaix; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   189
    STRIPFLAGS="-X32_64"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   190
  fi
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   191
32811
df82db312e58 8135060: Stop building Xcode projects in install build
erikj
parents: 30856
diff changeset
   192
  AC_SUBST(STRIPFLAGS)
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   193
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   194
  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   195
    CC_OUT_OPTION=-Fo
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   196
    EXE_OUT_OPTION=-out:
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   197
    LD_OUT_OPTION=-out:
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   198
    AR_OUT_OPTION=-out:
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   199
  else
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   200
    # The option used to specify the target .o,.a or .so file.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   201
    # When compiling, how to specify the to be created object file.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   202
    CC_OUT_OPTION='-o$(SPACE)'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   203
    # When linking, how to specify the to be created executable.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   204
    EXE_OUT_OPTION='-o$(SPACE)'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   205
    # When linking, how to specify the to be created dynamically linkable library.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   206
    LD_OUT_OPTION='-o$(SPACE)'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   207
    # When archiving, how to specify the to be create static archive for object files.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   208
    AR_OUT_OPTION='rcs$(SPACE)'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   209
  fi
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   210
  AC_SUBST(CC_OUT_OPTION)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   211
  AC_SUBST(EXE_OUT_OPTION)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   212
  AC_SUBST(LD_OUT_OPTION)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   213
  AC_SUBST(AR_OUT_OPTION)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   214
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   215
  # On Windows, we need to set RC flags.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   216
  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
27593
4703225f5be4 8065913: Various improvements in SetupNativeCompilation
ihse
parents: 27586
diff changeset
   217
    RC_FLAGS="-nologo -l0x409"
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   218
    JVM_RCFLAGS="-nologo"
35747
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   219
    if test "x$DEBUG_LEVEL" = xrelease; then
27593
4703225f5be4 8065913: Various improvements in SetupNativeCompilation
ihse
parents: 27586
diff changeset
   220
      RC_FLAGS="$RC_FLAGS -DNDEBUG"
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   221
      JVM_RCFLAGS="$JVM_RCFLAGS -DNDEBUG"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   222
    fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   223
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   224
    # The version variables used to create RC_FLAGS may be overridden
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   225
    # in a custom configure script, or possibly the command line.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   226
    # Let those variables be expanded at make time in spec.gmk.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   227
    # The \$ are escaped to the shell, and the $(...) variables
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   228
    # are evaluated by make.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   229
    RC_FLAGS="$RC_FLAGS \
33926
3a19edba4808 8085822: JEP 223: New Version-String Scheme (initial integration)
ihse
parents: 30740
diff changeset
   230
        -D\"JDK_VERSION_STRING=\$(VERSION_STRING)\" \
27593
4703225f5be4 8065913: Various improvements in SetupNativeCompilation
ihse
parents: 27586
diff changeset
   231
        -D\"JDK_COMPANY=\$(COMPANY_NAME)\" \
4703225f5be4 8065913: Various improvements in SetupNativeCompilation
ihse
parents: 27586
diff changeset
   232
        -D\"JDK_COMPONENT=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) binary\" \
33941
c112bac36e88 8135083: Product version string for DLLs and EXEs should not include trailing zeros
dtitov
parents: 33927
diff changeset
   233
        -D\"JDK_VER=\$(VERSION_NUMBER)\" \
27593
4703225f5be4 8065913: Various improvements in SetupNativeCompilation
ihse
parents: 27586
diff changeset
   234
        -D\"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \
33926
3a19edba4808 8085822: JEP 223: New Version-String Scheme (initial integration)
ihse
parents: 30740
diff changeset
   235
        -D\"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(VERSION_MAJOR)\" \
3a19edba4808 8085822: JEP 223: New Version-String Scheme (initial integration)
ihse
parents: 30740
diff changeset
   236
        -D\"JDK_FVER=\$(subst .,\$(COMMA),\$(VERSION_NUMBER_FOUR_POSITIONS))\""
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   237
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   238
    JVM_RCFLAGS="$JVM_RCFLAGS \
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   239
        -D\"HS_BUILD_ID=\$(VERSION_STRING)\" \
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   240
        -D\"HS_COMPANY=\$(COMPANY_NAME)\" \
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   241
        -D\"JDK_DOTVER=\$(VERSION_NUMBER_FOUR_POSITIONS)\" \
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   242
        -D\"HS_COPYRIGHT=Copyright $COPYRIGHT_YEAR\" \
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   243
        -D\"HS_NAME=\$(PRODUCT_NAME) \$(VERSION_SHORT)\" \
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   244
        -D\"JDK_VER=\$(subst .,\$(COMMA),\$(VERSION_NUMBER_FOUR_POSITIONS))\" \
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   245
        -D\"HS_FNAME=jvm.dll\" \
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   246
        -D\"HS_INTERNAL_NAME=jvm\""
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   247
  fi
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   248
  AC_SUBST(RC_FLAGS)
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   249
  AC_SUBST(JVM_RCFLAGS)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   250
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   251
  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   252
    # silence copyright notice and other headers.
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   253
    COMMON_CCXXFLAGS="$COMMON_CCXXFLAGS -nologo"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   254
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   255
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   256
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   257
AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_LIBS],
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   258
[
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   259
  ###############################################################################
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   260
  #
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   261
  # How to compile shared libraries.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   262
  #
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   263
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   264
  if test "x$TOOLCHAIN_TYPE" = xgcc; then
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   265
    PICFLAG="-fPIC"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   266
    C_FLAG_REORDER=''
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   267
    CXX_FLAG_REORDER=''
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   268
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   269
    if test "x$OPENJDK_TARGET_OS" = xmacosx; then
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   270
      # Linking is different on MacOSX
33562
c76b2fa11486 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 32813
diff changeset
   271
      if test "x$STATIC_BUILD" = xtrue; then
c76b2fa11486 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 32813
diff changeset
   272
        SHARED_LIBRARY_FLAGS ='-undefined dynamic_lookup'
c76b2fa11486 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 32813
diff changeset
   273
      else
c76b2fa11486 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 32813
diff changeset
   274
        SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG"
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   275
        JVM_CFLAGS="$JVM_CFLAGS $PICFLAG"
33562
c76b2fa11486 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 32813
diff changeset
   276
      fi
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   277
      SET_EXECUTABLE_ORIGIN='-Wl,-rpath,@loader_path/.'
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   278
      SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   279
      SET_SHARED_LIBRARY_NAME='-Wl,-install_name,@rpath/[$]1'
35747
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   280
      SET_SHARED_LIBRARY_MAPFILE='-Wl,-exported_symbols_list,[$]1'
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   281
    else
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   282
      # Default works for linux, might work on other platforms as well.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   283
      SHARED_LIBRARY_FLAGS='-shared'
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   284
      SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$$$ORIGIN[$]1'
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   285
      SET_SHARED_LIBRARY_ORIGIN="-Wl,-z,origin $SET_EXECUTABLE_ORIGIN"
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   286
      SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   287
      SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=[$]1'
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   288
    fi
23161
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   289
  elif test "x$TOOLCHAIN_TYPE" = xclang; then
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   290
    C_FLAG_REORDER=''
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   291
    CXX_FLAG_REORDER=''
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   292
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   293
    if test "x$OPENJDK_TARGET_OS" = xmacosx; then
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   294
      # Linking is different on MacOSX
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   295
      PICFLAG=''
23161
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   296
      SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG"
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   297
      SET_EXECUTABLE_ORIGIN='-Wl,-rpath,@loader_path/.'
23161
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   298
      SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   299
      SET_SHARED_LIBRARY_NAME='-Wl,-install_name,@rpath/[$]1'
35747
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   300
      SET_SHARED_LIBRARY_MAPFILE='-Wl,-exported_symbols_list,[$]1'
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   301
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   302
      if test "x$STATIC_BUILD" = xfalse; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   303
        JVM_CFLAGS="$JVM_CFLAGS -fPIC"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   304
      fi
23161
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   305
    else
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   306
      # Default works for linux, might work on other platforms as well.
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   307
      PICFLAG='-fPIC'
23161
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   308
      SHARED_LIBRARY_FLAGS='-shared'
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   309
      SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$$$ORIGIN[$]1'
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   310
      SET_SHARED_LIBRARY_ORIGIN="-Wl,-z,origin $SET_EXECUTABLE_ORIGIN"
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   311
      SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   312
      SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=[$]1'
23161
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   313
    fi
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   314
  elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   315
    PICFLAG="-KPIC"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   316
    C_FLAG_REORDER='-xF'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   317
    CXX_FLAG_REORDER='-xF'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   318
    SHARED_LIBRARY_FLAGS="-G"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   319
    SET_EXECUTABLE_ORIGIN='-R\$$$$ORIGIN[$]1'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   320
    SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   321
    SET_SHARED_LIBRARY_NAME='-h [$]1'
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   322
    SET_SHARED_LIBRARY_MAPFILE='-M[$]1'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   323
  elif test "x$TOOLCHAIN_TYPE" = xxlc; then
36051
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   324
    # '-qpic' defaults to 'qpic=small'. This means that the compiler generates only
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   325
    # one instruction for accessing the TOC. If the TOC grows larger than 64K, the linker
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   326
    # will have to patch this single instruction with a call to some out-of-order code which
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   327
    # does the load from the TOC. This is of course slow. But in that case we also would have
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   328
    # to use '-bbigtoc' for linking anyway so we could also change the PICFLAG to 'qpic=large'.
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   329
    # With 'qpic=large' the compiler will by default generate a two-instruction sequence which
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   330
    # can be patched directly by the linker and does not require a jump to out-of-order code.
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   331
    # Another alternative instead of using 'qpic=large -bbigtoc' may be to use '-qminimaltoc'
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   332
    # instead. This creates a distinct TOC for every compilation unit (and thus requires two
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   333
    # loads for accessing a global variable). But there are rumors that this may be seen as a
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   334
    # 'performance feature' because of improved code locality of the symbols used in a
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   335
    # compilation unit.
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   336
    PICFLAG="-qpic"
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   337
    JVM_CFLAGS="$JVM_CFLAGS $PICFLAG"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   338
    C_FLAG_REORDER=''
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   339
    CXX_FLAG_REORDER=''
36051
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   340
    SHARED_LIBRARY_FLAGS="-qmkshrobj -bM:SRE -bnoentry"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   341
    SET_EXECUTABLE_ORIGIN=""
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   342
    SET_SHARED_LIBRARY_ORIGIN=''
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   343
    SET_SHARED_LIBRARY_NAME=''
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   344
    SET_SHARED_LIBRARY_MAPFILE=''
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   345
  elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   346
    PICFLAG=""
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   347
    C_FLAG_REORDER=''
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   348
    CXX_FLAG_REORDER=''
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   349
    SHARED_LIBRARY_FLAGS="-dll"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   350
    SET_EXECUTABLE_ORIGIN=''
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   351
    SET_SHARED_LIBRARY_ORIGIN=''
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   352
    SET_SHARED_LIBRARY_NAME=''
35747
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   353
    SET_SHARED_LIBRARY_MAPFILE='-def:[$]1'
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   354
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   355
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   356
  AC_SUBST(C_FLAG_REORDER)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   357
  AC_SUBST(CXX_FLAG_REORDER)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   358
  AC_SUBST(SET_EXECUTABLE_ORIGIN)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   359
  AC_SUBST(SET_SHARED_LIBRARY_ORIGIN)
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   360
  AC_SUBST(SET_SHARED_LIBRARY_NAME)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   361
  AC_SUBST(SET_SHARED_LIBRARY_MAPFILE)
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   362
  AC_SUBST(SHARED_LIBRARY_FLAGS)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   363
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   364
  # The (cross) compiler is now configured, we can now test capabilities
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   365
  # of the target platform.
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   366
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   367
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   368
# Documentation on common flags used for solstudio in HIGHEST.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   369
#
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   370
# WARNING: Use of OPTIMIZATION_LEVEL=HIGHEST in your Makefile needs to be
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   371
#          done with care, there are some assumptions below that need to
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   372
#          be understood about the use of pointers, and IEEE behavior.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   373
#
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   374
# -fns: Use non-standard floating point mode (not IEEE 754)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   375
# -fsimple: Do some simplification of floating point arithmetic (not IEEE 754)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   376
# -fsingle: Use single precision floating point with 'float'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   377
# -xalias_level=basic: Assume memory references via basic pointer types do not alias
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   378
#   (Source with excessing pointer casting and data access with mixed
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   379
#    pointer types are not recommended)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   380
# -xbuiltin=%all: Use intrinsic or inline versions for math/std functions
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   381
#   (If you expect perfect errno behavior, do not use this)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   382
# -xdepend: Loop data dependency optimizations (need -xO3 or higher)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   383
# -xrestrict: Pointer parameters to functions do not overlap
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   384
#   (Similar to -xalias_level=basic usage, but less obvious sometimes.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   385
#    If you pass in multiple pointers to the same data, do not use this)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   386
# -xlibmil: Inline some library routines
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   387
#   (If you expect perfect errno behavior, do not use this)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   388
# -xlibmopt: Use optimized math routines (CURRENTLY DISABLED)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   389
#   (If you expect perfect errno behavior, do not use this)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   390
#  Can cause undefined external on Solaris 8 X86 on __sincos, removing for now
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   391
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   392
    # FIXME: this will never happen since sparc != sparcv9, ie 32 bit, which we don't build anymore.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   393
    # Bug?
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   394
    #if test "x$OPENJDK_TARGET_CPU" = xsparc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   395
    #  CFLAGS_JDK="${CFLAGS_JDK} -xmemalign=4s"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   396
    #  CXXFLAGS_JDK="${CXXFLAGS_JDK} -xmemalign=4s"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   397
    #fi
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   398
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   399
AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_OPTIMIZATION],
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   400
[
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   401
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   402
  ###############################################################################
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   403
  #
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   404
  # Setup the opt flags for different compilers
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   405
  # and different operating systems.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   406
  #
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   407
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   408
  # FIXME: this was indirectly the old default, but just inherited.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   409
  # if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   410
  #   C_FLAG_DEPS="-MMD -MF"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   411
  # fi
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   412
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   413
  # Generate make dependency files
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   414
  if test "x$TOOLCHAIN_TYPE" = xgcc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   415
    C_FLAG_DEPS="-MMD -MF"
23161
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   416
  elif test "x$TOOLCHAIN_TYPE" = xclang; then
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   417
    C_FLAG_DEPS="-MMD -MF"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   418
  elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   419
    C_FLAG_DEPS="-xMMD -xMF"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   420
  elif test "x$TOOLCHAIN_TYPE" = xxlc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   421
    C_FLAG_DEPS="-qmakedep=gcc -MF"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   422
  fi
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   423
  CXX_FLAG_DEPS="$C_FLAG_DEPS"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   424
  AC_SUBST(C_FLAG_DEPS)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   425
  AC_SUBST(CXX_FLAG_DEPS)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   426
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   427
  # Debug symbols
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   428
  if test "x$TOOLCHAIN_TYPE" = xgcc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   429
    if test "x$OPENJDK_TARGET_CPU_BITS" = "x64" && test "x$DEBUG_LEVEL" = "xfastdebug"; then
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   430
      # reduce from default "-g2" option to save space
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   431
      CFLAGS_DEBUG_SYMBOLS="-g1"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   432
      CXXFLAGS_DEBUG_SYMBOLS="-g1"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   433
    else
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   434
      CFLAGS_DEBUG_SYMBOLS="-g"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   435
      CXXFLAGS_DEBUG_SYMBOLS="-g"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   436
    fi
23161
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   437
  elif test "x$TOOLCHAIN_TYPE" = xclang; then
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   438
    CFLAGS_DEBUG_SYMBOLS="-g"
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   439
    CXXFLAGS_DEBUG_SYMBOLS="-g"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   440
  elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   441
    CFLAGS_DEBUG_SYMBOLS="-g -xs"
35032
c2f315819691 8145596: Enable debug symbols for all libraries
ihse
parents: 35029
diff changeset
   442
    # -g0 enables debug symbols without disabling inlining.
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   443
    CXXFLAGS_DEBUG_SYMBOLS="-g0 -xs"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   444
  elif test "x$TOOLCHAIN_TYPE" = xxlc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   445
    CFLAGS_DEBUG_SYMBOLS="-g"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   446
    CXXFLAGS_DEBUG_SYMBOLS="-g"
36531
ef4e1ca50af8 8151619: genSocketOptionRegistry.exe always relinked on Windows
erikj
parents: 36051
diff changeset
   447
  elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
ef4e1ca50af8 8151619: genSocketOptionRegistry.exe always relinked on Windows
erikj
parents: 36051
diff changeset
   448
    CFLAGS_DEBUG_SYMBOLS="-Zi"
ef4e1ca50af8 8151619: genSocketOptionRegistry.exe always relinked on Windows
erikj
parents: 36051
diff changeset
   449
    CXXFLAGS_DEBUG_SYMBOLS="-Zi"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   450
  fi
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   451
  AC_SUBST(CFLAGS_DEBUG_SYMBOLS)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   452
  AC_SUBST(CXXFLAGS_DEBUG_SYMBOLS)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   453
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   454
  # Debug symbols for JVM_CFLAGS
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   455
  if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   456
    JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -xs"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   457
    if test "x$DEBUG_LEVEL" = xslowdebug; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   458
      JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -g"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   459
    else
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   460
      # -g0 does not disable inlining, which -g does.
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   461
      JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -g0"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   462
    fi
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   463
  elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   464
    JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -Z7 -d2Zi+"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   465
  else
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   466
    JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -g"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   467
  fi
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   468
  AC_SUBST(JVM_CFLAGS_SYMBOLS)
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   469
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   470
  # bounds, memory and behavior checking options
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   471
  if test "x$TOOLCHAIN_TYPE" = xgcc; then
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   472
    case $DEBUG_LEVEL in
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   473
    release )
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   474
      # no adjustment
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   475
      ;;
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   476
    fastdebug )
26123
44827e1a7a7b 8047952: Remove FORTIFY_SOURCE from fastdebug and slowdebug builds
mduigou
parents: 25459
diff changeset
   477
      # no adjustment
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   478
      ;;
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   479
    slowdebug )
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   480
      # FIXME: By adding this to C(XX)FLAGS_DEBUG_OPTIONS/JVM_CFLAGS_SYMBOLS it
35747
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   481
      # get's added conditionally on whether we produce debug symbols or not.
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   482
      # This is most likely not really correct.
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   483
30856
09b01c98ca8d 8081692: Configure should verify that -fstack-protector is valid
ihse
parents: 30740
diff changeset
   484
      # Add runtime stack smashing and undefined behavior checks.
09b01c98ca8d 8081692: Configure should verify that -fstack-protector is valid
ihse
parents: 30740
diff changeset
   485
      # Not all versions of gcc support -fstack-protector
09b01c98ca8d 8081692: Configure should verify that -fstack-protector is valid
ihse
parents: 30740
diff changeset
   486
      STACK_PROTECTOR_CFLAG="-fstack-protector-all"
35451
d0b71f2375d0 8129395: Configure should verify that -fstack-protector is valid - take 2
ihse
parents: 35450
diff changeset
   487
      FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$STACK_PROTECTOR_CFLAG -Werror], IF_FALSE: [STACK_PROTECTOR_CFLAG=""])
30856
09b01c98ca8d 8081692: Configure should verify that -fstack-protector is valid
ihse
parents: 30740
diff changeset
   488
09b01c98ca8d 8081692: Configure should verify that -fstack-protector is valid
ihse
parents: 30740
diff changeset
   489
      CFLAGS_DEBUG_OPTIONS="$STACK_PROTECTOR_CFLAG --param ssp-buffer-size=1"
09b01c98ca8d 8081692: Configure should verify that -fstack-protector is valid
ihse
parents: 30740
diff changeset
   490
      CXXFLAGS_DEBUG_OPTIONS="$STACK_PROTECTOR_CFLAG --param ssp-buffer-size=1"
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   491
      if test "x$STACK_PROTECTOR_CFLAG" != x; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   492
        JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS $STACK_PROTECTOR_CFLAG --param ssp-buffer-size=1"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   493
      fi
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   494
      ;;
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   495
    esac
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   496
  fi
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   497
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   498
  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   499
    if test "x$DEBUG_LEVEL" != xrelease; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   500
      if test "x$OPENJDK_TARGET_CPU" = xx86_64; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   501
        JVM_CFLAGS="$JVM_CFLAGS -homeparams"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   502
      fi
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   503
    fi
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   504
  fi
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   505
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   506
  # Optimization levels
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   507
  if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
22730
c6ac76f2c90c 8019729: JDK build HIGHEST compiler optimisation setting isn't valid for Sun C++ compiler
erikj
parents: 22721
diff changeset
   508
    CC_HIGHEST="$CC_HIGHEST -fns -fsimple -fsingle -xbuiltin=%all -xdepend -xrestrict -xlibmil"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   509
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   510
    if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86"; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   511
      # FIXME: seems we always set -xregs=no%frameptr; put it elsewhere more global?
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   512
      C_O_FLAG_HIGHEST_JVM="-xO4"
22730
c6ac76f2c90c 8019729: JDK build HIGHEST compiler optimisation setting isn't valid for Sun C++ compiler
erikj
parents: 22721
diff changeset
   513
      C_O_FLAG_HIGHEST="-xO4 -Wu,-O4~yz $CC_HIGHEST -xalias_level=basic -xregs=no%frameptr"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   514
      C_O_FLAG_HI="-xO4 -Wu,-O4~yz -xregs=no%frameptr"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   515
      C_O_FLAG_NORM="-xO2 -Wu,-O2~yz -xregs=no%frameptr"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   516
      C_O_FLAG_DEBUG="-xregs=no%frameptr"
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   517
      C_O_FLAG_DEBUG_JVM=""
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   518
      C_O_FLAG_NONE="-xregs=no%frameptr"
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   519
      CXX_O_FLAG_HIGHEST_JVM="-xO4"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   520
      CXX_O_FLAG_HIGHEST="-xO4 -Qoption ube -O4~yz $CC_HIGHEST -xregs=no%frameptr"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   521
      CXX_O_FLAG_HI="-xO4 -Qoption ube -O4~yz -xregs=no%frameptr"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   522
      CXX_O_FLAG_NORM="-xO2 -Qoption ube -O2~yz -xregs=no%frameptr"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   523
      CXX_O_FLAG_DEBUG="-xregs=no%frameptr"
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   524
      CXX_O_FLAG_DEBUG_JVM=""
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   525
      CXX_O_FLAG_NONE="-xregs=no%frameptr"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   526
      if test "x$OPENJDK_TARGET_CPU_BITS" = "x32"; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   527
        C_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST -xchip=pentium"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   528
        CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_HIGHEST -xchip=pentium"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   529
      fi
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   530
    elif test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   531
      C_O_FLAG_HIGHEST_JVM="-xO4"
22730
c6ac76f2c90c 8019729: JDK build HIGHEST compiler optimisation setting isn't valid for Sun C++ compiler
erikj
parents: 22721
diff changeset
   532
      C_O_FLAG_HIGHEST="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0 $CC_HIGHEST -xalias_level=basic -xprefetch=auto,explicit -xchip=ultra"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   533
      C_O_FLAG_HI="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   534
      C_O_FLAG_NORM="-xO2 -Wc,-Qrm-s -Wc,-Qiselect-T0"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   535
      C_O_FLAG_DEBUG=""
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   536
      C_O_FLAG_DEBUG_JVM=""
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   537
      C_O_FLAG_NONE=""
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   538
      CXX_O_FLAG_HIGHEST_JVM="-xO4"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   539
      CXX_O_FLAG_HIGHEST="-xO4 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0 $CC_HIGHEST -xprefetch=auto,explicit -xchip=ultra"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   540
      CXX_O_FLAG_HI="-xO4 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   541
      CXX_O_FLAG_NORM="-xO2 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0"
35747
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   542
      CXX_O_FLAG_DEBUG=""
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   543
      CXX_O_FLAG_DEBUG_JVM=""
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   544
      CXX_O_FLAG_NONE=""
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   545
    fi
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   546
  else
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   547
    # The remaining toolchains share opt flags between CC and CXX;
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   548
    # setup for C and duplicate afterwards.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   549
    if test "x$TOOLCHAIN_TYPE" = xgcc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   550
      if test "x$OPENJDK_TARGET_OS" = xmacosx; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   551
        # On MacOSX we optimize for size, something
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   552
        # we should do for all platforms?
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   553
        C_O_FLAG_HIGHEST_JVM="-Os"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   554
        C_O_FLAG_HIGHEST="-Os"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   555
        C_O_FLAG_HI="-Os"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   556
        C_O_FLAG_NORM="-Os"
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   557
        C_O_FLAG_SIZE="-Os"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   558
      else
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   559
        C_O_FLAG_HIGHEST_JVM="-O3"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   560
        C_O_FLAG_HIGHEST="-O3"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   561
        C_O_FLAG_HI="-O3"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   562
        C_O_FLAG_NORM="-O2"
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   563
        C_O_FLAG_SIZE="-Os"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   564
      fi
25459
30ba61626044 8047734: Backout use of -Og
mduigou
parents: 25034
diff changeset
   565
      C_O_FLAG_DEBUG="-O0"
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   566
      if test "x$OPENJDK_TARGET_OS" = xmacosx; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   567
        C_O_FLAG_DEBUG_JVM=""
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   568
      elif test "x$OPENJDK_TARGET_OS" = xlinux; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   569
        C_O_FLAG_DEBUG_JVM="-O0"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   570
      fi
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   571
      C_O_FLAG_NONE="-O0"
23161
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   572
    elif test "x$TOOLCHAIN_TYPE" = xclang; then
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   573
      if test "x$OPENJDK_TARGET_OS" = xmacosx; then
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   574
        # On MacOSX we optimize for size, something
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   575
        # we should do for all platforms?
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   576
        C_O_FLAG_HIGHEST_JVM="-Os"
23161
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   577
        C_O_FLAG_HIGHEST="-Os"
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   578
        C_O_FLAG_HI="-Os"
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   579
        C_O_FLAG_NORM="-Os"
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   580
        C_O_FLAG_SIZE="-Os"
23161
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   581
      else
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   582
        C_O_FLAG_HIGHEST_JVM="-O3"
23161
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   583
        C_O_FLAG_HIGHEST="-O3"
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   584
        C_O_FLAG_HI="-O3"
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   585
        C_O_FLAG_NORM="-O2"
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   586
        C_O_FLAG_SIZE="-Os"
23161
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   587
      fi
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   588
      C_O_FLAG_DEBUG="-O0"
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   589
      if test "x$OPENJDK_TARGET_OS" = xmacosx; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   590
        C_O_FLAG_DEBUG_JVM=""
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   591
      elif test "x$OPENJDK_TARGET_OS" = xlinux; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   592
        C_O_FLAG_DEBUG_JVM="-O0"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   593
      fi
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   594
      C_O_FLAG_NONE="-O0"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   595
    elif test "x$TOOLCHAIN_TYPE" = xxlc; then
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   596
      C_O_FLAG_HIGHEST_JVM="-O3"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   597
      C_O_FLAG_HIGHEST="-O3"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   598
      C_O_FLAG_HI="-O3 -qstrict"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   599
      C_O_FLAG_NORM="-O2"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   600
      C_O_FLAG_DEBUG="-qnoopt"
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   601
      # FIXME: Value below not verified.
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   602
      C_O_FLAG_DEBUG_JVM=""
35020
8a7f717c3bc2 8145427: [aix] xlc: wrong flag used to switch off optimization
stuefe
parents: 34120
diff changeset
   603
      C_O_FLAG_NONE="-qnoopt"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   604
    elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   605
      C_O_FLAG_HIGHEST_JVM="-O2 -Oy-"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   606
      C_O_FLAG_HIGHEST="-O2"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   607
      C_O_FLAG_HI="-O1"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   608
      C_O_FLAG_NORM="-O1"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   609
      C_O_FLAG_DEBUG="-Od"
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   610
      C_O_FLAG_DEBUG_JVM=""
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   611
      C_O_FLAG_NONE="-Od"
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   612
      C_O_FLAG_SIZE="-Os"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   613
    fi
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   614
    CXX_O_FLAG_HIGHEST_JVM="$C_O_FLAG_HIGHEST_JVM"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   615
    CXX_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   616
    CXX_O_FLAG_HI="$C_O_FLAG_HI"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   617
    CXX_O_FLAG_NORM="$C_O_FLAG_NORM"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   618
    CXX_O_FLAG_DEBUG="$C_O_FLAG_DEBUG"
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   619
    CXX_O_FLAG_DEBUG_JVM="$C_O_FLAG_DEBUG_JVM"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   620
    CXX_O_FLAG_NONE="$C_O_FLAG_NONE"
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   621
    CXX_O_FLAG_SIZE="$C_O_FLAG_SIZE"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   622
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   623
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   624
  # Adjust optimization flags according to debug level.
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   625
  case $DEBUG_LEVEL in
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   626
    release )
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   627
      # no adjustment
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   628
      ;;
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   629
    fastdebug )
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   630
      # Not quite so much optimization
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   631
      C_O_FLAG_HI="$C_O_FLAG_NORM"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   632
      CXX_O_FLAG_HI="$CXX_O_FLAG_NORM"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   633
      ;;
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   634
    slowdebug )
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   635
      # Disable optimization
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   636
      C_O_FLAG_HIGHEST_JVM="$C_O_FLAG_DEBUG_JVM"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   637
      C_O_FLAG_HIGHEST="$C_O_FLAG_DEBUG"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   638
      C_O_FLAG_HI="$C_O_FLAG_DEBUG"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   639
      C_O_FLAG_NORM="$C_O_FLAG_DEBUG"
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   640
      C_O_FLAG_SIZE="$C_O_FLAG_DEBUG"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   641
      CXX_O_FLAG_HIGHEST_JVM="$CXX_O_FLAG_DEBUG_JVM"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   642
      CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_DEBUG"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   643
      CXX_O_FLAG_HI="$CXX_O_FLAG_DEBUG"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   644
      CXX_O_FLAG_NORM="$CXX_O_FLAG_DEBUG"
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   645
      CXX_O_FLAG_SIZE="$CXX_O_FLAG_DEBUG"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   646
      ;;
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   647
  esac
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   648
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   649
  AC_SUBST(C_O_FLAG_HIGHEST_JVM)
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   650
  AC_SUBST(C_O_FLAG_HIGHEST)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   651
  AC_SUBST(C_O_FLAG_HI)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   652
  AC_SUBST(C_O_FLAG_NORM)
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   653
  AC_SUBST(C_O_FLAG_DEBUG)
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   654
  AC_SUBST(C_O_FLAG_NONE)
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   655
  AC_SUBST(C_O_FLAG_SIZE)
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   656
  AC_SUBST(CXX_O_FLAG_HIGHEST_JVM)
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   657
  AC_SUBST(CXX_O_FLAG_HIGHEST)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   658
  AC_SUBST(CXX_O_FLAG_HI)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   659
  AC_SUBST(CXX_O_FLAG_NORM)
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   660
  AC_SUBST(CXX_O_FLAG_DEBUG)
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   661
  AC_SUBST(CXX_O_FLAG_NONE)
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   662
  AC_SUBST(CXX_O_FLAG_SIZE)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   663
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   664
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   665
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   666
AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK],
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   667
[
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   668
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   669
  FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER([TARGET])
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   670
  FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER([BUILD], [OPENJDK_BUILD_])
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   671
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   672
  # Tests are only ever compiled for TARGET
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   673
  # Flags for compiling test libraries
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   674
  CFLAGS_TESTLIB="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   675
  CXXFLAGS_TESTLIB="$COMMON_CCXXFLAGS_JDK $CXXFLAGS_JDK $PICFLAG $CXXFLAGS_JDKLIB_EXTRA"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   676
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   677
  # Flags for compiling test executables
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   678
  CFLAGS_TESTEXE="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   679
  CXXFLAGS_TESTEXE="$COMMON_CCXXFLAGS_JDK $CXXFLAGS_JDK"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   680
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   681
  AC_SUBST(CFLAGS_TESTLIB)
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   682
  AC_SUBST(CFLAGS_TESTEXE)
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   683
  AC_SUBST(CXXFLAGS_TESTLIB)
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   684
  AC_SUBST(CXXFLAGS_TESTEXE)
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   685
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   686
  LDFLAGS_TESTLIB="$LDFLAGS_JDKLIB"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   687
  LDFLAGS_TESTEXE="$LDFLAGS_JDKEXE"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   688
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   689
  AC_SUBST(LDFLAGS_TESTLIB)
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   690
  AC_SUBST(LDFLAGS_TESTEXE)
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   691
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   692
])
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   693
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   694
################################################################################
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   695
# $1 - Either BUILD or TARGET to pick the correct OS/CPU variables to check
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   696
#      conditionals against.
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   697
# $2 - Optional prefix for each variable defined.
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   698
AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER],
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   699
[
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   700
  # Special extras...
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   701
  if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   702
    if test "x$OPENJDK_$1_CPU_ARCH" = "xsparc"; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   703
      $2CFLAGS_JDKLIB_EXTRA="${$2CFLAGS_JDKLIB_EXTRA} -xregs=no%appl"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   704
      $2CXXFLAGS_JDKLIB_EXTRA="${$2CXXFLAGS_JDKLIB_EXTRA} -xregs=no%appl"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   705
    fi
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   706
    $2CFLAGS_JDKLIB_EXTRA="${$2CFLAGS_JDKLIB_EXTRA} -errtags=yes -errfmt"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   707
    $2CXXFLAGS_JDKLIB_EXTRA="${$2CXXFLAGS_JDKLIB_EXTRA} -errtags=yes -errfmt"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   708
  elif test "x$TOOLCHAIN_TYPE" = xxlc; then
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   709
    $2CFLAGS_JDK="${$2CFLAGS_JDK} -qchars=signed -qfullpath -qsaveopt"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   710
    $2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} -qchars=signed -qfullpath -qsaveopt"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   711
  elif test "x$TOOLCHAIN_TYPE" = xgcc; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   712
    $2CXXSTD_CXXFLAG="-std=gnu++98"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   713
    FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [[$]$2CXXSTD_CXXFLAG -Werror],
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   714
    						 IF_FALSE: [$2CXXSTD_CXXFLAG=""])
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   715
    $2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} ${$2CXXSTD_CXXFLAG}"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   716
    AC_SUBST([$2CXXSTD_CXXFLAG])
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   717
  fi
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   718
  if test "x$OPENJDK_TARGET_OS" = xsolaris; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   719
    $2CFLAGS_JDK="${$2CFLAGS_JDK} -D__solaris__"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   720
    $2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} -D__solaris__"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   721
    $2CFLAGS_JDKLIB_EXTRA='-xstrconst'
29451
443fdcba9598 8075515: AIX: cleanup xlc options and use -bernotok to detect missing symbols at build time
simonis
parents: 29305
diff changeset
   722
    CFLAGS_JDK="${CFLAGS_JDK} -qchars=signed -qfullpath -qsaveopt"
443fdcba9598 8075515: AIX: cleanup xlc options and use -bernotok to detect missing symbols at build time
simonis
parents: 29305
diff changeset
   723
    CXXFLAGS_JDK="${CXXFLAGS_JDK} -qchars=signed -qfullpath -qsaveopt"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   724
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   725
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   726
  if test "x$OPENJDK_TARGET_OS" = xsolaris; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   727
    $2CFLAGS_JDK="${$2CFLAGS_JDK} -D__solaris__"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   728
    $2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} -D__solaris__"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   729
    $2CFLAGS_JDKLIB_EXTRA='-xstrconst'
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   730
  fi
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   731
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   732
  $2CFLAGS_JDK="${$2CFLAGS_JDK} ${$2EXTRA_CFLAGS}"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   733
  $2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} ${$2EXTRA_CXXFLAGS}"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   734
  $2LDFLAGS_JDK="${$2LDFLAGS_JDK} ${$2EXTRA_LDFLAGS}"
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   735
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   736
  ###############################################################################
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   737
  #
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   738
  # Now setup the CFLAGS and LDFLAGS for the JDK build.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   739
  # Later we will also have CFLAGS and LDFLAGS for the hotspot subrepo build.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   740
  #
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   741
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   742
  # Setup compiler/platform specific flags into
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   743
  #    $2CFLAGS_JDK    - C Compiler flags
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   744
  #    $2CXXFLAGS_JDK  - C++ Compiler flags
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   745
  #    $2COMMON_CCXXFLAGS_JDK - common to C and C++
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   746
  if test "x$TOOLCHAIN_TYPE" = xgcc; then
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   747
    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_GNU_SOURCE"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   748
    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_REENTRANT"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   749
    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -fcheck-new"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   750
    if test "x$OPENJDK_$1_CPU" = xx86; then
30418
aa3cd6848aa0 8039426: gcc can target wrong instruction set when building JDK native code
erikj
parents: 30415
diff changeset
   751
      # Force compatibility with i586 on 32 bit intel platforms.
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   752
      $2COMMON_CCXXFLAGS="${$2COMMON_CCXXFLAGS} -march=i586"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   753
      $2JVM_CFLAGS="[$]$2JVM_CFLAGS -march=i586"
30418
aa3cd6848aa0 8039426: gcc can target wrong instruction set when building JDK native code
erikj
parents: 30415
diff changeset
   754
    fi
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   755
    $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS [$]$2COMMON_CCXXFLAGS_JDK -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2 \
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   756
        -pipe -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   757
    case $OPENJDK_$1_CPU_ARCH in
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   758
      arm )
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   759
        # on arm we don't prevent gcc to omit frame pointer but do prevent strict aliasing
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   760
        $2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   761
        ;;
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   762
      ppc )
23981
6ae1260c5cab 8041141: JDK9 emb build failure on PPC platform
dholmes
parents: 23428
diff changeset
   763
        # on ppc we don't prevent gcc to omit frame pointer but do prevent strict aliasing
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   764
        $2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   765
        ;;
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   766
      * )
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   767
        $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   768
        $2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   769
        ;;
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   770
    esac
37864
5284b5a9fdc7 8155587: Cross compilation may cause compiler warnings for "build" compiler
erikj
parents: 37404
diff changeset
   771
    TOOLCHAIN_CHECK_COMPILER_VERSION(VERSION: 6, PREFIX: $2, IF_AT_LEAST: FLAGS_SETUP_GCC6_COMPILER_FLAGS)
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   772
  elif test "x$TOOLCHAIN_TYPE" = xclang; then
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   773
    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_GNU_SOURCE"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   774
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   775
    # Restrict the debug information created by Clang to avoid
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   776
    # too big object files and speed the build up a little bit
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   777
    # (see http://llvm.org/bugs/show_bug.cgi?id=7554)
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   778
    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -flimit-debug-info"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   779
    if test "x$OPENJDK_$1_OS" = xlinux; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   780
      if test "x$OPENJDK_$1_CPU" = xx86; then
35444
4d323e794486 8148655: LOG=cmdlines and other build-infra fixes
ihse
parents: 35032
diff changeset
   781
        # Force compatibility with i586 on 32 bit intel platforms.
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   782
        $2COMMON_CCXXFLAGS="${$2COMMON_CCXXFLAGS} -march=i586"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   783
        $2JVM_CFLAGS="[$]$2JVM_CFLAGS -march=i586"
35444
4d323e794486 8148655: LOG=cmdlines and other build-infra fixes
ihse
parents: 35032
diff changeset
   784
      fi
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   785
      $2JVM_CFLAGS="[$]$2JVM_CFLAGS -Wno-sometimes-uninitialized"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   786
      $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS [$]$2COMMON_CCXXFLAGS_JDK -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2 \
35444
4d323e794486 8148655: LOG=cmdlines and other build-infra fixes
ihse
parents: 35032
diff changeset
   787
          -pipe -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   788
      case $OPENJDK_$1_CPU_ARCH in
35444
4d323e794486 8148655: LOG=cmdlines and other build-infra fixes
ihse
parents: 35032
diff changeset
   789
        ppc )
4d323e794486 8148655: LOG=cmdlines and other build-infra fixes
ihse
parents: 35032
diff changeset
   790
          # on ppc we don't prevent gcc to omit frame pointer but do prevent strict aliasing
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   791
          $2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
35444
4d323e794486 8148655: LOG=cmdlines and other build-infra fixes
ihse
parents: 35032
diff changeset
   792
          ;;
4d323e794486 8148655: LOG=cmdlines and other build-infra fixes
ihse
parents: 35032
diff changeset
   793
        * )
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   794
          $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   795
          $2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
35444
4d323e794486 8148655: LOG=cmdlines and other build-infra fixes
ihse
parents: 35032
diff changeset
   796
          ;;
4d323e794486 8148655: LOG=cmdlines and other build-infra fixes
ihse
parents: 35032
diff changeset
   797
      esac
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   798
    fi
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   799
  elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   800
    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -DSPARC_WORKS"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   801
    $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS [$]$2COMMON_CCXXFLAGS_JDK -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   802
    if test "x$OPENJDK_$1_CPU_ARCH" = xx86; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   803
      $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -DcpuIntel -Di586 -D$OPENJDK_$1_CPU_LEGACY_LIB"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   804
    fi
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   805
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   806
    $2CFLAGS_JDK="[$]$2CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -W0,-noglobal"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   807
    $2CXXFLAGS_JDK="[$]$2CXXFLAGS_JDK -errtags=yes +w -mt -features=no%except -DCC_NOEX -norunpath -xnolib"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   808
  elif test "x$TOOLCHAIN_TYPE" = xxlc; then
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   809
    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_REENTRANT -D__STDC_FORMAT_MACROS"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   810
    $2CFLAGS_JDK="[$]$2CFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   811
    $2CXXFLAGS_JDK="[$]$2CXXFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   812
  elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   813
    $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS [$]$2COMMON_CCXXFLAGS_JDK \
36531
ef4e1ca50af8 8151619: genSocketOptionRegistry.exe always relinked on Windows
erikj
parents: 36051
diff changeset
   814
        -MD -Zc:wchar_t- -W3 -wd4800 \
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 27602
diff changeset
   815
        -DWIN32_LEAN_AND_MEAN \
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 27602
diff changeset
   816
        -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \
30740
754229ce9d68 8080983: libdt_socket: Build failed with VS2013 SP4
erikj
parents: 30418
diff changeset
   817
        -D_WINSOCK_DEPRECATED_NO_WARNINGS \
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 27602
diff changeset
   818
        -DWIN32 -DIAL"
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   819
    if test "x$OPENJDK_$1_CPU" = xx86_64; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   820
      $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_AMD64_ -Damd64"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   821
    else
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   822
      $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_X86_ -Dx86"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   823
    fi
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 27602
diff changeset
   824
    # If building with Visual Studio 2010, we can still use _STATIC_CPPLIB to
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 27602
diff changeset
   825
    # avoid bundling msvcpNNN.dll. Doesn't work with newer versions of visual
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 27602
diff changeset
   826
    # studio.
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 27602
diff changeset
   827
    if test "x$TOOLCHAIN_VERSION" = "x2010"; then
35747
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   828
      STATIC_CPPLIB_FLAGS="-D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB"
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   829
      $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK $STATIC_CPPLIB_FLAGS"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   830
      $2JVM_CFLAGS="[$]$2JVM_CFLAGS $STATIC_CPPLIB_FLAGS"
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 27602
diff changeset
   831
    fi
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   832
  fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   833
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   834
  ###############################################################################
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   835
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   836
  # Adjust flags according to debug level.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   837
  case $DEBUG_LEVEL in
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   838
    fastdebug | slowdebug )
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   839
      $2CFLAGS_JDK="[$]$2CFLAGS_JDK $CFLAGS_DEBUG_SYMBOLS $CFLAGS_DEBUG_OPTIONS"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   840
      $2CXXFLAGS_JDK="[$]$2CXXFLAGS_JDK $CXXFLAGS_DEBUG_SYMBOLS $CXXFLAGS_DEBUG_OPTIONS"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   841
      JAVAC_FLAGS="$JAVAC_FLAGS -g"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   842
      ;;
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   843
    release )
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   844
      ;;
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   845
    * )
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   846
      AC_MSG_ERROR([Unrecognized \$DEBUG_LEVEL: $DEBUG_LEVEL])
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   847
      ;;
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   848
  esac
18020
eade0d9836bf 8014404: Debug flag not added to jdk native compile when --enable-debug is set
erikj
parents: 17664
diff changeset
   849
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   850
  # Set some common defines. These works for all compilers, but assume
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   851
  # -D is universally accepted.
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   852
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   853
  # Setup endianness
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   854
  if test "x$OPENJDK_$1_CPU_ENDIAN" = xlittle; then
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   855
    # The macro _LITTLE_ENDIAN needs to be defined the same to avoid the
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   856
    #   Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   857
    #   (The Solaris X86 system defines this in file /usr/include/sys/isa_defs.h).
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   858
    #   Note: -Dmacro         is the same as    #define macro 1
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   859
    #         -Dmacro=        is the same as    #define macro
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   860
    if test "x$OPENJDK_$1_OS" = xsolaris; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   861
      $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_LITTLE_ENDIAN="
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   862
    else
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   863
      $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_LITTLE_ENDIAN"
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   864
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   865
  else
23428
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23423
diff changeset
   866
    # Same goes for _BIG_ENDIAN. Do we really need to set *ENDIAN on Solaris if they
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23423
diff changeset
   867
    # are defined in the system?
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   868
    if test "x$OPENJDK_$1_OS" = xsolaris; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   869
      $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_BIG_ENDIAN="
23428
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23423
diff changeset
   870
    else
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   871
      $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_BIG_ENDIAN"
23428
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23423
diff changeset
   872
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   873
  fi
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   874
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   875
  # Setup target OS define. Use OS target name but in upper case.
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   876
  OPENJDK_$1_OS_UPPERCASE=`$ECHO $OPENJDK_$1_OS | $TR 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   877
  $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D$OPENJDK_$1_OS_UPPERCASE"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   878
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   879
  # Setup target CPU
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   880
  $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK \
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   881
      $OPENJDK_$1_ADD_LP64 \
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   882
      -DARCH='\"$OPENJDK_$1_CPU_LEGACY\"' -D$OPENJDK_$1_CPU_LEGACY"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   883
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   884
  # Setup debug/release defines
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   885
  if test "x$DEBUG_LEVEL" = xrelease; then
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   886
    $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -DNDEBUG"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   887
    if test "x$OPENJDK_$1_OS" = xsolaris; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   888
      $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -DTRIMMED"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   889
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   890
  else
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   891
    $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -DDEBUG"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   892
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   893
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   894
  # Set some additional per-OS defines.
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   895
  if test "x$OPENJDK_$1_OS" = xlinux; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   896
    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -DLINUX"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   897
    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -pipe -fPIC -fno-rtti -fno-exceptions \
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   898
        -fvisibility=hidden -fno-strict-aliasing -fno-omit-frame-pointer"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   899
  elif test "x$OPENJDK_$1_OS" = xsolaris; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   900
    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -DSOLARIS"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   901
    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -template=no%extdef -features=no%split_init \
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   902
        -D_Crun_inline_placement -library=%none -KPIC -mt -xwe -features=no%except"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   903
  elif test "x$OPENJDK_$1_OS" = xmacosx; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   904
    $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   905
    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_ALLBSD_SOURCE"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   906
    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_DARWIN_C_SOURCE -D_XOPEN_SOURCE"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   907
    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -fno-rtti -fno-exceptions -fvisibility=hidden \
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   908
        -mno-omit-leaf-frame-pointer -mstack-alignment=16 -pipe -fno-strict-aliasing \
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   909
        -DMAC_OS_X_VERSION_MAX_ALLOWED=1070 -mmacosx-version-min=10.7.0 \
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   910
        -fno-omit-frame-pointer"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   911
  elif test "x$OPENJDK_$1_OS" = xaix; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   912
    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -DAIX"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   913
    # We may need '-qminimaltoc' or '-qpic=large -bbigtoc' if the TOC overflows.
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   914
    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -qtune=balanced -qhot=level=1 -qinline \
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   915
        -qinlglue -qalias=noansi -qstrict -qtls=default -qlanglvl=c99vla \
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   916
        -qlanglvl=noredefmac -qnortti -qnoeh -qignerrno"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   917
  elif test "x$OPENJDK_$1_OS" = xbsd; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   918
    $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_ALLBSD_SOURCE"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   919
  elif test "x$OPENJDK_$1_OS" = xwindows; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   920
    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_WINDOWS -DWIN32 -D_JNI_IMPLEMENTATION_"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   921
    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -nologo -W3 -MD -MP"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   922
  fi
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   923
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   924
  # Set some additional per-CPU defines.
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   925
  if test "x$OPENJDK_$1_OS-$OPENJDK_$1_CPU" = xwindows-x86; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   926
    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -arch:IA32"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   927
  elif test "x$OPENJDK_$1_CPU" = xsparcv9; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   928
    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -xarch=sparc"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   929
  elif test "x$OPENJDK_$1_CPU" = xppc64; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   930
    if test "x$OPENJDK_$1_OS" = xlinux; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   931
      $2JVM_CFLAGS="[$]$2JVM_CFLAGS -minsert-sched-nops=regroup_exact -mno-multiple -mno-string"
37404
1ab1c5c6cd5a 8154087: Fix AIX and Linux/ppc64le after the integration of the new hotspot build
simonis
parents: 37402
diff changeset
   932
      # fixes `relocation truncated to fit' error for gcc 4.1.
1ab1c5c6cd5a 8154087: Fix AIX and Linux/ppc64le after the integration of the new hotspot build
simonis
parents: 37402
diff changeset
   933
      $2JVM_CFLAGS="[$]$2JVM_CFLAGS -mminimal-toc"
1ab1c5c6cd5a 8154087: Fix AIX and Linux/ppc64le after the integration of the new hotspot build
simonis
parents: 37402
diff changeset
   934
      # Use ppc64 instructions, but schedule for power5
1ab1c5c6cd5a 8154087: Fix AIX and Linux/ppc64le after the integration of the new hotspot build
simonis
parents: 37402
diff changeset
   935
      $2JVM_CFLAGS="[$]$2JVM_CFLAGS -mcpu=powerpc64 -mtune=power5"
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   936
    elif test "x$OPENJDK_$1_OS" = xaix; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   937
      $2JVM_CFLAGS="[$]$2JVM_CFLAGS -qarch=ppc64"
37404
1ab1c5c6cd5a 8154087: Fix AIX and Linux/ppc64le after the integration of the new hotspot build
simonis
parents: 37402
diff changeset
   938
    fi
1ab1c5c6cd5a 8154087: Fix AIX and Linux/ppc64le after the integration of the new hotspot build
simonis
parents: 37402
diff changeset
   939
  elif test "x$OPENJDK_$1_CPU" = xppc64le; then
1ab1c5c6cd5a 8154087: Fix AIX and Linux/ppc64le after the integration of the new hotspot build
simonis
parents: 37402
diff changeset
   940
    if test "x$OPENJDK_$1_OS" = xlinux; then
1ab1c5c6cd5a 8154087: Fix AIX and Linux/ppc64le after the integration of the new hotspot build
simonis
parents: 37402
diff changeset
   941
      $2JVM_CFLAGS="[$]$2JVM_CFLAGS -minsert-sched-nops=regroup_exact -mno-multiple -mno-string"
1ab1c5c6cd5a 8154087: Fix AIX and Linux/ppc64le after the integration of the new hotspot build
simonis
parents: 37402
diff changeset
   942
      # Little endian machine uses ELFv2 ABI.
1ab1c5c6cd5a 8154087: Fix AIX and Linux/ppc64le after the integration of the new hotspot build
simonis
parents: 37402
diff changeset
   943
      $2JVM_CFLAGS="[$]$2JVM_CFLAGS -DABI_ELFv2"
1ab1c5c6cd5a 8154087: Fix AIX and Linux/ppc64le after the integration of the new hotspot build
simonis
parents: 37402
diff changeset
   944
      # Use Power8, this is the first CPU to support PPC64 LE with ELFv2 ABI.
1ab1c5c6cd5a 8154087: Fix AIX and Linux/ppc64le after the integration of the new hotspot build
simonis
parents: 37402
diff changeset
   945
      $2JVM_CFLAGS="[$]$2JVM_CFLAGS -mcpu=power7 -mtune=power8"
1ab1c5c6cd5a 8154087: Fix AIX and Linux/ppc64le after the integration of the new hotspot build
simonis
parents: 37402
diff changeset
   946
    fi
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   947
  fi
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   948
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   949
  if test "x$OPENJDK_$1_CPU_ENDIAN" = xlittle; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   950
    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -DVM_LITTLE_ENDIAN"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   951
  fi
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   952
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   953
  if test "x$OPENJDK_$1_CPU_BITS" = x64; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   954
    if test "x$OPENJDK_$1_OS" != xsolaris && test "x$OPENJDK_$1_OS" != xaix; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   955
      # Solaris does not have _LP64=1 in the old build.
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   956
      # xlc on AIX defines _LP64=1 by default and issues a warning if we redefine it.
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   957
      $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_LP64=1"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   958
    fi
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   959
  fi
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   960
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   961
  # Set $2JVM_CFLAGS warning handling
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   962
  if test "x$OPENJDK_$1_OS" = xlinux; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   963
    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -Wpointer-arith -Wsign-compare -Wunused-function \
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   964
        -Wunused-value -Woverloaded-virtual"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   965
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   966
    if test "x$TOOLCHAIN_TYPE" = xgcc; then
37864
5284b5a9fdc7 8155587: Cross compilation may cause compiler warnings for "build" compiler
erikj
parents: 37404
diff changeset
   967
      TOOLCHAIN_CHECK_COMPILER_VERSION(VERSION: [4.8], PREFIX: $2,
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   968
          IF_AT_LEAST: [
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   969
            # These flags either do not work or give spurious warnings prior to gcc 4.8.
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   970
            $2JVM_CFLAGS="[$]$2JVM_CFLAGS -Wno-format-zero-length -Wtype-limits -Wuninitialized"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   971
          ]
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   972
      )
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   973
    fi
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   974
    if ! HOTSPOT_CHECK_JVM_VARIANT(zero) && ! HOTSPOT_CHECK_JVM_VARIANT(zeroshark); then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   975
      # Non-zero builds have stricter warnings
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   976
      $2JVM_CFLAGS="[$]$2JVM_CFLAGS -Wreturn-type -Wundef -Wformat=2"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   977
    else
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   978
      if test "x$TOOLCHAIN_TYPE" = xclang; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   979
        # Some versions of llvm do not like -Wundef
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   980
        $2JVM_CFLAGS="[$]$2JVM_CFLAGS -Wno-undef"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   981
      fi
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   982
    fi
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   983
  elif test "x$OPENJDK_$1_OS" = xmacosx; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   984
    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -Wno-deprecated -Wpointer-arith \
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   985
        -Wsign-compare -Wundef -Wunused-function -Wformat=2"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   986
  fi
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   987
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   988
  # Additional macosx handling
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   989
  if test "x$OPENJDK_$1_OS" = xmacosx; then
25034
d9ca34c227b8 8043340: [macosx] Fix hard-wired paths to JavaVM.framework
ddehaven
parents: 24911
diff changeset
   990
    # Setting these parameters makes it an error to link to macosx APIs that are
d9ca34c227b8 8043340: [macosx] Fix hard-wired paths to JavaVM.framework
ddehaven
parents: 24911
diff changeset
   991
    # newer than the given OS version and makes the linked binaries compatible
d9ca34c227b8 8043340: [macosx] Fix hard-wired paths to JavaVM.framework
ddehaven
parents: 24911
diff changeset
   992
    # even if built on a newer version of the OS.
d9ca34c227b8 8043340: [macosx] Fix hard-wired paths to JavaVM.framework
ddehaven
parents: 24911
diff changeset
   993
    # The expected format is X.Y.Z
d9ca34c227b8 8043340: [macosx] Fix hard-wired paths to JavaVM.framework
ddehaven
parents: 24911
diff changeset
   994
    MACOSX_VERSION_MIN=10.7.0
d9ca34c227b8 8043340: [macosx] Fix hard-wired paths to JavaVM.framework
ddehaven
parents: 24911
diff changeset
   995
    AC_SUBST(MACOSX_VERSION_MIN)
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   996
25034
d9ca34c227b8 8043340: [macosx] Fix hard-wired paths to JavaVM.framework
ddehaven
parents: 24911
diff changeset
   997
    # The macro takes the version with no dots, ex: 1070
d9ca34c227b8 8043340: [macosx] Fix hard-wired paths to JavaVM.framework
ddehaven
parents: 24911
diff changeset
   998
    # Let the flags variables get resolved in make for easier override on make
d9ca34c227b8 8043340: [macosx] Fix hard-wired paths to JavaVM.framework
ddehaven
parents: 24911
diff changeset
   999
    # command line.
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1000
    $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1001
    $2LDFLAGS_JDK="[$]$2LDFLAGS_JDK -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
  1002
  fi
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
  1003
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
  1004
  # Setup some hard coded includes
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1005
  $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK \
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 25459
diff changeset
  1006
      -I${JDK_TOPDIR}/src/java.base/share/native/include \
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1007
      -I${JDK_TOPDIR}/src/java.base/$OPENJDK_$1_OS/native/include \
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1008
      -I${JDK_TOPDIR}/src/java.base/$OPENJDK_$1_OS_TYPE/native/include \
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1009
      -I${JDK_TOPDIR}/src/java.base/share/native/libjava \
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1010
      -I${JDK_TOPDIR}/src/java.base/$OPENJDK_$1_OS_TYPE/native/libjava"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
  1011
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1012
  # The shared libraries are compiled using the picflag.
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1013
  $2CFLAGS_JDKLIB="[$]$2COMMON_CCXXFLAGS_JDK \
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1014
      [$]$2CFLAGS_JDK [$]$2EXTRA_CFLAGS_JDK $PICFLAG [$]$2CFLAGS_JDKLIB_EXTRA"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1015
  $2CXXFLAGS_JDKLIB="[$]$2COMMON_CCXXFLAGS_JDK \
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1016
      [$]$2CXXFLAGS_JDK [$]$2EXTRA_CXXFLAGS_JDK $PICFLAG [$]$2CXXFLAGS_JDKLIB_EXTRA"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
  1017
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1018
  # Executable flags
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1019
  $2CFLAGS_JDKEXE="[$]$2COMMON_CCXXFLAGS_JDK [$]$2CFLAGS_JDK [$]$2EXTRA_CFLAGS_JDK"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1020
  $2CXXFLAGS_JDKEXE="[$]$2COMMON_CCXXFLAGS_JDK [$]$2CXXFLAGS_JDK [$]$2EXTRA_CXXFLAGS_JDK"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
  1021
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1022
  AC_SUBST($2CFLAGS_JDKLIB)
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1023
  AC_SUBST($2CFLAGS_JDKEXE)
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1024
  AC_SUBST($2CXXFLAGS_JDKLIB)
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1025
  AC_SUBST($2CXXFLAGS_JDKEXE)
29305
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
  1026
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
  1027
  # Setup LDFLAGS et al.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
  1028
  #
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1029
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
  1030
  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
35747
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
  1031
    LDFLAGS_MICROSOFT="-nologo -opt:ref"
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1032
    $2LDFLAGS_JDK="[$]$2LDFLAGS_JDK $LDFLAGS_MICROSOFT -incremental:no"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1033
    $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LDFLAGS_MICROSOFT -opt:icf,8 -subsystem:windows -base:0x8000000"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1034
    if test "x$OPENJDK_$1_CPU_BITS" = "x32"; then
35747
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
  1035
      LDFLAGS_SAFESH="-safeseh"
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1036
      $2LDFLAGS_JDK="[$]$2LDFLAGS_JDK $LDFLAGS_SAFESH"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1037
      $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LDFLAGS_SAFESH"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1038
      # NOTE: Old build added -machine. Probably not needed.
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1039
      $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -machine:I386"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1040
    else
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1041
      $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -machine:AMD64"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1042
    fi
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1043
  elif test "x$TOOLCHAIN_TYPE" = xclang; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1044
      $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -mno-omit-leaf-frame-pointer -mstack-alignment=16 -stdlib=libstdc++ -fPIC"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1045
      if test "x$OPENJDK_$1_OS" = xmacosx; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1046
        # FIXME: We should really generalize SET_SHARED_LIBRARY_ORIGIN instead.
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1047
        $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/.."
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
  1048
    fi
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1049
  elif test "x$TOOLCHAIN_TYPE" = xgcc; then
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1050
    # If this is a --hash-style=gnu system, use --hash-style=both, why?
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1051
    # We have previously set HAS_GNU_HASH if this is the case
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1052
    if test -n "$HAS_GNU_HASH"; then
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1053
      $2LDFLAGS_HASH_STYLE="-Wl,--hash-style=both"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1054
      $2LDFLAGS_JDK="${$2LDFLAGS_JDK} [$]$2LDFLAGS_HASH_STYLE"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1055
      $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS [$]$2LDFLAGS_HASH_STYLE"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1056
    fi
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1057
      if test "x$OPENJDK_$1_OS" = xmacosx; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1058
        $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/.."
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1059
    fi
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1060
    if test "x$OPENJDK_$1_OS" = xlinux; then
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1061
      # And since we now know that the linker is gnu, then add -z defs, to forbid
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1062
      # undefined symbols in object files.
35747
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
  1063
      LDFLAGS_NO_UNDEF_SYM="-Wl,-z,defs"
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1064
      $2LDFLAGS_JDK="${$2LDFLAGS_JDK} $LDFLAGS_NO_UNDEF_SYM"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1065
      $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS  $LDFLAGS_NO_UNDEF_SYM"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1066
      LDFLAGS_NO_EXEC_STACK="-Wl,-z,noexecstack"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1067
      $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LDFLAGS_NO_EXEC_STACK"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1068
      if test "x$OPENJDK_$1_CPU" = xx86; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1069
        $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -march=i586"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1070
      fi
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1071
      case $DEBUG_LEVEL in
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1072
        release )
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1073
          # tell linker to optimize libraries.
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1074
          # Should this be supplied to the OSS linker as well?
35747
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
  1075
          LDFLAGS_DEBUGLEVEL_release="-Wl,-O1"
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1076
          $2LDFLAGS_JDK="${$2LDFLAGS_JDK} $LDFLAGS_DEBUGLEVEL_release"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1077
          $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LDFLAGS_DEBUGLEVEL_release"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1078
          if test "x$HAS_LINKER_RELRO" = "xtrue"; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1079
            $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LINKER_RELRO_FLAG"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1080
          fi
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1081
          ;;
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1082
        slowdebug )
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1083
          # Hotspot always let the linker optimize
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1084
          $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -Wl,-O1"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1085
          if test "x$HAS_LINKER_NOW" = "xtrue"; then
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1086
            # do relocations at load
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1087
            $2LDFLAGS_JDK="[$]$2LDFLAGS_JDK $LINKER_NOW_FLAG"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1088
            $2LDFLAGS_CXX_JDK="[$]$2LDFLAGS_CXX_JDK $LINKER_NOW_FLAG"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1089
            $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LINKER_NOW_FLAG"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1090
          fi
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1091
          if test "x$HAS_LINKER_RELRO" = "xtrue"; then
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1092
            # mark relocations read only
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1093
            $2LDFLAGS_JDK="[$]$2LDFLAGS_JDK $LINKER_RELRO_FLAG"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1094
            $2LDFLAGS_CXX_JDK="[$]$2LDFLAGS_CXX_JDK $LINKER_RELRO_FLAG"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1095
            $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LINKER_RELRO_FLAG"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1096
          fi
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1097
          ;;
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1098
        fastdebug )
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1099
          # Hotspot always let the linker optimize
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1100
          $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -Wl,-O1"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1101
          if test "x$HAS_LINKER_RELRO" = "xtrue"; then
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1102
            # mark relocations read only
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1103
            $2LDFLAGS_JDK="[$]$2LDFLAGS_JDK $LINKER_RELRO_FLAG"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1104
            $2LDFLAGS_CXX_JDK="[$]$2LDFLAGS_CXX_JDK $LINKER_RELRO_FLAG"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1105
            $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LINKER_RELRO_FLAG"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1106
          fi
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1107
          ;;
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1108
        * )
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1109
          AC_MSG_ERROR([Unrecognized \$DEBUG_LEVEL: $DEBUG_LEVEL])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1110
          ;;
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1111
        esac
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1112
    fi
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1113
  elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
35747
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
  1114
    LDFLAGS_SOLSTUDIO="-Wl,-z,defs"
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1115
    $2LDFLAGS_JDK="[$]$2LDFLAGS_JDK $LDFLAGS_SOLSTUDIO -xildoff -ztext"
35747
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
  1116
    LDFLAGS_CXX_SOLSTUDIO="-norunpath"
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1117
    $2LDFLAGS_CXX_JDK="[$]$2LDFLAGS_CXX_JDK $LDFLAGS_CXX_SOLSTUDIO -xnolib"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1118
    $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LDFLAGS_SOLSTUDIO -library=%none -mt $LDFLAGS_CXX_SOLSTUDIO -z noversion"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1119
    if test "x$OPENJDK_$1_CPU_ARCH" = "xsparc"; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1120
      $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -xarch=sparc"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1121
    fi
29451
443fdcba9598 8075515: AIX: cleanup xlc options and use -bernotok to detect missing symbols at build time
simonis
parents: 29305
diff changeset
  1122
  elif test "x$TOOLCHAIN_TYPE" = xxlc; then
36051
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
  1123
    LDFLAGS_XLC="-b64 -brtl -bnolibpath -bexpall -bernotok"
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1124
    $2LDFLAGS_JDK="${$2LDFLAGS_JDK} $LDFLAGS_XLC"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1125
    $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LDFLAGS_XLC"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1126
  fi
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1127
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1128
  # Customize LDFLAGS for executables
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1129
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1130
  $2LDFLAGS_JDKEXE="${$2LDFLAGS_JDK}"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1131
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1132
  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1133
    if test "x$OPENJDK_$1_CPU_BITS" = "x64"; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1134
      LDFLAGS_STACK_SIZE=1048576
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
  1135
    else
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1136
      LDFLAGS_STACK_SIZE=327680
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
  1137
    fi
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1138
    $2LDFLAGS_JDKEXE="${$2LDFLAGS_JDKEXE} /STACK:$LDFLAGS_STACK_SIZE"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1139
  elif test "x$OPENJDK_$1_OS" = xlinux; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1140
    $2LDFLAGS_JDKEXE="[$]$2LDFLAGS_JDKEXE -Wl,--allow-shlib-undefined"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1141
  fi
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1142
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1143
  $2LDFLAGS_JDKEXE="${$2LDFLAGS_JDKEXE} ${$2EXTRA_LDFLAGS_JDK}"
36506
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
  1144
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1145
  # Customize LDFLAGS for libs
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1146
  $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDK}"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1147
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1148
  $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} ${SHARED_LIBRARY_FLAGS}"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1149
  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1150
    $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} \
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
  1151
        -libpath:${OUTPUT_ROOT}/support/modules_libs/java.base"
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1152
    $2JDKLIB_LIBS=""
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1153
  else
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1154
    $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} \
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1155
        -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)"
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
  1156
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1157
    if test "x$1" = "xTARGET"; then
14465
d529faf5e36a 8001460: build-infra: Linker warnings on macosx
erikj
parents: 14464
diff changeset
  1158
    # On some platforms (mac) the linker warns about non existing -L dirs.
14467
a973c0a1bd5d 8003528: build-infra: Diffs in libjava and hotspot libs on solaris.
erikj
parents: 14465
diff changeset
  1159
    # Add server first if available. Linking aginst client does not always produce the same results.
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1160
      # Only add client/minimal dir if client/minimal is being built.
14810
4e7fee179b4a 7190137: Add support for JVM_VARIANT minimal1
dholmes
parents: 14614
diff changeset
  1161
    # Default to server for other variants.
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1162
      if HOTSPOT_CHECK_JVM_VARIANT(server); then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1163
        $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/server"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1164
      elif HOTSPOT_CHECK_JVM_VARIANT(client); then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1165
        $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/client"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1166
      elif HOTSPOT_CHECK_JVM_VARIANT(minimal); then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1167
        $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/minimal"
14465
d529faf5e36a 8001460: build-infra: Linker warnings on macosx
erikj
parents: 14464
diff changeset
  1168
    else
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1169
        $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/server"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1170
    fi
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1171
    elif test "x$1" = "xBUILD"; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1172
      # When building a buildjdk, it's always only the server variant
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1173
      $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} \
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1174
          -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_$1_CPU_LIBDIR)/server"
14465
d529faf5e36a 8001460: build-infra: Linker warnings on macosx
erikj
parents: 14464
diff changeset
  1175
    fi
d529faf5e36a 8001460: build-infra: Linker warnings on macosx
erikj
parents: 14464
diff changeset
  1176
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1177
    $2JDKLIB_LIBS="-ljava -ljvm"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
  1178
    if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1179
      $2JDKLIB_LIBS="[$]$2JDKLIB_LIBS -lc"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
  1180
    fi
36506
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
  1181
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1182
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
  1183
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1184
  # Set $2JVM_LIBS (per os)
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1185
  if test "x$OPENJDK_$1_OS" = xlinux; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1186
    $2JVM_LIBS="[$]$2JVM_LIBS -lm -ldl -lpthread"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1187
  elif test "x$OPENJDK_$1_OS" = xsolaris; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1188
    # FIXME: This hard-coded path is not really proper.
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1189
    if test "x$OPENJDK_$1_CPU" = xx86_64; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1190
      $2SOLARIS_LIBM_LIBS="/usr/lib/amd64/libm.so.1"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1191
    elif test "x$OPENJDK_$1_CPU" = xsparcv9; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1192
      $2SOLARIS_LIBM_LIBS="/usr/lib/sparcv9/libm.so.1"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1193
    fi
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1194
    $2JVM_LIBS="[$]$2JVM_LIBS -lsocket -lsched -ldl $SOLARIS_LIBM_LIBS -lCrun \
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1195
        -lthread -ldoor -lc -ldemangle -lnsl -lkstat -lrt"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1196
  elif test "x$OPENJDK_$1_OS" = xmacosx; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1197
    $2JVM_LIBS="[$]$2JVM_LIBS -lm"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1198
  elif test "x$OPENJDK_$1_OS" = xaix; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1199
    $2JVM_LIBS="[$]$2JVM_LIBS -Wl,-lC_r -lm -ldl -lpthread"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1200
  elif test "x$OPENJDK_$1_OS" = xbsd; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1201
    $2JVM_LIBS="[$]$2JVM_LIBS -lm"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1202
  elif test "x$OPENJDK_$1_OS" = xwindows; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1203
    $2JVM_LIBS="[$]$2JVM_LIBS kernel32.lib user32.lib gdi32.lib winspool.lib \
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1204
        comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib \
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1205
        wsock32.lib winmm.lib version.lib psapi.lib"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1206
    fi
36506
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
  1207
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1208
  # Set $2JVM_ASFLAGS
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1209
  if test "x$OPENJDK_$1_OS" = xlinux; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1210
    if test "x$OPENJDK_$1_CPU" = xx86; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1211
      $2JVM_ASFLAGS="[$]$2JVM_ASFLAGS -march=i586"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1212
    fi
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1213
  elif test "x$OPENJDK_$1_OS" = xmacosx; then
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1214
    $2JVM_ASFLAGS="[$]$2JVM_ASFLAGS -x assembler-with-cpp -mno-omit-leaf-frame-pointer -mstack-alignment=16"
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1215
  fi
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1216
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1217
  $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} ${$2EXTRA_LDFLAGS_JDK}"
29305
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
  1218
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1219
  AC_SUBST($2LDFLAGS_JDKLIB)
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1220
  AC_SUBST($2LDFLAGS_JDKEXE)
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1221
  AC_SUBST($2JDKLIB_LIBS)
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1222
  AC_SUBST($2JDKEXE_LIBS)
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1223
  AC_SUBST($2LDFLAGS_CXX_JDK)
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1224
  AC_SUBST($2LDFLAGS_HASH_STYLE)
29305
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
  1225
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1226
  AC_SUBST($2JVM_CFLAGS)
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1227
  AC_SUBST($2JVM_LDFLAGS)
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1228
  AC_SUBST($2JVM_ASFLAGS)
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1229
  AC_SUBST($2JVM_LIBS)
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
  1230
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
  1231
])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1232
36535
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1233
# FLAGS_C_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1234
#                                  IF_FALSE: [RUN-IF-FALSE])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1235
# ------------------------------------------------------------
36535
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1236
# Check that the C compiler supports an argument
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1237
BASIC_DEFUN_NAMED([FLAGS_C_COMPILER_CHECK_ARGUMENTS],
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1238
    [*ARGUMENT IF_TRUE IF_FALSE], [$@],
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1239
[
36535
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1240
  AC_MSG_CHECKING([if the C compiler supports "ARG_ARGUMENT"])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1241
  supports=yes
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1242
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1243
  saved_cflags="$CFLAGS"
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1244
  CFLAGS="$CFLAGS ARG_ARGUMENT"
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1245
  AC_LANG_PUSH([C])
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1246
  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1247
      [supports=no])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1248
  AC_LANG_POP([C])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1249
  CFLAGS="$saved_cflags"
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1250
36535
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1251
  AC_MSG_RESULT([$supports])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1252
  if test "x$supports" = "xyes" ; then
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1253
    :
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1254
    ARG_IF_TRUE
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1255
  else
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1256
    :
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1257
    ARG_IF_FALSE
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1258
  fi
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1259
])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1260
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1261
# FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1262
#                                    IF_FALSE: [RUN-IF-FALSE])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1263
# ------------------------------------------------------------
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1264
# Check that the C++ compiler supports an argument
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1265
BASIC_DEFUN_NAMED([FLAGS_CXX_COMPILER_CHECK_ARGUMENTS],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1266
    [*ARGUMENT IF_TRUE IF_FALSE], [$@],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1267
[
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1268
  AC_MSG_CHECKING([if the C++ compiler supports "ARG_ARGUMENT"])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1269
  supports=yes
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1270
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1271
  saved_cxxflags="$CXXFLAGS"
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1272
  CXXFLAGS="$CXXFLAG ARG_ARGUMENT"
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1273
  AC_LANG_PUSH([C++])
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1274
  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1275
      [supports=no])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1276
  AC_LANG_POP([C++])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1277
  CXXFLAGS="$saved_cxxflags"
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1278
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1279
  AC_MSG_RESULT([$supports])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1280
  if test "x$supports" = "xyes" ; then
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1281
    :
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1282
    ARG_IF_TRUE
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1283
  else
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1284
    :
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1285
    ARG_IF_FALSE
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1286
  fi
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1287
])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1288
36535
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1289
# FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1290
#                                IF_FALSE: [RUN-IF-FALSE])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1291
# ------------------------------------------------------------
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1292
# Check that the C and C++ compilers support an argument
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1293
BASIC_DEFUN_NAMED([FLAGS_COMPILER_CHECK_ARGUMENTS],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1294
    [*ARGUMENT IF_TRUE IF_FALSE], [$@],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1295
[
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1296
  FLAGS_C_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARG_ARGUMENT],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1297
  					     IF_TRUE: [C_COMP_SUPPORTS="yes"],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1298
					     IF_FALSE: [C_COMP_SUPPORTS="no"])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1299
  FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARG_ARGUMENT],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1300
  					       IF_TRUE: [CXX_COMP_SUPPORTS="yes"],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1301
					       IF_FALSE: [CXX_COMP_SUPPORTS="no"])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1302
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1303
  AC_MSG_CHECKING([if both compilers support "ARG_ARGUMENT"])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1304
  supports=no
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1305
  if test "x$C_COMP_SUPPORTS" = "xyes" -a "x$CXX_COMP_SUPPORTS" = "xyes"; then supports=yes; fi
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1306
  
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1307
  AC_MSG_RESULT([$supports])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1308
  if test "x$supports" = "xyes" ; then
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1309
    :
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1310
    ARG_IF_TRUE
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1311
  else
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1312
    :
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1313
    ARG_IF_FALSE
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1314
  fi
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1315
])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1316
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1317
# FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1318
#                                   IF_FALSE: [RUN-IF-FALSE])
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1319
# ------------------------------------------------------------
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1320
# Check that the linker support an argument
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1321
BASIC_DEFUN_NAMED([FLAGS_LINKER_CHECK_ARGUMENTS],
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1322
    [*ARGUMENT IF_TRUE IF_FALSE], [$@],
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1323
[
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1324
  AC_MSG_CHECKING([if linker supports "ARG_ARGUMENT"])
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1325
  supports=yes
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1326
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1327
  saved_ldflags="$LDFLAGS"
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1328
  LDFLAGS="$LDFLAGS ARG_ARGUMENT"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1329
  AC_LANG_PUSH([C])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1330
  AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1331
      [], [supports=no])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1332
  AC_LANG_POP([C])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1333
  LDFLAGS="$saved_ldflags"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1334
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1335
  AC_MSG_RESULT([$supports])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1336
  if test "x$supports" = "xyes" ; then
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1337
    :
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1338
    ARG_IF_TRUE
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1339
  else
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1340
    :
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1341
    ARG_IF_FALSE
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1342
  fi
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1343
])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1344
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
  1345
AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_MISC],
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1346
[
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1347
  # Some Zero and Shark settings.
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1348
  # ZERO_ARCHFLAG tells the compiler which mode to build for
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1349
  case "${OPENJDK_TARGET_CPU}" in
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1350
    s390)
22466
25aaf85d1ada 8024265: Enable new build on AIX
simonis
parents: 22465
diff changeset
  1351
      ZERO_ARCHFLAG="${COMPILER_TARGET_BITS_FLAG}31"
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1352
      ;;
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1353
    *)
22466
25aaf85d1ada 8024265: Enable new build on AIX
simonis
parents: 22465
diff changeset
  1354
      ZERO_ARCHFLAG="${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1355
  esac
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1356
  FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$ZERO_ARCHFLAG], IF_FALSE: [ZERO_ARCHFLAG=""])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1357
  AC_SUBST(ZERO_ARCHFLAG)
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1358
22466
25aaf85d1ada 8024265: Enable new build on AIX
simonis
parents: 22465
diff changeset
  1359
  # Check that the compiler supports -mX (or -qX on AIX) flags
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1360
  # Set COMPILER_SUPPORTS_TARGET_BITS_FLAG to 'true' if it does
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1361
  FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}],
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1362
      IF_TRUE: [COMPILER_SUPPORTS_TARGET_BITS_FLAG=true],
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1363
      IF_FALSE: [COMPILER_SUPPORTS_TARGET_BITS_FLAG=false])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1364
  AC_SUBST(COMPILER_SUPPORTS_TARGET_BITS_FLAG)
23423
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
  1365
30415
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1366
  AC_ARG_ENABLE([warnings-as-errors], [AS_HELP_STRING([--disable-warnings-as-errors],
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1367
      [do not consider native warnings to be an error @<:@enabled@:>@])])
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1368
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1369
  AC_MSG_CHECKING([if native warnings are errors])
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1370
  if test "x$enable_warnings_as_errors" = "xyes"; then
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1371
    AC_MSG_RESULT([yes (explicitely set)])
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1372
    WARNINGS_AS_ERRORS=true
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1373
  elif test "x$enable_warnings_as_errors" = "xno"; then
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1374
    AC_MSG_RESULT([no])
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1375
    WARNINGS_AS_ERRORS=false
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1376
  elif test "x$enable_warnings_as_errors" = "x"; then
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1377
    AC_MSG_RESULT([yes (default)])
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1378
    WARNINGS_AS_ERRORS=true
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1379
  else
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1380
    AC_MSG_ERROR([--enable-warnings-as-errors accepts no argument])
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1381
  fi
33443
ea274e904321 8141543: Propagate --disable-warnings-as-errors to hotspot
ihse
parents: 33440
diff changeset
  1382
ea274e904321 8141543: Propagate --disable-warnings-as-errors to hotspot
ihse
parents: 33440
diff changeset
  1383
  if test "x$WARNINGS_AS_ERRORS" = "xfalse"; then
ea274e904321 8141543: Propagate --disable-warnings-as-errors to hotspot
ihse
parents: 33440
diff changeset
  1384
    # Set legacy hotspot variable
33445
9131d6736fd0 8141574: recent change for 8141543 breaks all builds
erikj
parents: 33443
diff changeset
  1385
    HOTSPOT_SET_WARNINGS_AS_ERRORS="WARNINGS_ARE_ERRORS="
33443
ea274e904321 8141543: Propagate --disable-warnings-as-errors to hotspot
ihse
parents: 33440
diff changeset
  1386
  else
33445
9131d6736fd0 8141574: recent change for 8141543 breaks all builds
erikj
parents: 33443
diff changeset
  1387
    HOTSPOT_SET_WARNINGS_AS_ERRORS=""
33443
ea274e904321 8141543: Propagate --disable-warnings-as-errors to hotspot
ihse
parents: 33440
diff changeset
  1388
  fi
ea274e904321 8141543: Propagate --disable-warnings-as-errors to hotspot
ihse
parents: 33440
diff changeset
  1389
30415
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1390
  AC_SUBST(WARNINGS_AS_ERRORS)
33443
ea274e904321 8141543: Propagate --disable-warnings-as-errors to hotspot
ihse
parents: 33440
diff changeset
  1391
  AC_SUBST(HOTSPOT_SET_WARNINGS_AS_ERRORS)
30415
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1392
23423
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
  1393
  case "${TOOLCHAIN_TYPE}" in
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
  1394
    microsoft)
29304
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
  1395
      DISABLE_WARNING_PREFIX="-wd"
25882
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 25854
diff changeset
  1396
      CFLAGS_WARNINGS_ARE_ERRORS="-WX"
23423
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
  1397
      ;;
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
  1398
    solstudio)
29304
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
  1399
      DISABLE_WARNING_PREFIX="-erroff="
23423
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
  1400
      CFLAGS_WARNINGS_ARE_ERRORS="-errtags -errwarn=%all"
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
  1401
      ;;
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
  1402
    gcc)
29304
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
  1403
      # Prior to gcc 4.4, a -Wno-X where X is unknown for that version of gcc will cause an error
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1404
      FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [-Wno-this-is-a-warning-that-do-not-exist],
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1405
          IF_TRUE: [GCC_CAN_DISABLE_WARNINGS=true],
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1406
          IF_FALSE: [GCC_CAN_DISABLE_WARNINGS=false]
29304
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
  1407
      )
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
  1408
      if test "x$GCC_CAN_DISABLE_WARNINGS" = "xtrue"; then
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
  1409
        DISABLE_WARNING_PREFIX="-Wno-"
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
  1410
      else
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
  1411
        DISABLE_WARNING_PREFIX=
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
  1412
      fi
23423
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
  1413
      CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
37864
5284b5a9fdc7 8155587: Cross compilation may cause compiler warnings for "build" compiler
erikj
parents: 37404
diff changeset
  1414
      # Repeate the check for the BUILD_CC and BUILD_CXX. Need to also reset
5284b5a9fdc7 8155587: Cross compilation may cause compiler warnings for "build" compiler
erikj
parents: 37404
diff changeset
  1415
      # CFLAGS since any target specific flags will likely not work with the
5284b5a9fdc7 8155587: Cross compilation may cause compiler warnings for "build" compiler
erikj
parents: 37404
diff changeset
  1416
      # build compiler
34102
c0a98357f847 8143141: Bring in minor build changes from the jigsaw/jake forest
erikj
parents: 33571
diff changeset
  1417
      CC_OLD="$CC"
37864
5284b5a9fdc7 8155587: Cross compilation may cause compiler warnings for "build" compiler
erikj
parents: 37404
diff changeset
  1418
      CXX_OLD="$CXX"
34102
c0a98357f847 8143141: Bring in minor build changes from the jigsaw/jake forest
erikj
parents: 33571
diff changeset
  1419
      CC="$BUILD_CC"
37864
5284b5a9fdc7 8155587: Cross compilation may cause compiler warnings for "build" compiler
erikj
parents: 37404
diff changeset
  1420
      CXX="$BUILD_CXX"
5284b5a9fdc7 8155587: Cross compilation may cause compiler warnings for "build" compiler
erikj
parents: 37404
diff changeset
  1421
      CFLAGS_OLD="$CFLAGS"
5284b5a9fdc7 8155587: Cross compilation may cause compiler warnings for "build" compiler
erikj
parents: 37404
diff changeset
  1422
      CFLAGS=""
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1423
      FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [-Wno-this-is-a-warning-that-do-not-exist],
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1424
          IF_TRUE: [BUILD_CC_CAN_DISABLE_WARNINGS=true],
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1425
          IF_FALSE: [BUILD_CC_CAN_DISABLE_WARNINGS=false]
34102
c0a98357f847 8143141: Bring in minor build changes from the jigsaw/jake forest
erikj
parents: 33571
diff changeset
  1426
      )
c0a98357f847 8143141: Bring in minor build changes from the jigsaw/jake forest
erikj
parents: 33571
diff changeset
  1427
      if test "x$BUILD_CC_CAN_DISABLE_WARNINGS" = "xtrue"; then
c0a98357f847 8143141: Bring in minor build changes from the jigsaw/jake forest
erikj
parents: 33571
diff changeset
  1428
        BUILD_CC_DISABLE_WARNING_PREFIX="-Wno-"
c0a98357f847 8143141: Bring in minor build changes from the jigsaw/jake forest
erikj
parents: 33571
diff changeset
  1429
      else
c0a98357f847 8143141: Bring in minor build changes from the jigsaw/jake forest
erikj
parents: 33571
diff changeset
  1430
        BUILD_CC_DISABLE_WARNING_PREFIX=
c0a98357f847 8143141: Bring in minor build changes from the jigsaw/jake forest
erikj
parents: 33571
diff changeset
  1431
      fi
c0a98357f847 8143141: Bring in minor build changes from the jigsaw/jake forest
erikj
parents: 33571
diff changeset
  1432
      CC="$CC_OLD"
37864
5284b5a9fdc7 8155587: Cross compilation may cause compiler warnings for "build" compiler
erikj
parents: 37404
diff changeset
  1433
      CXX="$CXX_OLD"
5284b5a9fdc7 8155587: Cross compilation may cause compiler warnings for "build" compiler
erikj
parents: 37404
diff changeset
  1434
      CFLAGS="$CFLAGS_OLD"
23423
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
  1435
      ;;
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
  1436
    clang)
29304
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
  1437
      DISABLE_WARNING_PREFIX="-Wno-"
23423
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
  1438
      CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
  1439
      ;;
35747
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
  1440
    xlc)
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
  1441
      DISABLE_WARNING_PREFIX="-qsuppress="
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
  1442
      CFLAGS_WARNINGS_ARE_ERRORS="-qhalt=w"
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
  1443
      ;;
23423
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
  1444
  esac
29304
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
  1445
  AC_SUBST(DISABLE_WARNING_PREFIX)
36506
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
  1446
  AC_SUBST(BUILD_CC_DISABLE_WARNING_PREFIX)
23423
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
  1447
  AC_SUBST(CFLAGS_WARNINGS_ARE_ERRORS)
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1448
])
36535
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1449
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1450
AC_DEFUN_ONCE([FLAGS_SETUP_GCC6_COMPILER_FLAGS],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1451
[
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1452
  # These flags are required for GCC 6 builds as undefined behaviour in OpenJDK code
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1453
  # runs afoul of the more aggressive versions of these optimisations.
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1454
  # Notably, value range propagation now assumes that the this pointer of C++
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1455
  # member functions is non-null.
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1456
  NO_NULL_POINTER_CHECK_CFLAG="-fno-delete-null-pointer-checks"
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1457
  FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_NULL_POINTER_CHECK_CFLAG -Werror],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1458
  					     IF_FALSE: [NO_NULL_POINTER_CHECK_CFLAG=""])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1459
  AC_SUBST([NO_NULL_POINTER_CHECK_CFLAG])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1460
  NO_LIFETIME_DSE_CFLAG="-fno-lifetime-dse"
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1461
  FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_LIFETIME_DSE_CFLAG -Werror],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1462
  					     IF_FALSE: [NO_LIFETIME_DSE_CFLAG=""])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1463
  CFLAGS_JDK="${CFLAGS_JDK} ${NO_NULL_POINTER_CHECK_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1464
  AC_SUBST([NO_LIFETIME_DSE_CFLAG])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
  1465
])