make/autoconf/flags.m4
author jwilhelm
Thu, 13 Sep 2018 01:49:48 +0200
changeset 53332 ab474ef0a0ac
parent 52736 99c48295ec8e
child 53643 1126811a5124
permissions -rw-r--r--
8199552: Update to build scripts Reviewed-by: jwilhelm, mschoene, rhalade Contributed-by: magnus.ihse.bursie@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     1
#
48767
0c6ce8fdb50a 8080990: libdt_socket/socket_md.c(202) : warning C4996: 'gethostbyname': Use getaddrinfo() or GetAddrInfoW()
gadams
parents: 48751
diff changeset
     2
# Copyright (c) 2011, 2018, 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
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
    26
m4_include([flags-cflags.m4])
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
    27
m4_include([flags-ldflags.m4])
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
    28
m4_include([flags-other.m4])
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
    29
42538
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    30
################################################################################
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    31
#
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    32
# Setup ABI profile (for arm)
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    33
#
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    34
AC_DEFUN([FLAGS_SETUP_ABI_PROFILE],
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    35
[
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    36
  AC_ARG_WITH(abi-profile, [AS_HELP_STRING([--with-abi-profile],
52351
0ecb4e520110 8209093: JEP 340: One AArch64 Port, Not Two
bobv
parents: 51783
diff changeset
    37
      [specify ABI profile for ARM builds (arm-vfp-sflt,arm-vfp-hflt,arm-sflt, armv5-vfp-sflt,armv6-vfp-hflt,aarch64) @<:@toolchain dependent@:>@ ])])
42538
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    38
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    39
  if test "x$with_abi_profile" != x; then
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    40
    if test "x$OPENJDK_TARGET_CPU" != xarm && \
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    41
        test "x$OPENJDK_TARGET_CPU" != xaarch64; then
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    42
      AC_MSG_ERROR([--with-abi-profile only available on arm/aarch64])
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    43
    fi
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    44
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    45
    OPENJDK_TARGET_ABI_PROFILE=$with_abi_profile
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    46
    AC_MSG_CHECKING([for ABI profle])
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    47
    AC_MSG_RESULT([$OPENJDK_TARGET_ABI_PROFILE])
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    48
52736
99c48295ec8e 8214465: Upgrade arm-sflt minimum architecture to ARMv5TE for assembler
dholmes
parents: 52735
diff changeset
    49
    # --- Arm-sflt CFLAGS and ASFLAGS ---
99c48295ec8e 8214465: Upgrade arm-sflt minimum architecture to ARMv5TE for assembler
dholmes
parents: 52735
diff changeset
    50
    # Armv5te is required for assembler, because pld insn used in arm32 hotspot is only in v5E and above.
99c48295ec8e 8214465: Upgrade arm-sflt minimum architecture to ARMv5TE for assembler
dholmes
parents: 52735
diff changeset
    51
    # However, there is also a GCC bug which generates unaligned strd/ldrd instructions on armv5te:
99c48295ec8e 8214465: Upgrade arm-sflt minimum architecture to ARMv5TE for assembler
dholmes
parents: 52735
diff changeset
    52
    # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82445, and it was fixed only quite recently.
99c48295ec8e 8214465: Upgrade arm-sflt minimum architecture to ARMv5TE for assembler
dholmes
parents: 52735
diff changeset
    53
    # The resulting compromise is to enable v5TE for assembler and let GCC generate code for v5T.
42538
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    54
    if test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-vfp-sflt; then
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    55
      ARM_FLOAT_TYPE=vfp-sflt
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    56
      ARM_ARCH_TYPE_FLAGS='-march=armv7-a -mthumb'
52735
7b9f61b7fd94 8214466: Append assembler flags on ARM targets
dholmes
parents: 52351
diff changeset
    57
      ARM_ARCH_TYPE_ASFLAGS='-march=armv7-a -mthumb'
42538
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    58
    elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-vfp-hflt; then
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    59
      ARM_FLOAT_TYPE=vfp-hflt
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    60
      ARM_ARCH_TYPE_FLAGS='-march=armv7-a -mthumb'
52735
7b9f61b7fd94 8214466: Append assembler flags on ARM targets
dholmes
parents: 52351
diff changeset
    61
      ARM_ARCH_TYPE_ASFLAGS='-march=armv7-a -mthumb'
42538
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    62
    elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-sflt; then
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    63
      ARM_FLOAT_TYPE=sflt
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    64
      ARM_ARCH_TYPE_FLAGS='-march=armv5t -marm'
52736
99c48295ec8e 8214465: Upgrade arm-sflt minimum architecture to ARMv5TE for assembler
dholmes
parents: 52735
diff changeset
    65
      ARM_ARCH_TYPE_ASFLAGS='-march=armv5te'
42538
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    66
    elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarmv5-vfp-sflt; then
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    67
      ARM_FLOAT_TYPE=vfp-sflt
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    68
      ARM_ARCH_TYPE_FLAGS='-march=armv5t -marm'
52736
99c48295ec8e 8214465: Upgrade arm-sflt minimum architecture to ARMv5TE for assembler
dholmes
parents: 52735
diff changeset
    69
      ARM_ARCH_TYPE_ASFLAGS='-march=armv5te'
42538
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    70
    elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarmv6-vfp-hflt; then
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    71
      ARM_FLOAT_TYPE=vfp-hflt
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    72
      ARM_ARCH_TYPE_FLAGS='-march=armv6 -marm'
52735
7b9f61b7fd94 8214466: Append assembler flags on ARM targets
dholmes
parents: 52351
diff changeset
    73
      ARM_ARCH_TYPE_ASFLAGS='-march=armv6'
42538
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    74
    elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xaarch64; then
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    75
      # No special flags, just need to trigger setting JDK_ARCH_ABI_PROP_NAME
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    76
      ARM_FLOAT_TYPE=
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    77
      ARM_ARCH_TYPE_FLAGS=
52735
7b9f61b7fd94 8214466: Append assembler flags on ARM targets
dholmes
parents: 52351
diff changeset
    78
      ARM_ARCH_TYPE_ASFLAGS=
42538
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    79
    else
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    80
      AC_MSG_ERROR([Invalid ABI profile: "$OPENJDK_TARGET_ABI_PROFILE"])
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    81
    fi
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    82
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    83
    if test "x$ARM_FLOAT_TYPE" = xvfp-sflt; then
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    84
      ARM_FLOAT_TYPE_FLAGS='-mfloat-abi=softfp -mfpu=vfp -DFLOAT_ARCH=-vfp-sflt'
52735
7b9f61b7fd94 8214466: Append assembler flags on ARM targets
dholmes
parents: 52351
diff changeset
    85
      ARM_FLOAT_TYPE_ASFLAGS="-mfloat-abi=softfp -mfpu=vfp"
42538
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    86
    elif test "x$ARM_FLOAT_TYPE" = xvfp-hflt; then
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    87
      ARM_FLOAT_TYPE_FLAGS='-mfloat-abi=hard -mfpu=vfp -DFLOAT_ARCH=-vfp-hflt'
52735
7b9f61b7fd94 8214466: Append assembler flags on ARM targets
dholmes
parents: 52351
diff changeset
    88
      ARM_FLOAT_TYPE_ASFLAGS="-mfloat-abi=hard -mfpu=vfp"
42538
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    89
    elif test "x$ARM_FLOAT_TYPE" = xsflt; then
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    90
      ARM_FLOAT_TYPE_FLAGS='-msoft-float -mfpu=vfp'
52735
7b9f61b7fd94 8214466: Append assembler flags on ARM targets
dholmes
parents: 52351
diff changeset
    91
      ARM_FLOAT_TYPE_ASFLAGS="-mfloat-abi=soft -mfpu=vfp"
42538
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    92
    fi
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    93
    AC_MSG_CHECKING([for $ARM_FLOAT_TYPE floating point flags])
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    94
    AC_MSG_RESULT([$ARM_FLOAT_TYPE_FLAGS])
52735
7b9f61b7fd94 8214466: Append assembler flags on ARM targets
dholmes
parents: 52351
diff changeset
    95
    AC_MSG_CHECKING([for $ARM_FLOAT_TYPE floating point flags for assembler])
7b9f61b7fd94 8214466: Append assembler flags on ARM targets
dholmes
parents: 52351
diff changeset
    96
    AC_MSG_RESULT([$ARM_FLOAT_TYPE_ASFLAGS])
42538
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    97
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    98
    AC_MSG_CHECKING([for arch type flags])
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    99
    AC_MSG_RESULT([$ARM_ARCH_TYPE_FLAGS])
52735
7b9f61b7fd94 8214466: Append assembler flags on ARM targets
dholmes
parents: 52351
diff changeset
   100
    AC_MSG_CHECKING([for arch type flags for assembler])
7b9f61b7fd94 8214466: Append assembler flags on ARM targets
dholmes
parents: 52351
diff changeset
   101
    AC_MSG_RESULT([$ARM_ARCH_TYPE_ASFLAGS])
42538
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
   102
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
   103
    # Now set JDK_ARCH_ABI_PROP_NAME. This is equivalent to the last part of the
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
   104
    # autoconf target triplet.
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
   105
    [ JDK_ARCH_ABI_PROP_NAME=`$ECHO $OPENJDK_TARGET_AUTOCONF_NAME | $SED -e 's/.*-\([^-]*\)$/\1/'` ]
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
   106
    # Sanity check that it is a known ABI.
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
   107
    if test "x$JDK_ARCH_ABI_PROP_NAME" != xgnu && \
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
   108
        test "x$JDK_ARCH_ABI_PROP_NAME" != xgnueabi  && \
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
   109
        test "x$JDK_ARCH_ABI_PROP_NAME" != xgnueabihf; then
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
   110
          AC_MSG_WARN([Unknown autoconf target triplet ABI: "$JDK_ARCH_ABI_PROP_NAME"])
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
   111
    fi
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
   112
    AC_MSG_CHECKING([for ABI property name])
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
   113
    AC_MSG_RESULT([$JDK_ARCH_ABI_PROP_NAME])
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
   114
    AC_SUBST(JDK_ARCH_ABI_PROP_NAME)
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
   115
  fi
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
   116
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
   117
  # When building with an abi profile, the name of that profile is appended on the
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
   118
  # bundle platform, which is used in bundle names.
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
   119
  if test "x$OPENJDK_TARGET_ABI_PROFILE" != x; then
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
   120
    OPENJDK_TARGET_BUNDLE_PLATFORM="$OPENJDK_TARGET_OS_BUNDLE-$OPENJDK_TARGET_ABI_PROFILE"
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
   121
  fi
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
   122
])
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
   123
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   124
AC_DEFUN([FLAGS_SETUP_MACOSX_VERSION],
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   125
[
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   126
  # Additional macosx handling
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   127
  if test "x$OPENJDK_TARGET_OS" = xmacosx; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   128
    # MACOSX_VERSION_MIN specifies the lowest version of Macosx that the built
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   129
    # binaries should be compatible with, even if compiled on a newer version
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   130
    # of the OS. It currently has a hard coded value. Setting this also limits
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   131
    # exposure to API changes in header files. Bumping this is likely to
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   132
    # require code changes to build.
49523
69c6eb97297f 8196724: Change macosx deployment target to 10.9
erikj
parents: 49418
diff changeset
   133
    MACOSX_VERSION_MIN=10.9.0
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   134
    MACOSX_VERSION_MIN_NODOTS=${MACOSX_VERSION_MIN//\./}
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   135
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   136
    AC_SUBST(MACOSX_VERSION_MIN)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   137
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   138
    # Setting --with-macosx-version-max=<version> makes it an error to build or
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   139
    # link to macosx APIs that are newer than the given OS version. The expected
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   140
    # format for <version> is either nn.n.n or nn.nn.nn. See /usr/include/AvailabilityMacros.h.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   141
    AC_ARG_WITH([macosx-version-max], [AS_HELP_STRING([--with-macosx-version-max],
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   142
        [error on use of newer functionality. @<:@macosx@:>@])],
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   143
        [
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   144
          if echo "$with_macosx_version_max" | $GREP -q "^[[0-9]][[0-9]]\.[[0-9]]\.[[0-9]]\$"; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   145
              MACOSX_VERSION_MAX=$with_macosx_version_max
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   146
          elif echo "$with_macosx_version_max" | $GREP -q "^[[0-9]][[0-9]]\.[[0-9]][[0-9]]\.[[0-9]][[0-9]]\$"; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   147
              MACOSX_VERSION_MAX=$with_macosx_version_max
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   148
          elif test "x$with_macosx_version_max" = "xno"; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   149
              # Use build system default
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   150
              MACOSX_VERSION_MAX=
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   151
          else
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   152
              AC_MSG_ERROR([osx version format must be nn.n.n or nn.nn.nn])
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   153
          fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   154
        ],
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   155
        [MACOSX_VERSION_MAX=]
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   156
    )
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   157
    MACOSX_VERSION_MAX_NODOTS=${MACOSX_VERSION_MAX//\./}
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   158
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   159
    AC_SUBST(MACOSX_VERSION_MAX)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   160
  fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   161
])
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   162
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   163
# 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
   164
# corresponding configure arguments instead
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   165
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
   166
[
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   167
  if test "x$CFLAGS" != "x"; then
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   168
    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
   169
  fi
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   170
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   171
  if test "x$CXXFLAGS" != "x"; then
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   172
    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
   173
  fi
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   174
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   175
  if test "x$LDFLAGS" != "x"; then
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   176
    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
   177
  fi
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   178
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   179
  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
   180
      [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
   181
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   182
  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
   183
      [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
   184
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   185
  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
   186
      [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
   187
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   188
  USER_CFLAGS="$with_extra_cflags"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   189
  USER_CXXFLAGS="$with_extra_cxxflags"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   190
  USER_LDFLAGS="$with_extra_ldflags"
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   191
])
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   192
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   193
# 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
   194
# 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
   195
# TOOLCHAIN_TYPE is available here.
33395
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   196
# Param 1 - Optional prefix to all variables. (e.g BUILD_)
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   197
AC_DEFUN([FLAGS_SETUP_SYSROOT_FLAGS],
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   198
[
33395
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   199
  if test "x[$]$1SYSROOT" != "x"; then
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   200
    if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   201
      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
   202
        # 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
   203
        # make sure the default include and lib dirs are appended to each
35450
0124e2c9ef64 8148929: Suboptimal code generated when setting sysroot include with Solaris Studio
erikj
parents: 35444
diff changeset
   204
        # compile and link command line. Must also add -I-xbuiltin to enable
0124e2c9ef64 8148929: Suboptimal code generated when setting sysroot include with Solaris Studio
erikj
parents: 35444
diff changeset
   205
        # inlining of system functions and intrinsics.
0124e2c9ef64 8148929: Suboptimal code generated when setting sysroot include with Solaris Studio
erikj
parents: 35444
diff changeset
   206
        $1SYSROOT_CFLAGS="-I-xbuiltin -I[$]$1SYSROOT/usr/include"
33395
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   207
        $1SYSROOT_LDFLAGS="-L[$]$1SYSROOT/usr/lib$OPENJDK_TARGET_CPU_ISADIR \
41040
7b919a4497ff 8165161: Solaris: /usr/ccs /opt/sfw and /opt/csw are dead, references should be expunged
alanbur
parents: 39940
diff changeset
   208
            -L[$]$1SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR"
48909
54b423e1c4cf 8153294: Solaris devkit uses linker from system instead of in devkit
erikj
parents: 48854
diff changeset
   209
        # If the devkit contains the ld linker, make sure we use it.
54b423e1c4cf 8153294: Solaris devkit uses linker from system instead of in devkit
erikj
parents: 48854
diff changeset
   210
        AC_PATH_PROG(SOLARIS_LD, ld, , $DEVKIT_TOOLCHAIN_PATH:$DEVKIT_EXTRA_PATH)
54b423e1c4cf 8153294: Solaris devkit uses linker from system instead of in devkit
erikj
parents: 48854
diff changeset
   211
        # Make sure this ld is runnable.
54b423e1c4cf 8153294: Solaris devkit uses linker from system instead of in devkit
erikj
parents: 48854
diff changeset
   212
        if test -f "$SOLARIS_LD"; then
54b423e1c4cf 8153294: Solaris devkit uses linker from system instead of in devkit
erikj
parents: 48854
diff changeset
   213
          if "$SOLARIS_LD" -V > /dev/null 2> /dev/null; then
54b423e1c4cf 8153294: Solaris devkit uses linker from system instead of in devkit
erikj
parents: 48854
diff changeset
   214
            $1SYSROOT_LDFLAGS="[$]$1SYSROOT_LDFLAGS -Yl,$(dirname $SOLARIS_LD)"
54b423e1c4cf 8153294: Solaris devkit uses linker from system instead of in devkit
erikj
parents: 48854
diff changeset
   215
          else
54b423e1c4cf 8153294: Solaris devkit uses linker from system instead of in devkit
erikj
parents: 48854
diff changeset
   216
            AC_MSG_WARN([Could not run $SOLARIS_LD found in devkit, reverting to system ld])
54b423e1c4cf 8153294: Solaris devkit uses linker from system instead of in devkit
erikj
parents: 48854
diff changeset
   217
          fi
54b423e1c4cf 8153294: Solaris devkit uses linker from system instead of in devkit
erikj
parents: 48854
diff changeset
   218
        fi
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   219
      fi
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   220
    elif test "x$TOOLCHAIN_TYPE" = xgcc; then
33395
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   221
      $1SYSROOT_CFLAGS="--sysroot=[$]$1SYSROOT"
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   222
      $1SYSROOT_LDFLAGS="--sysroot=[$]$1SYSROOT"
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   223
    elif test "x$TOOLCHAIN_TYPE" = xclang; then
33395
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   224
      $1SYSROOT_CFLAGS="-isysroot [$]$1SYSROOT"
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   225
      $1SYSROOT_LDFLAGS="-isysroot [$]$1SYSROOT"
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   226
    fi
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   227
  fi
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   228
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   229
  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
   230
    # We also need -iframework<path>/System/Library/Frameworks
33395
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   231
    $1SYSROOT_CFLAGS="[$]$1SYSROOT_CFLAGS -iframework [$]$1SYSROOT/System/Library/Frameworks"
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   232
    $1SYSROOT_LDFLAGS="[$]$1SYSROOT_LDFLAGS -iframework [$]$1SYSROOT/System/Library/Frameworks"
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   233
    # 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
   234
    # set this here so it doesn't have to be peppered throughout the forest
33395
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   235
    $1SYSROOT_CFLAGS="[$]$1SYSROOT_CFLAGS -F [$]$1SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks"
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   236
    $1SYSROOT_LDFLAGS="[$]$1SYSROOT_LDFLAGS -F [$]$1SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks"
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   237
  fi
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   238
33395
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   239
  AC_SUBST($1SYSROOT_CFLAGS)
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   240
  AC_SUBST($1SYSROOT_LDFLAGS)
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   241
])
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   242
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   243
AC_DEFUN_ONCE([FLAGS_PRE_TOOLCHAIN],
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   244
[
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   245
  # We should always include user supplied flags
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   246
  FLAGS_SETUP_USER_SUPPLIED_FLAGS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   247
  # The sysroot flags are needed for configure to be able to run the compilers
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   248
  FLAGS_SETUP_SYSROOT_FLAGS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   249
49846
a24f067a02dc 8201536: configure fails compiler check due to bad -m32 flag
ihse
parents: 49534
diff changeset
   250
  # For solstudio and xlc, the word size flag is required for correct behavior.
a24f067a02dc 8201536: configure fails compiler check due to bad -m32 flag
ihse
parents: 49534
diff changeset
   251
  # For clang/gcc, the flag is only strictly required for reduced builds, but
a24f067a02dc 8201536: configure fails compiler check due to bad -m32 flag
ihse
parents: 49534
diff changeset
   252
  # set it always where possible (x86, sparc and ppc).
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   253
  if test "x$TOOLCHAIN_TYPE" = xxlc; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   254
    MACHINE_FLAG="-q${OPENJDK_TARGET_CPU_BITS}"
49846
a24f067a02dc 8201536: configure fails compiler check due to bad -m32 flag
ihse
parents: 49534
diff changeset
   255
  elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
a24f067a02dc 8201536: configure fails compiler check due to bad -m32 flag
ihse
parents: 49534
diff changeset
   256
    MACHINE_FLAG="-m${OPENJDK_TARGET_CPU_BITS}"
a24f067a02dc 8201536: configure fails compiler check due to bad -m32 flag
ihse
parents: 49534
diff changeset
   257
  elif test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
51641
9ce4a0d718c7 8165440: Add Zero support for x86_64-linux-gnux32 target
glaubitz
parents: 49846
diff changeset
   258
    if test "x$OPENJDK_TARGET_CPU_ARCH" = xx86 &&
9ce4a0d718c7 8165440: Add Zero support for x86_64-linux-gnux32 target
glaubitz
parents: 49846
diff changeset
   259
        test "x$OPENJDK_TARGET_CPU" != xx32 ||
49846
a24f067a02dc 8201536: configure fails compiler check due to bad -m32 flag
ihse
parents: 49534
diff changeset
   260
        test "x$OPENJDK_TARGET_CPU_ARCH" = xsparc ||
a24f067a02dc 8201536: configure fails compiler check due to bad -m32 flag
ihse
parents: 49534
diff changeset
   261
        test "x$OPENJDK_TARGET_CPU_ARCH" = xppc; then
49132
5d35b6050163 8199052: Configure broken on aarch64
ihse
parents: 49120
diff changeset
   262
      MACHINE_FLAG="-m${OPENJDK_TARGET_CPU_BITS}"
5d35b6050163 8199052: Configure broken on aarch64
ihse
parents: 49120
diff changeset
   263
    fi
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   264
  fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   265
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   266
  # FIXME: global flags are not used yet...
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   267
  # The "global" flags will *always* be set. Without them, it is not possible to
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   268
  # get a working compilation.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   269
  GLOBAL_CFLAGS="$MACHINE_FLAG $SYSROOT_CFLAGS $USER_CFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   270
  GLOBAL_CXXFLAGS="$MACHINE_FLAG $SYSROOT_CFLAGS $USER_CXXFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   271
  GLOBAL_LDFLAGS="$MACHINE_FLAG $SYSROOT_LDFLAGS $USER_LDFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   272
  # FIXME: Don't really know how to do with this, but this was the old behavior
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   273
  GLOBAL_CPPFLAGS="$SYSROOT_CFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   274
  AC_SUBST(GLOBAL_CFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   275
  AC_SUBST(GLOBAL_CXXFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   276
  AC_SUBST(GLOBAL_LDFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   277
  AC_SUBST(GLOBAL_CPPFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   278
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   279
  # FIXME: For compatilibity, export this as EXTRA_CFLAGS for now.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   280
  EXTRA_CFLAGS="$MACHINE_FLAG $USER_CFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   281
  EXTRA_CXXFLAGS="$MACHINE_FLAG $USER_CXXFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   282
  EXTRA_LDFLAGS="$MACHINE_FLAG $USER_LDFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   283
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   284
  AC_SUBST(EXTRA_CFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   285
  AC_SUBST(EXTRA_CXXFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   286
  AC_SUBST(EXTRA_LDFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   287
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   288
  # For autoconf testing to work, the global flags must also be stored in the
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   289
  # "unnamed" CFLAGS etc.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   290
  CFLAGS="$GLOBAL_CFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   291
  CXXFLAGS="$GLOBAL_CXXFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   292
  LDFLAGS="$GLOBAL_LDFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   293
  CPPFLAGS="$GLOBAL_CPPFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   294
])
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   295
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   296
AC_DEFUN([FLAGS_SETUP_TOOLCHAIN_CONTROL],
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   297
[
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   298
  # COMPILER_TARGET_BITS_FLAG  : option for selecting 32- or 64-bit output
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   299
  # COMPILER_COMMAND_FILE_FLAG : option for passing a command file to the compiler
36051
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   300
  # COMPILER_BINDCMD_FILE_FLAG : option for specifying a file which saves the binder
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   301
  #                              commands produced by the link step (currently AIX only)
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   302
  if test "x$TOOLCHAIN_TYPE" = xxlc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   303
    COMPILER_TARGET_BITS_FLAG="-q"
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   304
    COMPILER_COMMAND_FILE_FLAG="-f"
36051
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   305
    COMPILER_BINDCMD_FILE_FLAG="-bloadmap:"
22458
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   306
  else
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   307
    COMPILER_TARGET_BITS_FLAG="-m"
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   308
    COMPILER_COMMAND_FILE_FLAG="@"
36051
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   309
    COMPILER_BINDCMD_FILE_FLAG=""
34864
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   310
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   311
    # The solstudio linker does not support @-files.
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   312
    if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   313
      COMPILER_COMMAND_FILE_FLAG=
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   314
    fi
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   315
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   316
    # Check if @file is supported by gcc
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   317
    if test "x$TOOLCHAIN_TYPE" = xgcc; then
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   318
      AC_MSG_CHECKING([if @file is supported by gcc])
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   319
      # Extra emtpy "" to prevent ECHO from interpreting '--version' as argument
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   320
      $ECHO "" "--version" > command.file
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   321
      if $CXX @command.file 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD; then
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   322
        AC_MSG_RESULT(yes)
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   323
        COMPILER_COMMAND_FILE_FLAG="@"
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   324
      else
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   325
        AC_MSG_RESULT(no)
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   326
        COMPILER_COMMAND_FILE_FLAG=
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   327
      fi
38843
2b141e8e916f 8158535: Configure script uses basic tools directly in many places
erikj
parents: 37864
diff changeset
   328
      $RM command.file
34864
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   329
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   330
  fi
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   331
22467
kvn
parents: 22466 21055
diff changeset
   332
  AC_SUBST(COMPILER_TARGET_BITS_FLAG)
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   333
  AC_SUBST(COMPILER_COMMAND_FILE_FLAG)
36051
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   334
  AC_SUBST(COMPILER_BINDCMD_FILE_FLAG)
22466
25aaf85d1ada 8024265: Enable new build on AIX
simonis
parents: 22465
diff changeset
   335
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   336
  # Check that the compiler supports -mX (or -qX on AIX) flags
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   337
  # Set COMPILER_SUPPORTS_TARGET_BITS_FLAG to 'true' if it does
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   338
  FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}],
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   339
      IF_TRUE: [COMPILER_SUPPORTS_TARGET_BITS_FLAG=true],
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   340
      IF_FALSE: [COMPILER_SUPPORTS_TARGET_BITS_FLAG=false])
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   341
  AC_SUBST(COMPILER_SUPPORTS_TARGET_BITS_FLAG)
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   342
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   343
  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   344
    CC_OUT_OPTION=-Fo
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   345
    LD_OUT_OPTION=-out:
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   346
    AR_OUT_OPTION=-out:
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   347
  else
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   348
    # 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
   349
    # 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
   350
    CC_OUT_OPTION='-o$(SPACE)'
49534
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49523
diff changeset
   351
    # When linking, how to specify the output
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   352
    LD_OUT_OPTION='-o$(SPACE)'
51783
4482acfef2a5 8210729: Clean up macosx static library handling
ihse
parents: 51641
diff changeset
   353
    # When archiving, how to specify the destination static archive.
4482acfef2a5 8210729: Clean up macosx static library handling
ihse
parents: 51641
diff changeset
   354
    if test "x$OPENJDK_TARGET_OS" = xmacosx; then
4482acfef2a5 8210729: Clean up macosx static library handling
ihse
parents: 51641
diff changeset
   355
      AR_OUT_OPTION='-r -cs$(SPACE)'
4482acfef2a5 8210729: Clean up macosx static library handling
ihse
parents: 51641
diff changeset
   356
    else
4482acfef2a5 8210729: Clean up macosx static library handling
ihse
parents: 51641
diff changeset
   357
      AR_OUT_OPTION='-rcs$(SPACE)'
4482acfef2a5 8210729: Clean up macosx static library handling
ihse
parents: 51641
diff changeset
   358
    fi
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   359
  fi
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   360
  AC_SUBST(CC_OUT_OPTION)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   361
  AC_SUBST(LD_OUT_OPTION)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   362
  AC_SUBST(AR_OUT_OPTION)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   363
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   364
  # Generate make dependency files
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   365
  if test "x$TOOLCHAIN_TYPE" = xgcc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   366
    C_FLAG_DEPS="-MMD -MF"
23161
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   367
  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
   368
    C_FLAG_DEPS="-MMD -MF"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   369
  elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   370
    C_FLAG_DEPS="-xMMD -xMF"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   371
  elif test "x$TOOLCHAIN_TYPE" = xxlc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   372
    C_FLAG_DEPS="-qmakedep=gcc -MF"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   373
  fi
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   374
  CXX_FLAG_DEPS="$C_FLAG_DEPS"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   375
  AC_SUBST(C_FLAG_DEPS)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   376
  AC_SUBST(CXX_FLAG_DEPS)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   377
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   378
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   379
AC_DEFUN_ONCE([FLAGS_POST_TOOLCHAIN],
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   380
[
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   381
  FLAGS_SETUP_TOOLCHAIN_CONTROL
46224
b1ce24ef8897 8174231: Factor out and share PlatformEvent and Parker code for POSIX systems
dholmes
parents: 44398
diff changeset
   382
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   383
  if test "x$BUILD_SYSROOT" != x; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   384
    FLAGS_SETUP_SYSROOT_FLAGS([BUILD_])
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   385
  else
49204
564802b01ded 8199451: Create linux-aarch64 cross-compilation devkit, and fix cross-compilation
ihse
parents: 49194
diff changeset
   386
    if test "x$COMPILE_TYPE" != "xcross"; then
564802b01ded 8199451: Create linux-aarch64 cross-compilation devkit, and fix cross-compilation
ihse
parents: 49194
diff changeset
   387
      BUILD_SYSROOT_CFLAGS="$SYSROOT_CFLAGS"
564802b01ded 8199451: Create linux-aarch64 cross-compilation devkit, and fix cross-compilation
ihse
parents: 49194
diff changeset
   388
      BUILD_SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS"
564802b01ded 8199451: Create linux-aarch64 cross-compilation devkit, and fix cross-compilation
ihse
parents: 49194
diff changeset
   389
    fi
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   390
  fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   391
  AC_SUBST(BUILD_SYSROOT_CFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   392
  AC_SUBST(BUILD_SYSROOT_LDFLAGS)
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   393
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   394
])
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   395
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   396
AC_DEFUN([FLAGS_SETUP_FLAGS],
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   397
[
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   398
  FLAGS_SETUP_MACOSX_VERSION
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   399
  FLAGS_SETUP_ABI_PROFILE
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   400
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   401
  FLAGS_SETUP_SHARED_LIBS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   402
  FLAGS_SETUP_DEBUG_SYMBOLS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   403
  FLAGS_SETUP_WARNINGS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   404
  FLAGS_SETUP_QUALITY_CHECKS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   405
  FLAGS_SETUP_OPTIMIZATION
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   406
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   407
  FLAGS_SETUP_CFLAGS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   408
  FLAGS_SETUP_LDFLAGS
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   409
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   410
  FLAGS_SETUP_ARFLAGS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   411
  FLAGS_SETUP_STRIPFLAGS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   412
  FLAGS_SETUP_RCFLAGS
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   413
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   414
  FLAGS_SETUP_ASFLAGS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   415
  FLAGS_SETUP_ASFLAGS_CPU_DEP([TARGET])
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   416
  FLAGS_SETUP_ASFLAGS_CPU_DEP([BUILD], [OPENJDK_BUILD_])
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   417
])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   418
36535
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   419
# FLAGS_C_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   420
#                                  IF_FALSE: [RUN-IF-FALSE])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   421
# ------------------------------------------------------------
36535
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   422
# Check that the C compiler supports an argument
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   423
BASIC_DEFUN_NAMED([FLAGS_C_COMPILER_CHECK_ARGUMENTS],
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   424
    [*ARGUMENT IF_TRUE IF_FALSE], [$@],
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   425
[
36535
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   426
  AC_MSG_CHECKING([if the C compiler supports "ARG_ARGUMENT"])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   427
  supports=yes
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   428
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   429
  saved_cflags="$CFLAGS"
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   430
  CFLAGS="$CFLAGS ARG_ARGUMENT"
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   431
  AC_LANG_PUSH([C])
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   432
  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   433
      [supports=no])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   434
  AC_LANG_POP([C])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   435
  CFLAGS="$saved_cflags"
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   436
36535
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   437
  AC_MSG_RESULT([$supports])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   438
  if test "x$supports" = "xyes" ; then
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   439
    :
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   440
    ARG_IF_TRUE
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   441
  else
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   442
    :
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   443
    ARG_IF_FALSE
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   444
  fi
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   445
])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   446
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   447
# FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   448
#                                    IF_FALSE: [RUN-IF-FALSE])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   449
# ------------------------------------------------------------
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   450
# Check that the C++ compiler supports an argument
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   451
BASIC_DEFUN_NAMED([FLAGS_CXX_COMPILER_CHECK_ARGUMENTS],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   452
    [*ARGUMENT IF_TRUE IF_FALSE], [$@],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   453
[
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   454
  AC_MSG_CHECKING([if the C++ compiler supports "ARG_ARGUMENT"])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   455
  supports=yes
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   456
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   457
  saved_cxxflags="$CXXFLAGS"
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   458
  CXXFLAGS="$CXXFLAG ARG_ARGUMENT"
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   459
  AC_LANG_PUSH([C++])
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   460
  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   461
      [supports=no])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   462
  AC_LANG_POP([C++])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   463
  CXXFLAGS="$saved_cxxflags"
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   464
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   465
  AC_MSG_RESULT([$supports])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   466
  if test "x$supports" = "xyes" ; then
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   467
    :
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   468
    ARG_IF_TRUE
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   469
  else
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   470
    :
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   471
    ARG_IF_FALSE
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   472
  fi
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   473
])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   474
36535
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   475
# FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   476
#                                IF_FALSE: [RUN-IF-FALSE])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   477
# ------------------------------------------------------------
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   478
# Check that the C and C++ compilers support an argument
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   479
BASIC_DEFUN_NAMED([FLAGS_COMPILER_CHECK_ARGUMENTS],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   480
    [*ARGUMENT IF_TRUE IF_FALSE], [$@],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   481
[
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   482
  FLAGS_C_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARG_ARGUMENT],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   483
  					     IF_TRUE: [C_COMP_SUPPORTS="yes"],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   484
					     IF_FALSE: [C_COMP_SUPPORTS="no"])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   485
  FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARG_ARGUMENT],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   486
  					       IF_TRUE: [CXX_COMP_SUPPORTS="yes"],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   487
					       IF_FALSE: [CXX_COMP_SUPPORTS="no"])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   488
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   489
  AC_MSG_CHECKING([if both compilers support "ARG_ARGUMENT"])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   490
  supports=no
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   491
  if test "x$C_COMP_SUPPORTS" = "xyes" -a "x$CXX_COMP_SUPPORTS" = "xyes"; then supports=yes; fi
42141
06c697759688 7164925: Change -KPIC to -xcode=pic32 on sparc
ihse
parents: 42140
diff changeset
   492
36535
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   493
  AC_MSG_RESULT([$supports])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   494
  if test "x$supports" = "xyes" ; then
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   495
    :
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   496
    ARG_IF_TRUE
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   497
  else
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   498
    :
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   499
    ARG_IF_FALSE
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   500
  fi
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   501
])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   502
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   503
# FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   504
#                                   IF_FALSE: [RUN-IF-FALSE])
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   505
# ------------------------------------------------------------
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   506
# Check that the linker support an argument
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   507
BASIC_DEFUN_NAMED([FLAGS_LINKER_CHECK_ARGUMENTS],
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   508
    [*ARGUMENT IF_TRUE IF_FALSE], [$@],
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   509
[
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   510
  AC_MSG_CHECKING([if linker supports "ARG_ARGUMENT"])
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   511
  supports=yes
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   512
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   513
  saved_ldflags="$LDFLAGS"
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   514
  LDFLAGS="$LDFLAGS ARG_ARGUMENT"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   515
  AC_LANG_PUSH([C])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   516
  AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   517
      [], [supports=no])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   518
  AC_LANG_POP([C])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   519
  LDFLAGS="$saved_ldflags"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   520
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   521
  AC_MSG_RESULT([$supports])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   522
  if test "x$supports" = "xyes" ; then
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   523
    :
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   524
    ARG_IF_TRUE
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   525
  else
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   526
    :
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   527
    ARG_IF_FALSE
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   528
  fi
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   529
])