make/autoconf/flags.m4
author jwilhelm
Fri, 02 Mar 2018 21:00:12 +0100
changeset 49194 ece10494786c
parent 49144 71bc133f25ea
parent 49165 75e2a82fed81
child 49204 564802b01ded
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     1
#
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.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   119
    MACOSX_VERSION_MIN=10.7.0
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
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   236
  if test "x$TOOLCHAIN_TYPE" = xxlc; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   237
    MACHINE_FLAG="-q${OPENJDK_TARGET_CPU_BITS}"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   238
  elif test "x$TOOLCHAIN_TYPE" != xmicrosoft; then
49144
71bc133f25ea 8199152: Configure broken on arm32
enevill
parents: 49132
diff changeset
   239
    if test "x$OPENJDK_TARGET_CPU" != xaarch64 &&
71bc133f25ea 8199152: Configure broken on arm32
enevill
parents: 49132
diff changeset
   240
        test "x$OPENJDK_TARGET_CPU" != xarm; then
49132
5d35b6050163 8199052: Configure broken on aarch64
ihse
parents: 49120
diff changeset
   241
      MACHINE_FLAG="-m${OPENJDK_TARGET_CPU_BITS}"
5d35b6050163 8199052: Configure broken on aarch64
ihse
parents: 49120
diff changeset
   242
    fi
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   243
  fi
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
  # FIXME: global flags are not used yet...
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   246
  # 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
   247
  # get a working compilation.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   248
  GLOBAL_CFLAGS="$MACHINE_FLAG $SYSROOT_CFLAGS $USER_CFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   249
  GLOBAL_CXXFLAGS="$MACHINE_FLAG $SYSROOT_CFLAGS $USER_CXXFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   250
  GLOBAL_LDFLAGS="$MACHINE_FLAG $SYSROOT_LDFLAGS $USER_LDFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   251
  # 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
   252
  GLOBAL_CPPFLAGS="$SYSROOT_CFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   253
  AC_SUBST(GLOBAL_CFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   254
  AC_SUBST(GLOBAL_CXXFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   255
  AC_SUBST(GLOBAL_LDFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   256
  AC_SUBST(GLOBAL_CPPFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   257
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   258
  # FIXME: For compatilibity, export this as EXTRA_CFLAGS for now.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   259
  EXTRA_CFLAGS="$MACHINE_FLAG $USER_CFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   260
  EXTRA_CXXFLAGS="$MACHINE_FLAG $USER_CXXFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   261
  EXTRA_LDFLAGS="$MACHINE_FLAG $USER_LDFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   262
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   263
  AC_SUBST(EXTRA_CFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   264
  AC_SUBST(EXTRA_CXXFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   265
  AC_SUBST(EXTRA_LDFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   266
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   267
  # 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
   268
  # "unnamed" CFLAGS etc.
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   269
  CFLAGS="$GLOBAL_CFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   270
  CXXFLAGS="$GLOBAL_CXXFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   271
  LDFLAGS="$GLOBAL_LDFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   272
  CPPFLAGS="$GLOBAL_CPPFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   273
])
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   274
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   275
AC_DEFUN([FLAGS_SETUP_TOOLCHAIN_CONTROL],
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   276
[
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   277
  # 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
   278
  # 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
   279
  # 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
   280
  #                              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
   281
  if test "x$TOOLCHAIN_TYPE" = xxlc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   282
    COMPILER_TARGET_BITS_FLAG="-q"
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   283
    COMPILER_COMMAND_FILE_FLAG="-f"
36051
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   284
    COMPILER_BINDCMD_FILE_FLAG="-bloadmap:"
22458
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   285
  else
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   286
    COMPILER_TARGET_BITS_FLAG="-m"
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   287
    COMPILER_COMMAND_FILE_FLAG="@"
36051
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   288
    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
   289
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   290
    # 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
   291
    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
   292
      COMPILER_COMMAND_FILE_FLAG=
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   293
    fi
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   294
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   295
    # 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
   296
    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
   297
      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
   298
      # 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
   299
      $ECHO "" "--version" > command.file
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   300
      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
   301
        AC_MSG_RESULT(yes)
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   302
        COMPILER_COMMAND_FILE_FLAG="@"
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   303
      else
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   304
        AC_MSG_RESULT(no)
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   305
        COMPILER_COMMAND_FILE_FLAG=
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   306
      fi
38843
2b141e8e916f 8158535: Configure script uses basic tools directly in many places
erikj
parents: 37864
diff changeset
   307
      $RM command.file
34864
47326b00e368 8146638: Only use compiler option files if they are really supported by the toolchain
simonis
parents: 34596
diff changeset
   308
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   309
  fi
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   310
22467
kvn
parents: 22466 21055
diff changeset
   311
  AC_SUBST(COMPILER_TARGET_BITS_FLAG)
34596
e8328ce5b64e 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34120
diff changeset
   312
  AC_SUBST(COMPILER_COMMAND_FILE_FLAG)
36051
25fa80338f92 8150197: Integrate AIX fixes from build-infra
simonis
parents: 36050
diff changeset
   313
  AC_SUBST(COMPILER_BINDCMD_FILE_FLAG)
22466
25aaf85d1ada 8024265: Enable new build on AIX
simonis
parents: 22465
diff changeset
   314
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   315
  # Check that the compiler supports -mX (or -qX on AIX) flags
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   316
  # Set COMPILER_SUPPORTS_TARGET_BITS_FLAG to 'true' if it does
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   317
  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
   318
      IF_TRUE: [COMPILER_SUPPORTS_TARGET_BITS_FLAG=true],
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   319
      IF_FALSE: [COMPILER_SUPPORTS_TARGET_BITS_FLAG=false])
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   320
  AC_SUBST(COMPILER_SUPPORTS_TARGET_BITS_FLAG)
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   321
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   322
  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   323
    CC_OUT_OPTION=-Fo
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   324
    EXE_OUT_OPTION=-out:
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   325
    LD_OUT_OPTION=-out:
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   326
    AR_OUT_OPTION=-out:
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   327
  else
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   328
    # 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
   329
    # 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
   330
    CC_OUT_OPTION='-o$(SPACE)'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   331
    # When linking, how to specify the to be created executable.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   332
    EXE_OUT_OPTION='-o$(SPACE)'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   333
    # When linking, how to specify the to be created dynamically linkable library.
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   334
    LD_OUT_OPTION='-o$(SPACE)'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   335
    # 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
   336
    AR_OUT_OPTION='rcs$(SPACE)'
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   337
  fi
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   338
  AC_SUBST(CC_OUT_OPTION)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   339
  AC_SUBST(EXE_OUT_OPTION)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   340
  AC_SUBST(LD_OUT_OPTION)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   341
  AC_SUBST(AR_OUT_OPTION)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   342
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   343
  # Generate make dependency files
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   344
  if test "x$TOOLCHAIN_TYPE" = xgcc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   345
    C_FLAG_DEPS="-MMD -MF"
23161
85635b5bf0a6 8019470: Changes needed to compile JDK 8 on MacOS with clang compiler
henryjen
parents: 22730
diff changeset
   346
  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
   347
    C_FLAG_DEPS="-MMD -MF"
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   348
  elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   349
    C_FLAG_DEPS="-xMMD -xMF"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   350
  elif test "x$TOOLCHAIN_TYPE" = xxlc; then
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   351
    C_FLAG_DEPS="-qmakedep=gcc -MF"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   352
  fi
22721
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   353
  CXX_FLAG_DEPS="$C_FLAG_DEPS"
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   354
  AC_SUBST(C_FLAG_DEPS)
63761da45392 8034788: Rewrite toolchain.m4 to support multiple toolchains per platform.
ihse
parents: 22715
diff changeset
   355
  AC_SUBST(CXX_FLAG_DEPS)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   356
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   357
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   358
AC_DEFUN_ONCE([FLAGS_POST_TOOLCHAIN],
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   359
[
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   360
  FLAGS_SETUP_TOOLCHAIN_CONTROL
46224
b1ce24ef8897 8174231: Factor out and share PlatformEvent and Parker code for POSIX systems
dholmes
parents: 44398
diff changeset
   361
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   362
  if test "x$BUILD_SYSROOT" != x; then
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   363
    FLAGS_SETUP_SYSROOT_FLAGS([BUILD_])
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   364
  else
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   365
    BUILD_SYSROOT_CFLAGS="$SYSROOT_CFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   366
    BUILD_SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS"
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   367
  fi
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   368
  AC_SUBST(BUILD_SYSROOT_CFLAGS)
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   369
  AC_SUBST(BUILD_SYSROOT_LDFLAGS)
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   370
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   371
])
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   372
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   373
AC_DEFUN([FLAGS_SETUP_FLAGS],
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   374
[
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   375
  FLAGS_SETUP_MACOSX_VERSION
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   376
  FLAGS_SETUP_ABI_PROFILE
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   377
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   378
  FLAGS_SETUP_SHARED_LIBS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   379
  FLAGS_SETUP_DEBUG_SYMBOLS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   380
  FLAGS_SETUP_WARNINGS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   381
  FLAGS_SETUP_QUALITY_CHECKS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   382
  FLAGS_SETUP_OPTIMIZATION
37402
62b5f067032e 8152666: The new Hotspot Build System
erikj
parents: 36541
diff changeset
   383
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   384
  FLAGS_SETUP_CFLAGS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   385
  FLAGS_SETUP_LDFLAGS
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   386
49120
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   387
  FLAGS_SETUP_ARFLAGS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   388
  FLAGS_SETUP_STRIPFLAGS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   389
  FLAGS_SETUP_RCFLAGS
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_ASFLAGS
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   392
  FLAGS_SETUP_ASFLAGS_CPU_DEP([TARGET])
c04d813140dc 8198724: Refactor FLAGS handling in configure
ihse
parents: 48909
diff changeset
   393
  FLAGS_SETUP_ASFLAGS_CPU_DEP([BUILD], [OPENJDK_BUILD_])
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   394
])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   395
36535
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   396
# 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
   397
#                                  IF_FALSE: [RUN-IF-FALSE])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   398
# ------------------------------------------------------------
36535
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   399
# Check that the C compiler supports an argument
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   400
BASIC_DEFUN_NAMED([FLAGS_C_COMPILER_CHECK_ARGUMENTS],
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   401
    [*ARGUMENT IF_TRUE 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
  AC_MSG_CHECKING([if the C compiler supports "ARG_ARGUMENT"])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   404
  supports=yes
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   405
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   406
  saved_cflags="$CFLAGS"
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   407
  CFLAGS="$CFLAGS ARG_ARGUMENT"
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   408
  AC_LANG_PUSH([C])
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   409
  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   410
      [supports=no])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   411
  AC_LANG_POP([C])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   412
  CFLAGS="$saved_cflags"
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   413
36535
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   414
  AC_MSG_RESULT([$supports])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   415
  if test "x$supports" = "xyes" ; then
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   416
    :
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   417
    ARG_IF_TRUE
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   418
  else
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   419
    :
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   420
    ARG_IF_FALSE
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   421
  fi
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   422
])
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
# 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
   425
#                                    IF_FALSE: [RUN-IF-FALSE])
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
# Check that the C++ compiler supports an argument
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   428
BASIC_DEFUN_NAMED([FLAGS_CXX_COMPILER_CHECK_ARGUMENTS],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   429
    [*ARGUMENT IF_TRUE 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
  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
   432
  supports=yes
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   433
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   434
  saved_cxxflags="$CXXFLAGS"
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   435
  CXXFLAGS="$CXXFLAG ARG_ARGUMENT"
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   436
  AC_LANG_PUSH([C++])
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   437
  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   438
      [supports=no])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   439
  AC_LANG_POP([C++])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   440
  CXXFLAGS="$saved_cxxflags"
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   441
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   442
  AC_MSG_RESULT([$supports])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   443
  if test "x$supports" = "xyes" ; then
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   444
    :
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   445
    ARG_IF_TRUE
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   446
  else
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   447
    :
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   448
    ARG_IF_FALSE
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   449
  fi
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   450
])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
   451
36535
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   452
# 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
   453
#                                IF_FALSE: [RUN-IF-FALSE])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   454
# ------------------------------------------------------------
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   455
# 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
   456
BASIC_DEFUN_NAMED([FLAGS_COMPILER_CHECK_ARGUMENTS],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   457
    [*ARGUMENT IF_TRUE 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
  FLAGS_C_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARG_ARGUMENT],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   460
  					     IF_TRUE: [C_COMP_SUPPORTS="yes"],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   461
					     IF_FALSE: [C_COMP_SUPPORTS="no"])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   462
  FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARG_ARGUMENT],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   463
  					       IF_TRUE: [CXX_COMP_SUPPORTS="yes"],
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   464
					       IF_FALSE: [CXX_COMP_SUPPORTS="no"])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   465
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   466
  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
   467
  supports=no
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   468
  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
   469
36535
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   470
  AC_MSG_RESULT([$supports])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   471
  if test "x$supports" = "xyes" ; then
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   472
    :
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   473
    ARG_IF_TRUE
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   474
  else
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   475
    :
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   476
    ARG_IF_FALSE
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   477
  fi
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   478
])
141db8da8c18 8151841: Build needs additional flags to compile with GCC 6
andrew
parents: 36531
diff changeset
   479
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   480
# FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   481
#                                   IF_FALSE: [RUN-IF-FALSE])
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   482
# ------------------------------------------------------------
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   483
# Check that the linker support an argument
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   484
BASIC_DEFUN_NAMED([FLAGS_LINKER_CHECK_ARGUMENTS],
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   485
    [*ARGUMENT IF_TRUE IF_FALSE], [$@],
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   486
[
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   487
  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
   488
  supports=yes
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   489
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   490
  saved_ldflags="$LDFLAGS"
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   491
  LDFLAGS="$LDFLAGS ARG_ARGUMENT"
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   492
  AC_LANG_PUSH([C])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   493
  AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   494
      [], [supports=no])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   495
  AC_LANG_POP([C])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   496
  LDFLAGS="$saved_ldflags"
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   497
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   498
  AC_MSG_RESULT([$supports])
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   499
  if test "x$supports" = "xyes" ; then
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   500
    :
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   501
    ARG_IF_TRUE
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   502
  else
34923
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   503
    :
0a2be16ce53d 8146995: Introduce named arguments in configure
ihse
parents: 34864
diff changeset
   504
    ARG_IF_FALSE
24911
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   505
  fi
a039e17f8896 8032045: Enable compiler and linker safety switches for debug builds
mduigou
parents: 23981
diff changeset
   506
])