common/autoconf/flags.m4
author lana
Thu, 22 Oct 2015 08:47:53 -0700
changeset 33329 15a50c5e0668
parent 32813 407e8f8bd95b
child 33562 c76b2fa11486
child 33394 dbd286b8742f
child 33950 7757ee805a0c
permissions -rw-r--r--
Added tag jdk9-b88 for changeset b543e47c74b1
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
#
29304
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
     2
# Copyright (c) 2011, 2015, 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.
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    75
AC_DEFUN_ONCE([FLAGS_SETUP_SYSROOT_FLAGS],
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    76
[
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    77
  if test "x$SYSROOT" != "x"; then
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    78
    if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    79
      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
    80
        # 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
    81
        # make sure the default include and lib dirs are appended to each
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    82
        # compile and link command line.
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    83
        SYSROOT_CFLAGS="-I$SYSROOT/usr/include"
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    84
        SYSROOT_LDFLAGS="-L$SYSROOT/usr/lib$OPENJDK_TARGET_CPU_ISADIR \
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    85
            -L$SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR \
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    86
            -L$SYSROOT/usr/ccs/lib$OPENJDK_TARGET_CPU_ISADIR"
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    87
      fi
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    88
    elif test "x$TOOLCHAIN_TYPE" = xgcc; then
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    89
      SYSROOT_CFLAGS="--sysroot=$SYSROOT"
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    90
      SYSROOT_LDFLAGS="--sysroot=$SYSROOT"
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    91
    elif test "x$TOOLCHAIN_TYPE" = xclang; then
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    92
      SYSROOT_CFLAGS="-isysroot $SYSROOT"
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    93
      SYSROOT_LDFLAGS="-isysroot $SYSROOT"
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    94
    fi
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    95
    # Propagate the sysroot args to hotspot
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    96
    LEGACY_EXTRA_CFLAGS="$LEGACY_EXTRA_CFLAGS $SYSROOT_CFLAGS"
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    97
    LEGACY_EXTRA_CXXFLAGS="$LEGACY_EXTRA_CXXFLAGS $SYSROOT_CFLAGS"
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    98
    LEGACY_EXTRA_LDFLAGS="$LEGACY_EXTRA_LDFLAGS $SYSROOT_LDFLAGS"
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
    99
    # The global CFLAGS and LDFLAGS variables need these for configure to function
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   100
    CFLAGS="$CFLAGS $SYSROOT_CFLAGS"
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   101
    CPPFLAGS="$CPPFLAGS $SYSROOT_CFLAGS"
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   102
    CXXFLAGS="$CXXFLAGS $SYSROOT_CFLAGS"
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   103
    LDFLAGS="$LDFLAGS $SYSROOT_LDFLAGS"
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   104
  fi
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   105
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   106
  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
   107
    # We also need -iframework<path>/System/Library/Frameworks
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   108
    SYSROOT_CFLAGS="$SYSROOT_CFLAGS -iframework $SYSROOT/System/Library/Frameworks"
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   109
    SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS -iframework $SYSROOT/System/Library/Frameworks"
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   110
    # 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
   111
    # set this here so it doesn't have to be peppered throughout the forest
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   112
    SYSROOT_CFLAGS="$SYSROOT_CFLAGS -F $SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks"
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   113
    SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS -F $SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks"
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   114
  fi
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   115
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   116
  AC_SUBST(SYSROOT_CFLAGS)
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   117
  AC_SUBST(SYSROOT_LDFLAGS)
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   118
])
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   119
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   120
AC_DEFUN_ONCE([FLAGS_SETUP_INIT_FLAGS],
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   121
[
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   122
  # Option used to tell the compiler whether to create 32- or 64-bit executables
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   123
  if test "x$TOOLCHAIN_TYPE" = xxlc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   124
    COMPILER_TARGET_BITS_FLAG="-q"
22458
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   125
  else
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   126
    COMPILER_TARGET_BITS_FLAG="-m"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   127
  fi
22467
kvn
parents: 22466 21055
diff changeset
   128
  AC_SUBST(COMPILER_TARGET_BITS_FLAG)
22466
25aaf85d1ada 8024265: Enable new build on AIX
simonis
parents: 22465
diff changeset
   129
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   130
  # 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
   131
  if test "x$OPENJDK_TARGET_OS" = xmacosx; then
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   132
    ARFLAGS="-r"
22467
kvn
parents: 22466 21055
diff changeset
   133
  elif test "x$OPENJDK_TARGET_OS" = xaix; then
22466
25aaf85d1ada 8024265: Enable new build on AIX
simonis
parents: 22465
diff changeset
   134
    ARFLAGS="-X64"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   135
  elif test "x$OPENJDK_TARGET_OS" = xwindows; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   136
    # 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
   137
    ARFLAGS="-nologo -NODEFAULTLIB:MSVCRT"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   138
  else
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   139
    ARFLAGS=""
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   140
  fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   141
  AC_SUBST(ARFLAGS)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   142
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   143
  ## Setup strip.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   144
  # 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
   145
  # 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
   146
  # 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
   147
  if test "x$OPENJDK_TARGET_OS" = xlinux; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   148
    STRIPFLAGS="-g"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   149
  elif test "x$OPENJDK_TARGET_OS" = xsolaris; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   150
    STRIPFLAGS="-x"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   151
  elif test "x$OPENJDK_TARGET_OS" = xmacosx; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   152
    STRIPFLAGS="-S"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   153
  elif test "x$OPENJDK_TARGET_OS" = xaix; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   154
    STRIPFLAGS="-X32_64"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   155
  fi
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   156
32811
df82db312e58 8135060: Stop building Xcode projects in install build
erikj
parents: 30856
diff changeset
   157
  AC_SUBST(STRIPFLAGS)
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   158
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   159
  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   160
    CC_OUT_OPTION=-Fo
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   161
    EXE_OUT_OPTION=-out:
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   162
    LD_OUT_OPTION=-out:
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   163
    AR_OUT_OPTION=-out:
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   164
  else
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   165
    # 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
   166
    # 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
   167
    CC_OUT_OPTION='-o$(SPACE)'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   168
    # 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
   169
    EXE_OUT_OPTION='-o$(SPACE)'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   170
    # 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
   171
    LD_OUT_OPTION='-o$(SPACE)'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   172
    # 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
   173
    AR_OUT_OPTION='rcs$(SPACE)'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   174
  fi
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   175
  AC_SUBST(CC_OUT_OPTION)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   176
  AC_SUBST(EXE_OUT_OPTION)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   177
  AC_SUBST(LD_OUT_OPTION)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   178
  AC_SUBST(AR_OUT_OPTION)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   179
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   180
  # On Windows, we need to set RC flags.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   181
  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
27593
4703225f5be4 8065913: Various improvements in SetupNativeCompilation
ihse
parents: 27586
diff changeset
   182
    RC_FLAGS="-nologo -l0x409"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   183
    if test "x$VARIANT" = xOPT; then
27593
4703225f5be4 8065913: Various improvements in SetupNativeCompilation
ihse
parents: 27586
diff changeset
   184
      RC_FLAGS="$RC_FLAGS -DNDEBUG"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   185
    fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   186
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   187
    # 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
   188
    # 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
   189
    # 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
   190
    # 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
   191
    # are evaluated by make.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   192
    RC_FLAGS="$RC_FLAGS \
27593
4703225f5be4 8065913: Various improvements in SetupNativeCompilation
ihse
parents: 27586
diff changeset
   193
        -D\"JDK_BUILD_ID=\$(FULL_VERSION)\" \
4703225f5be4 8065913: Various improvements in SetupNativeCompilation
ihse
parents: 27586
diff changeset
   194
        -D\"JDK_COMPANY=\$(COMPANY_NAME)\" \
4703225f5be4 8065913: Various improvements in SetupNativeCompilation
ihse
parents: 27586
diff changeset
   195
        -D\"JDK_COMPONENT=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) binary\" \
4703225f5be4 8065913: Various improvements in SetupNativeCompilation
ihse
parents: 27586
diff changeset
   196
        -D\"JDK_VER=\$(JDK_MINOR_VERSION).\$(JDK_MICRO_VERSION).\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0).\$(COOKED_BUILD_NUMBER)\" \
4703225f5be4 8065913: Various improvements in SetupNativeCompilation
ihse
parents: 27586
diff changeset
   197
        -D\"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \
4703225f5be4 8065913: Various improvements in SetupNativeCompilation
ihse
parents: 27586
diff changeset
   198
        -D\"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(JDK_MINOR_VERSION) \$(JDK_UPDATE_META_TAG)\" \
4703225f5be4 8065913: Various improvements in SetupNativeCompilation
ihse
parents: 27586
diff changeset
   199
        -D\"JDK_FVER=\$(JDK_MINOR_VERSION),\$(JDK_MICRO_VERSION),\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0),\$(COOKED_BUILD_NUMBER)\""
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   200
  fi
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   201
  AC_SUBST(RC_FLAGS)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   202
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   203
  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   204
    # silence copyright notice and other headers.
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   205
    COMMON_CCXXFLAGS="$COMMON_CCXXFLAGS -nologo"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   206
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   207
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   208
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   209
AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_LIBS],
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   210
[
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   211
  ###############################################################################
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   212
  #
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   213
  # How to compile shared libraries.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   214
  #
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   215
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   216
  if test "x$TOOLCHAIN_TYPE" = xgcc; then
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   217
    PICFLAG="-fPIC"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   218
    C_FLAG_REORDER=''
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   219
    CXX_FLAG_REORDER=''
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   220
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   221
    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
   222
      # Linking is different on MacOSX
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   223
      SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   224
      SET_EXECUTABLE_ORIGIN='-Xlinker -rpath -Xlinker @loader_path/.'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   225
      SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   226
      SET_SHARED_LIBRARY_NAME='-Xlinker -install_name -Xlinker @rpath/[$]1'
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   227
      SET_SHARED_LIBRARY_MAPFILE=''
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   228
    else
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   229
      # 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
   230
      SHARED_LIBRARY_FLAGS='-shared'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   231
      SET_EXECUTABLE_ORIGIN='-Xlinker -rpath -Xlinker \$$$$ORIGIN[$]1'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   232
      SET_SHARED_LIBRARY_ORIGIN="-Xlinker -z -Xlinker origin $SET_EXECUTABLE_ORIGIN"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   233
      SET_SHARED_LIBRARY_NAME='-Xlinker -soname=[$]1'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   234
      SET_SHARED_LIBRARY_MAPFILE='-Xlinker -version-script=[$]1'
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   235
    fi
23161
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   236
  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
   237
    PICFLAG=''
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   238
    C_FLAG_REORDER=''
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   239
    CXX_FLAG_REORDER=''
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   240
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   241
    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
   242
      # Linking is different on MacOSX
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   243
      SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG"
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   244
      SET_EXECUTABLE_ORIGIN='-Xlinker -rpath -Xlinker @loader_path/.'
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   245
      SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   246
      SET_SHARED_LIBRARY_NAME='-Xlinker -install_name -Xlinker @rpath/[$]1'
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   247
      SET_SHARED_LIBRARY_MAPFILE=''
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   248
    else
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   249
      # Default works for linux, might work on other platforms as well.
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   250
      SHARED_LIBRARY_FLAGS='-shared'
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   251
      SET_EXECUTABLE_ORIGIN='-Xlinker -rpath -Xlinker \$$$$ORIGIN[$]1'
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   252
      SET_SHARED_LIBRARY_ORIGIN="-Xlinker -z -Xlinker origin $SET_EXECUTABLE_ORIGIN"
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   253
      SET_SHARED_LIBRARY_NAME='-Xlinker -soname=[$]1'
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   254
      SET_SHARED_LIBRARY_MAPFILE='-Xlinker -version-script=[$]1'
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   255
    fi
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   256
  elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   257
    PICFLAG="-KPIC"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   258
    C_FLAG_REORDER='-xF'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   259
    CXX_FLAG_REORDER='-xF'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   260
    SHARED_LIBRARY_FLAGS="-G"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   261
    SET_EXECUTABLE_ORIGIN='-R\$$$$ORIGIN[$]1'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   262
    SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   263
    SET_SHARED_LIBRARY_NAME=''
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   264
    SET_SHARED_LIBRARY_MAPFILE='-M[$]1'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   265
  elif test "x$TOOLCHAIN_TYPE" = xxlc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   266
    PICFLAG="-qpic=large"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   267
    C_FLAG_REORDER=''
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   268
    CXX_FLAG_REORDER=''
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   269
    SHARED_LIBRARY_FLAGS="-qmkshrobj"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   270
    SET_EXECUTABLE_ORIGIN=""
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   271
    SET_SHARED_LIBRARY_ORIGIN=''
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   272
    SET_SHARED_LIBRARY_NAME=''
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   273
    SET_SHARED_LIBRARY_MAPFILE=''
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   274
  elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   275
    PICFLAG=""
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   276
    C_FLAG_REORDER=''
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   277
    CXX_FLAG_REORDER=''
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   278
    SHARED_LIBRARY_FLAGS="-LD"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   279
    SET_EXECUTABLE_ORIGIN=''
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   280
    SET_SHARED_LIBRARY_ORIGIN=''
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   281
    SET_SHARED_LIBRARY_NAME=''
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   282
    SET_SHARED_LIBRARY_MAPFILE=''
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   283
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   284
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   285
  AC_SUBST(C_FLAG_REORDER)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   286
  AC_SUBST(CXX_FLAG_REORDER)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   287
  AC_SUBST(SET_EXECUTABLE_ORIGIN)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   288
  AC_SUBST(SET_SHARED_LIBRARY_ORIGIN)
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   289
  AC_SUBST(SET_SHARED_LIBRARY_NAME)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   290
  AC_SUBST(SET_SHARED_LIBRARY_MAPFILE)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   291
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   292
  if test "x$OPENJDK_TARGET_OS" = xsolaris; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   293
    CFLAGS_JDK="${CFLAGS_JDK} -D__solaris__"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   294
    CXXFLAGS_JDK="${CXXFLAGS_JDK} -D__solaris__"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   295
    CFLAGS_JDKLIB_EXTRA='-xstrconst'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   296
  fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   297
  # The (cross) compiler is now configured, we can now test capabilities
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   298
  # of the target platform.
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   299
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   300
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   301
# 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
   302
#
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   303
# 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
   304
#          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
   305
#          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
   306
#
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   307
# -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
   308
# -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
   309
# -fsingle: Use single precision floating point with 'float'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   310
# -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
   311
#   (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
   312
#    pointer types are not recommended)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   313
# -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
   314
#   (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
   315
# -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
   316
# -xrestrict: Pointer parameters to functions do not overlap
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   317
#   (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
   318
#    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
   319
# -xlibmil: Inline some library routines
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   320
#   (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
   321
# -xlibmopt: Use optimized math routines (CURRENTLY DISABLED)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   322
#   (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
   323
#  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
   324
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   325
    # 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
   326
    # Bug?
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   327
    #if test "x$OPENJDK_TARGET_CPU" = xsparc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   328
    #  CFLAGS_JDK="${CFLAGS_JDK} -xmemalign=4s"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   329
    #  CXXFLAGS_JDK="${CXXFLAGS_JDK} -xmemalign=4s"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   330
    #fi
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   331
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   332
AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_OPTIMIZATION],
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   333
[
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   334
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   335
  ###############################################################################
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   336
  #
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   337
  # Setup the opt flags for different compilers
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   338
  # and different operating systems.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   339
  #
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   340
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   341
  # 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
   342
  # if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   343
  #   C_FLAG_DEPS="-MMD -MF"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   344
  # fi
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   345
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   346
  # Generate make dependency files
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   347
  if test "x$TOOLCHAIN_TYPE" = xgcc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   348
    C_FLAG_DEPS="-MMD -MF"
23161
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   349
  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
   350
    C_FLAG_DEPS="-MMD -MF"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   351
  elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   352
    C_FLAG_DEPS="-xMMD -xMF"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   353
  elif test "x$TOOLCHAIN_TYPE" = xxlc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   354
    C_FLAG_DEPS="-qmakedep=gcc -MF"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   355
  fi
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   356
  CXX_FLAG_DEPS="$C_FLAG_DEPS"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   357
  AC_SUBST(C_FLAG_DEPS)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   358
  AC_SUBST(CXX_FLAG_DEPS)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   359
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   360
  # Debug symbols
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   361
  if test "x$TOOLCHAIN_TYPE" = xgcc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   362
    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
   363
      # 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
   364
      CFLAGS_DEBUG_SYMBOLS="-g1"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   365
      CXXFLAGS_DEBUG_SYMBOLS="-g1"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   366
    else
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   367
      CFLAGS_DEBUG_SYMBOLS="-g"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   368
      CXXFLAGS_DEBUG_SYMBOLS="-g"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   369
    fi
23161
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   370
  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
   371
    CFLAGS_DEBUG_SYMBOLS="-g"
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   372
    CXXFLAGS_DEBUG_SYMBOLS="-g"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   373
  elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   374
    CFLAGS_DEBUG_SYMBOLS="-g -xs"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   375
    # FIXME: likely a bug, this disables debug symbols rather than enables them
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   376
    CXXFLAGS_DEBUG_SYMBOLS="-g0 -xs"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   377
  elif test "x$TOOLCHAIN_TYPE" = xxlc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   378
    CFLAGS_DEBUG_SYMBOLS="-g"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   379
    CXXFLAGS_DEBUG_SYMBOLS="-g"
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
  AC_SUBST(CFLAGS_DEBUG_SYMBOLS)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   382
  AC_SUBST(CXXFLAGS_DEBUG_SYMBOLS)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   383
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   384
  # bounds, memory and behavior checking options
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   385
  if test "x$TOOLCHAIN_TYPE" = xgcc; then
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   386
    case $DEBUG_LEVEL in
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   387
    release )
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   388
      # no adjustment
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   389
      ;;
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   390
    fastdebug )
26123
44827e1a7a7b 8047952: Remove FORTIFY_SOURCE from fastdebug and slowdebug builds
mduigou
parents: 25459
diff changeset
   391
      # no adjustment
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   392
      ;;
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   393
    slowdebug )
30856
09b01c98ca8d 8081692: Configure should verify that -fstack-protector is valid
ihse
parents: 30740
diff changeset
   394
      # Add runtime stack smashing and undefined behavior checks.
09b01c98ca8d 8081692: Configure should verify that -fstack-protector is valid
ihse
parents: 30740
diff changeset
   395
      # Not all versions of gcc support -fstack-protector
09b01c98ca8d 8081692: Configure should verify that -fstack-protector is valid
ihse
parents: 30740
diff changeset
   396
      STACK_PROTECTOR_CFLAG="-fstack-protector-all"
09b01c98ca8d 8081692: Configure should verify that -fstack-protector is valid
ihse
parents: 30740
diff changeset
   397
      FLAGS_COMPILER_CHECK_ARGUMENTS([$STACK_PROTECTOR_CFLAG], [], [STACK_PROTECTOR_CFLAG=""])
09b01c98ca8d 8081692: Configure should verify that -fstack-protector is valid
ihse
parents: 30740
diff changeset
   398
09b01c98ca8d 8081692: Configure should verify that -fstack-protector is valid
ihse
parents: 30740
diff changeset
   399
      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
   400
      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
   401
      ;;
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   402
    esac
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   403
  fi
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   404
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   405
  # Optimization levels
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   406
  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
   407
    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
   408
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   409
    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
   410
      # 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
   411
      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
   412
      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
   413
      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
   414
      C_O_FLAG_DEBUG="-xregs=no%frameptr"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   415
      C_O_FLAG_NONE="-xregs=no%frameptr"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   416
      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
   417
      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
   418
      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
   419
      CXX_O_FLAG_DEBUG="-xregs=no%frameptr"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   420
      CXX_O_FLAG_NONE="-xregs=no%frameptr"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   421
      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
   422
        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
   423
        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
   424
      fi
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   425
    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
   426
      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
   427
      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
   428
      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
   429
      C_O_FLAG_DEBUG=""
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   430
      C_O_FLAG_NONE=""
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   431
      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
   432
      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
   433
      CXX_O_FLAG_NORM="-xO2 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   434
      C_O_FLAG_DEBUG=""
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   435
      CXX_O_FLAG_NONE=""
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   436
    fi
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   437
  else
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   438
    # 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
   439
    # setup for C and duplicate afterwards.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   440
    if test "x$TOOLCHAIN_TYPE" = xgcc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   441
      if test "x$OPENJDK_TARGET_OS" = xmacosx; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   442
        # On MacOSX we optimize for size, something
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   443
        # we should do for all platforms?
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   444
        C_O_FLAG_HIGHEST="-Os"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   445
        C_O_FLAG_HI="-Os"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   446
        C_O_FLAG_NORM="-Os"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   447
      else
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   448
        C_O_FLAG_HIGHEST="-O3"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   449
        C_O_FLAG_HI="-O3"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   450
        C_O_FLAG_NORM="-O2"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   451
      fi
25459
30ba61626044 8047734: Backout use of -Og
mduigou
parents: 25034
diff changeset
   452
      C_O_FLAG_DEBUG="-O0"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   453
      C_O_FLAG_NONE="-O0"
23161
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   454
    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
   455
      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
   456
        # 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
   457
        # we should do for all platforms?
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   458
        C_O_FLAG_HIGHEST="-Os"
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   459
        C_O_FLAG_HI="-Os"
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   460
        C_O_FLAG_NORM="-Os"
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   461
      else
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   462
        C_O_FLAG_HIGHEST="-O3"
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   463
        C_O_FLAG_HI="-O3"
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   464
        C_O_FLAG_NORM="-O2"
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   465
      fi
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   466
      C_O_FLAG_DEBUG="-O0"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   467
      C_O_FLAG_NONE="-O0"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   468
    elif test "x$TOOLCHAIN_TYPE" = xxlc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   469
      C_O_FLAG_HIGHEST="-O3"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   470
      C_O_FLAG_HI="-O3 -qstrict"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   471
      C_O_FLAG_NORM="-O2"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   472
      C_O_FLAG_DEBUG="-qnoopt"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   473
      C_O_FLAG_NONE="-qnoop"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   474
    elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   475
      C_O_FLAG_HIGHEST="-O2"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   476
      C_O_FLAG_HI="-O1"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   477
      C_O_FLAG_NORM="-O1"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   478
      C_O_FLAG_DEBUG="-Od"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   479
      C_O_FLAG_NONE="-Od"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   480
    fi
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   481
    CXX_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   482
    CXX_O_FLAG_HI="$C_O_FLAG_HI"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   483
    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
   484
    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
   485
    CXX_O_FLAG_NONE="$C_O_FLAG_NONE"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   486
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   487
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   488
  # Adjust optimization flags according to debug level.
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   489
  case $DEBUG_LEVEL in
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   490
    release )
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   491
      # no adjustment
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   492
      ;;
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   493
    fastdebug )
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   494
      # Not quite so much optimization
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   495
      C_O_FLAG_HI="$C_O_FLAG_NORM"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   496
      CXX_O_FLAG_HI="$CXX_O_FLAG_NORM"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   497
      ;;
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   498
    slowdebug )
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   499
      # Disable optimization
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   500
      C_O_FLAG_HIGHEST="$C_O_FLAG_DEBUG"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   501
      C_O_FLAG_HI="$C_O_FLAG_DEBUG"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   502
      C_O_FLAG_NORM="$C_O_FLAG_DEBUG"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   503
      CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_DEBUG"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   504
      CXX_O_FLAG_HI="$CXX_O_FLAG_DEBUG"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   505
      CXX_O_FLAG_NORM="$CXX_O_FLAG_DEBUG"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   506
      ;;
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   507
  esac
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   508
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   509
  AC_SUBST(C_O_FLAG_HIGHEST)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   510
  AC_SUBST(C_O_FLAG_HI)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   511
  AC_SUBST(C_O_FLAG_NORM)
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   512
  AC_SUBST(C_O_FLAG_DEBUG)
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   513
  AC_SUBST(C_O_FLAG_NONE)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   514
  AC_SUBST(CXX_O_FLAG_HIGHEST)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   515
  AC_SUBST(CXX_O_FLAG_HI)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   516
  AC_SUBST(CXX_O_FLAG_NORM)
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   517
  AC_SUBST(CXX_O_FLAG_DEBUG)
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   518
  AC_SUBST(CXX_O_FLAG_NONE)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   519
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   520
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   521
AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK],
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   522
[
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   523
  # Special extras...
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   524
  if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   525
    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
   526
      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
   527
      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
   528
    fi
29304
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
   529
    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
   530
    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
   531
  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
   532
    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
   533
    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
   534
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   535
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   536
  CFLAGS_JDK="${CFLAGS_JDK} $EXTRA_CFLAGS"
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   537
  CXXFLAGS_JDK="${CXXFLAGS_JDK} $EXTRA_CXXFLAGS"
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   538
  LDFLAGS_JDK="${LDFLAGS_JDK} $EXTRA_LDFLAGS"
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   539
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   540
  ###############################################################################
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   541
  #
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   542
  # Now setup the CFLAGS and LDFLAGS for the JDK build.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   543
  # 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
   544
  #
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   545
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   546
  # Setup compiler/platform specific flags into
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   547
  #    CFLAGS_JDK    - C Compiler flags
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   548
  #    CXXFLAGS_JDK  - C++ Compiler flags
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   549
  #    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
   550
  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
   551
    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
   552
      # 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
   553
      COMMON_CCXXFLAGS="${COMMON_CCXXFLAGS} -march=i586"
aa3cd6848aa0 8039426: gcc can target wrong instruction set when building JDK native code
erikj
parents: 30415
diff changeset
   554
    fi
29304
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
   555
    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
   556
        -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
   557
    case $OPENJDK_TARGET_CPU_ARCH in
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   558
      arm )
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   559
        # 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
   560
        CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   561
        ;;
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   562
      ppc )
23981
6ae1260c5cab 8041141: JDK9 emb build failure on PPC platform
dholmes
parents: 23428
diff changeset
   563
        # 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
   564
        CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   565
        ;;
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   566
      * )
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   567
        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
   568
        CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   569
        ;;
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   570
    esac
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   571
  elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   572
    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
   573
    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
   574
      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
   575
    fi
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   576
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   577
    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
   578
    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
   579
  elif test "x$TOOLCHAIN_TYPE" = xxlc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   580
    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
   581
    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
   582
  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
   583
    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
   584
        -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
   585
        -DWIN32_LEAN_AND_MEAN \
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 27602
diff changeset
   586
        -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
   587
        -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
   588
        -DWIN32 -DIAL"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   589
    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
   590
      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
   591
    else
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   592
      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
   593
    fi
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 27602
diff changeset
   594
    # 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
   595
    # 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
   596
    # studio.
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 27602
diff changeset
   597
    if test "x$TOOLCHAIN_VERSION" = "x2010"; then
28907
769bc76d1f2c 8072107: New dependency introduced by deploy.dll and awt.dll (msvcp100.dll)
erikj
parents: 28901
diff changeset
   598
      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK \
28901
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 27602
diff changeset
   599
          -D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB"
5acc0ec03d06 8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents: 27602
diff changeset
   600
    fi
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   601
  fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   602
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   603
  ###############################################################################
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   604
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   605
  # Adjust flags according to debug level.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   606
  case $DEBUG_LEVEL in
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   607
    fastdebug | slowdebug )
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   608
      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
   609
      CXXFLAGS_JDK="$CXXFLAGS_JDK $CXXFLAGS_DEBUG_SYMBOLS $CXXFLAGS_DEBUG_OPTIONS"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   610
      JAVAC_FLAGS="$JAVAC_FLAGS -g"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   611
      ;;
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   612
    release )
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   613
      ;;
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   614
    * )
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   615
      AC_MSG_ERROR([Unrecognized \$DEBUG_LEVEL: $DEBUG_LEVEL])
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   616
      ;;
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   617
  esac
18020
eade0d9836bf 8014404: Debug flag not added to jdk native compile when --enable-debug is set
erikj
parents: 17664
diff changeset
   618
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   619
  # Setup LP64
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   620
  COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK $ADD_LP64"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   621
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   622
  # 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
   623
  # -D is universally accepted.
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   624
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   625
  # Setup endianness
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   626
  if test "x$OPENJDK_TARGET_CPU_ENDIAN" = xlittle; then
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   627
    # 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
   628
    #   Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   629
    #   (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
   630
    #   Note: -Dmacro         is the same as    #define macro 1
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   631
    #         -Dmacro=        is the same as    #define macro
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   632
    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
   633
      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_LITTLE_ENDIAN="
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   634
    else
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   635
      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_LITTLE_ENDIAN"
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   636
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   637
  else
23428
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23423
diff changeset
   638
    # 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
   639
    # are defined in the system?
3c8a05bf4656 8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents: 23423
diff changeset
   640
    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
   641
      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
   642
    else
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   643
      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
   644
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   645
  fi
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   646
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   647
  # 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
   648
  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
   649
  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
   650
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   651
  # Setup target CPU
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   652
  COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DARCH='\"$OPENJDK_TARGET_CPU_LEGACY\"' -D$OPENJDK_TARGET_CPU_LEGACY"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   653
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   654
  # Setup debug/release defines
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   655
  if test "x$DEBUG_LEVEL" = xrelease; then
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   656
    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DNDEBUG"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   657
    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
   658
      COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DTRIMMED"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   659
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   660
  else
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   661
    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DDEBUG"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   662
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   663
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   664
  # Setup release name
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   665
  COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DRELEASE='\"\$(RELEASE)\"'"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   666
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   667
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   668
  # Set some additional per-OS defines.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   669
  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
   670
    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
   671
  elif test "x$OPENJDK_TARGET_OS" = xaix; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   672
    # FIXME: PPC64 should not be here.
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   673
    COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -DPPC64"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   674
  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
   675
    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
   676
  fi
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   677
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   678
  # Additional macosx handling
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   679
  if test "x$OPENJDK_TARGET_OS" = xmacosx; then
25034
d9ca34c227b8 8043340: [macosx] Fix hard-wired paths to JavaVM.framework
ddehaven
parents: 24911
diff changeset
   680
    # 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
   681
    # 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
   682
    # 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
   683
    # The expected format is X.Y.Z
d9ca34c227b8 8043340: [macosx] Fix hard-wired paths to JavaVM.framework
ddehaven
parents: 24911
diff changeset
   684
    MACOSX_VERSION_MIN=10.7.0
d9ca34c227b8 8043340: [macosx] Fix hard-wired paths to JavaVM.framework
ddehaven
parents: 24911
diff changeset
   685
    AC_SUBST(MACOSX_VERSION_MIN)
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   686
25034
d9ca34c227b8 8043340: [macosx] Fix hard-wired paths to JavaVM.framework
ddehaven
parents: 24911
diff changeset
   687
    # 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
   688
    # 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
   689
    # command line.
d9ca34c227b8 8043340: [macosx] Fix hard-wired paths to JavaVM.framework
ddehaven
parents: 24911
diff changeset
   690
    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
   691
    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
   692
  fi
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   693
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   694
  # Setup some hard coded includes
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   695
  COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK \
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 25459
diff changeset
   696
      -I${JDK_TOPDIR}/src/java.base/share/native/include \
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 25459
diff changeset
   697
      -I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS/native/include \
27586
e7cfdc266a70 8058631: Rename posix to unix in build system to match file name changes
ihse
parents: 27241
diff changeset
   698
      -I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/include"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   699
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   700
  # The shared libraries are compiled using the picflag.
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   701
  CFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA"
29305
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   702
  CXXFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $CXXFLAGS_JDK $PICFLAG $CXXFLAGS_JDKLIB_EXTRA"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   703
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   704
  # Executable flags
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   705
  CFLAGS_JDKEXE="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   706
  CXXFLAGS_JDKEXE="$COMMON_CCXXFLAGS_JDK $CXXFLAGS_JDK"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   707
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   708
  AC_SUBST(CFLAGS_JDKLIB)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   709
  AC_SUBST(CFLAGS_JDKEXE)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   710
  AC_SUBST(CXXFLAGS_JDKLIB)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   711
  AC_SUBST(CXXFLAGS_JDKEXE)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   712
29305
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   713
  # Flags for compiling test libraries
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   714
  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
   715
  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
   716
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   717
  # Flags for compiling test executables
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   718
  CFLAGS_TESTEXE="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK"
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   719
  CXXFLAGS_TESTEXE="$COMMON_CCXXFLAGS_JDK $CXXFLAGS_JDK"
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   720
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   721
  AC_SUBST(CFLAGS_TESTLIB)
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   722
  AC_SUBST(CFLAGS_TESTEXE)
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   723
  AC_SUBST(CXXFLAGS_TESTLIB)
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   724
  AC_SUBST(CXXFLAGS_TESTEXE)
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   725
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   726
  # Setup LDFLAGS et al.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   727
  #
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   728
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   729
  # Now this is odd. The JDK native libraries have to link against libjvm.so
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   730
  # On 32-bit machines there is normally two distinct libjvm.so:s, client and server.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   731
  # Which should we link to? Are we lucky enough that the binary api to the libjvm.so library
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   732
  # is identical for client and server? Yes. Which is picked at runtime (client or server)?
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   733
  # Neither, since the chosen libjvm.so has already been loaded by the launcher, all the following
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   734
  # libraries will link to whatever is in memory. Yuck.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   735
  #
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   736
  # Thus we offer the compiler to find libjvm.so first in server then in client. It works. Ugh.
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   737
  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   738
    LDFLAGS_JDK="$LDFLAGS_JDK -nologo -opt:ref -incremental:no"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   739
    if test "x$OPENJDK_TARGET_CPU_BITS" = "x32"; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   740
      LDFLAGS_JDK="$LDFLAGS_JDK -safeseh"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   741
    fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   742
    # TODO: make -debug optional "--disable-full-debug-symbols"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   743
    LDFLAGS_JDK="$LDFLAGS_JDK -debug"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   744
  elif test "x$TOOLCHAIN_TYPE" = xgcc; then
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   745
    # 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
   746
    # 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
   747
    if test -n "$HAS_GNU_HASH"; then
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   748
      LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker --hash-style=both"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   749
    fi
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   750
    if test "x$OPENJDK_TARGET_OS" = xlinux; then
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   751
      # 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
   752
      # undefined symbols in object files.
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   753
      LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker -z -Xlinker defs"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   754
      case $DEBUG_LEVEL in
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   755
        release )
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   756
          # tell linker to optimize libraries.
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   757
          # Should this be supplied to the OSS linker as well?
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   758
          LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker -O1"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   759
          ;;
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   760
        slowdebug )
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   761
          if test "x$HAS_LINKER_NOW" = "xtrue"; then
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   762
            # do relocations at load
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   763
            LDFLAGS_JDK="$LDFLAGS_JDK $LINKER_NOW_FLAG"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   764
            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
   765
          fi
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   766
          if test "x$HAS_LINKER_RELRO" = "xtrue"; then
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   767
            # mark relocations read only
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   768
            LDFLAGS_JDK="$LDFLAGS_JDK $LINKER_RELRO_FLAG"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   769
            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
   770
          fi
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   771
          ;;
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   772
        fastdebug )
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   773
          if test "x$HAS_LINKER_RELRO" = "xtrue"; then
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   774
            # mark relocations read only
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   775
            LDFLAGS_JDK="$LDFLAGS_JDK $LINKER_RELRO_FLAG"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   776
            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
   777
          fi
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   778
          ;;
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   779
        * )
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   780
          AC_MSG_ERROR([Unrecognized \$DEBUG_LEVEL: $DEBUG_LEVEL])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   781
          ;;
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   782
        esac
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   783
    fi
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   784
  elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   785
    LDFLAGS_JDK="$LDFLAGS_JDK -z defs -xildoff -ztext"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   786
    LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK -norunpath -xnolib"
29451
443fdcba9598 8075515: AIX: cleanup xlc options and use -bernotok to detect missing symbols at build time
simonis
parents: 29305
diff changeset
   787
  elif test "x$TOOLCHAIN_TYPE" = xxlc; then
443fdcba9598 8075515: AIX: cleanup xlc options and use -bernotok to detect missing symbols at build time
simonis
parents: 29305
diff changeset
   788
    LDFLAGS_JDK="${LDFLAGS_JDK} -brtl -bnolibpath -liconv -bexpall -bernotok"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   789
  fi
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   790
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   791
  # Customize LDFLAGS for executables
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   792
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   793
  LDFLAGS_JDKEXE="${LDFLAGS_JDK}"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   794
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   795
  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   796
    if test "x$OPENJDK_TARGET_CPU_BITS" = "x64"; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   797
      LDFLAGS_STACK_SIZE=1048576
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   798
    else
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   799
      LDFLAGS_STACK_SIZE=327680
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   800
    fi
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   801
    LDFLAGS_JDKEXE="${LDFLAGS_JDKEXE} /STACK:$LDFLAGS_STACK_SIZE"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   802
  elif test "x$OPENJDK_TARGET_OS" = xlinux; then
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   803
    LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE -Xlinker --allow-shlib-undefined"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   804
  fi
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   805
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   806
  # Customize LDFLAGS for libs
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   807
  LDFLAGS_JDKLIB="${LDFLAGS_JDK}"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   808
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   809
  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27241
diff changeset
   810
    LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -dll -libpath:${OUTPUT_ROOT}/support/modules_libs/java.base"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   811
    LDFLAGS_JDKLIB_SUFFIX=""
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   812
  else
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   813
    LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB}  ${SHARED_LIBRARY_FLAGS} \
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27241
diff changeset
   814
        -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}"
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   815
14465
d529faf5e36a 8001460: build-infra: Linker warnings on macosx
erikj
parents: 14464
diff changeset
   816
    # 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
   817
    # 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
   818
    # 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
   819
    # Default to server for other variants.
14467
a973c0a1bd5d 8003528: build-infra: Diffs in libjava and hotspot libs on solaris.
erikj
parents: 14465
diff changeset
   820
    if test "x$JVM_VARIANT_SERVER" = xtrue; then
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27241
diff changeset
   821
      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/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
   822
    elif test "x$JVM_VARIANT_CLIENT" = xtrue; then
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27241
diff changeset
   823
      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/client"
14810
4e7fee179b4a 7190137: Add support for JVM_VARIANT minimal1
dholmes
parents: 14614
diff changeset
   824
    elif test "x$JVM_VARIANT_MINIMAL1" = xtrue; then
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27241
diff changeset
   825
      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/minimal"
14465
d529faf5e36a 8001460: build-infra: Linker warnings on macosx
erikj
parents: 14464
diff changeset
   826
    else
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents: 27241
diff changeset
   827
      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/server"
14465
d529faf5e36a 8001460: build-infra: Linker warnings on macosx
erikj
parents: 14464
diff changeset
   828
    fi
d529faf5e36a 8001460: build-infra: Linker warnings on macosx
erikj
parents: 14464
diff changeset
   829
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   830
    LDFLAGS_JDKLIB_SUFFIX="-ljava -ljvm"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   831
    if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   832
      LDFLAGS_JDKLIB_SUFFIX="$LDFLAGS_JDKLIB_SUFFIX -lc"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   833
    fi
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   834
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   835
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   836
  AC_SUBST(LDFLAGS_JDKLIB)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   837
  AC_SUBST(LDFLAGS_JDKEXE)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   838
  AC_SUBST(LDFLAGS_JDKLIB_SUFFIX)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   839
  AC_SUBST(LDFLAGS_JDKEXE_SUFFIX)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   840
  AC_SUBST(LDFLAGS_CXX_JDK)
29305
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   841
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   842
  LDFLAGS_TESTLIB="$LDFLAGS_JDKLIB"
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   843
  LDFLAGS_TESTEXE="$LDFLAGS_JDKEXE"
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   844
  LDFLAGS_TESTLIB_SUFFIX="$LDFLAGS_JDKLIB_SUFFIX"
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   845
  LDFLAGS_TESTEXE_SUFFIX="$LDFLAGS_JDKEXE_SUFFIX"
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   846
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   847
  AC_SUBST(LDFLAGS_TESTLIB)
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   848
  AC_SUBST(LDFLAGS_TESTEXE)
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   849
  AC_SUBST(LDFLAGS_TESTLIB_SUFFIX)
4ddc6faf7842 8073021: add native code coverage target into makefiles
erikj
parents: 29304
diff changeset
   850
  AC_SUBST(LDFLAGS_TESTEXE_SUFFIX)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   851
])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   852
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   853
# FLAGS_COMPILER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE],
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   854
#                                   [RUN-IF-FALSE])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   855
# ------------------------------------------------------------
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   856
# Check that the c and c++ compilers support an argument
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   857
AC_DEFUN([FLAGS_COMPILER_CHECK_ARGUMENTS],
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   858
[
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   859
  AC_MSG_CHECKING([if compiler supports "$1"])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   860
  supports=yes
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   861
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   862
  saved_cflags="$CFLAGS"
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   863
  CFLAGS="$CFLAGS $1"
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   864
  AC_LANG_PUSH([C])
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   865
  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   866
      [supports=no])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   867
  AC_LANG_POP([C])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   868
  CFLAGS="$saved_cflags"
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   869
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   870
  saved_cxxflags="$CXXFLAGS"
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   871
  CXXFLAGS="$CXXFLAG $1"
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   872
  AC_LANG_PUSH([C++])
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   873
  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   874
      [supports=no])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   875
  AC_LANG_POP([C++])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   876
  CXXFLAGS="$saved_cxxflags"
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   877
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   878
  AC_MSG_RESULT([$supports])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   879
  if test "x$supports" = "xyes" ; then
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   880
    m4_ifval([$2], [$2], [:])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   881
  else
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   882
    m4_ifval([$3], [$3], [:])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   883
  fi
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   884
])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   885
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   886
# FLAGS_LINKER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE],
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   887
#                                    [RUN-IF-FALSE])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   888
# ------------------------------------------------------------
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   889
# Check that the linker support an argument
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   890
AC_DEFUN([FLAGS_LINKER_CHECK_ARGUMENTS],
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   891
[
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   892
  AC_MSG_CHECKING([if linker supports "$1"])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   893
  supports=yes
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   894
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   895
  saved_ldflags="$LDFLAGS"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   896
  LDFLAGS="$LDFLAGS $1"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   897
  AC_LANG_PUSH([C])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   898
  AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   899
      [], [supports=no])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   900
  AC_LANG_POP([C])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   901
  LDFLAGS="$saved_ldflags"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   902
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   903
  AC_MSG_RESULT([$supports])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   904
  if test "x$supports" = "xyes" ; then
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   905
    m4_ifval([$2], [$2], [:])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   906
  else
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   907
    m4_ifval([$3], [$3], [:])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   908
  fi
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   909
])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   910
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   911
AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_MISC],
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   912
[
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   913
  # Some Zero and Shark settings.
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   914
  # ZERO_ARCHFLAG tells the compiler which mode to build for
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   915
  case "${OPENJDK_TARGET_CPU}" in
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   916
    s390)
22466
25aaf85d1ada 8024265: Enable new build on AIX
simonis
parents: 22465
diff changeset
   917
      ZERO_ARCHFLAG="${COMPILER_TARGET_BITS_FLAG}31"
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   918
      ;;
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   919
    *)
22466
25aaf85d1ada 8024265: Enable new build on AIX
simonis
parents: 22465
diff changeset
   920
      ZERO_ARCHFLAG="${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   921
  esac
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   922
  FLAGS_COMPILER_CHECK_ARGUMENTS([$ZERO_ARCHFLAG], [], [ZERO_ARCHFLAG=""])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   923
  AC_SUBST(ZERO_ARCHFLAG)
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   924
22466
25aaf85d1ada 8024265: Enable new build on AIX
simonis
parents: 22465
diff changeset
   925
  # 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
   926
  # Set COMPILER_SUPPORTS_TARGET_BITS_FLAG to 'true' if it does
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   927
  FLAGS_COMPILER_CHECK_ARGUMENTS([${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}],
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   928
      [COMPILER_SUPPORTS_TARGET_BITS_FLAG=true],
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   929
      [COMPILER_SUPPORTS_TARGET_BITS_FLAG=false])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   930
  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
   931
30415
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
   932
  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
   933
      [do not consider native warnings to be an error @<:@enabled@:>@])])
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
   934
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
   935
  AC_MSG_CHECKING([if native warnings are errors])
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
   936
  if test "x$enable_warnings_as_errors" = "xyes"; then
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
   937
    AC_MSG_RESULT([yes (explicitely set)])
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
   938
    WARNINGS_AS_ERRORS=true
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
   939
  elif test "x$enable_warnings_as_errors" = "xno"; then
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
   940
    AC_MSG_RESULT([no])
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
   941
    WARNINGS_AS_ERRORS=false
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
   942
  elif test "x$enable_warnings_as_errors" = "x"; then
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
   943
    AC_MSG_RESULT([yes (default)])
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
   944
    WARNINGS_AS_ERRORS=true
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
   945
  else
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
   946
    AC_MSG_ERROR([--enable-warnings-as-errors accepts no argument])
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
   947
  fi
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
   948
  AC_SUBST(WARNINGS_AS_ERRORS)
c5629d65265d 8074859: Turn on warnings as error
ihse
parents: 30096
diff changeset
   949
23423
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
   950
  case "${TOOLCHAIN_TYPE}" in
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
   951
    microsoft)
29304
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
   952
      DISABLE_WARNING_PREFIX="-wd"
25882
bd4315f0084b 8022177: Windows/MSYS builds broken
erikj
parents: 25854
diff changeset
   953
      CFLAGS_WARNINGS_ARE_ERRORS="-WX"
23423
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
   954
      ;;
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
   955
    solstudio)
29304
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
   956
      DISABLE_WARNING_PREFIX="-erroff="
23423
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
   957
      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
   958
      ;;
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
   959
    gcc)
29304
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
   960
      # Prior to gcc 4.4, a -Wno-X where X is unknown for that version of gcc will cause an error
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
   961
      FLAGS_COMPILER_CHECK_ARGUMENTS([-Wno-this-is-a-warning-that-do-not-exist],
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
   962
          [GCC_CAN_DISABLE_WARNINGS=true],
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
   963
          [GCC_CAN_DISABLE_WARNINGS=false]
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
   964
      )
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
   965
      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
   966
        DISABLE_WARNING_PREFIX="-Wno-"
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
   967
      else
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
   968
        DISABLE_WARNING_PREFIX=
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
   969
      fi
23423
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
   970
      CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
   971
      ;;
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
   972
    clang)
29304
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
   973
      DISABLE_WARNING_PREFIX="-Wno-"
23423
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
   974
      CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
   975
      ;;
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
   976
  esac
29304
81a723f8d33c 8074096: Disable (most) native warnings in JDK on a per-library basis
ihse
parents: 28907
diff changeset
   977
  AC_SUBST(DISABLE_WARNING_PREFIX)
23423
153d4b6b1124 8037825: Fix warnings and enable "warnings as errors" in serviceability native libraries
sla
parents: 23161
diff changeset
   978
  AC_SUBST(CFLAGS_WARNINGS_ARE_ERRORS)
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   979
])