common/autoconf/flags.m4
author alanb
Thu, 17 Mar 2016 19:03:53 +0000
changeset 36506 17612cee3530
parent 36051 25fa80338f92
child 36541 5a025732e169
permissions -rw-r--r--
8142968: Module System implementation Summary: Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282 Reviewed-by: alanb, mchung, tbell Contributed-by: alan.bateman@oracle.com, alex.buckley@oracle.com, jonathan.gibbons@oracle.com, karen.kinnear@oracle.com, mandy.chung@oracle.com, mark.reinhold@oracle.com, erik.joelsson@oracle.com, chris.hegarty@oracle.com, christian.tornqvist@oracle.com, harold.seigel@oracle.com, igor.ignatyev@oracle.com, james.laskey@oracle.com, jean-francois.denise@oracle.com, sundararajan.athijegannathan@oracle.com
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
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    64
  # 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
    65
  # should include the extra parameters
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    66
  CFLAGS="$EXTRA_CFLAGS"
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    67
  CXXFLAGS="$EXTRA_CXXFLAGS"
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    68
  LDFLAGS="$EXTRA_LDFLAGS"
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    69
  CPPFLAGS=""
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    70
])
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    71
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    72
# 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
    73
# 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
    74
# TOOLCHAIN_TYPE is available here.
33395
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
    75
# 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
    76
AC_DEFUN([FLAGS_SETUP_SYSROOT_FLAGS],
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    77
[
33395
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
    78
  if test "x[$]$1SYSROOT" != "x"; then
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    79
    if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    80
      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
    81
        # 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
    82
        # 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
    83
        # 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
    84
        # inlining of system functions and intrinsics.
0124e2c9ef64 8148929: Suboptimal code generated when setting sysroot include with Solaris Studio
erikj
parents: 35444
diff changeset
    85
        $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
    86
        $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
    87
            -L[$]$1SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR \
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
    88
            -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
    89
      fi
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    90
    elif test "x$TOOLCHAIN_TYPE" = xgcc; then
33395
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
    91
      $1SYSROOT_CFLAGS="--sysroot=[$]$1SYSROOT"
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
    92
      $1SYSROOT_LDFLAGS="--sysroot=[$]$1SYSROOT"
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    93
    elif test "x$TOOLCHAIN_TYPE" = xclang; then
33395
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
    94
      $1SYSROOT_CFLAGS="-isysroot [$]$1SYSROOT"
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
    95
      $1SYSROOT_LDFLAGS="-isysroot [$]$1SYSROOT"
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    96
    fi
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    97
    # Propagate the sysroot args to hotspot
33395
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
    98
    $1LEGACY_EXTRA_CFLAGS="[$]$1LEGACY_EXTRA_CFLAGS [$]$1SYSROOT_CFLAGS"
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
    99
    $1LEGACY_EXTRA_CXXFLAGS="[$]$1LEGACY_EXTRA_CXXFLAGS [$]$1SYSROOT_CFLAGS"
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   100
    $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
   101
    # 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
   102
    $1CFLAGS="[$]$1CFLAGS [$]$1SYSROOT_CFLAGS"
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   103
    $1CPPFLAGS="[$]$1CPPFLAGS [$]$1SYSROOT_CFLAGS"
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   104
    $1CXXFLAGS="[$]$1CXXFLAGS [$]$1SYSROOT_CFLAGS"
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   105
    $1LDFLAGS="[$]$1LDFLAGS [$]$1SYSROOT_LDFLAGS"
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   106
  fi
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   107
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   108
  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
   109
    # 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
   110
    $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
   111
    $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
   112
    # 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
   113
    # 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
   114
    $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
   115
    $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
   116
  fi
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   117
33395
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   118
  AC_SUBST($1SYSROOT_CFLAGS)
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   119
  AC_SUBST($1SYSROOT_LDFLAGS)
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   120
])
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   121
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   122
AC_DEFUN_ONCE([FLAGS_SETUP_INIT_FLAGS],
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   123
[
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   124
  # 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
   125
  # 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
   126
  # 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
   127
  #                              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
   128
  if test "x$TOOLCHAIN_TYPE" = xxlc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   129
    COMPILER_TARGET_BITS_FLAG="-q"
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   130
    COMPILER_COMMAND_FILE_FLAG="-f"
36051
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   131
    COMPILER_BINDCMD_FILE_FLAG="-bloadmap:"
22458
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   132
  else
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   133
    COMPILER_TARGET_BITS_FLAG="-m"
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   134
    COMPILER_COMMAND_FILE_FLAG="@"
36051
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   135
    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
   136
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   137
    # 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
   138
    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
   139
      COMPILER_COMMAND_FILE_FLAG=
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   140
    fi
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   141
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   142
    # 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
   143
    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
   144
      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
   145
      # 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
   146
      $ECHO "" "--version" > command.file
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   147
      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
   148
        AC_MSG_RESULT(yes)
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   149
        COMPILER_COMMAND_FILE_FLAG="@"
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   150
      else
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   151
        AC_MSG_RESULT(no)
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   152
        COMPILER_COMMAND_FILE_FLAG=
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   153
      fi
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   154
      rm -rf command.file
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   155
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   156
  fi
22467
kvn
parents: 22466 21055
diff changeset
   157
  AC_SUBST(COMPILER_TARGET_BITS_FLAG)
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   158
  AC_SUBST(COMPILER_COMMAND_FILE_FLAG)
36051
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   159
  AC_SUBST(COMPILER_BINDCMD_FILE_FLAG)
22466
25aaf85d1ada 8024265: Enable new build on AIX
simonis
parents: 22465
diff changeset
   160
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   161
  # 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
   162
  if test "x$OPENJDK_TARGET_OS" = xmacosx; then
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   163
    ARFLAGS="-r"
22467
kvn
parents: 22466 21055
diff changeset
   164
  elif test "x$OPENJDK_TARGET_OS" = xaix; then
22466
25aaf85d1ada 8024265: Enable new build on AIX
simonis
parents: 22465
diff changeset
   165
    ARFLAGS="-X64"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   166
  elif test "x$OPENJDK_TARGET_OS" = xwindows; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   167
    # 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
   168
    ARFLAGS="-nologo -NODEFAULTLIB:MSVCRT"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   169
  else
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   170
    ARFLAGS=""
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   171
  fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   172
  AC_SUBST(ARFLAGS)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   173
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   174
  ## Setup strip.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   175
  # 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
   176
  # 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
   177
  # 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
   178
  if test "x$OPENJDK_TARGET_OS" = xlinux; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   179
    STRIPFLAGS="-g"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   180
  elif test "x$OPENJDK_TARGET_OS" = xsolaris; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   181
    STRIPFLAGS="-x"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   182
  elif test "x$OPENJDK_TARGET_OS" = xmacosx; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   183
    STRIPFLAGS="-S"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   184
  elif test "x$OPENJDK_TARGET_OS" = xaix; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   185
    STRIPFLAGS="-X32_64"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   186
  fi
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   187
32811
df82db312e58 8135060: Stop building Xcode projects in install build
erikj
parents: 30856
diff changeset
   188
  AC_SUBST(STRIPFLAGS)
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   189
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   190
  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   191
    CC_OUT_OPTION=-Fo
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   192
    EXE_OUT_OPTION=-out:
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   193
    LD_OUT_OPTION=-out:
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   194
    AR_OUT_OPTION=-out:
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   195
  else
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   196
    # 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
   197
    # 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
   198
    CC_OUT_OPTION='-o$(SPACE)'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   199
    # 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
   200
    EXE_OUT_OPTION='-o$(SPACE)'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   201
    # 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
   202
    LD_OUT_OPTION='-o$(SPACE)'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   203
    # 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
   204
    AR_OUT_OPTION='rcs$(SPACE)'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   205
  fi
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   206
  AC_SUBST(CC_OUT_OPTION)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   207
  AC_SUBST(EXE_OUT_OPTION)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   208
  AC_SUBST(LD_OUT_OPTION)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   209
  AC_SUBST(AR_OUT_OPTION)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   210
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   211
  # On Windows, we need to set RC flags.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   212
  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
27593
4703225f5be4 8065913: Various improvements in SetupNativeCompilation
ihse
parents: 27586
diff changeset
   213
    RC_FLAGS="-nologo -l0x409"
35747
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   214
    if test "x$DEBUG_LEVEL" = xrelease; then
27593
4703225f5be4 8065913: Various improvements in SetupNativeCompilation
ihse
parents: 27586
diff changeset
   215
      RC_FLAGS="$RC_FLAGS -DNDEBUG"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   216
    fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   217
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   218
    # 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
   219
    # 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
   220
    # 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
   221
    # 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
   222
    # are evaluated by make.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   223
    RC_FLAGS="$RC_FLAGS \
33926
3a19edba4808 8085822: JEP 223: New Version-String Scheme (initial integration)
ihse
parents: 30740
diff changeset
   224
        -D\"JDK_VERSION_STRING=\$(VERSION_STRING)\" \
27593
4703225f5be4 8065913: Various improvements in SetupNativeCompilation
ihse
parents: 27586
diff changeset
   225
        -D\"JDK_COMPANY=\$(COMPANY_NAME)\" \
4703225f5be4 8065913: Various improvements in SetupNativeCompilation
ihse
parents: 27586
diff changeset
   226
        -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
   227
        -D\"JDK_VER=\$(VERSION_NUMBER)\" \
27593
4703225f5be4 8065913: Various improvements in SetupNativeCompilation
ihse
parents: 27586
diff changeset
   228
        -D\"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \
33926
3a19edba4808 8085822: JEP 223: New Version-String Scheme (initial integration)
ihse
parents: 30740
diff changeset
   229
        -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
   230
        -D\"JDK_FVER=\$(subst .,\$(COMMA),\$(VERSION_NUMBER_FOUR_POSITIONS))\""
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   231
  fi
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   232
  AC_SUBST(RC_FLAGS)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   233
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   234
  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   235
    # silence copyright notice and other headers.
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   236
    COMMON_CCXXFLAGS="$COMMON_CCXXFLAGS -nologo"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   237
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   238
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   239
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   240
AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_LIBS],
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   241
[
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   242
  ###############################################################################
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   243
  #
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   244
  # How to compile shared libraries.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   245
  #
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   246
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   247
  if test "x$TOOLCHAIN_TYPE" = xgcc; then
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   248
    PICFLAG="-fPIC"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   249
    C_FLAG_REORDER=''
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   250
    CXX_FLAG_REORDER=''
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   251
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   252
    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
   253
      # Linking is different on MacOSX
33562
c76b2fa11486 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 32813
diff changeset
   254
      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
   255
        SHARED_LIBRARY_FLAGS ='-undefined dynamic_lookup'
c76b2fa11486 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 32813
diff changeset
   256
      else
c76b2fa11486 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 32813
diff changeset
   257
        SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG"
c76b2fa11486 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 32813
diff changeset
   258
      fi
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   259
      SET_EXECUTABLE_ORIGIN='-Wl,-rpath,@loader_path/.'
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   260
      SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   261
      SET_SHARED_LIBRARY_NAME='-Wl,-install_name,@rpath/[$]1'
35747
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   262
      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
   263
    else
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   264
      # 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
   265
      SHARED_LIBRARY_FLAGS='-shared'
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   266
      SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$$$ORIGIN[$]1'
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   267
      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
   268
      SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   269
      SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=[$]1'
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   270
    fi
23161
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   271
  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
   272
    C_FLAG_REORDER=''
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   273
    CXX_FLAG_REORDER=''
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   274
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   275
    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
   276
      # Linking is different on MacOSX
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   277
      PICFLAG=''
23161
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   278
      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
   279
      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
   280
      SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   281
      SET_SHARED_LIBRARY_NAME='-Wl,-install_name,@rpath/[$]1'
35747
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   282
      SET_SHARED_LIBRARY_MAPFILE='-Wl,-exported_symbols_list,[$]1'
23161
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   283
    else
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   284
      # 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
   285
      PICFLAG='-fPIC'
23161
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   286
      SHARED_LIBRARY_FLAGS='-shared'
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   287
      SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$$$ORIGIN[$]1'
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   288
      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
   289
      SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   290
      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
   291
    fi
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   292
  elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   293
    PICFLAG="-KPIC"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   294
    C_FLAG_REORDER='-xF'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   295
    CXX_FLAG_REORDER='-xF'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   296
    SHARED_LIBRARY_FLAGS="-G"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   297
    SET_EXECUTABLE_ORIGIN='-R\$$$$ORIGIN[$]1'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
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='-h [$]1'
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   300
    SET_SHARED_LIBRARY_MAPFILE='-M[$]1'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   301
  elif test "x$TOOLCHAIN_TYPE" = xxlc; then
36051
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   302
    # '-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
   303
    # 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
   304
    # 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
   305
    # 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
   306
    # 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
   307
    # 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
   308
    # 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
   309
    # 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
   310
    # 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
   311
    # 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
   312
    # '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
   313
    # compilation unit.
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   314
    PICFLAG="-qpic"
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   315
    JVM_CFLAGS="$JVM_CFLAGS $PICFLAG"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   316
    C_FLAG_REORDER=''
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   317
    CXX_FLAG_REORDER=''
36051
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   318
    SHARED_LIBRARY_FLAGS="-qmkshrobj -bM:SRE -bnoentry"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   319
    SET_EXECUTABLE_ORIGIN=""
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   320
    SET_SHARED_LIBRARY_ORIGIN=''
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   321
    SET_SHARED_LIBRARY_NAME=''
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   322
    SET_SHARED_LIBRARY_MAPFILE=''
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   323
  elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   324
    PICFLAG=""
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   325
    C_FLAG_REORDER=''
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   326
    CXX_FLAG_REORDER=''
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   327
    SHARED_LIBRARY_FLAGS="-dll"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   328
    SET_EXECUTABLE_ORIGIN=''
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   329
    SET_SHARED_LIBRARY_ORIGIN=''
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   330
    SET_SHARED_LIBRARY_NAME=''
35747
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   331
    SET_SHARED_LIBRARY_MAPFILE='-def:[$]1'
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   332
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   333
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   334
  AC_SUBST(C_FLAG_REORDER)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   335
  AC_SUBST(CXX_FLAG_REORDER)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   336
  AC_SUBST(SET_EXECUTABLE_ORIGIN)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   337
  AC_SUBST(SET_SHARED_LIBRARY_ORIGIN)
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   338
  AC_SUBST(SET_SHARED_LIBRARY_NAME)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   339
  AC_SUBST(SET_SHARED_LIBRARY_MAPFILE)
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   340
  AC_SUBST(SHARED_LIBRARY_FLAGS)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   341
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   342
  if test "x$OPENJDK_TARGET_OS" = xsolaris; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   343
    CFLAGS_JDK="${CFLAGS_JDK} -D__solaris__"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   344
    CXXFLAGS_JDK="${CXXFLAGS_JDK} -D__solaris__"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   345
    CFLAGS_JDKLIB_EXTRA='-xstrconst'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   346
  fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   347
  # The (cross) compiler is now configured, we can now test capabilities
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   348
  # of the target platform.
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   349
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   350
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   351
# 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
   352
#
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   353
# 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
   354
#          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
   355
#          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
   356
#
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   357
# -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
   358
# -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
   359
# -fsingle: Use single precision floating point with 'float'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   360
# -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
   361
#   (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
   362
#    pointer types are not recommended)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   363
# -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
   364
#   (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
   365
# -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
   366
# -xrestrict: Pointer parameters to functions do not overlap
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   367
#   (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
   368
#    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
   369
# -xlibmil: Inline some library routines
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   370
#   (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
   371
# -xlibmopt: Use optimized math routines (CURRENTLY DISABLED)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   372
#   (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
   373
#  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
   374
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   375
    # 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
   376
    # Bug?
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   377
    #if test "x$OPENJDK_TARGET_CPU" = xsparc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   378
    #  CFLAGS_JDK="${CFLAGS_JDK} -xmemalign=4s"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   379
    #  CXXFLAGS_JDK="${CXXFLAGS_JDK} -xmemalign=4s"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   380
    #fi
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   381
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   382
AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_OPTIMIZATION],
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   383
[
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   384
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   385
  ###############################################################################
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   386
  #
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   387
  # Setup the opt flags for different compilers
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   388
  # and different operating systems.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   389
  #
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   390
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   391
  # 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
   392
  # if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   393
  #   C_FLAG_DEPS="-MMD -MF"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   394
  # fi
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   395
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   396
  # Generate make dependency files
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   397
  if test "x$TOOLCHAIN_TYPE" = xgcc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   398
    C_FLAG_DEPS="-MMD -MF"
23161
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   399
  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
   400
    C_FLAG_DEPS="-MMD -MF"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   401
  elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   402
    C_FLAG_DEPS="-xMMD -xMF"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   403
  elif test "x$TOOLCHAIN_TYPE" = xxlc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   404
    C_FLAG_DEPS="-qmakedep=gcc -MF"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   405
  fi
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   406
  CXX_FLAG_DEPS="$C_FLAG_DEPS"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   407
  AC_SUBST(C_FLAG_DEPS)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   408
  AC_SUBST(CXX_FLAG_DEPS)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   409
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   410
  # Debug symbols
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   411
  if test "x$TOOLCHAIN_TYPE" = xgcc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   412
    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
   413
      # 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
   414
      CFLAGS_DEBUG_SYMBOLS="-g1"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   415
      CXXFLAGS_DEBUG_SYMBOLS="-g1"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   416
    else
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   417
      CFLAGS_DEBUG_SYMBOLS="-g"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   418
      CXXFLAGS_DEBUG_SYMBOLS="-g"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   419
    fi
23161
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   420
  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
   421
    CFLAGS_DEBUG_SYMBOLS="-g"
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   422
    CXXFLAGS_DEBUG_SYMBOLS="-g"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   423
  elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   424
    CFLAGS_DEBUG_SYMBOLS="-g -xs"
35032
c2f315819691 8145596: Enable debug symbols for all libraries
ihse
parents: 35029
diff changeset
   425
    # -g0 enables debug symbols without disabling inlining.
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   426
    CXXFLAGS_DEBUG_SYMBOLS="-g0 -xs"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   427
  elif test "x$TOOLCHAIN_TYPE" = xxlc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   428
    CFLAGS_DEBUG_SYMBOLS="-g"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   429
    CXXFLAGS_DEBUG_SYMBOLS="-g"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   430
  fi
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   431
  AC_SUBST(CFLAGS_DEBUG_SYMBOLS)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   432
  AC_SUBST(CXXFLAGS_DEBUG_SYMBOLS)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   433
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   434
  # bounds, memory and behavior checking options
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   435
  if test "x$TOOLCHAIN_TYPE" = xgcc; then
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   436
    case $DEBUG_LEVEL in
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   437
    release )
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   438
      # no adjustment
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   439
      ;;
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   440
    fastdebug )
26123
44827e1a7a7b 8047952: Remove FORTIFY_SOURCE from fastdebug and slowdebug builds
mduigou
parents: 25459
diff changeset
   441
      # no adjustment
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   442
      ;;
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   443
    slowdebug )
35747
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   444
      # FIXME: By adding this to C(XX)FLAGS_DEBUG_OPTIONS it
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   445
      # get's added conditionally on whether we produce debug symbols or not.
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   446
      # This is most likely not really correct.
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   447
30856
09b01c98ca8d 8081692: Configure should verify that -fstack-protector is valid
ihse
parents: 30740
diff changeset
   448
      # Add runtime stack smashing and undefined behavior checks.
09b01c98ca8d 8081692: Configure should verify that -fstack-protector is valid
ihse
parents: 30740
diff changeset
   449
      # Not all versions of gcc support -fstack-protector
09b01c98ca8d 8081692: Configure should verify that -fstack-protector is valid
ihse
parents: 30740
diff changeset
   450
      STACK_PROTECTOR_CFLAG="-fstack-protector-all"
35451
d0b71f2375d0 8129395: Configure should verify that -fstack-protector is valid - take 2
ihse
parents: 35450
diff changeset
   451
      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
   452
09b01c98ca8d 8081692: Configure should verify that -fstack-protector is valid
ihse
parents: 30740
diff changeset
   453
      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
   454
      CXXFLAGS_DEBUG_OPTIONS="$STACK_PROTECTOR_CFLAG --param ssp-buffer-size=1"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   455
      ;;
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   456
    esac
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   457
  fi
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   458
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   459
  # Optimization levels
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   460
  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
   461
    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
   462
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   463
    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
   464
      # FIXME: seems we always set -xregs=no%frameptr; put it elsewhere more global?
22730
c6ac76f2c90c 8019729: JDK build HIGHEST compiler optimisation setting isn't valid for Sun C++ compiler
erikj
parents: 22721
diff changeset
   465
      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
   466
      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
   467
      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
   468
      C_O_FLAG_DEBUG="-xregs=no%frameptr"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   469
      C_O_FLAG_NONE="-xregs=no%frameptr"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   470
      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
   471
      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
   472
      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
   473
      CXX_O_FLAG_DEBUG="-xregs=no%frameptr"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   474
      CXX_O_FLAG_NONE="-xregs=no%frameptr"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   475
      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
   476
        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
   477
        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
   478
      fi
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   479
    elif test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then
22730
c6ac76f2c90c 8019729: JDK build HIGHEST compiler optimisation setting isn't valid for Sun C++ compiler
erikj
parents: 22721
diff changeset
   480
      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
   481
      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
   482
      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
   483
      C_O_FLAG_DEBUG=""
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   484
      C_O_FLAG_NONE=""
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   485
      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
   486
      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
   487
      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
   488
      CXX_O_FLAG_DEBUG=""
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   489
      CXX_O_FLAG_NONE=""
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   490
    fi
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   491
  else
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   492
    # 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
   493
    # setup for C and duplicate afterwards.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   494
    if test "x$TOOLCHAIN_TYPE" = xgcc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   495
      if test "x$OPENJDK_TARGET_OS" = xmacosx; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   496
        # On MacOSX we optimize for size, something
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   497
        # we should do for all platforms?
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   498
        C_O_FLAG_HIGHEST="-Os"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   499
        C_O_FLAG_HI="-Os"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   500
        C_O_FLAG_NORM="-Os"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   501
      else
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   502
        C_O_FLAG_HIGHEST="-O3"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   503
        C_O_FLAG_HI="-O3"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   504
        C_O_FLAG_NORM="-O2"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   505
      fi
25459
30ba61626044 8047734: Backout use of -Og
mduigou
parents: 25034
diff changeset
   506
      C_O_FLAG_DEBUG="-O0"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   507
      C_O_FLAG_NONE="-O0"
23161
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   508
    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
   509
      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
   510
        # 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
   511
        # we should do for all platforms?
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   512
        C_O_FLAG_HIGHEST="-Os"
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   513
        C_O_FLAG_HI="-Os"
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   514
        C_O_FLAG_NORM="-Os"
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   515
      else
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   516
        C_O_FLAG_HIGHEST="-O3"
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   517
        C_O_FLAG_HI="-O3"
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   518
        C_O_FLAG_NORM="-O2"
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   519
      fi
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   520
      C_O_FLAG_DEBUG="-O0"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   521
      C_O_FLAG_NONE="-O0"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   522
    elif test "x$TOOLCHAIN_TYPE" = xxlc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   523
      C_O_FLAG_HIGHEST="-O3"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   524
      C_O_FLAG_HI="-O3 -qstrict"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   525
      C_O_FLAG_NORM="-O2"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   526
      C_O_FLAG_DEBUG="-qnoopt"
35020
8a7f717c3bc2 8145427: [aix] xlc: wrong flag used to switch off optimization
stuefe
parents: 34120
diff changeset
   527
      C_O_FLAG_NONE="-qnoopt"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   528
    elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   529
      C_O_FLAG_HIGHEST="-O2"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   530
      C_O_FLAG_HI="-O1"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   531
      C_O_FLAG_NORM="-O1"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   532
      C_O_FLAG_DEBUG="-Od"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   533
      C_O_FLAG_NONE="-Od"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   534
    fi
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   535
    CXX_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   536
    CXX_O_FLAG_HI="$C_O_FLAG_HI"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   537
    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
   538
    CXX_O_FLAG_DEBUG="$C_O_FLAG_DEBUG"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   539
    CXX_O_FLAG_NONE="$C_O_FLAG_NONE"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   540
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   541
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   542
  # Adjust optimization flags according to debug level.
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   543
  case $DEBUG_LEVEL in
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   544
    release )
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   545
      # no adjustment
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   546
      ;;
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   547
    fastdebug )
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   548
      # Not quite so much optimization
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   549
      C_O_FLAG_HI="$C_O_FLAG_NORM"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   550
      CXX_O_FLAG_HI="$CXX_O_FLAG_NORM"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   551
      ;;
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   552
    slowdebug )
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   553
      # Disable optimization
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   554
      C_O_FLAG_HIGHEST="$C_O_FLAG_DEBUG"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   555
      C_O_FLAG_HI="$C_O_FLAG_DEBUG"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   556
      C_O_FLAG_NORM="$C_O_FLAG_DEBUG"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   557
      CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_DEBUG"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   558
      CXX_O_FLAG_HI="$CXX_O_FLAG_DEBUG"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   559
      CXX_O_FLAG_NORM="$CXX_O_FLAG_DEBUG"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   560
      ;;
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   561
  esac
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   562
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   563
  AC_SUBST(C_O_FLAG_HIGHEST)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   564
  AC_SUBST(C_O_FLAG_HI)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   565
  AC_SUBST(C_O_FLAG_NORM)
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   566
  AC_SUBST(C_O_FLAG_DEBUG)
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   567
  AC_SUBST(C_O_FLAG_NONE)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   568
  AC_SUBST(CXX_O_FLAG_HIGHEST)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   569
  AC_SUBST(CXX_O_FLAG_HI)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   570
  AC_SUBST(CXX_O_FLAG_NORM)
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   571
  AC_SUBST(CXX_O_FLAG_DEBUG)
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   572
  AC_SUBST(CXX_O_FLAG_NONE)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   573
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   574
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   575
AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK],
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   576
[
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   577
  # Special extras...
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   578
  if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   579
    if test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   580
      CFLAGS_JDKLIB_EXTRA="${CFLAGS_JDKLIB_EXTRA} -xregs=no%appl"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   581
      CXXFLAGS_JDKLIB_EXTRA="${CXXFLAGS_JDKLIB_EXTRA} -xregs=no%appl"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   582
    fi
29304
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
   583
    CFLAGS_JDKLIB_EXTRA="${CFLAGS_JDKLIB_EXTRA} -errtags=yes -errfmt"
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
   584
    CXXFLAGS_JDKLIB_EXTRA="${CXXFLAGS_JDKLIB_EXTRA} -errtags=yes -errfmt"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   585
  elif test "x$TOOLCHAIN_TYPE" = xxlc; then
29451
443fdcba9598 8075515: AIX: cleanup xlc options and use -bernotok to detect missing symbols at build time
simonis
parents: 29305
diff changeset
   586
    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
   587
    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
   588
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   589
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   590
  CFLAGS_JDK="${CFLAGS_JDK} $EXTRA_CFLAGS"
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   591
  CXXFLAGS_JDK="${CXXFLAGS_JDK} $EXTRA_CXXFLAGS"
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   592
  LDFLAGS_JDK="${LDFLAGS_JDK} $EXTRA_LDFLAGS"
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   593
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   594
  ###############################################################################
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   595
  #
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   596
  # Now setup the CFLAGS and LDFLAGS for the JDK build.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   597
  # 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
   598
  #
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   599
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   600
  # Setup compiler/platform specific flags into
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   601
  #    CFLAGS_JDK    - C Compiler flags
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   602
  #    CXXFLAGS_JDK  - C++ Compiler flags
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   603
  #    COMMON_CCXXFLAGS_JDK - common to C and C++
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   604
  if test "x$TOOLCHAIN_TYPE" = xgcc; then
30418
aa3cd6848aa0 8039426: gcc can target wrong instruction set when building JDK native code
erikj
parents: 30415
diff changeset
   605
    if test "x$OPENJDK_TARGET_CPU" = xx86; then
aa3cd6848aa0 8039426: gcc can target wrong instruction set when building JDK native code
erikj
parents: 30415
diff changeset
   606
      # Force compatibility with i586 on 32 bit intel platforms.
aa3cd6848aa0 8039426: gcc can target wrong instruction set when building JDK native code
erikj
parents: 30415
diff changeset
   607
      COMMON_CCXXFLAGS="${COMMON_CCXXFLAGS} -march=i586"
aa3cd6848aa0 8039426: gcc can target wrong instruction set when building JDK native code
erikj
parents: 30415
diff changeset
   608
    fi
29304
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
   609
    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_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
   610
        -pipe -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   611
    case $OPENJDK_TARGET_CPU_ARCH in
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   612
      arm )
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   613
        # on arm we don't prevent gcc to omit frame pointer but do prevent strict aliasing
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   614
        CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   615
        ;;
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   616
      ppc )
23981
6ae1260c5cab 8041141: JDK9 emb build failure on PPC platform
dholmes
parents: 23428
diff changeset
   617
        # on ppc we don't prevent gcc to omit frame pointer but do prevent strict aliasing
6ae1260c5cab 8041141: JDK9 emb build failure on PPC platform
dholmes
parents: 23428
diff changeset
   618
        CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   619
        ;;
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   620
      * )
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   621
        COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   622
        CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   623
        ;;
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   624
    esac
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   625
  elif test "x$TOOLCHAIN_TYPE" = xclang; then
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   626
    if test "x$OPENJDK_TARGET_OS" = xlinux; then
35444
4d323e794486 8148655: LOG=cmdlines and other build-infra fixes
ihse
parents: 35032
diff changeset
   627
      if test "x$OPENJDK_TARGET_CPU" = xx86; then
4d323e794486 8148655: LOG=cmdlines and other build-infra fixes
ihse
parents: 35032
diff changeset
   628
        # Force compatibility with i586 on 32 bit intel platforms.
4d323e794486 8148655: LOG=cmdlines and other build-infra fixes
ihse
parents: 35032
diff changeset
   629
        COMMON_CCXXFLAGS="${COMMON_CCXXFLAGS} -march=i586"
4d323e794486 8148655: LOG=cmdlines and other build-infra fixes
ihse
parents: 35032
diff changeset
   630
      fi
4d323e794486 8148655: LOG=cmdlines and other build-infra fixes
ihse
parents: 35032
diff changeset
   631
      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2 \
4d323e794486 8148655: LOG=cmdlines and other build-infra fixes
ihse
parents: 35032
diff changeset
   632
          -pipe -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
4d323e794486 8148655: LOG=cmdlines and other build-infra fixes
ihse
parents: 35032
diff changeset
   633
      case $OPENJDK_TARGET_CPU_ARCH in
4d323e794486 8148655: LOG=cmdlines and other build-infra fixes
ihse
parents: 35032
diff changeset
   634
        ppc )
4d323e794486 8148655: LOG=cmdlines and other build-infra fixes
ihse
parents: 35032
diff changeset
   635
          # on ppc we don't prevent gcc to omit frame pointer but do prevent strict aliasing
4d323e794486 8148655: LOG=cmdlines and other build-infra fixes
ihse
parents: 35032
diff changeset
   636
          CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
4d323e794486 8148655: LOG=cmdlines and other build-infra fixes
ihse
parents: 35032
diff changeset
   637
          ;;
4d323e794486 8148655: LOG=cmdlines and other build-infra fixes
ihse
parents: 35032
diff changeset
   638
        * )
4d323e794486 8148655: LOG=cmdlines and other build-infra fixes
ihse
parents: 35032
diff changeset
   639
          COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer"
4d323e794486 8148655: LOG=cmdlines and other build-infra fixes
ihse
parents: 35032
diff changeset
   640
          CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
4d323e794486 8148655: LOG=cmdlines and other build-infra fixes
ihse
parents: 35032
diff changeset
   641
          ;;
4d323e794486 8148655: LOG=cmdlines and other build-infra fixes
ihse
parents: 35032
diff changeset
   642
      esac
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   643
    fi
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   644
  elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   645
    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   646
    if test "x$OPENJDK_TARGET_CPU_ARCH" = xx86; then
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   647
      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DcpuIntel -Di586 -D$OPENJDK_TARGET_CPU_LEGACY_LIB"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   648
    fi
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   649
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   650
    CFLAGS_JDK="$CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -W0,-noglobal"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   651
    CXXFLAGS_JDK="$CXXFLAGS_JDK -errtags=yes +w -mt -features=no%except -DCC_NOEX -norunpath -xnolib"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   652
  elif test "x$TOOLCHAIN_TYPE" = xxlc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   653
    CFLAGS_JDK="$CFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   654
    CXXFLAGS_JDK="$CXXFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   655
  elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 27602
diff changeset
   656
    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS $COMMON_CCXXFLAGS_JDK \
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 27602
diff changeset
   657
        -Zi -MD -Zc:wchar_t- -W3 -wd4800 \
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 27602
diff changeset
   658
        -DWIN32_LEAN_AND_MEAN \
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 27602
diff changeset
   659
        -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
   660
        -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
   661
        -DWIN32 -DIAL"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   662
    if test "x$OPENJDK_TARGET_CPU" = xx86_64; then
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   663
      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_AMD64_ -Damd64"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   664
    else
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   665
      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_X86_ -Dx86"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   666
    fi
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 27602
diff changeset
   667
    # 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
   668
    # 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
   669
    # studio.
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 27602
diff changeset
   670
    if test "x$TOOLCHAIN_VERSION" = "x2010"; then
35747
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   671
      STATIC_CPPLIB_FLAGS="-D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB"
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   672
      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK $STATIC_CPPLIB_FLAGS"
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 27602
diff changeset
   673
    fi
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   674
  fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   675
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   676
  ###############################################################################
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   677
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   678
  # Adjust flags according to debug level.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   679
  case $DEBUG_LEVEL in
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   680
    fastdebug | slowdebug )
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   681
      CFLAGS_JDK="$CFLAGS_JDK $CFLAGS_DEBUG_SYMBOLS $CFLAGS_DEBUG_OPTIONS"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   682
      CXXFLAGS_JDK="$CXXFLAGS_JDK $CXXFLAGS_DEBUG_SYMBOLS $CXXFLAGS_DEBUG_OPTIONS"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   683
      JAVAC_FLAGS="$JAVAC_FLAGS -g"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   684
      ;;
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   685
    release )
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   686
      ;;
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   687
    * )
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   688
      AC_MSG_ERROR([Unrecognized \$DEBUG_LEVEL: $DEBUG_LEVEL])
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   689
      ;;
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   690
  esac
18020
eade0d9836bf 8014404: Debug flag not added to jdk native compile when --enable-debug is set
erikj
parents: 17664
diff changeset
   691
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   692
  # 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
   693
  # -D is universally accepted.
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   694
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   695
  # Setup endianness
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   696
  if test "x$OPENJDK_TARGET_CPU_ENDIAN" = xlittle; then
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   697
    # 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
   698
    #   Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   699
    #   (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
   700
    #   Note: -Dmacro         is the same as    #define macro 1
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   701
    #         -Dmacro=        is the same as    #define macro
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   702
    if test "x$OPENJDK_TARGET_OS" = xsolaris; then
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   703
      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_LITTLE_ENDIAN="
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   704
    else
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   705
      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_LITTLE_ENDIAN"
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   706
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   707
  else
23428
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23423
diff changeset
   708
    # 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
   709
    # are defined in the system?
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23423
diff changeset
   710
    if test "x$OPENJDK_TARGET_OS" = xsolaris; then
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   711
      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_BIG_ENDIAN="
23428
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23423
diff changeset
   712
    else
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   713
      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_BIG_ENDIAN"
23428
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23423
diff changeset
   714
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   715
  fi
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   716
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   717
  # Setup target OS define. Use OS target name but in upper case.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   718
  OPENJDK_TARGET_OS_UPPERCASE=`$ECHO $OPENJDK_TARGET_OS | $TR 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   719
  COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D$OPENJDK_TARGET_OS_UPPERCASE"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   720
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   721
  # Setup target CPU
36506
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   722
  OPENJDK_TARGET_CCXXFLAGS_JDK="$OPENJDK_TARGET_CCXXFLAGS_JDK \
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   723
      $ADD_LP64 \
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   724
      -DARCH='\"$OPENJDK_TARGET_CPU_LEGACY\"' -D$OPENJDK_TARGET_CPU_LEGACY"
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   725
  OPENJDK_BUILD_CCXXFLAGS_JDK="$OPENJDK_BUILD_CCXXFLAGS_JDK \
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   726
      $OPENJDK_BUILD_ADD_LP64 \
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   727
      -DARCH='\"$OPENJDK_BUILD_CPU_LEGACY\"' -D$OPENJDK_BUILD_CPU_LEGACY"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   728
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   729
  # Setup debug/release defines
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   730
  if test "x$DEBUG_LEVEL" = xrelease; then
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   731
    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DNDEBUG"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   732
    if test "x$OPENJDK_TARGET_OS" = xsolaris; then
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   733
      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DTRIMMED"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   734
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   735
  else
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   736
    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DDEBUG"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   737
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   738
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   739
  # Set some additional per-OS defines.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   740
  if test "x$OPENJDK_TARGET_OS" = xmacosx; then
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   741
    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   742
  elif test "x$OPENJDK_TARGET_OS" = xbsd; then
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   743
    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_ALLBSD_SOURCE"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   744
  fi
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   745
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   746
  # Additional macosx handling
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   747
  if test "x$OPENJDK_TARGET_OS" = xmacosx; then
25034
d9ca34c227b8 8043340: [macosx] Fix hard-wired paths to JavaVM.framework
ddehaven
parents: 24911
diff changeset
   748
    # 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
   749
    # 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
   750
    # 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
   751
    # The expected format is X.Y.Z
d9ca34c227b8 8043340: [macosx] Fix hard-wired paths to JavaVM.framework
ddehaven
parents: 24911
diff changeset
   752
    MACOSX_VERSION_MIN=10.7.0
d9ca34c227b8 8043340: [macosx] Fix hard-wired paths to JavaVM.framework
ddehaven
parents: 24911
diff changeset
   753
    AC_SUBST(MACOSX_VERSION_MIN)
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   754
25034
d9ca34c227b8 8043340: [macosx] Fix hard-wired paths to JavaVM.framework
ddehaven
parents: 24911
diff changeset
   755
    # 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
   756
    # 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
   757
    # command line.
d9ca34c227b8 8043340: [macosx] Fix hard-wired paths to JavaVM.framework
ddehaven
parents: 24911
diff changeset
   758
    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
d9ca34c227b8 8043340: [macosx] Fix hard-wired paths to JavaVM.framework
ddehaven
parents: 24911
diff changeset
   759
    LDFLAGS_JDK="$LDFLAGS_JDK -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   760
  fi
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
  # Setup some hard coded includes
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   763
  COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK \
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 25459
diff changeset
   764
      -I${JDK_TOPDIR}/src/java.base/share/native/include \
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 25459
diff changeset
   765
      -I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS/native/include \
33562
c76b2fa11486 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 32813
diff changeset
   766
      -I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/include \
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   767
      -I${JDK_TOPDIR}/src/java.base/share/native/libjava \
33562
c76b2fa11486 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 32813
diff changeset
   768
      -I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/libjava"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   769
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   770
  # The shared libraries are compiled using the picflag.
36506
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   771
  CFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $OPENJDK_TARGET_CCXXFLAGS_JDK \
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   772
      $CFLAGS_JDK $EXTRA_CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA"
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   773
  CXXFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $OPENJDK_TARGET_CCXXFLAGS_JDK \
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   774
      $CXXFLAGS_JDK $EXTRA_CXXFLAGS_JDK $PICFLAG $CXXFLAGS_JDKLIB_EXTRA"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   775
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   776
  # Executable flags
36506
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   777
  CFLAGS_JDKEXE="$COMMON_CCXXFLAGS_JDK $OPENJDK_TARGET_CCXXFLAGS_JDK \
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   778
      $CFLAGS_JDK $EXTRA_CFLAGS_JDK"
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   779
  CXXFLAGS_JDKEXE="$COMMON_CCXXFLAGS_JDK $OPENJDK_TARGET_CCXXFLAGS_JDK \
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   780
      $CXXFLAGS_JDK $EXTRA_CXXFLAGS_JDK"
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   781
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   782
  # The corresponding flags for building for the build platform. This is still an
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   783
  # approximation, we only need something that runs on this machine when cross
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   784
  # compiling the product.
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   785
  OPENJDK_BUILD_CFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $OPENJDK_BUILD_CCXXFLAGS_JDK \
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   786
      $PICFLAG $CFLAGS_JDKLIB_EXTRA"
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   787
  OPENJDK_BUILD_CXXFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $OPENJDK_BUILD_CCXXFLAGS_JDK \
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   788
      $PICFLAG $CXXFLAGS_JDKLIB_EXTRA"
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   789
  OPENJDK_BUILD_CFLAGS_JDKEXE="$COMMON_CCXXFLAGS_JDK $OPENJDK_BUILD_CCXXFLAGS_JDK"
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   790
  OPENJDK_BUILD_CXXFLAGS_JDKEXE="$COMMON_CCXXFLAGS_JDK $OPENJDK_BUILD_CCXXFLAGS_JDK"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   791
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   792
  AC_SUBST(CFLAGS_JDKLIB)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   793
  AC_SUBST(CFLAGS_JDKEXE)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   794
  AC_SUBST(CXXFLAGS_JDKLIB)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   795
  AC_SUBST(CXXFLAGS_JDKEXE)
36506
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   796
  AC_SUBST(OPENJDK_BUILD_CFLAGS_JDKLIB)
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   797
  AC_SUBST(OPENJDK_BUILD_CFLAGS_JDKEXE)
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   798
  AC_SUBST(OPENJDK_BUILD_CXXFLAGS_JDKLIB)
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   799
  AC_SUBST(OPENJDK_BUILD_CXXFLAGS_JDKEXE)
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   800
29305
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   801
  # Flags for compiling test libraries
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   802
  CFLAGS_TESTLIB="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA"
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   803
  CXXFLAGS_TESTLIB="$COMMON_CCXXFLAGS_JDK $CXXFLAGS_JDK $PICFLAG $CXXFLAGS_JDKLIB_EXTRA"
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   804
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   805
  # Flags for compiling test executables
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   806
  CFLAGS_TESTEXE="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK"
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   807
  CXXFLAGS_TESTEXE="$COMMON_CCXXFLAGS_JDK $CXXFLAGS_JDK"
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   808
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   809
  AC_SUBST(CFLAGS_TESTLIB)
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   810
  AC_SUBST(CFLAGS_TESTEXE)
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   811
  AC_SUBST(CXXFLAGS_TESTLIB)
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   812
  AC_SUBST(CXXFLAGS_TESTEXE)
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   813
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   814
  # Setup LDFLAGS et al.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   815
  #
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   816
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   817
  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
35747
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   818
    LDFLAGS_MICROSOFT="-nologo -opt:ref"
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   819
    LDFLAGS_JDK="$LDFLAGS_JDK $LDFLAGS_MICROSOFT -incremental:no"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   820
    if test "x$OPENJDK_TARGET_CPU_BITS" = "x32"; then
35747
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   821
      LDFLAGS_SAFESH="-safeseh"
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   822
      LDFLAGS_JDK="$LDFLAGS_JDK $LDFLAGS_SAFESH"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   823
    fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   824
    # TODO: make -debug optional "--disable-full-debug-symbols"
35747
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   825
    LDFLAGS_MICROSOFT_DEBUG="-debug"
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   826
    LDFLAGS_JDK="$LDFLAGS_JDK $LDFLAGS_MICROSOFT_DEBUG"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   827
  elif test "x$TOOLCHAIN_TYPE" = xgcc; then
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   828
    # 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
   829
    # 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
   830
    if test -n "$HAS_GNU_HASH"; then
35747
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   831
      LDFLAGS_HASH_STYLE="-Wl,--hash-style=both"
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   832
      LDFLAGS_JDK="${LDFLAGS_JDK} $LDFLAGS_HASH_STYLE"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   833
    fi
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   834
    if test "x$OPENJDK_TARGET_OS" = xlinux; then
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   835
      # 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
   836
      # undefined symbols in object files.
35747
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   837
      LDFLAGS_NO_UNDEF_SYM="-Wl,-z,defs"
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   838
      LDFLAGS_JDK="${LDFLAGS_JDK} $LDFLAGS_NO_UNDEF_SYM"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   839
      case $DEBUG_LEVEL in
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   840
        release )
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   841
          # tell linker to optimize libraries.
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   842
          # Should this be supplied to the OSS linker as well?
35747
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   843
          LDFLAGS_DEBUGLEVEL_release="-Wl,-O1"
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   844
          LDFLAGS_JDK="${LDFLAGS_JDK} $LDFLAGS_DEBUGLEVEL_release"
24911
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
        slowdebug )
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   847
          if test "x$HAS_LINKER_NOW" = "xtrue"; then
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   848
            # do relocations at load
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   849
            LDFLAGS_JDK="$LDFLAGS_JDK $LINKER_NOW_FLAG"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   850
            LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK $LINKER_NOW_FLAG"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   851
          fi
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   852
          if test "x$HAS_LINKER_RELRO" = "xtrue"; then
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   853
            # mark relocations read only
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   854
            LDFLAGS_JDK="$LDFLAGS_JDK $LINKER_RELRO_FLAG"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   855
            LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK $LINKER_RELRO_FLAG"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   856
          fi
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   857
          ;;
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   858
        fastdebug )
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   859
          if test "x$HAS_LINKER_RELRO" = "xtrue"; then
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   860
            # mark relocations read only
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   861
            LDFLAGS_JDK="$LDFLAGS_JDK $LINKER_RELRO_FLAG"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   862
            LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK $LINKER_RELRO_FLAG"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   863
          fi
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   864
          ;;
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   865
        * )
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   866
          AC_MSG_ERROR([Unrecognized \$DEBUG_LEVEL: $DEBUG_LEVEL])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   867
          ;;
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   868
        esac
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   869
    fi
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   870
  elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
35747
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   871
    LDFLAGS_SOLSTUDIO="-Wl,-z,defs"
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   872
    LDFLAGS_JDK="$LDFLAGS_JDK $LDFLAGS_SOLSTUDIO -xildoff -ztext"
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   873
    LDFLAGS_CXX_SOLSTUDIO="-norunpath"
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   874
    LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK $LDFLAGS_CXX_SOLSTUDIO -xnolib"
29451
443fdcba9598 8075515: AIX: cleanup xlc options and use -bernotok to detect missing symbols at build time
simonis
parents: 29305
diff changeset
   875
  elif test "x$TOOLCHAIN_TYPE" = xxlc; then
36051
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   876
    LDFLAGS_XLC="-b64 -brtl -bnolibpath -bexpall -bernotok"
35747
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
   877
    LDFLAGS_JDK="${LDFLAGS_JDK} $LDFLAGS_XLC"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   878
  fi
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   879
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   880
  # Customize LDFLAGS for executables
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   881
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   882
  LDFLAGS_JDKEXE="${LDFLAGS_JDK}"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   883
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   884
  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   885
    if test "x$OPENJDK_TARGET_CPU_BITS" = "x64"; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   886
      LDFLAGS_STACK_SIZE=1048576
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   887
    else
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   888
      LDFLAGS_STACK_SIZE=327680
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   889
    fi
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   890
    LDFLAGS_JDKEXE="${LDFLAGS_JDKEXE} /STACK:$LDFLAGS_STACK_SIZE"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   891
  elif test "x$OPENJDK_TARGET_OS" = xlinux; then
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   892
    LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE -Wl,--allow-shlib-undefined"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   893
  fi
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   894
36506
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   895
  OPENJDK_BUILD_LDFLAGS_JDKEXE="${LDFLAGS_JDKEXE}"
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   896
  LDFLAGS_JDKEXE="${LDFLAGS_JDKEXE} ${EXTRA_LDFLAGS_JDK}"
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   897
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   898
  # Customize LDFLAGS for libs
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   899
  LDFLAGS_JDKLIB="${LDFLAGS_JDK}"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   900
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   901
  LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} ${SHARED_LIBRARY_FLAGS}"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   902
  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   903
    LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} \
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   904
        -libpath:${OUTPUT_ROOT}/support/modules_libs/java.base"
33394
dbd286b8742f 8140661: Rename LDFLAGS_SUFFIX to LIBS
ihse
parents: 32813
diff changeset
   905
    JDKLIB_LIBS=""
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   906
  else
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   907
    LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} \
36506
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   908
        -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)"
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   909
14465
d529faf5e36a 8001460: build-infra: Linker warnings on macosx
erikj
parents: 14464
diff changeset
   910
    # 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
   911
    # Add server first if available. Linking aginst client does not always produce the same results.
14810
4e7fee179b4a 7190137: Add support for JVM_VARIANT minimal1
dholmes
parents: 14614
diff changeset
   912
    # Only add client dir if client is being built. Add minimal (note not minimal1) if only building minimal1.
4e7fee179b4a 7190137: Add support for JVM_VARIANT minimal1
dholmes
parents: 14614
diff changeset
   913
    # Default to server for other variants.
14467
a973c0a1bd5d 8003528: build-infra: Diffs in libjava and hotspot libs on solaris.
erikj
parents: 14465
diff changeset
   914
    if test "x$JVM_VARIANT_SERVER" = xtrue; then
36506
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   915
      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/server"
14467
a973c0a1bd5d 8003528: build-infra: Diffs in libjava and hotspot libs on solaris.
erikj
parents: 14465
diff changeset
   916
    elif test "x$JVM_VARIANT_CLIENT" = xtrue; then
36506
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   917
      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/client"
14810
4e7fee179b4a 7190137: Add support for JVM_VARIANT minimal1
dholmes
parents: 14614
diff changeset
   918
    elif test "x$JVM_VARIANT_MINIMAL1" = xtrue; then
36506
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   919
      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/minimal"
14465
d529faf5e36a 8001460: build-infra: Linker warnings on macosx
erikj
parents: 14464
diff changeset
   920
    else
36506
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   921
      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/server"
14465
d529faf5e36a 8001460: build-infra: Linker warnings on macosx
erikj
parents: 14464
diff changeset
   922
    fi
d529faf5e36a 8001460: build-infra: Linker warnings on macosx
erikj
parents: 14464
diff changeset
   923
33394
dbd286b8742f 8140661: Rename LDFLAGS_SUFFIX to LIBS
ihse
parents: 32813
diff changeset
   924
    JDKLIB_LIBS="-ljava -ljvm"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   925
    if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
33394
dbd286b8742f 8140661: Rename LDFLAGS_SUFFIX to LIBS
ihse
parents: 32813
diff changeset
   926
      JDKLIB_LIBS="$JDKLIB_LIBS -lc"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   927
    fi
36506
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   928
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   929
    # When building a buildjdk, it's always only the server variant
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   930
    OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} \
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   931
        -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base\$(OPENJDK_TARGET_CPU_LIBDIR)/server"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   932
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   933
36506
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   934
  OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} ${LDFLAGS_JDKLIB}"
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   935
  LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} ${EXTRA_LDFLAGS_JDK}"
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   936
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   937
  AC_SUBST(LDFLAGS_JDKLIB)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   938
  AC_SUBST(LDFLAGS_JDKEXE)
36506
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   939
  AC_SUBST(OPENJDK_BUILD_LDFLAGS_JDKLIB)
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
   940
  AC_SUBST(OPENJDK_BUILD_LDFLAGS_JDKEXE)
33394
dbd286b8742f 8140661: Rename LDFLAGS_SUFFIX to LIBS
ihse
parents: 32813
diff changeset
   941
  AC_SUBST(JDKLIB_LIBS)
dbd286b8742f 8140661: Rename LDFLAGS_SUFFIX to LIBS
ihse
parents: 32813
diff changeset
   942
  AC_SUBST(JDKEXE_LIBS)
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   943
  AC_SUBST(LDFLAGS_CXX_JDK)
36050
f6590b6e5e97 8150203: Incremental update from build-infra project
ihse
parents: 35747
diff changeset
   944
  AC_SUBST(LDFLAGS_HASH_STYLE)
29305
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   945
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   946
  LDFLAGS_TESTLIB="$LDFLAGS_JDKLIB"
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   947
  LDFLAGS_TESTEXE="$LDFLAGS_JDKEXE"
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   948
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   949
  AC_SUBST(LDFLAGS_TESTLIB)
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   950
  AC_SUBST(LDFLAGS_TESTEXE)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   951
])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   952
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   953
# FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   954
#                                   IF_FALSE: [RUN-IF-FALSE])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   955
# ------------------------------------------------------------
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   956
# Check that the c and c++ compilers support an argument
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   957
BASIC_DEFUN_NAMED([FLAGS_COMPILER_CHECK_ARGUMENTS],
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   958
    [*ARGUMENT IF_TRUE IF_FALSE], [$@],
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   959
[
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   960
  AC_MSG_CHECKING([if compiler supports "ARG_ARGUMENT"])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   961
  supports=yes
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   962
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   963
  saved_cflags="$CFLAGS"
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   964
  CFLAGS="$CFLAGS ARG_ARGUMENT"
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   965
  AC_LANG_PUSH([C])
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   966
  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   967
      [supports=no])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   968
  AC_LANG_POP([C])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   969
  CFLAGS="$saved_cflags"
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   970
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   971
  saved_cxxflags="$CXXFLAGS"
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   972
  CXXFLAGS="$CXXFLAG ARG_ARGUMENT"
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   973
  AC_LANG_PUSH([C++])
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   974
  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   975
      [supports=no])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   976
  AC_LANG_POP([C++])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   977
  CXXFLAGS="$saved_cxxflags"
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   978
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   979
  AC_MSG_RESULT([$supports])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   980
  if test "x$supports" = "xyes" ; then
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   981
    :
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   982
    ARG_IF_TRUE
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   983
  else
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   984
    :
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   985
    ARG_IF_FALSE
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   986
  fi
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   987
])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   988
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   989
# FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   990
#                                   IF_FALSE: [RUN-IF-FALSE])
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   991
# ------------------------------------------------------------
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   992
# Check that the linker support an argument
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   993
BASIC_DEFUN_NAMED([FLAGS_LINKER_CHECK_ARGUMENTS],
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   994
    [*ARGUMENT IF_TRUE IF_FALSE], [$@],
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   995
[
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   996
  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
   997
  supports=yes
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   998
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   999
  saved_ldflags="$LDFLAGS"
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1000
  LDFLAGS="$LDFLAGS ARG_ARGUMENT"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1001
  AC_LANG_PUSH([C])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1002
  AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1003
      [], [supports=no])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1004
  AC_LANG_POP([C])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1005
  LDFLAGS="$saved_ldflags"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1006
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1007
  AC_MSG_RESULT([$supports])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1008
  if test "x$supports" = "xyes" ; then
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1009
    :
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1010
    ARG_IF_TRUE
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1011
  else
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1012
    :
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1013
    ARG_IF_FALSE
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1014
  fi
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1015
])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
  1016
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
  1017
AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_MISC],
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1018
[
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1019
  # Some Zero and Shark settings.
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1020
  # ZERO_ARCHFLAG tells the compiler which mode to build for
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1021
  case "${OPENJDK_TARGET_CPU}" in
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1022
    s390)
22466
25aaf85d1ada 8024265: Enable new build on AIX
simonis
parents: 22465
diff changeset
  1023
      ZERO_ARCHFLAG="${COMPILER_TARGET_BITS_FLAG}31"
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1024
      ;;
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1025
    *)
22466
25aaf85d1ada 8024265: Enable new build on AIX
simonis
parents: 22465
diff changeset
  1026
      ZERO_ARCHFLAG="${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1027
  esac
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1028
  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
  1029
  AC_SUBST(ZERO_ARCHFLAG)
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1030
22466
25aaf85d1ada 8024265: Enable new build on AIX
simonis
parents: 22465
diff changeset
  1031
  # 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
  1032
  # Set COMPILER_SUPPORTS_TARGET_BITS_FLAG to 'true' if it does
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1033
  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
  1034
      IF_TRUE: [COMPILER_SUPPORTS_TARGET_BITS_FLAG=true],
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1035
      IF_FALSE: [COMPILER_SUPPORTS_TARGET_BITS_FLAG=false])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1036
  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
  1037
30415
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1038
  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
  1039
      [do not consider native warnings to be an error @<:@enabled@:>@])])
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1040
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1041
  AC_MSG_CHECKING([if native warnings are errors])
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1042
  if test "x$enable_warnings_as_errors" = "xyes"; then
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1043
    AC_MSG_RESULT([yes (explicitely set)])
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1044
    WARNINGS_AS_ERRORS=true
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1045
  elif test "x$enable_warnings_as_errors" = "xno"; then
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1046
    AC_MSG_RESULT([no])
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1047
    WARNINGS_AS_ERRORS=false
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1048
  elif test "x$enable_warnings_as_errors" = "x"; then
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1049
    AC_MSG_RESULT([yes (default)])
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1050
    WARNINGS_AS_ERRORS=true
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1051
  else
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1052
    AC_MSG_ERROR([--enable-warnings-as-errors accepts no argument])
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1053
  fi
33443
ea274e904321 8141543: Propagate --disable-warnings-as-errors to hotspot
ihse
parents: 33440
diff changeset
  1054
ea274e904321 8141543: Propagate --disable-warnings-as-errors to hotspot
ihse
parents: 33440
diff changeset
  1055
  if test "x$WARNINGS_AS_ERRORS" = "xfalse"; then
ea274e904321 8141543: Propagate --disable-warnings-as-errors to hotspot
ihse
parents: 33440
diff changeset
  1056
    # Set legacy hotspot variable
33445
9131d6736fd0 8141574: recent change for 8141543 breaks all builds
erikj
parents: 33443
diff changeset
  1057
    HOTSPOT_SET_WARNINGS_AS_ERRORS="WARNINGS_ARE_ERRORS="
33443
ea274e904321 8141543: Propagate --disable-warnings-as-errors to hotspot
ihse
parents: 33440
diff changeset
  1058
  else
33445
9131d6736fd0 8141574: recent change for 8141543 breaks all builds
erikj
parents: 33443
diff changeset
  1059
    HOTSPOT_SET_WARNINGS_AS_ERRORS=""
33443
ea274e904321 8141543: Propagate --disable-warnings-as-errors to hotspot
ihse
parents: 33440
diff changeset
  1060
  fi
ea274e904321 8141543: Propagate --disable-warnings-as-errors to hotspot
ihse
parents: 33440
diff changeset
  1061
30415
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1062
  AC_SUBST(WARNINGS_AS_ERRORS)
33443
ea274e904321 8141543: Propagate --disable-warnings-as-errors to hotspot
ihse
parents: 33440
diff changeset
  1063
  AC_SUBST(HOTSPOT_SET_WARNINGS_AS_ERRORS)
30415
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
  1064
23423
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
  1065
  case "${TOOLCHAIN_TYPE}" in
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
  1066
    microsoft)
29304
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
  1067
      DISABLE_WARNING_PREFIX="-wd"
25882
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 25854
diff changeset
  1068
      CFLAGS_WARNINGS_ARE_ERRORS="-WX"
23423
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
  1069
      ;;
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
  1070
    solstudio)
29304
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
  1071
      DISABLE_WARNING_PREFIX="-erroff="
23423
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
  1072
      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
  1073
      ;;
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
  1074
    gcc)
29304
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
  1075
      # 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
  1076
      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
  1077
          IF_TRUE: [GCC_CAN_DISABLE_WARNINGS=true],
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1078
          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
  1079
      )
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
  1080
      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
  1081
        DISABLE_WARNING_PREFIX="-Wno-"
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
  1082
      else
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
  1083
        DISABLE_WARNING_PREFIX=
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
  1084
      fi
23423
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
  1085
      CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
34102
c0a98357f847 8143141: Bring in minor build changes from the jigsaw/jake forest
erikj
parents: 33571
diff changeset
  1086
      # Repeate the check for the BUILD_CC
c0a98357f847 8143141: Bring in minor build changes from the jigsaw/jake forest
erikj
parents: 33571
diff changeset
  1087
      CC_OLD="$CC"
c0a98357f847 8143141: Bring in minor build changes from the jigsaw/jake forest
erikj
parents: 33571
diff changeset
  1088
      CC="$BUILD_CC"
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1089
      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
  1090
          IF_TRUE: [BUILD_CC_CAN_DISABLE_WARNINGS=true],
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
  1091
          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
  1092
      )
c0a98357f847 8143141: Bring in minor build changes from the jigsaw/jake forest
erikj
parents: 33571
diff changeset
  1093
      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
  1094
        BUILD_CC_DISABLE_WARNING_PREFIX="-Wno-"
c0a98357f847 8143141: Bring in minor build changes from the jigsaw/jake forest
erikj
parents: 33571
diff changeset
  1095
      else
c0a98357f847 8143141: Bring in minor build changes from the jigsaw/jake forest
erikj
parents: 33571
diff changeset
  1096
        BUILD_CC_DISABLE_WARNING_PREFIX=
c0a98357f847 8143141: Bring in minor build changes from the jigsaw/jake forest
erikj
parents: 33571
diff changeset
  1097
      fi
c0a98357f847 8143141: Bring in minor build changes from the jigsaw/jake forest
erikj
parents: 33571
diff changeset
  1098
      CC="$CC_OLD"
23423
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
  1099
      ;;
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
  1100
    clang)
29304
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
  1101
      DISABLE_WARNING_PREFIX="-Wno-"
23423
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
  1102
      CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
  1103
      ;;
35747
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
  1104
    xlc)
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
  1105
      DISABLE_WARNING_PREFIX="-qsuppress="
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
  1106
      CFLAGS_WARNINGS_ARE_ERRORS="-qhalt=w"
aeaa6d0101a8 8149647: Incremental enhancements from build-infra
ihse
parents: 35451
diff changeset
  1107
      ;;
23423
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
  1108
  esac
29304
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
  1109
  AC_SUBST(DISABLE_WARNING_PREFIX)
36506
17612cee3530 8142968: Module System implementation
alanb
parents: 36051
diff changeset
  1110
  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
  1111
  AC_SUBST(CFLAGS_WARNINGS_ARE_ERRORS)
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1112
])