2
# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5
# This code is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License version 2 only, as
7
# published by the Free Software Foundation. Oracle designates this
8
# particular file as subject to the "Classpath" exception as provided
9
# by Oracle in the LICENSE file that accompanied this code.
11
# This code is distributed in the hope that it will be useful, but WITHOUT
12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
# version 2 for more details (a copy is included in the LICENSE file that
15
# accompanied this code).
17
# You should have received a copy of the GNU General Public License version
18
# 2 along with this work; if not, write to the Free Software Foundation,
19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
# or visit www.oracle.com if you need additional information or have any
26
################################################################################
28
# Setup flags for other tools than C/C++ compiler
31
AC_DEFUN([FLAGS_SETUP_ARFLAGS],
33
# FIXME: figure out if we should select AR flags depending on OS or toolchain.
34
if test "x$OPENJDK_TARGET_OS" = xaix; then
43
AC_DEFUN([FLAGS_SETUP_LIBFLAGS],
45
# LIB is used to create static libraries on Windows
46
if test "x$OPENJDK_TARGET_OS" = xwindows; then
47
LIBFLAGS="-nodefaultlib:msvcrt"
55
AC_DEFUN([FLAGS_SETUP_STRIPFLAGS],
58
if test "x$STRIP" != x; then
59
AC_MSG_CHECKING([how to run strip])
61
# Easy cheat: Check strip variant by passing --version as an argument.
62
# Different types of strip have varying command line syntaxes for querying their
63
# version string, and all noisily fail if the provided version option is not
66
# The actual version string or failure to execute strip are hidden by redirection
67
# to config.log with 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD
69
if $STRIP "--version" 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD; then
70
# strip that comes from the GNU family uses --version
71
# This variant of strip is usually found accompanying gcc and clang
72
STRIPFLAGS="--strip-debug"
73
elif $STRIP "-V" 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD; then
74
# IBM strip that works with AIX binaries only supports -V
77
# The only strip variant left is MacOS/Xcode strip, which does not have any
78
# way whatsoever to be identified (lacking even basic help or version options),
79
# so we leave it as the last fallback when all other tests have failed.
82
AC_MSG_RESULT($STRIPFLAGS)
88
AC_DEFUN([FLAGS_SETUP_RCFLAGS],
90
# On Windows, we need to set RC flags.
91
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
93
if test "x$DEBUG_LEVEL" = xrelease; then
94
RCFLAGS="$RCFLAGS -DNDEBUG"
100
AC_DEFUN([FLAGS_SETUP_NMFLAGS],
102
# On AIX, we need to set NM flag -X64 for processing 64bit object files
103
if test "x$OPENJDK_TARGET_OS" = xaix; then
110
################################################################################
111
# platform independent
112
AC_DEFUN([FLAGS_SETUP_ASFLAGS],
114
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
115
# Force preprocessor to run, just to make sure
116
BASIC_ASFLAGS="-x assembler-with-cpp"
117
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
118
BASIC_ASFLAGS="-nologo -c"
120
AC_SUBST(BASIC_ASFLAGS)
122
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
123
JVM_BASIC_ASFLAGS="-mno-omit-leaf-frame-pointer -mstack-alignment=16"
125
# Fix linker warning.
126
# Code taken from make/autoconf/flags-cflags.m4 and adapted.
127
JVM_BASIC_ASFLAGS="$JVM_BASIC_ASFLAGS \
128
-DMAC_OS_X_VERSION_MIN_REQUIRED=$MACOSX_VERSION_MIN_NODOTS \
129
-mmacosx-version-min=$MACOSX_VERSION_MIN"
131
if test -n "$MACOSX_VERSION_MAX"; then
132
JVM_BASIC_ASFLAGS="$JVM_BASIC_ASFLAGS $OS_CFLAGS \
133
-DMAC_OS_X_VERSION_MAX_ALLOWED=$MACOSX_VERSION_MAX_NODOTS"
138
################################################################################
139
# $1 - Either BUILD or TARGET to pick the correct OS/CPU variables to check
140
# conditionals against.
141
# $2 - Optional prefix for each variable defined.
142
AC_DEFUN([FLAGS_SETUP_ASFLAGS_CPU_DEP],
144
# Misuse EXTRA_CFLAGS to mimic old behavior
145
$2JVM_ASFLAGS="$JVM_BASIC_ASFLAGS ${$2EXTRA_CFLAGS}"
147
if test "x$1" = "xTARGET" && \
148
test "x$TOOLCHAIN_TYPE" = xgcc && \
149
test "x$OPENJDK_TARGET_CPU" = xarm; then
150
$2JVM_ASFLAGS="${$2JVM_ASFLAGS} $ARM_ARCH_TYPE_ASFLAGS $ARM_FLOAT_TYPE_ASFLAGS"
153
AC_SUBST($2JVM_ASFLAGS)