make/autoconf/flags.m4
author eosterlund
Fri, 08 Jun 2018 11:30:10 +0200
changeset 50470 f3aac763a315
parent 49846 a24f067a02dc
child 51641 9ce4a0d718c7
child 56721 01b558efd286
child 56726 3a9b7a1f9197
permissions -rw-r--r--
8204504: Fix for 8198285 breaks slowdebug builds Reviewed-by: rkennke, mgronlun
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],
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    37
      [specify ABI profile for ARM builds (arm-vfp-sflt,arm-vfp-hflt,arm-sflt, armv5-vfp-sflt,armv6-vfp-hflt,arm64,aarch64) @<:@toolchain dependent@:>@ ])])
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
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    49
    if test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-vfp-sflt; then
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    50
      ARM_FLOAT_TYPE=vfp-sflt
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    51
      ARM_ARCH_TYPE_FLAGS='-march=armv7-a -mthumb'
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    52
    elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-vfp-hflt; then
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    53
      ARM_FLOAT_TYPE=vfp-hflt
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    54
      ARM_ARCH_TYPE_FLAGS='-march=armv7-a -mthumb'
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    55
    elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-sflt; then
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    56
      ARM_FLOAT_TYPE=sflt
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    57
      ARM_ARCH_TYPE_FLAGS='-march=armv5t -marm'
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    58
    elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarmv5-vfp-sflt; then
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    59
      ARM_FLOAT_TYPE=vfp-sflt
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    60
      ARM_ARCH_TYPE_FLAGS='-march=armv5t -marm'
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    61
    elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarmv6-vfp-hflt; then
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    62
      ARM_FLOAT_TYPE=vfp-hflt
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    63
      ARM_ARCH_TYPE_FLAGS='-march=armv6 -marm'
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    64
    elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm64; then
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    65
      # 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
    66
      ARM_FLOAT_TYPE=
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    67
      ARM_ARCH_TYPE_FLAGS=
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    68
    elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xaarch64; then
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    69
      # 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
    70
      ARM_FLOAT_TYPE=
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    71
      ARM_ARCH_TYPE_FLAGS=
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    72
    else
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    73
      AC_MSG_ERROR([Invalid ABI profile: "$OPENJDK_TARGET_ABI_PROFILE"])
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    74
    fi
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    75
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    76
    if test "x$ARM_FLOAT_TYPE" = xvfp-sflt; then
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    77
      ARM_FLOAT_TYPE_FLAGS='-mfloat-abi=softfp -mfpu=vfp -DFLOAT_ARCH=-vfp-sflt'
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    78
    elif test "x$ARM_FLOAT_TYPE" = xvfp-hflt; then
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    79
      ARM_FLOAT_TYPE_FLAGS='-mfloat-abi=hard -mfpu=vfp -DFLOAT_ARCH=-vfp-hflt'
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    80
    elif test "x$ARM_FLOAT_TYPE" = xsflt; then
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    81
      ARM_FLOAT_TYPE_FLAGS='-msoft-float -mfpu=vfp'
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    82
    fi
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    83
    AC_MSG_CHECKING([for $ARM_FLOAT_TYPE floating point flags])
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    84
    AC_MSG_RESULT([$ARM_FLOAT_TYPE_FLAGS])
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    85
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    86
    AC_MSG_CHECKING([for arch type flags])
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    87
    AC_MSG_RESULT([$ARM_ARCH_TYPE_FLAGS])
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    88
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    89
    # 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
    90
    # autoconf target triplet.
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    91
    [ 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
    92
    # Sanity check that it is a known ABI.
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    93
    if test "x$JDK_ARCH_ABI_PROP_NAME" != xgnu && \
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    94
        test "x$JDK_ARCH_ABI_PROP_NAME" != xgnueabi  && \
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    95
        test "x$JDK_ARCH_ABI_PROP_NAME" != xgnueabihf; then
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    96
          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
    97
    fi
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    98
    AC_MSG_CHECKING([for ABI property name])
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
    99
    AC_MSG_RESULT([$JDK_ARCH_ABI_PROP_NAME])
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
   100
    AC_SUBST(JDK_ARCH_ABI_PROP_NAME)
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
   101
  fi
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
  # 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
   104
  # bundle platform, which is used in bundle names.
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
   105
  if test "x$OPENJDK_TARGET_ABI_PROFILE" != x; then
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
   106
    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
   107
  fi
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
   108
])
973e43884dba 8168503: JEP 297: Unified arm32/arm64 Port
bobv
parents: 42530
diff changeset
   109
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   110
AC_DEFUN([FLAGS_SETUP_MACOSX_VERSION],
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   111
[
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   112
  # Additional macosx handling
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   113
  if test "x$OPENJDK_TARGET_OS" = xmacosx; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   114
    # MACOSX_VERSION_MIN specifies the lowest version of Macosx that the built
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   115
    # binaries should be compatible with, even if compiled on a newer version
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   116
    # 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
   117
    # exposure to API changes in header files. Bumping this is likely to
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   118
    # require code changes to build.
49523
69c6eb97297f 8196724: Change macosx deployment target to 10.9
erikj
parents: 49418
diff changeset
   119
    MACOSX_VERSION_MIN=10.9.0
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   120
    MACOSX_VERSION_MIN_NODOTS=${MACOSX_VERSION_MIN//\./}
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   121
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   122
    AC_SUBST(MACOSX_VERSION_MIN)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   123
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   124
    # 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
   125
    # 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
   126
    # 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
   127
    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
   128
        [error on use of newer functionality. @<:@macosx@:>@])],
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   129
        [
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   130
          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
   131
              MACOSX_VERSION_MAX=$with_macosx_version_max
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   132
          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
   133
              MACOSX_VERSION_MAX=$with_macosx_version_max
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   134
          elif test "x$with_macosx_version_max" = "xno"; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   135
              # Use build system default
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   136
              MACOSX_VERSION_MAX=
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   137
          else
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   138
              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
   139
          fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   140
        ],
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   141
        [MACOSX_VERSION_MAX=]
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   142
    )
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   143
    MACOSX_VERSION_MAX_NODOTS=${MACOSX_VERSION_MAX//\./}
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   144
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   145
    AC_SUBST(MACOSX_VERSION_MAX)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   146
  fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   147
])
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   148
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   149
# 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
   150
# corresponding configure arguments instead
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   151
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
   152
[
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   153
  if test "x$CFLAGS" != "x"; then
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   154
    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
   155
  fi
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   156
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   157
  if test "x$CXXFLAGS" != "x"; then
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   158
    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
   159
  fi
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   160
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   161
  if test "x$LDFLAGS" != "x"; then
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   162
    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
   163
  fi
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   164
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   165
  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
   166
      [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
   167
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   168
  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
   169
      [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
   170
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   171
  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
   172
      [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
   173
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   174
  USER_CFLAGS="$with_extra_cflags"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   175
  USER_CXXFLAGS="$with_extra_cxxflags"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   176
  USER_LDFLAGS="$with_extra_ldflags"
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   177
])
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
# 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
   180
# 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
   181
# TOOLCHAIN_TYPE is available here.
33395
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   182
# 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
   183
AC_DEFUN([FLAGS_SETUP_SYSROOT_FLAGS],
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   184
[
33395
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   185
  if test "x[$]$1SYSROOT" != "x"; then
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   186
    if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   187
      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
   188
        # 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
   189
        # 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
   190
        # 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
   191
        # inlining of system functions and intrinsics.
0124e2c9ef64 8148929: Suboptimal code generated when setting sysroot include with Solaris Studio
erikj
parents: 35444
diff changeset
   192
        $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
   193
        $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
   194
            -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
   195
        # 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
   196
        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
   197
        # Make sure this ld is runnable.
54b423e1c4cf 8153294: Solaris devkit uses linker from system instead of in devkit
erikj
parents: 48854
diff changeset
   198
        if test -f "$SOLARIS_LD"; then
54b423e1c4cf 8153294: Solaris devkit uses linker from system instead of in devkit
erikj
parents: 48854
diff changeset
   199
          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
   200
            $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
   201
          else
54b423e1c4cf 8153294: Solaris devkit uses linker from system instead of in devkit
erikj
parents: 48854
diff changeset
   202
            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
   203
          fi
54b423e1c4cf 8153294: Solaris devkit uses linker from system instead of in devkit
erikj
parents: 48854
diff changeset
   204
        fi
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   205
      fi
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   206
    elif test "x$TOOLCHAIN_TYPE" = xgcc; then
33395
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   207
      $1SYSROOT_CFLAGS="--sysroot=[$]$1SYSROOT"
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   208
      $1SYSROOT_LDFLAGS="--sysroot=[$]$1SYSROOT"
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   209
    elif test "x$TOOLCHAIN_TYPE" = xclang; then
33395
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   210
      $1SYSROOT_CFLAGS="-isysroot [$]$1SYSROOT"
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   211
      $1SYSROOT_LDFLAGS="-isysroot [$]$1SYSROOT"
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   212
    fi
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   213
  fi
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   214
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   215
  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
   216
    # 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
   217
    $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
   218
    $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
   219
    # 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
   220
    # 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
   221
    $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
   222
    $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
   223
  fi
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   224
33395
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   225
  AC_SUBST($1SYSROOT_CFLAGS)
5907d5b1287c 8140593: Add configure parameter for devkit for the build compiler
erikj
parents: 33394
diff changeset
   226
  AC_SUBST($1SYSROOT_LDFLAGS)
32810
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   227
])
8203e52cd373 8138694: Devkit build on Macosx still requires Xcode to be installed
erikj
parents: 30856
diff changeset
   228
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   229
AC_DEFUN_ONCE([FLAGS_PRE_TOOLCHAIN],
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   230
[
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   231
  # We should always include user supplied flags
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   232
  FLAGS_SETUP_USER_SUPPLIED_FLAGS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   233
  # 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
   234
  FLAGS_SETUP_SYSROOT_FLAGS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   235
49846
a24f067a02dc 8201536: configure fails compiler check due to bad -m32 flag
ihse
parents: 49534
diff changeset
   236
  # 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
   237
  # 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
   238
  # set it always where possible (x86, sparc and ppc).
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   239
  if test "x$TOOLCHAIN_TYPE" = xxlc; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   240
    MACHINE_FLAG="-q${OPENJDK_TARGET_CPU_BITS}"
49846
a24f067a02dc 8201536: configure fails compiler check due to bad -m32 flag
ihse
parents: 49534
diff changeset
   241
  elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
a24f067a02dc 8201536: configure fails compiler check due to bad -m32 flag
ihse
parents: 49534
diff changeset
   242
    MACHINE_FLAG="-m${OPENJDK_TARGET_CPU_BITS}"
a24f067a02dc 8201536: configure fails compiler check due to bad -m32 flag
ihse
parents: 49534
diff changeset
   243
  elif test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
a24f067a02dc 8201536: configure fails compiler check due to bad -m32 flag
ihse
parents: 49534
diff changeset
   244
    if test "x$OPENJDK_TARGET_CPU_ARCH" = xx86 ||
a24f067a02dc 8201536: configure fails compiler check due to bad -m32 flag
ihse
parents: 49534
diff changeset
   245
        test "x$OPENJDK_TARGET_CPU_ARCH" = xsparc ||
a24f067a02dc 8201536: configure fails compiler check due to bad -m32 flag
ihse
parents: 49534
diff changeset
   246
        test "x$OPENJDK_TARGET_CPU_ARCH" = xppc; then
49132
5d35b6050163 8199052: Configure broken on aarch64
ihse
parents: 49120
diff changeset
   247
      MACHINE_FLAG="-m${OPENJDK_TARGET_CPU_BITS}"
5d35b6050163 8199052: Configure broken on aarch64
ihse
parents: 49120
diff changeset
   248
    fi
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   249
  fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   250
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   251
  # FIXME: global flags are not used yet...
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   252
  # 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
   253
  # get a working compilation.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   254
  GLOBAL_CFLAGS="$MACHINE_FLAG $SYSROOT_CFLAGS $USER_CFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   255
  GLOBAL_CXXFLAGS="$MACHINE_FLAG $SYSROOT_CFLAGS $USER_CXXFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   256
  GLOBAL_LDFLAGS="$MACHINE_FLAG $SYSROOT_LDFLAGS $USER_LDFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   257
  # 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
   258
  GLOBAL_CPPFLAGS="$SYSROOT_CFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   259
  AC_SUBST(GLOBAL_CFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   260
  AC_SUBST(GLOBAL_CXXFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   261
  AC_SUBST(GLOBAL_LDFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   262
  AC_SUBST(GLOBAL_CPPFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   263
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   264
  # FIXME: For compatilibity, export this as EXTRA_CFLAGS for now.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   265
  EXTRA_CFLAGS="$MACHINE_FLAG $USER_CFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   266
  EXTRA_CXXFLAGS="$MACHINE_FLAG $USER_CXXFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   267
  EXTRA_LDFLAGS="$MACHINE_FLAG $USER_LDFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   268
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   269
  AC_SUBST(EXTRA_CFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   270
  AC_SUBST(EXTRA_CXXFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   271
  AC_SUBST(EXTRA_LDFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   272
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   273
  # 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
   274
  # "unnamed" CFLAGS etc.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   275
  CFLAGS="$GLOBAL_CFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   276
  CXXFLAGS="$GLOBAL_CXXFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   277
  LDFLAGS="$GLOBAL_LDFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   278
  CPPFLAGS="$GLOBAL_CPPFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   279
])
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   280
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   281
AC_DEFUN([FLAGS_SETUP_TOOLCHAIN_CONTROL],
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   282
[
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   283
  # 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
   284
  # 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
   285
  # 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
   286
  #                              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
   287
  if test "x$TOOLCHAIN_TYPE" = xxlc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   288
    COMPILER_TARGET_BITS_FLAG="-q"
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   289
    COMPILER_COMMAND_FILE_FLAG="-f"
36051
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   290
    COMPILER_BINDCMD_FILE_FLAG="-bloadmap:"
22458
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   291
  else
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   292
    COMPILER_TARGET_BITS_FLAG="-m"
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   293
    COMPILER_COMMAND_FILE_FLAG="@"
36051
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   294
    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
   295
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   296
    # 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
   297
    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
   298
      COMPILER_COMMAND_FILE_FLAG=
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   299
    fi
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   300
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   301
    # 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
   302
    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
   303
      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
   304
      # 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
   305
      $ECHO "" "--version" > command.file
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   306
      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
   307
        AC_MSG_RESULT(yes)
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   308
        COMPILER_COMMAND_FILE_FLAG="@"
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   309
      else
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   310
        AC_MSG_RESULT(no)
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   311
        COMPILER_COMMAND_FILE_FLAG=
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   312
      fi
38843
2b141e8e916f 8158535: Configure script uses basic tools directly in many places
erikj
parents: 37864
diff changeset
   313
      $RM command.file
34864
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   314
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   315
  fi
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   316
22467
kvn
parents: 22466 21055
diff changeset
   317
  AC_SUBST(COMPILER_TARGET_BITS_FLAG)
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   318
  AC_SUBST(COMPILER_COMMAND_FILE_FLAG)
36051
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   319
  AC_SUBST(COMPILER_BINDCMD_FILE_FLAG)
22466
25aaf85d1ada 8024265: Enable new build on AIX
simonis
parents: 22465
diff changeset
   320
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   321
  # Check that the compiler supports -mX (or -qX on AIX) flags
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   322
  # Set COMPILER_SUPPORTS_TARGET_BITS_FLAG to 'true' if it does
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   323
  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
   324
      IF_TRUE: [COMPILER_SUPPORTS_TARGET_BITS_FLAG=true],
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   325
      IF_FALSE: [COMPILER_SUPPORTS_TARGET_BITS_FLAG=false])
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   326
  AC_SUBST(COMPILER_SUPPORTS_TARGET_BITS_FLAG)
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   327
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   328
  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   329
    CC_OUT_OPTION=-Fo
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   330
    LD_OUT_OPTION=-out:
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   331
    AR_OUT_OPTION=-out:
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   332
  else
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   333
    # 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
   334
    # 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
   335
    CC_OUT_OPTION='-o$(SPACE)'
49534
210cf224b690 8200358: Remove mapfiles for JDK executables
ihse
parents: 49523
diff changeset
   336
    # When linking, how to specify the output
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   337
    LD_OUT_OPTION='-o$(SPACE)'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   338
    # 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
   339
    AR_OUT_OPTION='rcs$(SPACE)'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   340
  fi
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   341
  AC_SUBST(CC_OUT_OPTION)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   342
  AC_SUBST(LD_OUT_OPTION)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   343
  AC_SUBST(AR_OUT_OPTION)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   344
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   345
  # Generate make dependency files
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   346
  if test "x$TOOLCHAIN_TYPE" = xgcc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   347
    C_FLAG_DEPS="-MMD -MF"
23161
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   348
  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
   349
    C_FLAG_DEPS="-MMD -MF"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   350
  elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   351
    C_FLAG_DEPS="-xMMD -xMF"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   352
  elif test "x$TOOLCHAIN_TYPE" = xxlc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   353
    C_FLAG_DEPS="-qmakedep=gcc -MF"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   354
  fi
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   355
  CXX_FLAG_DEPS="$C_FLAG_DEPS"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   356
  AC_SUBST(C_FLAG_DEPS)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   357
  AC_SUBST(CXX_FLAG_DEPS)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   358
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   359
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   360
AC_DEFUN_ONCE([FLAGS_POST_TOOLCHAIN],
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   361
[
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   362
  FLAGS_SETUP_TOOLCHAIN_CONTROL
46224
b1ce24ef8897 8174231: Factor out and share PlatformEvent and Parker code for POSIX systems
dholmes
parents: 44398
diff changeset
   363
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   364
  if test "x$BUILD_SYSROOT" != x; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   365
    FLAGS_SETUP_SYSROOT_FLAGS([BUILD_])
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   366
  else
49204
564802b01ded 8199451: Create linux-aarch64 cross-compilation devkit, and fix cross-compilation
ihse
parents: 49194
diff changeset
   367
    if test "x$COMPILE_TYPE" != "xcross"; then
564802b01ded 8199451: Create linux-aarch64 cross-compilation devkit, and fix cross-compilation
ihse
parents: 49194
diff changeset
   368
      BUILD_SYSROOT_CFLAGS="$SYSROOT_CFLAGS"
564802b01ded 8199451: Create linux-aarch64 cross-compilation devkit, and fix cross-compilation
ihse
parents: 49194
diff changeset
   369
      BUILD_SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS"
564802b01ded 8199451: Create linux-aarch64 cross-compilation devkit, and fix cross-compilation
ihse
parents: 49194
diff changeset
   370
    fi
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   371
  fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   372
  AC_SUBST(BUILD_SYSROOT_CFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   373
  AC_SUBST(BUILD_SYSROOT_LDFLAGS)
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   374
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   375
])
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   376
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   377
AC_DEFUN([FLAGS_SETUP_FLAGS],
13133
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
  FLAGS_SETUP_MACOSX_VERSION
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   380
  FLAGS_SETUP_ABI_PROFILE
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   381
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   382
  FLAGS_SETUP_SHARED_LIBS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   383
  FLAGS_SETUP_DEBUG_SYMBOLS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   384
  FLAGS_SETUP_WARNINGS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   385
  FLAGS_SETUP_QUALITY_CHECKS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   386
  FLAGS_SETUP_OPTIMIZATION
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   387
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   388
  FLAGS_SETUP_CFLAGS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   389
  FLAGS_SETUP_LDFLAGS
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   390
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   391
  FLAGS_SETUP_ARFLAGS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   392
  FLAGS_SETUP_STRIPFLAGS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   393
  FLAGS_SETUP_RCFLAGS
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   394
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   395
  FLAGS_SETUP_ASFLAGS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   396
  FLAGS_SETUP_ASFLAGS_CPU_DEP([TARGET])
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   397
  FLAGS_SETUP_ASFLAGS_CPU_DEP([BUILD], [OPENJDK_BUILD_])
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   398
])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   399
36535
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   400
# 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
   401
#                                  IF_FALSE: [RUN-IF-FALSE])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   402
# ------------------------------------------------------------
36535
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   403
# Check that the C compiler supports an argument
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   404
BASIC_DEFUN_NAMED([FLAGS_C_COMPILER_CHECK_ARGUMENTS],
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   405
    [*ARGUMENT IF_TRUE IF_FALSE], [$@],
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   406
[
36535
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   407
  AC_MSG_CHECKING([if the C compiler supports "ARG_ARGUMENT"])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   408
  supports=yes
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   409
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   410
  saved_cflags="$CFLAGS"
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   411
  CFLAGS="$CFLAGS ARG_ARGUMENT"
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   412
  AC_LANG_PUSH([C])
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   413
  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   414
      [supports=no])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   415
  AC_LANG_POP([C])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   416
  CFLAGS="$saved_cflags"
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   417
36535
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   418
  AC_MSG_RESULT([$supports])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   419
  if test "x$supports" = "xyes" ; then
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   420
    :
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   421
    ARG_IF_TRUE
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   422
  else
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   423
    :
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   424
    ARG_IF_FALSE
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   425
  fi
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   426
])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   427
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   428
# 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
   429
#                                    IF_FALSE: [RUN-IF-FALSE])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   430
# ------------------------------------------------------------
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   431
# Check that the C++ compiler supports an argument
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   432
BASIC_DEFUN_NAMED([FLAGS_CXX_COMPILER_CHECK_ARGUMENTS],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   433
    [*ARGUMENT IF_TRUE IF_FALSE], [$@],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   434
[
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   435
  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
   436
  supports=yes
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   437
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   438
  saved_cxxflags="$CXXFLAGS"
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   439
  CXXFLAGS="$CXXFLAG ARG_ARGUMENT"
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   440
  AC_LANG_PUSH([C++])
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   441
  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   442
      [supports=no])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   443
  AC_LANG_POP([C++])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   444
  CXXFLAGS="$saved_cxxflags"
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   445
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   446
  AC_MSG_RESULT([$supports])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   447
  if test "x$supports" = "xyes" ; then
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   448
    :
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   449
    ARG_IF_TRUE
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   450
  else
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   451
    :
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   452
    ARG_IF_FALSE
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   453
  fi
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   454
])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   455
36535
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   456
# 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
   457
#                                IF_FALSE: [RUN-IF-FALSE])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   458
# ------------------------------------------------------------
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   459
# 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
   460
BASIC_DEFUN_NAMED([FLAGS_COMPILER_CHECK_ARGUMENTS],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   461
    [*ARGUMENT IF_TRUE IF_FALSE], [$@],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   462
[
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   463
  FLAGS_C_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARG_ARGUMENT],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   464
  					     IF_TRUE: [C_COMP_SUPPORTS="yes"],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   465
					     IF_FALSE: [C_COMP_SUPPORTS="no"])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   466
  FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARG_ARGUMENT],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   467
  					       IF_TRUE: [CXX_COMP_SUPPORTS="yes"],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   468
					       IF_FALSE: [CXX_COMP_SUPPORTS="no"])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   469
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   470
  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
   471
  supports=no
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   472
  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
   473
36535
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   474
  AC_MSG_RESULT([$supports])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   475
  if test "x$supports" = "xyes" ; then
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   476
    :
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   477
    ARG_IF_TRUE
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   478
  else
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   479
    :
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   480
    ARG_IF_FALSE
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   481
  fi
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   482
])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   483
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   484
# FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   485
#                                   IF_FALSE: [RUN-IF-FALSE])
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   486
# ------------------------------------------------------------
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   487
# Check that the linker support an argument
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   488
BASIC_DEFUN_NAMED([FLAGS_LINKER_CHECK_ARGUMENTS],
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   489
    [*ARGUMENT IF_TRUE IF_FALSE], [$@],
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   490
[
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   491
  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
   492
  supports=yes
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   493
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   494
  saved_ldflags="$LDFLAGS"
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   495
  LDFLAGS="$LDFLAGS ARG_ARGUMENT"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   496
  AC_LANG_PUSH([C])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   497
  AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   498
      [], [supports=no])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   499
  AC_LANG_POP([C])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   500
  LDFLAGS="$saved_ldflags"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   501
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   502
  AC_MSG_RESULT([$supports])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   503
  if test "x$supports" = "xyes" ; then
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   504
    :
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   505
    ARG_IF_TRUE
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   506
  else
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   507
    :
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   508
    ARG_IF_FALSE
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   509
  fi
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   510
])