common/autoconf/toolchain.m4
author ihse
Tue, 28 Jan 2014 14:47:22 +0100
changeset 22458 6a74da13c52f
parent 22179 59d2bd4620b0
child 22473 210fdf11f9df
permissions -rw-r--r--
8022411: Allow overriding of CXX and CC with absolute path Reviewed-by: erikj, tbell
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
#
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     2
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
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
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    26
# $1 = compiler to test (CC or CXX)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    27
# $2 = human readable name of compiler (C or C++)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    28
AC_DEFUN([TOOLCHAIN_CHECK_COMPILER_VERSION],
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    29
[
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    30
  COMPILER=[$]$1
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    31
  COMPILER_NAME=$2
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    32
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    33
  if test "x$OPENJDK_TARGET_OS" = xsolaris; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    34
    # Make sure we use the Sun Studio compiler and not gcc on Solaris, which won't work
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    35
    COMPILER_VERSION_TEST=`$COMPILER -V 2>&1 | $HEAD -n 1`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    36
    $ECHO $COMPILER_VERSION_TEST | $GREP "^.*: Sun $COMPILER_NAME" > /dev/null
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    37
    if test $? -ne 0; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    38
      GCC_VERSION_TEST=`$COMPILER --version 2>&1 | $HEAD -n 1`
17664
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
    39
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    40
      AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required Sun Studio compiler.])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    41
      AC_MSG_NOTICE([The result from running with -V was: "$COMPILER_VERSION_TEST" and with --version: "$GCC_VERSION_TEST"])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    42
      AC_MSG_ERROR([Sun Studio compiler is required. Try setting --with-tools-dir.])
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    43
    else
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    44
      COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.*@<:@ ,\t@:>@$COMPILER_NAME@<:@ ,\t@:>@\(@<:@1-9@:>@\.@<:@0-9@:>@@<:@0-9@:>@*\).*/\1/p"`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    45
      COMPILER_VENDOR="Sun Studio"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    46
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    47
  elif test  "x$OPENJDK_TARGET_OS" = xwindows; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    48
    # First line typically looks something like:
20362
5f8289bfda3e 8023611: Win32 and win64: Remove all the WARNINGS in JDK 8 builds for Windows 2008 and MSVS 2010 SP1
tbell
parents: 19763
diff changeset
    49
    # Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
18423
5f706ddb73ed 8019229: Build Configuration Fail in Windows Platform
erikj
parents: 18421
diff changeset
    50
    COMPILER_VERSION_TEST=`$COMPILER 2>&1 | $HEAD -n 1 | $TR -d '\r'`
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    51
    COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.*Version \(@<:@1-9@:>@@<:@0-9.@:>@*\) .*/\1/p"`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    52
    COMPILER_VENDOR="Microsoft CL.EXE"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    53
    COMPILER_CPU_TEST=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.* for \(.*\)$/\1/p"`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    54
    if test "x$OPENJDK_TARGET_CPU" = "xx86"; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    55
      if test "x$COMPILER_CPU_TEST" != "x80x86"; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    56
        AC_MSG_ERROR([Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for "$COMPILER_CPU_TEST"; expected "80x86".])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    57
      fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    58
    elif test "x$OPENJDK_TARGET_CPU" = "xx86_64"; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    59
      if test "x$COMPILER_CPU_TEST" != "xx64"; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    60
        AC_MSG_ERROR([Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for "$COMPILER_CPU_TEST"; expected "x64".])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    61
      fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    62
    fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    63
  else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    64
    COMPILER_VERSION_TEST=`$COMPILER --version 2>&1 | $HEAD -n 1`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    65
    # Check that this is likely to be GCC.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    66
    $COMPILER --version 2>&1 | $GREP "Free Software Foundation" > /dev/null
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    67
    if test $? -ne 0; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    68
      AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required GCC compiler.])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    69
      AC_MSG_NOTICE([The result from running with --version was: "$COMPILER_VERSION_TEST"])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    70
      AC_MSG_ERROR([GCC compiler is required. Try setting --with-tools-dir.])
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    71
    fi
17664
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
    72
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    73
    # First line typically looks something like:
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    74
    # gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    75
    COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.* \(@<:@1-9@:>@@<:@0-9.@:>@*\)/\1/p"`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    76
    COMPILER_VENDOR=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^\(.*\) @<:@1-9@:>@@<:@0-9.@:>@*/\1/p"`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    77
  fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    78
  # This sets CC_VERSION or CXX_VERSION. (This comment is a grep marker)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    79
  $1_VERSION="$COMPILER_VERSION"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    80
  # This sets CC_VENDOR or CXX_VENDOR. (This comment is a grep marker)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    81
  $1_VENDOR="$COMPILER_VENDOR"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    82
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    83
  AC_MSG_NOTICE([Using $COMPILER_VENDOR $COMPILER_NAME compiler version $COMPILER_VERSION (located at $COMPILER)])
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    84
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    85
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    86
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    87
AC_DEFUN_ONCE([TOOLCHAIN_SETUP_SYSROOT_AND_OUT_OPTIONS],
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    88
[
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
    89
  ###############################################################################
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
    90
  #
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
    91
  # Configure the development tool paths and potential sysroot.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
    92
  #
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
    93
  AC_LANG(C++)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    94
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
    95
  # The option used to specify the target .o,.a or .so file.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
    96
  # When compiling, how to specify the to be created object file.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
    97
  CC_OUT_OPTION='-o$(SPACE)'
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
    98
  # When linking, how to specify the to be created executable.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
    99
  EXE_OUT_OPTION='-o$(SPACE)'
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   100
  # When linking, how to specify the to be created dynamically linkable library.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   101
  LD_OUT_OPTION='-o$(SPACE)'
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   102
  # When archiving, how to specify the to be create static archive for object files.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   103
  AR_OUT_OPTION='rcs$(SPACE)'
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   104
  AC_SUBST(CC_OUT_OPTION)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   105
  AC_SUBST(EXE_OUT_OPTION)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   106
  AC_SUBST(LD_OUT_OPTION)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   107
  AC_SUBST(AR_OUT_OPTION)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   108
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   109
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   110
# $1 = compiler to test (CC or CXX)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   111
# $2 = human readable name of compiler (C or C++)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   112
# $3 = list of compiler names to search for
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   113
AC_DEFUN([TOOLCHAIN_FIND_COMPILER],
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   114
[
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   115
  COMPILER_NAME=$2
22458
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   116
  SEARCH_LIST="$3"
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   117
22458
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   118
  if test "x[$]$1" != x; then
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   119
    # User has supplied compiler name already, always let that override.
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   120
    AC_MSG_NOTICE([Will use user supplied compiler $1=[$]$1])
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   121
    if test "x`basename [$]$1`" = "x[$]$1"; then
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   122
      # A command without a complete path is provided, search $PATH.
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   123
      
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   124
      AC_PATH_PROGS(POTENTIAL_$1, [$]$1)
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   125
      if test "x$POTENTIAL_$1" != x; then
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   126
        $1=$POTENTIAL_$1
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   127
      else
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   128
        AC_MSG_ERROR([User supplied compiler $1=[$]$1 could not be found])
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   129
      fi
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   130
    else
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   131
      # Otherwise it might already be a complete path
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   132
      if test ! -x "[$]$1"; then
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   133
        AC_MSG_ERROR([User supplied compiler $1=[$]$1 does not exist])
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   134
      fi
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   135
    fi
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   136
  else
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   137
    # No user supplied value. Locate compiler ourselves
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   138
    $1=
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   139
    # If TOOLS_DIR is set, check for all compiler names in there first
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   140
    # before checking the rest of the PATH.
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   141
    if test -n "$TOOLS_DIR"; then
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   142
      PATH_save="$PATH"
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   143
      PATH="$TOOLS_DIR"
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   144
      AC_PATH_PROGS(TOOLS_DIR_$1, $SEARCH_LIST)
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   145
      $1=$TOOLS_DIR_$1
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   146
      PATH="$PATH_save"
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   147
    fi
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   148
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   149
    # AC_PATH_PROGS can't be run multiple times with the same variable,
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   150
    # so create a new name for this run.
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   151
    if test "x[$]$1" = x; then
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   152
      AC_PATH_PROGS(POTENTIAL_$1, $SEARCH_LIST)
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   153
      $1=$POTENTIAL_$1
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   154
    fi
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   155
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   156
    if test "x[$]$1" = x; then
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   157
      HELP_MSG_MISSING_DEPENDENCY([devkit])
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   158
      AC_MSG_ERROR([Could not find a $COMPILER_NAME compiler. $HELP_MSG])
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   159
    fi
14614
3bb0a6b81bb9 8003945: build-infra: problems finding compiler when using --with-dev-kit
erikj
parents: 14467
diff changeset
   160
  fi
3bb0a6b81bb9 8003945: build-infra: problems finding compiler when using --with-dev-kit
erikj
parents: 14467
diff changeset
   161
22458
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   162
  # Now we have a compiler binary in $1. Make sure it's okay.
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   163
  BASIC_FIXUP_EXECUTABLE($1)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   164
  AC_MSG_CHECKING([resolved symbolic links for $1])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   165
  TEST_COMPILER="[$]$1"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   166
  BASIC_REMOVE_SYMBOLIC_LINKS(TEST_COMPILER)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   167
  AC_MSG_RESULT([$TEST_COMPILER])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   168
  AC_MSG_CHECKING([if $1 is disguised ccache])
17664
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
   169
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   170
  COMPILER_BASENAME=`$BASENAME "$TEST_COMPILER"`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   171
  if test "x$COMPILER_BASENAME" = "xccache"; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   172
    AC_MSG_RESULT([yes, trying to find proper $COMPILER_NAME compiler])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   173
    # We /usr/lib/ccache in the path, so cc is a symlink to /usr/bin/ccache.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   174
    # We want to control ccache invocation ourselves, so ignore this cc and try
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   175
    # searching again.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   176
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   177
    # Remove the path to the fake ccache cc from the PATH
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   178
    RETRY_COMPILER_SAVED_PATH="$PATH"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   179
    COMPILER_DIRNAME=`$DIRNAME [$]$1`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   180
    PATH="`$ECHO $PATH | $SED -e "s,$COMPILER_DIRNAME,,g" -e "s,::,:,g" -e "s,^:,,g"`"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   181
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   182
    # Try again looking for our compiler
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   183
    AC_CHECK_TOOLS(PROPER_COMPILER_$1, $3)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   184
    BASIC_FIXUP_EXECUTABLE(PROPER_COMPILER_$1)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   185
    PATH="$RETRY_COMPILER_SAVED_PATH"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   186
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   187
    AC_MSG_CHECKING([for resolved symbolic links for $1])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   188
    BASIC_REMOVE_SYMBOLIC_LINKS(PROPER_COMPILER_$1)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   189
    AC_MSG_RESULT([$PROPER_COMPILER_$1])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   190
    $1="$PROPER_COMPILER_$1"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   191
  else
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   192
    AC_MSG_RESULT([no, keeping $1])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   193
  fi
22179
59d2bd4620b0 8031668: TOOLCHAIN_FIND_COMPILER unexpectedly resolves symbolic links
mduigou
parents: 22035
diff changeset
   194
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   195
  TOOLCHAIN_CHECK_COMPILER_VERSION([$1], [$COMPILER_NAME])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   196
])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   197
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   198
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   199
AC_DEFUN([TOOLCHAIN_SETUP_PATHS],
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   200
[
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   201
  if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   202
    TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV
20643
fa095e917446 8001912: Improve detection of msvcr100.dll
ihse
parents: 20363
diff changeset
   203
    TOOLCHAIN_SETUP_MSVCR_DLL
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   204
    BASIC_DEPRECATED_ARG_WITH([dxsdk])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   205
    BASIC_DEPRECATED_ARG_WITH([dxsdk-lib])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   206
    BASIC_DEPRECATED_ARG_WITH([dxsdk-include])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   207
  fi
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   208
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   209
  AC_SUBST(MSVCR_DLL)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   210
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   211
  # If --build AND --host is set, then the configure script will find any
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   212
  # cross compilation tools in the PATH. Cross compilation tools
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   213
  # follows the cross compilation standard where they are prefixed with ${host}.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   214
  # For example the binary i686-sun-solaris2.10-gcc
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   215
  # will cross compile for i686-sun-solaris2.10
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   216
  # If neither of build and host is not set, then build=host and the
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   217
  # default compiler found in the path will be used.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   218
  # Setting only --host, does not seem to be really supported.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   219
  # Please set both --build and --host if you want to cross compile.
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   220
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   221
  if test "x$COMPILE_TYPE" = "xcross"; then
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   222
    # Now we to find a C/C++ compiler that can build executables for the build
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   223
    # platform. We can't use the AC_PROG_CC macro, since it can only be used
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   224
    # once. Also, we need to do this before adding a tools dir to the path,
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   225
    # otherwise we might pick up cross-compilers which don't use standard naming.
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   226
    # Otherwise, we'll set the BUILD_tools to the native tools, but that'll have
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   227
    # to wait until they are properly discovered.
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   228
    AC_PATH_PROGS(BUILD_CC, [cl cc gcc])
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   229
    BASIC_FIXUP_EXECUTABLE(BUILD_CC)
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   230
    AC_PATH_PROGS(BUILD_CXX, [cl CC g++])
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   231
    BASIC_FIXUP_EXECUTABLE(BUILD_CXX)
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   232
    AC_PATH_PROG(BUILD_LD, ld)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   233
    BASIC_FIXUP_EXECUTABLE(BUILD_LD)
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   234
  fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   235
  AC_SUBST(BUILD_CC)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   236
  AC_SUBST(BUILD_CXX)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   237
  AC_SUBST(BUILD_LD)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   238
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   239
  # If a devkit is found on the builddeps server, then prepend its path to the
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   240
  # PATH variable. If there are cross compilers available in the devkit, these
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   241
  # will be found by AC_PROG_CC et al.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   242
  DEVKIT=
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   243
  BDEPS_CHECK_MODULE(DEVKIT, devkit, xxx,
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   244
      [
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   245
        # Found devkit
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   246
        PATH="$DEVKIT/bin:$PATH"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   247
        SYS_ROOT="$DEVKIT/${rewritten_target}/sys-root"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   248
        if test "x$x_includes" = "xNONE"; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   249
          x_includes="$SYS_ROOT/usr/include/X11"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   250
        fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   251
        if test "x$x_libraries" = "xNONE"; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   252
          x_libraries="$SYS_ROOT/usr/lib"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   253
        fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   254
      ],
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   255
      [])
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   256
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   257
  # Store the CFLAGS etal passed to the configure script.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   258
  ORG_CFLAGS="$CFLAGS"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   259
  ORG_CXXFLAGS="$CXXFLAGS"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   260
  ORG_OBJCFLAGS="$OBJCFLAGS"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   261
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   262
  # autoconf magic only relies on PATH, so update it if tools dir is specified
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   263
  OLD_PATH="$PATH"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   264
  if test "x$TOOLS_DIR" != x; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   265
    PATH=$TOOLS_DIR:$PATH
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   266
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   267
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   268
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   269
  ### Locate C compiler (CC)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   270
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   271
  # On windows, only cl.exe is supported.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   272
  # On Solaris, cc is preferred to gcc.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   273
  # Elsewhere, gcc is preferred to cc.
15906
3c42874d7148 8006988: build-infra: Configure fails if 'cl' is in path on linux
martin
parents: 15581
diff changeset
   274
22458
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   275
  if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   276
    COMPILER_CHECK_LIST="cl"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   277
  elif test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   278
    COMPILER_CHECK_LIST="cc gcc"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   279
  else
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   280
    COMPILER_CHECK_LIST="gcc cc"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   281
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   282
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   283
  TOOLCHAIN_FIND_COMPILER([CC],[C],[$COMPILER_CHECK_LIST])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   284
  # Now that we have resolved CC ourself, let autoconf have its go at it
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   285
  AC_PROG_CC([$CC])
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   286
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   287
  ### Locate C++ compiler (CXX)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   288
22458
6a74da13c52f 8022411: Allow overriding of CXX and CC with absolute path
ihse
parents: 22179
diff changeset
   289
  if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   290
    COMPILER_CHECK_LIST="cl"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   291
  elif test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   292
    COMPILER_CHECK_LIST="CC g++"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   293
  else
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   294
    COMPILER_CHECK_LIST="g++ CC"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   295
  fi
15906
3c42874d7148 8006988: build-infra: Configure fails if 'cl' is in path on linux
martin
parents: 15581
diff changeset
   296
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   297
  TOOLCHAIN_FIND_COMPILER([CXX],[C++],[$COMPILER_CHECK_LIST])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   298
  # Now that we have resolved CXX ourself, let autoconf have its go at it
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   299
  AC_PROG_CXX([$CXX])
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   300
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   301
  ### Locate other tools
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   302
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   303
  if test "x$OPENJDK_TARGET_OS" = xmacosx; then
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   304
    AC_PROG_OBJC
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   305
    BASIC_FIXUP_EXECUTABLE(OBJC)
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   306
  else
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   307
    OBJC=
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   308
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   309
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   310
  # Restore the flags to the user specified values.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   311
  # This is necessary since AC_PROG_CC defaults CFLAGS to "-g -O2"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   312
  CFLAGS="$ORG_CFLAGS"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   313
  CXXFLAGS="$ORG_CXXFLAGS"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   314
  OBJCFLAGS="$ORG_OBJCFLAGS"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   315
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   316
  LD="$CC"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   317
  LDEXE="$CC"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   318
  LDCXX="$CXX"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   319
  LDEXECXX="$CXX"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   320
  AC_SUBST(LD)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   321
  # LDEXE is the linker to use, when creating executables.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   322
  AC_SUBST(LDEXE)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   323
  # Linking C++ libraries.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   324
  AC_SUBST(LDCXX)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   325
  # Linking C++ executables.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   326
  AC_SUBST(LDEXECXX)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   327
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   328
  if test "x$OPENJDK_TARGET_OS" != xwindows; then
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   329
    AC_CHECK_TOOL(AR, ar)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   330
    BASIC_FIXUP_EXECUTABLE(AR)
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   331
  fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   332
  if test "x$OPENJDK_TARGET_OS" = xmacosx; then
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   333
    ARFLAGS="-r"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   334
  else
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   335
    ARFLAGS=""
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   336
  fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   337
  AC_SUBST(ARFLAGS)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   338
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   339
  # For hotspot, we need these in Windows mixed path; other platforms keep them the same
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   340
  HOTSPOT_CXX="$CXX"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   341
  HOTSPOT_LD="$LD"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   342
  AC_SUBST(HOTSPOT_CXX)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   343
  AC_SUBST(HOTSPOT_LD)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   344
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   345
  COMPILER_NAME=gcc
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   346
  COMPILER_TYPE=CC
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   347
  AS_IF([test "x$OPENJDK_TARGET_OS" = xwindows], [
17664
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
   348
    # For now, assume that we are always compiling using cl.exe.
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   349
    CC_OUT_OPTION=-Fo
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   350
    EXE_OUT_OPTION=-out:
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   351
    LD_OUT_OPTION=-out:
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   352
    AR_OUT_OPTION=-out:
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   353
    # On Windows, reject /usr/bin/link (as determined in CYGWIN_LINK), which is a cygwin
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   354
    # program for something completely different.
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   355
    AC_CHECK_PROG([WINLD], [link],[link],,, [$CYGWIN_LINK])
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   356
    # Since we must ignore the first found link, WINLD will contain
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   357
    # the full path to the link.exe program.
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   358
    BASIC_FIXUP_EXECUTABLE(WINLD)
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   359
    printf "Windows linker was found at $WINLD\n"
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   360
    AC_MSG_CHECKING([if the found link.exe is actually the Visual Studio linker])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   361
    "$WINLD" --version > /dev/null
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   362
    if test $? -eq 0 ; then
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   363
      AC_MSG_RESULT([no])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   364
      AC_MSG_ERROR([This is the Cygwin link tool. Please check your PATH and rerun configure.])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   365
    else
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   366
      AC_MSG_RESULT([yes])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   367
    fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   368
    LD="$WINLD"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   369
    LDEXE="$WINLD"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   370
    LDCXX="$WINLD"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   371
    LDEXECXX="$WINLD"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   372
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   373
    AC_CHECK_PROG([MT], [mt], [mt],,, [/usr/bin/mt])
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   374
    BASIC_FIXUP_EXECUTABLE(MT)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   375
    # The resource compiler
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   376
    AC_CHECK_PROG([RC], [rc], [rc],,, [/usr/bin/rc])
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   377
    BASIC_FIXUP_EXECUTABLE(RC)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   378
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   379
    # For hotspot, we need these in Windows mixed path,
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   380
    # so rewrite them all. Need added .exe suffix.
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   381
    HOTSPOT_CXX="$CXX.exe"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   382
    HOTSPOT_LD="$LD.exe"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   383
    HOTSPOT_MT="$MT.exe"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   384
    HOTSPOT_RC="$RC.exe"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   385
    BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_CXX)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   386
    BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_LD)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   387
    BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_MT)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   388
    BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(HOTSPOT_RC)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   389
    AC_SUBST(HOTSPOT_MT)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   390
    AC_SUBST(HOTSPOT_RC)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   391
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   392
    RC_FLAGS="-nologo -l 0x409 -r"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   393
    AS_IF([test "x$VARIANT" = xOPT], [
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   394
    RC_FLAGS="$RC_FLAGS -d NDEBUG"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   395
  ])
18426
bf9e616c1476 8009744: build-infra: REGRESSION: Publisher was NOT set for some JDK files
erikj
parents: 18423
diff changeset
   396
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   397
  # The version variables used to create RC_FLAGS may be overridden
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   398
  # in a custom configure script, or possibly the command line.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   399
  # Let those variables be expanded at make time in spec.gmk.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   400
  # The \$ are escaped to the shell, and the $(...) variables
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   401
  # are evaluated by make.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   402
  RC_FLAGS="$RC_FLAGS \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   403
      -d \"JDK_BUILD_ID=\$(FULL_VERSION)\" \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   404
      -d \"JDK_COMPANY=\$(COMPANY_NAME)\" \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   405
      -d \"JDK_COMPONENT=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) binary\" \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   406
      -d \"JDK_VER=\$(JDK_MINOR_VERSION).\$(JDK_MICRO_VERSION).\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0).\$(COOKED_BUILD_NUMBER)\" \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   407
      -d \"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   408
      -d \"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(JDK_MINOR_VERSION) \$(JDK_UPDATE_META_TAG)\" \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   409
      -d \"JDK_FVER=\$(JDK_MINOR_VERSION),\$(JDK_MICRO_VERSION),\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0),\$(COOKED_BUILD_NUMBER)\""
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   410
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   411
  # lib.exe is used to create static libraries.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   412
  AC_CHECK_PROG([WINAR], [lib],[lib],,,)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   413
  BASIC_FIXUP_EXECUTABLE(WINAR)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   414
  AR="$WINAR"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   415
  ARFLAGS="-nologo -NODEFAULTLIB:MSVCRT"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   416
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   417
  AC_CHECK_PROG([DUMPBIN], [dumpbin], [dumpbin],,,)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   418
      BASIC_FIXUP_EXECUTABLE(DUMPBIN)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   419
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   420
      COMPILER_TYPE=CL
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   421
      CCXXFLAGS="$CCXXFLAGS -nologo"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   422
  ])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   423
  AC_SUBST(RC_FLAGS)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   424
  AC_SUBST(COMPILER_TYPE)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   425
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   426
  AC_PROG_CPP
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   427
  BASIC_FIXUP_EXECUTABLE(CPP)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   428
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   429
  AC_PROG_CXXCPP
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   430
  BASIC_FIXUP_EXECUTABLE(CXXCPP)
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   431
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   432
  if test "x$COMPILE_TYPE" != "xcross"; then
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   433
    # If we are not cross compiling, use the same compilers for
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   434
    # building the build platform executables. The cross-compilation
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   435
    # case needed to be done earlier, but this can only be done after
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   436
    # the native tools have been localized.
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   437
    BUILD_CC="$CC"
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   438
    BUILD_CXX="$CXX"
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   439
    BUILD_LD="$LD"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   440
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   441
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   442
  # for solaris we really need solaris tools, and not gnu equivalent
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   443
  #   these seems to normally reside in /usr/ccs/bin so add that to path before
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   444
  #   starting to probe
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   445
  #
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   446
  #   NOTE: I add this /usr/ccs/bin after TOOLS but before OLD_PATH
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   447
  #         so that it can be overriden --with-tools-dir
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   448
  if test "x$OPENJDK_BUILD_OS" = xsolaris; then
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   449
    PATH="${TOOLS_DIR}:/usr/ccs/bin:${OLD_PATH}"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   450
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   451
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   452
  # Find the right assembler.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   453
  if test "x$OPENJDK_TARGET_OS" = xsolaris; then
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   454
    AC_PATH_PROG(AS, as)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   455
    BASIC_FIXUP_EXECUTABLE(AS)
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   456
  else
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   457
    AS="$CC -c"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   458
  fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   459
  AC_SUBST(AS)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   460
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   461
  if test "x$OPENJDK_TARGET_OS" = xsolaris; then
16582
61f0b8f48036 8006288: build-infra: Use solaris nm and not gnm on solaris
erikj
parents: 15912
diff changeset
   462
    AC_PATH_PROG(NM, nm)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   463
    BASIC_FIXUP_EXECUTABLE(NM)
16582
61f0b8f48036 8006288: build-infra: Use solaris nm and not gnm on solaris
erikj
parents: 15912
diff changeset
   464
    AC_PATH_PROG(GNM, gnm)
61f0b8f48036 8006288: build-infra: Use solaris nm and not gnm on solaris
erikj
parents: 15912
diff changeset
   465
    BASIC_FIXUP_EXECUTABLE(GNM)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   466
    AC_PATH_PROG(STRIP, strip)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   467
    BASIC_FIXUP_EXECUTABLE(STRIP)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   468
    AC_PATH_PROG(MCS, mcs)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   469
    BASIC_FIXUP_EXECUTABLE(MCS)
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   470
  elif test "x$OPENJDK_TARGET_OS" != xwindows; then
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   471
    AC_CHECK_TOOL(NM, nm)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   472
    BASIC_FIXUP_EXECUTABLE(NM)
16582
61f0b8f48036 8006288: build-infra: Use solaris nm and not gnm on solaris
erikj
parents: 15912
diff changeset
   473
    GNM="$NM"
61f0b8f48036 8006288: build-infra: Use solaris nm and not gnm on solaris
erikj
parents: 15912
diff changeset
   474
    AC_SUBST(GNM)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   475
    AC_CHECK_TOOL(STRIP, strip)
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   476
    BASIC_FIXUP_EXECUTABLE(STRIP)
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   477
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   478
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   479
  # objcopy is used for moving debug symbols to separate files when
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   480
  # full debug symbols are enabled.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   481
  if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xlinux; then
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   482
    AC_CHECK_TOOLS(OBJCOPY, [gobjcopy objcopy])
14464
b82a851468d0 8003300: build-infra: fails on solaris when objcopy is not found
tbell
parents: 14112
diff changeset
   483
    # Only call fixup if objcopy was found.
b82a851468d0 8003300: build-infra: fails on solaris when objcopy is not found
tbell
parents: 14112
diff changeset
   484
    if test -n "$OBJCOPY"; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   485
      BASIC_FIXUP_EXECUTABLE(OBJCOPY)
14464
b82a851468d0 8003300: build-infra: fails on solaris when objcopy is not found
tbell
parents: 14112
diff changeset
   486
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   487
  fi
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   488
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   489
  AC_CHECK_TOOLS(OBJDUMP, [gobjdump objdump])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   490
  if test "x$OBJDUMP" != x; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   491
    # Only used for compare.sh; we can live without it. BASIC_FIXUP_EXECUTABLE bails if argument is missing.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   492
    BASIC_FIXUP_EXECUTABLE(OBJDUMP)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   493
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   494
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   495
  if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   496
    AC_PATH_PROG(LIPO, lipo)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   497
    BASIC_FIXUP_EXECUTABLE(LIPO)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   498
  fi
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   499
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   500
  TOOLCHAIN_SETUP_JTREG
17593
de6741d8a142 8007129: build-infra Add configure --with-jtreg option for location of JTREG
erikj
parents: 16988
diff changeset
   501
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   502
  # Restore old path without tools dir
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   503
  PATH="$OLD_PATH"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   504
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   505
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   506
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   507
AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_FLAGS_FOR_LIBS],
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   508
[
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   509
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   510
  ###############################################################################
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   511
  #
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   512
  # How to compile shared libraries.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   513
  #
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   514
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   515
  if test "x$GCC" = xyes; then
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   516
    COMPILER_NAME=gcc
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   517
    PICFLAG="-fPIC"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   518
    LIBRARY_PREFIX=lib
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   519
    SHARED_LIBRARY='lib[$]1.so'
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   520
    STATIC_LIBRARY='lib[$]1.a'
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   521
    SHARED_LIBRARY_FLAGS="-shared"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   522
    SHARED_LIBRARY_SUFFIX='.so'
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   523
    STATIC_LIBRARY_SUFFIX='.a'
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   524
    OBJ_SUFFIX='.o'
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   525
    EXE_SUFFIX=''
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   526
    SET_SHARED_LIBRARY_NAME='-Xlinker -soname=[$]1'
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   527
    SET_SHARED_LIBRARY_MAPFILE='-Xlinker -version-script=[$]1'
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   528
    C_FLAG_REORDER=''
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   529
    CXX_FLAG_REORDER=''
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   530
    SET_SHARED_LIBRARY_ORIGIN='-Xlinker -z -Xlinker origin -Xlinker -rpath -Xlinker \$$$$ORIGIN[$]1'
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   531
    SET_EXECUTABLE_ORIGIN='-Xlinker -rpath -Xlinker \$$$$ORIGIN[$]1'
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   532
    LD="$CC"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   533
    LDEXE="$CC"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   534
    LDCXX="$CXX"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   535
    LDEXECXX="$CXX"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   536
    POST_STRIP_CMD="$STRIP -g"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   537
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   538
    # Linking is different on MacOSX
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   539
    if test "x$OPENJDK_TARGET_OS" = xmacosx; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   540
      # Might change in the future to clang.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   541
      COMPILER_NAME=gcc
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   542
      SHARED_LIBRARY='lib[$]1.dylib'
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   543
      SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   544
      SHARED_LIBRARY_SUFFIX='.dylib'
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   545
      EXE_SUFFIX=''
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   546
      SET_SHARED_LIBRARY_NAME='-Xlinker -install_name -Xlinker @rpath/[$]1'
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   547
      SET_SHARED_LIBRARY_MAPFILE=''
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   548
      SET_SHARED_LIBRARY_ORIGIN='-Xlinker -rpath -Xlinker @loader_path/.'
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   549
      SET_EXECUTABLE_ORIGIN="$SET_SHARED_LIBRARY_ORIGIN"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   550
      POST_STRIP_CMD="$STRIP -S"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   551
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   552
  else
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   553
    if test "x$OPENJDK_TARGET_OS" = xsolaris; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   554
      # If it is not gcc, then assume it is the Oracle Solaris Studio Compiler
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   555
      COMPILER_NAME=ossc
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   556
      PICFLAG="-KPIC"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   557
      LIBRARY_PREFIX=lib
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   558
      SHARED_LIBRARY='lib[$]1.so'
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   559
      STATIC_LIBRARY='lib[$]1.a'
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   560
      SHARED_LIBRARY_FLAGS="-G"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   561
      SHARED_LIBRARY_SUFFIX='.so'
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   562
      STATIC_LIBRARY_SUFFIX='.a'
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   563
      OBJ_SUFFIX='.o'
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   564
      EXE_SUFFIX=''
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   565
      SET_SHARED_LIBRARY_NAME=''
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   566
      SET_SHARED_LIBRARY_MAPFILE='-M[$]1'
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   567
      C_FLAG_REORDER='-xF'
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   568
      CXX_FLAG_REORDER='-xF'
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   569
      SET_SHARED_LIBRARY_ORIGIN='-R\$$$$ORIGIN[$]1'
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   570
      SET_EXECUTABLE_ORIGIN="$SET_SHARED_LIBRARY_ORIGIN"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   571
      CFLAGS_JDK="${CFLAGS_JDK} -D__solaris__"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   572
      CXXFLAGS_JDK="${CXXFLAGS_JDK} -D__solaris__"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   573
      CFLAGS_JDKLIB_EXTRA='-xstrconst'
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   574
      POST_STRIP_CMD="$STRIP -x"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   575
      POST_MCS_CMD="$MCS -d -a \"JDK $FULL_VERSION\""
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   576
    fi
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   577
    if test "x$OPENJDK_TARGET_OS" = xwindows; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   578
      # If it is not gcc, then assume it is the MS Visual Studio compiler
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   579
      COMPILER_NAME=cl
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   580
      PICFLAG=""
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   581
      LIBRARY_PREFIX=
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   582
      SHARED_LIBRARY='[$]1.dll'
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   583
      STATIC_LIBRARY='[$]1.lib'
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   584
      SHARED_LIBRARY_FLAGS="-LD"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   585
      SHARED_LIBRARY_SUFFIX='.dll'
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   586
      STATIC_LIBRARY_SUFFIX='.lib'
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   587
      OBJ_SUFFIX='.obj'
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   588
      EXE_SUFFIX='.exe'
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   589
      SET_SHARED_LIBRARY_NAME=''
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   590
      SET_SHARED_LIBRARY_MAPFILE=''
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   591
      SET_SHARED_LIBRARY_ORIGIN=''
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   592
      SET_EXECUTABLE_ORIGIN=''
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   593
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   594
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   595
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   596
  AC_SUBST(COMPILER_NAME)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   597
  AC_SUBST(OBJ_SUFFIX)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   598
  AC_SUBST(SHARED_LIBRARY)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   599
  AC_SUBST(STATIC_LIBRARY)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   600
  AC_SUBST(LIBRARY_PREFIX)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   601
  AC_SUBST(SHARED_LIBRARY_SUFFIX)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   602
  AC_SUBST(STATIC_LIBRARY_SUFFIX)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   603
  AC_SUBST(EXE_SUFFIX)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   604
  AC_SUBST(SHARED_LIBRARY_FLAGS)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   605
  AC_SUBST(SET_SHARED_LIBRARY_NAME)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   606
  AC_SUBST(SET_SHARED_LIBRARY_MAPFILE)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   607
  AC_SUBST(C_FLAG_REORDER)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   608
  AC_SUBST(CXX_FLAG_REORDER)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   609
  AC_SUBST(SET_SHARED_LIBRARY_ORIGIN)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   610
  AC_SUBST(SET_EXECUTABLE_ORIGIN)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   611
  AC_SUBST(POST_STRIP_CMD)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   612
  AC_SUBST(POST_MCS_CMD)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   613
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   614
  # The (cross) compiler is now configured, we can now test capabilities
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   615
  # of the target platform.
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   616
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   617
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   618
AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_FLAGS_FOR_OPTIMIZATION],
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   619
[
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   620
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   621
  ###############################################################################
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   622
  #
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   623
  # Setup the opt flags for different compilers
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   624
  # and different operating systems.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   625
  #
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   626
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   627
  #
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   628
  # NOTE: check for -mstackrealign needs to be below potential addition of -m32
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   629
  #
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   630
  if test "x$OPENJDK_TARGET_CPU_BITS" = x32 && test "x$OPENJDK_TARGET_OS" = xmacosx; then
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   631
    # On 32-bit MacOSX the OS requires C-entry points to be 16 byte aligned.
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   632
    # While waiting for a better solution, the current workaround is to use -mstackrealign.
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   633
    CFLAGS="$CFLAGS -mstackrealign"
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   634
    AC_MSG_CHECKING([if 32-bit compiler supports -mstackrealign])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   635
    AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   636
        [
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   637
          AC_MSG_RESULT([yes])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   638
        ],
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   639
        [
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   640
          AC_MSG_RESULT([no])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   641
          AC_MSG_ERROR([The selected compiler $CXX does not support -mstackrealign! Try to put another compiler in the path.])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   642
        ]
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   643
    )
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   644
  fi
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   645
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   646
  C_FLAG_DEPS="-MMD -MF"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   647
  CXX_FLAG_DEPS="-MMD -MF"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   648
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   649
  case $COMPILER_TYPE in
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   650
    CC )
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   651
      case $COMPILER_NAME in
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   652
        gcc )
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   653
          case $OPENJDK_TARGET_OS in
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   654
            macosx )
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   655
              # On MacOSX we optimize for size, something
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   656
              # we should do for all platforms?
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   657
              C_O_FLAG_HI="-Os"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   658
              C_O_FLAG_NORM="-Os"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   659
              C_O_FLAG_NONE=""
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   660
              ;;
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   661
            *)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   662
              C_O_FLAG_HI="-O3"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   663
              C_O_FLAG_NORM="-O2"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   664
              C_O_FLAG_NONE="-O0"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   665
              ;;
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   666
          esac
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   667
          CXX_O_FLAG_HI="$C_O_FLAG_HI"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   668
          CXX_O_FLAG_NORM="$C_O_FLAG_NORM"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   669
          CXX_O_FLAG_NONE="$C_O_FLAG_NONE"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   670
          CFLAGS_DEBUG_SYMBOLS="-g"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   671
          CXXFLAGS_DEBUG_SYMBOLS="-g"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   672
          if test "x$OPENJDK_TARGET_CPU_BITS" = "x64" && test "x$DEBUG_LEVEL" = "xfastdebug"; then
18020
eade0d9836bf 8014404: Debug flag not added to jdk native compile when --enable-debug is set
erikj
parents: 17664
diff changeset
   673
            CFLAGS_DEBUG_SYMBOLS="-g1"
eade0d9836bf 8014404: Debug flag not added to jdk native compile when --enable-debug is set
erikj
parents: 17664
diff changeset
   674
            CXXFLAGS_DEBUG_SYMBOLS="-g1"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   675
          fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   676
          ;;
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   677
        ossc )
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   678
          #
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   679
          # Forte has different names for this with their C++ compiler...
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   680
          #
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   681
          C_FLAG_DEPS="-xMMD -xMF"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   682
          CXX_FLAG_DEPS="-xMMD -xMF"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   683
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   684
          # Extra options used with HIGHEST
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   685
          #
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   686
          # WARNING: Use of OPTIMIZATION_LEVEL=HIGHEST in your Makefile needs to be
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   687
          #          done with care, there are some assumptions below that need to
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   688
          #          be understood about the use of pointers, and IEEE behavior.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   689
          #
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   690
          # Use non-standard floating point mode (not IEEE 754)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   691
          CC_HIGHEST="$CC_HIGHEST -fns"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   692
          # Do some simplification of floating point arithmetic (not IEEE 754)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   693
          CC_HIGHEST="$CC_HIGHEST -fsimple"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   694
          # Use single precision floating point with 'float'
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   695
          CC_HIGHEST="$CC_HIGHEST -fsingle"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   696
          # Assume memory references via basic pointer types do not alias
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   697
          #   (Source with excessing pointer casting and data access with mixed
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   698
          #    pointer types are not recommended)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   699
          CC_HIGHEST="$CC_HIGHEST -xalias_level=basic"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   700
          # Use intrinsic or inline versions for math/std functions
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   701
          #   (If you expect perfect errno behavior, do not use this)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   702
          CC_HIGHEST="$CC_HIGHEST -xbuiltin=%all"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   703
          # Loop data dependency optimizations (need -xO3 or higher)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   704
          CC_HIGHEST="$CC_HIGHEST -xdepend"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   705
          # Pointer parameters to functions do not overlap
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   706
          #   (Similar to -xalias_level=basic usage, but less obvious sometimes.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   707
          #    If you pass in multiple pointers to the same data, do not use this)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   708
          CC_HIGHEST="$CC_HIGHEST -xrestrict"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   709
          # Inline some library routines
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   710
          #   (If you expect perfect errno behavior, do not use this)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   711
          CC_HIGHEST="$CC_HIGHEST -xlibmil"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   712
          # Use optimized math routines
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   713
          #   (If you expect perfect errno behavior, do not use this)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   714
          #  Can cause undefined external on Solaris 8 X86 on __sincos, removing for now
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   715
          #CC_HIGHEST="$CC_HIGHEST -xlibmopt"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   716
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   717
          if test "x$OPENJDK_TARGET_CPU" = xsparc; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   718
            CFLAGS_JDK="${CFLAGS_JDK} -xmemalign=4s"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   719
            CXXFLAGS_JDK="${CXXFLAGS_JDK} -xmemalign=4s"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   720
          fi
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   721
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   722
          case $OPENJDK_TARGET_CPU_ARCH in
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   723
            x86)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   724
              C_O_FLAG_HIGHEST="-xO4 -Wu,-O4~yz $CC_HIGHEST -xregs=no%frameptr"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   725
              C_O_FLAG_HI="-xO4 -Wu,-O4~yz -xregs=no%frameptr"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   726
              C_O_FLAG_NORM="-xO2 -Wu,-O2~yz -xregs=no%frameptr"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   727
              C_O_FLAG_NONE="-xregs=no%frameptr"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   728
              CXX_O_FLAG_HIGHEST="-xO4 -Qoption ube -O4~yz $CC_HIGHEST -xregs=no%frameptr"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   729
              CXX_O_FLAG_HI="-xO4 -Qoption ube -O4~yz -xregs=no%frameptr"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   730
              CXX_O_FLAG_NORM="-xO2 -Qoption ube -O2~yz -xregs=no%frameptr"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   731
              CXX_O_FLAG_NONE="-xregs=no%frameptr"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   732
              if test "x$OPENJDK_TARGET_CPU" = xx86; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   733
                C_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST -xchip=pentium"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   734
                CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_HIGHEST -xchip=pentium"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   735
              fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   736
              ;;
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   737
            sparc)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   738
              CFLAGS_JDKLIB_EXTRA="${CFLAGS_JDKLIB_EXTRA} -xregs=no%appl"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   739
              CXXFLAGS_JDKLIB_EXTRA="${CXXFLAGS_JDKLIB_EXTRA} -xregs=no%appl"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   740
              C_O_FLAG_HIGHEST="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0 $CC_HIGHEST -xprefetch=auto,explicit -xchip=ultra"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   741
              C_O_FLAG_HI="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   742
              C_O_FLAG_NORM="-xO2 -Wc,-Qrm-s -Wc,-Qiselect-T0"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   743
              C_O_FLAG_NONE=""
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   744
              CXX_O_FLAG_HIGHEST="-xO4 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0 $CC_HIGHEST -xprefetch=auto,explicit -xchip=ultra"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   745
              CXX_O_FLAG_HI="-xO4 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   746
              CXX_O_FLAG_NORM="-xO2 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   747
              CXX_O_FLAG_NONE=""
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   748
              ;;
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   749
          esac
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   750
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   751
          CFLAGS_DEBUG_SYMBOLS="-g -xs"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   752
          CXXFLAGS_DEBUG_SYMBOLS="-g0 -xs"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   753
      esac
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   754
      ;;
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   755
    CL )
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   756
      C_O_FLAG_HIGHEST="-O2"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   757
      C_O_FLAG_HI="-O1"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   758
      C_O_FLAG_NORM="-O1"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   759
      C_O_FLAG_NONE="-Od"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   760
      CXX_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   761
      CXX_O_FLAG_HI="$C_O_FLAG_HI"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   762
      CXX_O_FLAG_NORM="$C_O_FLAG_NORM"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   763
      CXX_O_FLAG_NONE="$C_O_FLAG_NONE"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   764
      ;;
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   765
  esac
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   766
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   767
  if test -z "$C_O_FLAG_HIGHEST"; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   768
    C_O_FLAG_HIGHEST="$C_O_FLAG_HI"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   769
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   770
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   771
  if test -z "$CXX_O_FLAG_HIGHEST"; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   772
    CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_HI"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   773
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   774
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   775
  AC_SUBST(C_O_FLAG_HIGHEST)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   776
  AC_SUBST(C_O_FLAG_HI)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   777
  AC_SUBST(C_O_FLAG_NORM)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   778
  AC_SUBST(C_O_FLAG_NONE)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   779
  AC_SUBST(CXX_O_FLAG_HIGHEST)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   780
  AC_SUBST(CXX_O_FLAG_HI)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   781
  AC_SUBST(CXX_O_FLAG_NORM)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   782
  AC_SUBST(CXX_O_FLAG_NONE)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   783
  AC_SUBST(C_FLAG_DEPS)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   784
  AC_SUBST(CXX_FLAG_DEPS)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   785
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   786
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   787
AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_FLAGS_FOR_JDK],
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   788
[
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   789
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   790
  if test "x$CFLAGS" != "x${ADDED_CFLAGS}"; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   791
    AC_MSG_WARN([Ignoring CFLAGS($CFLAGS) found in environment. Use --with-extra-cflags])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   792
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   793
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   794
  if test "x$CXXFLAGS" != "x${ADDED_CXXFLAGS}"; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   795
    AC_MSG_WARN([Ignoring CXXFLAGS($CXXFLAGS) found in environment. Use --with-extra-cxxflags])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   796
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   797
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   798
  if test "x$LDFLAGS" != "x${ADDED_LDFLAGS}"; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   799
    AC_MSG_WARN([Ignoring LDFLAGS($LDFLAGS) found in environment. Use --with-extra-ldflags])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   800
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   801
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   802
  AC_ARG_WITH(extra-cflags, [AS_HELP_STRING([--with-extra-cflags],
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   803
      [extra flags to be used when compiling jdk c-files])])
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   804
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   805
  AC_ARG_WITH(extra-cxxflags, [AS_HELP_STRING([--with-extra-cxxflags],
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   806
      [extra flags to be used when compiling jdk c++-files])])
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   807
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   808
  AC_ARG_WITH(extra-ldflags, [AS_HELP_STRING([--with-extra-ldflags],
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   809
      [extra flags to be used when linking jdk])])
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   810
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   811
  CFLAGS_JDK="${CFLAGS_JDK} $with_extra_cflags"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   812
  CXXFLAGS_JDK="${CXXFLAGS_JDK} $with_extra_cxxflags"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   813
  LDFLAGS_JDK="${LDFLAGS_JDK} $with_extra_ldflags"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   814
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   815
  # Hotspot needs these set in their legacy form
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   816
  LEGACY_EXTRA_CFLAGS=$with_extra_cflags
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   817
  LEGACY_EXTRA_CXXFLAGS=$with_extra_cxxflags
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   818
  LEGACY_EXTRA_LDFLAGS=$with_extra_ldflags
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   819
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   820
  AC_SUBST(LEGACY_EXTRA_CFLAGS)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   821
  AC_SUBST(LEGACY_EXTRA_CXXFLAGS)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   822
  AC_SUBST(LEGACY_EXTRA_LDFLAGS)
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   823
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   824
  ###############################################################################
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   825
  #
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   826
  # Now setup the CFLAGS and LDFLAGS for the JDK build.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   827
  # Later we will also have CFLAGS and LDFLAGS for the hotspot subrepo build.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   828
  #
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   829
  case $COMPILER_NAME in
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   830
    gcc )
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   831
      CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -W -Wall -Wno-unused -Wno-parentheses \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   832
      -pipe \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   833
      -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   834
      case $OPENJDK_TARGET_CPU_ARCH in
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   835
        arm )
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   836
          # on arm we don't prevent gcc to omit frame pointer but do prevent strict aliasing
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   837
          CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   838
          ;;
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   839
        ppc )
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   840
          # on ppc we don't prevent gcc to omit frame pointer nor strict-aliasing
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   841
          ;;
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   842
        * )
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   843
          CCXXFLAGS_JDK="$CCXXFLAGS_JDK -fno-omit-frame-pointer"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   844
          CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   845
          ;;
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   846
      esac
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   847
      ;;
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   848
    ossc )
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   849
      CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   850
      case $OPENJDK_TARGET_CPU_ARCH in
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   851
        x86 )
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   852
          CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DcpuIntel -Di586 -D$OPENJDK_TARGET_CPU_LEGACY_LIB"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   853
          CFLAGS_JDK="$CFLAGS_JDK -erroff=E_BAD_PRAGMA_PACK_VALUE"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   854
          ;;
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   855
      esac
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   856
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   857
      CFLAGS_JDK="$CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -W0,-noglobal"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   858
      CXXFLAGS_JDK="$CXXFLAGS_JDK -errtags=yes +w -mt -features=no%except -DCC_NOEX -norunpath -xnolib"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   859
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   860
      LDFLAGS_JDK="$LDFLAGS_JDK -z defs -xildoff -ztext"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   861
      LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK -norunpath -xnolib"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   862
      ;;
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   863
    cl )
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   864
      CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -Zi -MD -Zc:wchar_t- -W3 -wd4800 \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   865
      -D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB -DWIN32_LEAN_AND_MEAN \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   866
      -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   867
      -DWIN32 -DIAL"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   868
      case $OPENJDK_TARGET_CPU in
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   869
        x86 )
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   870
          CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_X86_ -Dx86"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   871
          ;;
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   872
        x86_64 )
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   873
          CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_AMD64_ -Damd64"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   874
          ;;
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   875
      esac
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   876
      ;;
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   877
  esac
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   878
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   879
  ###############################################################################
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   880
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   881
  # Adjust flags according to debug level.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   882
  case $DEBUG_LEVEL in
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   883
    fastdebug )
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   884
      CFLAGS_JDK="$CFLAGS_JDK $CFLAGS_DEBUG_SYMBOLS"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   885
      CXXFLAGS_JDK="$CXXFLAGS_JDK $CXXFLAGS_DEBUG_SYMBOLS"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   886
      C_O_FLAG_HI="$C_O_FLAG_NORM"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   887
      C_O_FLAG_NORM="$C_O_FLAG_NORM"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   888
      CXX_O_FLAG_HI="$CXX_O_FLAG_NORM"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   889
      CXX_O_FLAG_NORM="$CXX_O_FLAG_NORM"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   890
      JAVAC_FLAGS="$JAVAC_FLAGS -g"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   891
      ;;
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   892
    slowdebug )
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   893
      CFLAGS_JDK="$CFLAGS_JDK $CFLAGS_DEBUG_SYMBOLS"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   894
      CXXFLAGS_JDK="$CXXFLAGS_JDK $CXXFLAGS_DEBUG_SYMBOLS"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   895
      C_O_FLAG_HI="$C_O_FLAG_NONE"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   896
      C_O_FLAG_NORM="$C_O_FLAG_NONE"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   897
      CXX_O_FLAG_HI="$CXX_O_FLAG_NONE"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   898
      CXX_O_FLAG_NORM="$CXX_O_FLAG_NONE"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   899
      JAVAC_FLAGS="$JAVAC_FLAGS -g"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   900
      ;;
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   901
  esac
18020
eade0d9836bf 8014404: Debug flag not added to jdk native compile when --enable-debug is set
erikj
parents: 17664
diff changeset
   902
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   903
  CCXXFLAGS_JDK="$CCXXFLAGS_JDK $ADD_LP64"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   904
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   905
  # The package path is used only on macosx?
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   906
  PACKAGE_PATH=/opt/local
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   907
  AC_SUBST(PACKAGE_PATH)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   908
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   909
  if test "x$OPENJDK_TARGET_CPU_ENDIAN" = xlittle; then
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   910
    # The macro _LITTLE_ENDIAN needs to be defined the same to avoid the
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   911
    #   Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   912
    #   (The Solaris X86 system defines this in file /usr/include/sys/isa_defs.h).
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   913
    #   Note: -Dmacro         is the same as    #define macro 1
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   914
    #         -Dmacro=        is the same as    #define macro
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   915
    if test "x$OPENJDK_TARGET_OS" = xsolaris; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   916
      CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN="
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   917
    else
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   918
      CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_LITTLE_ENDIAN"
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   919
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   920
  else
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   921
    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_BIG_ENDIAN"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   922
  fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   923
  if test "x$OPENJDK_TARGET_OS" = xlinux; then
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   924
    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DLINUX"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   925
  fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   926
  if test "x$OPENJDK_TARGET_OS" = xwindows; then
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   927
    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DWINDOWS"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   928
  fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   929
  if test "x$OPENJDK_TARGET_OS" = xsolaris; then
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   930
    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DSOLARIS"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   931
  fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   932
  if test "x$OPENJDK_TARGET_OS" = xmacosx; then
19311
741980fe0b33 8021820: Number of opened files used in select() is limited to 1024 [macosx]
aefimov
parents: 18426
diff changeset
   933
    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMACOSX -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
17664
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
   934
    # Setting these parameters makes it an error to link to macosx APIs that are
15786
abd76d7cd807 8008451: Make mac builds on 10.8 work on 10.7
erikj
parents: 15581
diff changeset
   935
    # newer than the given OS version and makes the linked binaries compatible even
abd76d7cd807 8008451: Make mac builds on 10.8 work on 10.7
erikj
parents: 15581
diff changeset
   936
    # if built on a newer version of the OS.
abd76d7cd807 8008451: Make mac builds on 10.8 work on 10.7
erikj
parents: 15581
diff changeset
   937
    # The expected format is X.Y.Z
abd76d7cd807 8008451: Make mac builds on 10.8 work on 10.7
erikj
parents: 15581
diff changeset
   938
    MACOSX_VERSION_MIN=10.7.0
abd76d7cd807 8008451: Make mac builds on 10.8 work on 10.7
erikj
parents: 15581
diff changeset
   939
    AC_SUBST(MACOSX_VERSION_MIN)
abd76d7cd807 8008451: Make mac builds on 10.8 work on 10.7
erikj
parents: 15581
diff changeset
   940
    # The macro takes the version with no dots, ex: 1070
abd76d7cd807 8008451: Make mac builds on 10.8 work on 10.7
erikj
parents: 15581
diff changeset
   941
    # Let the flags variables get resolved in make for easier override on make
abd76d7cd807 8008451: Make mac builds on 10.8 work on 10.7
erikj
parents: 15581
diff changeset
   942
    # command line.
abd76d7cd807 8008451: Make mac builds on 10.8 work on 10.7
erikj
parents: 15581
diff changeset
   943
    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
abd76d7cd807 8008451: Make mac builds on 10.8 work on 10.7
erikj
parents: 15581
diff changeset
   944
    LDFLAGS_JDK="$LDFLAGS_JDK -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   945
  fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   946
  if test "x$OPENJDK_TARGET_OS" = xbsd; then
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   947
    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DBSD -D_ALLBSD_SOURCE"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   948
  fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   949
  if test "x$DEBUG_LEVEL" = xrelease; then
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   950
    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DNDEBUG"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   951
  if test "x$OPENJDK_TARGET_OS" = xsolaris; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   952
    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DTRIMMED"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   953
  fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   954
  else
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   955
    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DDEBUG"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   956
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   957
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   958
  CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DARCH='\"$OPENJDK_TARGET_CPU_LEGACY\"' -D$OPENJDK_TARGET_CPU_LEGACY"
22035
897e2da883cd 8030781: System.setProperties(null) drops all system properties (RELEASE not set)
erikj
parents: 21055
diff changeset
   959
  CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DRELEASE='\"\$(RELEASE)\"'"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   960
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   961
  CCXXFLAGS_JDK="$CCXXFLAGS_JDK \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   962
      -I${JDK_OUTPUTDIR}/include \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   963
      -I${JDK_OUTPUTDIR}/include/$OPENJDK_TARGET_OS \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   964
      -I${JDK_TOPDIR}/src/share/javavm/export \
21055
d52217bb8e80 8016096: [macosx] jawt_md.h shipped with jdk is outdated
dholmes
parents: 20643
diff changeset
   965
      -I${JDK_TOPDIR}/src/$OPENJDK_TARGET_OS_EXPORT_DIR/javavm/export \
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   966
      -I${JDK_TOPDIR}/src/share/native/common \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   967
      -I${JDK_TOPDIR}/src/$OPENJDK_TARGET_OS_API_DIR/native/common"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   968
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   969
  # The shared libraries are compiled using the picflag.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   970
  CFLAGS_JDKLIB="$CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   971
  CXXFLAGS_JDKLIB="$CCXXFLAGS_JDK $CXXFLAGS_JDK $PICFLAG $CXXFLAGS_JDKLIB_EXTRA "
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   972
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   973
  # Executable flags
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   974
  CFLAGS_JDKEXE="$CCXXFLAGS_JDK $CFLAGS_JDK"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   975
  CXXFLAGS_JDKEXE="$CCXXFLAGS_JDK $CXXFLAGS_JDK"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   976
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   977
  # Now this is odd. The JDK native libraries have to link against libjvm.so
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   978
  # On 32-bit machines there is normally two distinct libjvm.so:s, client and server.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   979
  # Which should we link to? Are we lucky enough that the binary api to the libjvm.so library
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   980
  # is identical for client and server? Yes. Which is picked at runtime (client or server)?
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   981
  # Neither, since the chosen libjvm.so has already been loaded by the launcher, all the following
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   982
  # libraries will link to whatever is in memory. Yuck.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   983
  #
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   984
  # Thus we offer the compiler to find libjvm.so first in server then in client. It works. Ugh.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   985
  if test "x$COMPILER_NAME" = xcl; then
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   986
    LDFLAGS_JDK="$LDFLAGS_JDK -nologo -opt:ref -incremental:no"
17664
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
   987
    if test "x$OPENJDK_TARGET_CPU" = xx86; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   988
      LDFLAGS_JDK="$LDFLAGS_JDK -safeseh"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   989
    fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   990
    # TODO: make -debug optional "--disable-full-debug-symbols"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   991
    LDFLAGS_JDK="$LDFLAGS_JDK -debug"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   992
    LDFLAGS_JDKLIB="${LDFLAGS_JDK} -dll -libpath:${JDK_OUTPUTDIR}/lib"
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   993
    LDFLAGS_JDKLIB_SUFFIX=""
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   994
    if test "x$OPENJDK_TARGET_CPU_BITS" = "x64"; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   995
      LDFLAGS_STACK_SIZE=1048576
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   996
    else
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
   997
      LDFLAGS_STACK_SIZE=327680
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   998
    fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   999
    LDFLAGS_JDKEXE="${LDFLAGS_JDK} /STACK:$LDFLAGS_STACK_SIZE"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1000
  else
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
  1001
    if test "x$COMPILER_NAME" = xgcc; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1002
      # If this is a --hash-style=gnu system, use --hash-style=both, why?
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1003
      HAS_GNU_HASH=`$CC -dumpspecs 2>/dev/null | $GREP 'hash-style=gnu'`
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1004
      if test -n "$HAS_GNU_HASH"; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1005
        LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker --hash-style=both "
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1006
      fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1007
      if test "x$OPENJDK_TARGET_OS" = xlinux; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1008
        # And since we now know that the linker is gnu, then add -z defs, to forbid
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1009
        # undefined symbols in object files.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1010
        LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker -z -Xlinker defs"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1011
        if test "x$DEBUG_LEVEL" = "xrelease"; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1012
          # When building release libraries, tell the linker optimize them.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1013
          # Should this be supplied to the OSS linker as well?
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1014
          LDFLAGS_JDK="${LDFLAGS_JDK} -Xlinker -O1"
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
  1015
        fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1016
      fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
  1017
    fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
  1018
    LDFLAGS_JDKLIB="${LDFLAGS_JDK} $SHARED_LIBRARY_FLAGS \
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1019
        -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}"
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
  1020
14465
d529faf5e36a 8001460: build-infra: Linker warnings on macosx
erikj
parents: 14464
diff changeset
  1021
    # On some platforms (mac) the linker warns about non existing -L dirs.
14467
a973c0a1bd5d 8003528: build-infra: Diffs in libjava and hotspot libs on solaris.
erikj
parents: 14465
diff changeset
  1022
    # Add server first if available. Linking aginst client does not always produce the same results.
14810
4e7fee179b4a 7190137: Add support for JVM_VARIANT minimal1
dholmes
parents: 14614
diff changeset
  1023
    # Only add client dir if client is being built. Add minimal (note not minimal1) if only building minimal1.
4e7fee179b4a 7190137: Add support for JVM_VARIANT minimal1
dholmes
parents: 14614
diff changeset
  1024
    # Default to server for other variants.
14467
a973c0a1bd5d 8003528: build-infra: Diffs in libjava and hotspot libs on solaris.
erikj
parents: 14465
diff changeset
  1025
    if test "x$JVM_VARIANT_SERVER" = xtrue; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1026
      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server"
14467
a973c0a1bd5d 8003528: build-infra: Diffs in libjava and hotspot libs on solaris.
erikj
parents: 14465
diff changeset
  1027
    elif test "x$JVM_VARIANT_CLIENT" = xtrue; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1028
      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/client"
14810
4e7fee179b4a 7190137: Add support for JVM_VARIANT minimal1
dholmes
parents: 14614
diff changeset
  1029
    elif test "x$JVM_VARIANT_MINIMAL1" = xtrue; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1030
      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/minimal"
14465
d529faf5e36a 8001460: build-infra: Linker warnings on macosx
erikj
parents: 14464
diff changeset
  1031
    else
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1032
      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server"
14465
d529faf5e36a 8001460: build-infra: Linker warnings on macosx
erikj
parents: 14464
diff changeset
  1033
    fi
d529faf5e36a 8001460: build-infra: Linker warnings on macosx
erikj
parents: 14464
diff changeset
  1034
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
  1035
    LDFLAGS_JDKLIB_SUFFIX="-ljava -ljvm"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
  1036
    if test "x$COMPILER_NAME" = xossc; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1037
      LDFLAGS_JDKLIB_SUFFIX="$LDFLAGS_JDKLIB_SUFFIX -lc"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
  1038
    fi
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
  1039
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
  1040
    LDFLAGS_JDKEXE="${LDFLAGS_JDK}"
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
  1041
    if test "x$OPENJDK_TARGET_OS" = xlinux; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1042
      LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE -Xlinker --allow-shlib-undefined"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
  1043
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1044
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
  1045
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1046
  AC_SUBST(CFLAGS_JDKLIB)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1047
  AC_SUBST(CFLAGS_JDKEXE)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
  1048
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1049
  AC_SUBST(CXXFLAGS_JDKLIB)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1050
  AC_SUBST(CXXFLAGS_JDKEXE)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
  1051
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1052
  AC_SUBST(LDFLAGS_JDKLIB)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1053
  AC_SUBST(LDFLAGS_JDKEXE)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1054
  AC_SUBST(LDFLAGS_JDKLIB_SUFFIX)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1055
  AC_SUBST(LDFLAGS_JDKEXE_SUFFIX)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1056
  AC_SUBST(LDFLAGS_CXX_JDK)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
  1057
])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1058
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1059
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1060
# TOOLCHAIN_COMPILER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE],
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1061
#                                   [RUN-IF-FALSE])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1062
# ------------------------------------------------------------
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1063
# Check that the c and c++ compilers support an argument
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1064
AC_DEFUN([TOOLCHAIN_COMPILER_CHECK_ARGUMENTS],
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1065
[
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1066
  AC_MSG_CHECKING([if compiler supports "$1"])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1067
  supports=yes
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1068
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1069
  saved_cflags="$CFLAGS"
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1070
  CFLAGS="$CFLAGS $1"
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1071
  AC_LANG_PUSH([C])
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1072
  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [], 
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1073
      [supports=no])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1074
  AC_LANG_POP([C])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1075
  CFLAGS="$saved_cflags"
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1076
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1077
  saved_cxxflags="$CXXFLAGS"
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1078
  CXXFLAGS="$CXXFLAG $1"
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1079
  AC_LANG_PUSH([C++])
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1080
  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [], 
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1081
      [supports=no])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1082
  AC_LANG_POP([C++])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1083
  CXXFLAGS="$saved_cxxflags"
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1084
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1085
  AC_MSG_RESULT([$supports])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1086
  if test "x$supports" = "xyes" ; then
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1087
    m4_ifval([$2], [$2], [:])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1088
  else
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1089
    m4_ifval([$3], [$3], [:])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1090
  fi
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1091
])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1092
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1093
AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_FLAGS_MISC],
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1094
[
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1095
  # Some Zero and Shark settings.
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1096
  # ZERO_ARCHFLAG tells the compiler which mode to build for
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1097
  case "${OPENJDK_TARGET_CPU}" in
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1098
    s390)
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1099
      ZERO_ARCHFLAG="-m31"
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1100
      ;;
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1101
    *)
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1102
      ZERO_ARCHFLAG="-m${OPENJDK_TARGET_CPU_BITS}"
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1103
  esac
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1104
  TOOLCHAIN_COMPILER_CHECK_ARGUMENTS([$ZERO_ARCHFLAG], [], [ZERO_ARCHFLAG=""])
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1105
  AC_SUBST(ZERO_ARCHFLAG)
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1106
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1107
  # Check that the compiler supports -mX flags
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1108
  # Set COMPILER_SUPPORTS_TARGET_BITS_FLAG to 'true' if it does
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1109
  TOOLCHAIN_COMPILER_CHECK_ARGUMENTS([-m${OPENJDK_TARGET_CPU_BITS}],
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1110
      [COMPILER_SUPPORTS_TARGET_BITS_FLAG=true],
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1111
      [COMPILER_SUPPORTS_TARGET_BITS_FLAG=false])
16987
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1112
  AC_SUBST(COMPILER_SUPPORTS_TARGET_BITS_FLAG)
19305cbf4362 8013786: JDK-8013480 broke configure on solaris
erikj
parents: 16582
diff changeset
  1113
])
17593
de6741d8a142 8007129: build-infra Add configure --with-jtreg option for location of JTREG
erikj
parents: 16988
diff changeset
  1114
17664
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1115
# Setup the JTREG paths
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1116
AC_DEFUN_ONCE([TOOLCHAIN_SETUP_JTREG],
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1117
[
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1118
  AC_ARG_WITH(jtreg, [AS_HELP_STRING([--with-jtreg],
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1119
      [Regression Test Harness @<:@probed@:>@])],
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1120
      [],
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20362
diff changeset
  1121
      [with_jtreg=no])
17664
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1122
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1123
  if test "x$with_jtreg" = xno; then
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1124
    # jtreg disabled
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1125
    AC_MSG_CHECKING([for jtreg])
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1126
    AC_MSG_RESULT(no)
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1127
  else
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1128
    if test "x$with_jtreg" != xyes; then
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1129
      # with path specified.
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1130
      JT_HOME="$with_jtreg"
17593
de6741d8a142 8007129: build-infra Add configure --with-jtreg option for location of JTREG
erikj
parents: 16988
diff changeset
  1131
    fi
17664
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1132
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1133
    if test "x$JT_HOME" != x; then
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1134
      AC_MSG_CHECKING([for jtreg])
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1135
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1136
      # use JT_HOME enviroment var.
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1137
      BASIC_FIXUP_PATH([JT_HOME])
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1138
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1139
      # jtreg win32 script works for everybody
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1140
      JTREGEXE="$JT_HOME/win32/bin/jtreg"
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1141
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1142
      if test ! -f "$JTREGEXE"; then
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1143
        AC_MSG_ERROR([JTReg executable does not exist: $JTREGEXE])
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1144
      fi
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1145
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1146
      AC_MSG_RESULT($JTREGEXE)
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1147
    else
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1148
      # try to find jtreg on path
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1149
      BASIC_REQUIRE_PROG(JTREGEXE, jtreg)
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1150
      JT_HOME="`$DIRNAME $JTREGEXE`"
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1151
    fi
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1152
  fi
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1153
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1154
  AC_SUBST(JT_HOME)
2cb42641740b 8015510: (s) Improve JTReg location detection and provide location to test/Makefile
mduigou
parents: 17593
diff changeset
  1155
  AC_SUBST(JTREGEXE)
17593
de6741d8a142 8007129: build-infra Add configure --with-jtreg option for location of JTREG
erikj
parents: 16988
diff changeset
  1156
])