flags.m4 revision 2464:1588d044d709
1#
2# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4#
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.
10#
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).
16#
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.
20#
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
23# questions.
24#
25
26################################################################################
27#
28# Setup ABI profile (for arm)
29#
30AC_DEFUN([FLAGS_SETUP_ABI_PROFILE],
31[
32  AC_ARG_WITH(abi-profile, [AS_HELP_STRING([--with-abi-profile],
33      [specify ABI profile for ARM builds (arm-vfp-sflt,arm-vfp-hflt,arm-sflt, armv5-vfp-sflt,armv6-vfp-hflt,arm64,aarch64) @<:@toolchain dependent@:>@ ])])
34
35  if test "x$with_abi_profile" != x; then
36    if test "x$OPENJDK_TARGET_CPU" != xarm && \
37        test "x$OPENJDK_TARGET_CPU" != xaarch64; then
38      AC_MSG_ERROR([--with-abi-profile only available on arm/aarch64])
39    fi
40
41    OPENJDK_TARGET_ABI_PROFILE=$with_abi_profile
42    AC_MSG_CHECKING([for ABI profle])
43    AC_MSG_RESULT([$OPENJDK_TARGET_ABI_PROFILE])
44
45    if test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-vfp-sflt; then
46      ARM_FLOAT_TYPE=vfp-sflt
47      ARM_ARCH_TYPE_FLAGS='-march=armv7-a -mthumb'
48    elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-vfp-hflt; then
49      ARM_FLOAT_TYPE=vfp-hflt
50      ARM_ARCH_TYPE_FLAGS='-march=armv7-a -mthumb'
51    elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-sflt; then
52      ARM_FLOAT_TYPE=sflt
53      ARM_ARCH_TYPE_FLAGS='-march=armv5t -marm'
54    elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarmv5-vfp-sflt; then
55      ARM_FLOAT_TYPE=vfp-sflt
56      ARM_ARCH_TYPE_FLAGS='-march=armv5t -marm'
57    elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarmv6-vfp-hflt; then
58      ARM_FLOAT_TYPE=vfp-hflt
59      ARM_ARCH_TYPE_FLAGS='-march=armv6 -marm'
60    elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm64; then
61      # No special flags, just need to trigger setting JDK_ARCH_ABI_PROP_NAME
62      ARM_FLOAT_TYPE=
63      ARM_ARCH_TYPE_FLAGS=
64    elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xaarch64; then
65      # No special flags, just need to trigger setting JDK_ARCH_ABI_PROP_NAME
66      ARM_FLOAT_TYPE=
67      ARM_ARCH_TYPE_FLAGS=
68    else
69      AC_MSG_ERROR([Invalid ABI profile: "$OPENJDK_TARGET_ABI_PROFILE"])
70    fi
71
72    if test "x$ARM_FLOAT_TYPE" = xvfp-sflt; then
73      ARM_FLOAT_TYPE_FLAGS='-mfloat-abi=softfp -mfpu=vfp -DFLOAT_ARCH=-vfp-sflt'
74    elif test "x$ARM_FLOAT_TYPE" = xvfp-hflt; then
75      ARM_FLOAT_TYPE_FLAGS='-mfloat-abi=hard -mfpu=vfp -DFLOAT_ARCH=-vfp-hflt'
76    elif test "x$ARM_FLOAT_TYPE" = xsflt; then
77      ARM_FLOAT_TYPE_FLAGS='-msoft-float -mfpu=vfp'
78    fi
79    AC_MSG_CHECKING([for $ARM_FLOAT_TYPE floating point flags])
80    AC_MSG_RESULT([$ARM_FLOAT_TYPE_FLAGS])
81
82    AC_MSG_CHECKING([for arch type flags])
83    AC_MSG_RESULT([$ARM_ARCH_TYPE_FLAGS])
84
85    # Now set JDK_ARCH_ABI_PROP_NAME. This is equivalent to the last part of the
86    # autoconf target triplet.
87    [ JDK_ARCH_ABI_PROP_NAME=`$ECHO $OPENJDK_TARGET_AUTOCONF_NAME | $SED -e 's/.*-\([^-]*\)$/\1/'` ]
88    # Sanity check that it is a known ABI.
89    if test "x$JDK_ARCH_ABI_PROP_NAME" != xgnu && \
90        test "x$JDK_ARCH_ABI_PROP_NAME" != xgnueabi  && \
91        test "x$JDK_ARCH_ABI_PROP_NAME" != xgnueabihf; then
92          AC_MSG_WARN([Unknown autoconf target triplet ABI: "$JDK_ARCH_ABI_PROP_NAME"])
93    fi
94    AC_MSG_CHECKING([for ABI property name])
95    AC_MSG_RESULT([$JDK_ARCH_ABI_PROP_NAME])
96    AC_SUBST(JDK_ARCH_ABI_PROP_NAME)
97
98    # Pass these on to the open part of configure as if they were set using
99    # --with-extra-c[xx]flags.
100    EXTRA_CFLAGS="$EXTRA_CFLAGS $ARM_ARCH_TYPE_FLAGS $ARM_FLOAT_TYPE_FLAGS"
101    EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS $ARM_ARCH_TYPE_FLAGS $ARM_FLOAT_TYPE_FLAGS"
102    # Get rid of annoying "note: the mangling of 'va_list' has changed in GCC 4.4"
103    # FIXME: This should not really be set using extra_cflags.
104    if test "x$OPENJDK_TARGET_CPU" = xarm; then
105        EXTRA_CFLAGS="$EXTRA_CFLAGS -Wno-psabi"
106        EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -Wno-psabi"
107    fi
108    # Also add JDK_ARCH_ABI_PROP_NAME define, but only to CFLAGS.
109    EXTRA_CFLAGS="$EXTRA_CFLAGS -DJDK_ARCH_ABI_PROP_NAME='\"\$(JDK_ARCH_ABI_PROP_NAME)\"'"
110    # And pass the architecture flags to the linker as well
111    EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ARM_ARCH_TYPE_FLAGS $ARM_FLOAT_TYPE_FLAGS"
112  fi
113
114  # When building with an abi profile, the name of that profile is appended on the
115  # bundle platform, which is used in bundle names.
116  if test "x$OPENJDK_TARGET_ABI_PROFILE" != x; then
117    OPENJDK_TARGET_BUNDLE_PLATFORM="$OPENJDK_TARGET_OS_BUNDLE-$OPENJDK_TARGET_ABI_PROFILE"
118  fi
119])
120
121# Reset the global CFLAGS/LDFLAGS variables and initialize them with the
122# corresponding configure arguments instead
123AC_DEFUN_ONCE([FLAGS_SETUP_USER_SUPPLIED_FLAGS],
124[
125  if test "x$CFLAGS" != "x${ADDED_CFLAGS}"; then
126    AC_MSG_WARN([Ignoring CFLAGS($CFLAGS) found in environment. Use --with-extra-cflags])
127  fi
128
129  if test "x$CXXFLAGS" != "x${ADDED_CXXFLAGS}"; then
130    AC_MSG_WARN([Ignoring CXXFLAGS($CXXFLAGS) found in environment. Use --with-extra-cxxflags])
131  fi
132
133  if test "x$LDFLAGS" != "x${ADDED_LDFLAGS}"; then
134    AC_MSG_WARN([Ignoring LDFLAGS($LDFLAGS) found in environment. Use --with-extra-ldflags])
135  fi
136
137  AC_ARG_WITH(extra-cflags, [AS_HELP_STRING([--with-extra-cflags],
138      [extra flags to be used when compiling jdk c-files])])
139
140  AC_ARG_WITH(extra-cxxflags, [AS_HELP_STRING([--with-extra-cxxflags],
141      [extra flags to be used when compiling jdk c++-files])])
142
143  AC_ARG_WITH(extra-ldflags, [AS_HELP_STRING([--with-extra-ldflags],
144      [extra flags to be used when linking jdk])])
145
146  EXTRA_CFLAGS="$with_extra_cflags"
147  EXTRA_CXXFLAGS="$with_extra_cxxflags"
148  EXTRA_LDFLAGS="$with_extra_ldflags"
149
150  AC_SUBST(EXTRA_CFLAGS)
151  AC_SUBST(EXTRA_CXXFLAGS)
152  AC_SUBST(EXTRA_LDFLAGS)
153
154  # The global CFLAGS and LDLAGS variables are used by configure tests and
155  # should include the extra parameters
156  CFLAGS="$EXTRA_CFLAGS"
157  CXXFLAGS="$EXTRA_CXXFLAGS"
158  LDFLAGS="$EXTRA_LDFLAGS"
159  CPPFLAGS=""
160])
161
162# Setup the sysroot flags and add them to global CFLAGS and LDFLAGS so
163# that configure can use them while detecting compilers.
164# TOOLCHAIN_TYPE is available here.
165# Param 1 - Optional prefix to all variables. (e.g BUILD_)
166AC_DEFUN([FLAGS_SETUP_SYSROOT_FLAGS],
167[
168  if test "x[$]$1SYSROOT" != "x"; then
169    if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
170      if test "x$OPENJDK_TARGET_OS" = xsolaris; then
171        # Solaris Studio does not have a concept of sysroot. Instead we must
172        # make sure the default include and lib dirs are appended to each
173        # compile and link command line. Must also add -I-xbuiltin to enable
174        # inlining of system functions and intrinsics.
175        $1SYSROOT_CFLAGS="-I-xbuiltin -I[$]$1SYSROOT/usr/include"
176        $1SYSROOT_LDFLAGS="-L[$]$1SYSROOT/usr/lib$OPENJDK_TARGET_CPU_ISADIR \
177            -L[$]$1SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR"
178      fi
179    elif test "x$TOOLCHAIN_TYPE" = xgcc; then
180      $1SYSROOT_CFLAGS="--sysroot=[$]$1SYSROOT"
181      $1SYSROOT_LDFLAGS="--sysroot=[$]$1SYSROOT"
182    elif test "x$TOOLCHAIN_TYPE" = xclang; then
183      $1SYSROOT_CFLAGS="-isysroot [$]$1SYSROOT"
184      $1SYSROOT_LDFLAGS="-isysroot [$]$1SYSROOT"
185    fi
186    # The global CFLAGS and LDFLAGS variables need these for configure to function
187    $1CFLAGS="[$]$1CFLAGS [$]$1SYSROOT_CFLAGS"
188    $1CPPFLAGS="[$]$1CPPFLAGS [$]$1SYSROOT_CFLAGS"
189    $1CXXFLAGS="[$]$1CXXFLAGS [$]$1SYSROOT_CFLAGS"
190    $1LDFLAGS="[$]$1LDFLAGS [$]$1SYSROOT_LDFLAGS"
191  fi
192
193  if test "x$OPENJDK_TARGET_OS" = xmacosx; then
194    # We also need -iframework<path>/System/Library/Frameworks
195    $1SYSROOT_CFLAGS="[$]$1SYSROOT_CFLAGS -iframework [$]$1SYSROOT/System/Library/Frameworks"
196    $1SYSROOT_LDFLAGS="[$]$1SYSROOT_LDFLAGS -iframework [$]$1SYSROOT/System/Library/Frameworks"
197    # These always need to be set, or we can't find the frameworks embedded in JavaVM.framework
198    # set this here so it doesn't have to be peppered throughout the forest
199    $1SYSROOT_CFLAGS="[$]$1SYSROOT_CFLAGS -F [$]$1SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks"
200    $1SYSROOT_LDFLAGS="[$]$1SYSROOT_LDFLAGS -F [$]$1SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks"
201  fi
202
203  AC_SUBST($1SYSROOT_CFLAGS)
204  AC_SUBST($1SYSROOT_LDFLAGS)
205])
206
207AC_DEFUN_ONCE([FLAGS_SETUP_INIT_FLAGS],
208[
209  # COMPILER_TARGET_BITS_FLAG  : option for selecting 32- or 64-bit output
210  # COMPILER_COMMAND_FILE_FLAG : option for passing a command file to the compiler
211  # COMPILER_BINDCMD_FILE_FLAG : option for specifying a file which saves the binder
212  #                              commands produced by the link step (currently AIX only)
213  if test "x$TOOLCHAIN_TYPE" = xxlc; then
214    COMPILER_TARGET_BITS_FLAG="-q"
215    COMPILER_COMMAND_FILE_FLAG="-f"
216    COMPILER_BINDCMD_FILE_FLAG="-bloadmap:"
217  else
218    COMPILER_TARGET_BITS_FLAG="-m"
219    COMPILER_COMMAND_FILE_FLAG="@"
220    COMPILER_BINDCMD_FILE_FLAG=""
221
222    # The solstudio linker does not support @-files.
223    if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
224      COMPILER_COMMAND_FILE_FLAG=
225    fi
226
227    # Check if @file is supported by gcc
228    if test "x$TOOLCHAIN_TYPE" = xgcc; then
229      AC_MSG_CHECKING([if @file is supported by gcc])
230      # Extra emtpy "" to prevent ECHO from interpreting '--version' as argument
231      $ECHO "" "--version" > command.file
232      if $CXX @command.file 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD; then
233        AC_MSG_RESULT(yes)
234        COMPILER_COMMAND_FILE_FLAG="@"
235      else
236        AC_MSG_RESULT(no)
237        COMPILER_COMMAND_FILE_FLAG=
238      fi
239      $RM command.file
240    fi
241  fi
242  AC_SUBST(COMPILER_TARGET_BITS_FLAG)
243  AC_SUBST(COMPILER_COMMAND_FILE_FLAG)
244  AC_SUBST(COMPILER_BINDCMD_FILE_FLAG)
245
246  # FIXME: figure out if we should select AR flags depending on OS or toolchain.
247  if test "x$OPENJDK_TARGET_OS" = xmacosx; then
248    ARFLAGS="-r"
249  elif test "x$OPENJDK_TARGET_OS" = xaix; then
250    ARFLAGS="-X64"
251  elif test "x$OPENJDK_TARGET_OS" = xwindows; then
252    # lib.exe is used as AR to create static libraries.
253    ARFLAGS="-nologo -NODEFAULTLIB:MSVCRT"
254  else
255    ARFLAGS=""
256  fi
257  AC_SUBST(ARFLAGS)
258
259  ## Setup strip.
260  # FIXME: should this really be per platform, or should it be per toolchain type?
261  # strip is not provided by clang or solstudio; so guessing platform makes most sense.
262  # FIXME: we should really only export STRIPFLAGS from here, not POST_STRIP_CMD.
263  if test "x$OPENJDK_TARGET_OS" = xlinux; then
264    STRIPFLAGS="-g"
265  elif test "x$OPENJDK_TARGET_OS" = xsolaris; then
266    STRIPFLAGS="-x"
267  elif test "x$OPENJDK_TARGET_OS" = xmacosx; then
268    STRIPFLAGS="-S"
269  elif test "x$OPENJDK_TARGET_OS" = xaix; then
270    STRIPFLAGS="-X32_64"
271  fi
272
273  AC_SUBST(STRIPFLAGS)
274
275  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
276    CC_OUT_OPTION=-Fo
277    EXE_OUT_OPTION=-out:
278    LD_OUT_OPTION=-out:
279    AR_OUT_OPTION=-out:
280  else
281    # The option used to specify the target .o,.a or .so file.
282    # When compiling, how to specify the to be created object file.
283    CC_OUT_OPTION='-o$(SPACE)'
284    # When linking, how to specify the to be created executable.
285    EXE_OUT_OPTION='-o$(SPACE)'
286    # When linking, how to specify the to be created dynamically linkable library.
287    LD_OUT_OPTION='-o$(SPACE)'
288    # When archiving, how to specify the to be create static archive for object files.
289    AR_OUT_OPTION='rcs$(SPACE)'
290  fi
291  AC_SUBST(CC_OUT_OPTION)
292  AC_SUBST(EXE_OUT_OPTION)
293  AC_SUBST(LD_OUT_OPTION)
294  AC_SUBST(AR_OUT_OPTION)
295
296  # On Windows, we need to set RC flags.
297  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
298    RC_FLAGS="-nologo -l0x409"
299    JVM_RCFLAGS="-nologo"
300    if test "x$DEBUG_LEVEL" = xrelease; then
301      RC_FLAGS="$RC_FLAGS -DNDEBUG"
302      JVM_RCFLAGS="$JVM_RCFLAGS -DNDEBUG"
303    fi
304
305    # The version variables used to create RC_FLAGS may be overridden
306    # in a custom configure script, or possibly the command line.
307    # Let those variables be expanded at make time in spec.gmk.
308    # The \$ are escaped to the shell, and the $(...) variables
309    # are evaluated by make.
310    RC_FLAGS="$RC_FLAGS \
311        -D\"JDK_VERSION_STRING=\$(VERSION_STRING)\" \
312        -D\"JDK_COMPANY=\$(COMPANY_NAME)\" \
313        -D\"JDK_COMPONENT=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) binary\" \
314        -D\"JDK_VER=\$(VERSION_NUMBER)\" \
315        -D\"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \
316        -D\"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(VERSION_MAJOR)\" \
317        -D\"JDK_FVER=\$(subst .,\$(COMMA),\$(VERSION_NUMBER_FOUR_POSITIONS))\""
318
319    JVM_RCFLAGS="$JVM_RCFLAGS \
320        -D\"HS_BUILD_ID=\$(VERSION_STRING)\" \
321        -D\"HS_COMPANY=\$(COMPANY_NAME)\" \
322        -D\"JDK_DOTVER=\$(VERSION_NUMBER_FOUR_POSITIONS)\" \
323        -D\"HS_COPYRIGHT=Copyright $COPYRIGHT_YEAR\" \
324        -D\"HS_NAME=\$(PRODUCT_NAME) \$(VERSION_SHORT)\" \
325        -D\"JDK_VER=\$(subst .,\$(COMMA),\$(VERSION_NUMBER_FOUR_POSITIONS))\" \
326        -D\"HS_FNAME=jvm.dll\" \
327        -D\"HS_INTERNAL_NAME=jvm\""
328  fi
329  AC_SUBST(RC_FLAGS)
330  AC_SUBST(JVM_RCFLAGS)
331
332  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
333    # silence copyright notice and other headers.
334    COMMON_CCXXFLAGS="$COMMON_CCXXFLAGS -nologo"
335  fi
336])
337
338AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_LIBS],
339[
340  ###############################################################################
341  #
342  # How to compile shared libraries.
343  #
344
345  if test "x$TOOLCHAIN_TYPE" = xgcc; then
346    PICFLAG="-fPIC"
347    C_FLAG_REORDER=''
348    CXX_FLAG_REORDER=''
349
350    if test "x$OPENJDK_TARGET_OS" = xmacosx; then
351      # Linking is different on MacOSX
352      if test "x$STATIC_BUILD" = xtrue; then
353        SHARED_LIBRARY_FLAGS ='-undefined dynamic_lookup'
354      else
355        SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG"
356        JVM_CFLAGS="$JVM_CFLAGS $PICFLAG"
357      fi
358      SET_EXECUTABLE_ORIGIN='-Wl,-rpath,@loader_path/.'
359      SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
360      SET_SHARED_LIBRARY_NAME='-Wl,-install_name,@rpath/[$]1'
361      SET_SHARED_LIBRARY_MAPFILE='-Wl,-exported_symbols_list,[$]1'
362    else
363      # Default works for linux, might work on other platforms as well.
364      SHARED_LIBRARY_FLAGS='-shared'
365      SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$ORIGIN[$]1'
366      SET_SHARED_LIBRARY_ORIGIN="-Wl,-z,origin $SET_EXECUTABLE_ORIGIN"
367      SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
368      SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=[$]1'
369    fi
370  elif test "x$TOOLCHAIN_TYPE" = xclang; then
371    C_FLAG_REORDER=''
372    CXX_FLAG_REORDER=''
373
374    if test "x$OPENJDK_TARGET_OS" = xmacosx; then
375      # Linking is different on MacOSX
376      PICFLAG=''
377      SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG"
378      SET_EXECUTABLE_ORIGIN='-Wl,-rpath,@loader_path/.'
379      SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
380      SET_SHARED_LIBRARY_NAME='-Wl,-install_name,@rpath/[$]1'
381      SET_SHARED_LIBRARY_MAPFILE='-Wl,-exported_symbols_list,[$]1'
382
383      if test "x$STATIC_BUILD" = xfalse; then
384        JVM_CFLAGS="$JVM_CFLAGS -fPIC"
385      fi
386    else
387      # Default works for linux, might work on other platforms as well.
388      PICFLAG='-fPIC'
389      SHARED_LIBRARY_FLAGS='-shared'
390      SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$ORIGIN[$]1'
391      SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
392      SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=[$]1'
393
394      # arm specific settings
395      if test "x$OPENJDK_TARGET_CPU" = "xarm"; then
396        # '-Wl,-z,origin' isn't used on arm.
397        SET_SHARED_LIBRARY_ORIGIN='-Wl,-rpath,\$$$$ORIGIN[$]1'
398      else
399        SET_SHARED_LIBRARY_ORIGIN="-Wl,-z,origin $SET_EXECUTABLE_ORIGIN"
400      fi
401
402    fi
403  elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
404    if test "x$OPENJDK_TARGET_CPU" = xsparcv9; then
405      PICFLAG="-xcode=pic32"
406    else
407      PICFLAG="-KPIC"
408    fi
409    C_FLAG_REORDER='-xF'
410    CXX_FLAG_REORDER='-xF'
411    SHARED_LIBRARY_FLAGS="-G"
412    SET_EXECUTABLE_ORIGIN='-R\$$ORIGIN[$]1'
413    SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
414    SET_SHARED_LIBRARY_NAME='-h [$]1'
415    SET_SHARED_LIBRARY_MAPFILE='-M[$]1'
416  elif test "x$TOOLCHAIN_TYPE" = xxlc; then
417    # '-qpic' defaults to 'qpic=small'. This means that the compiler generates only
418    # one instruction for accessing the TOC. If the TOC grows larger than 64K, the linker
419    # will have to patch this single instruction with a call to some out-of-order code which
420    # does the load from the TOC. This is of course slow. But in that case we also would have
421    # to use '-bbigtoc' for linking anyway so we could also change the PICFLAG to 'qpic=large'.
422    # With 'qpic=large' the compiler will by default generate a two-instruction sequence which
423    # can be patched directly by the linker and does not require a jump to out-of-order code.
424    # Another alternative instead of using 'qpic=large -bbigtoc' may be to use '-qminimaltoc'
425    # instead. This creates a distinct TOC for every compilation unit (and thus requires two
426    # loads for accessing a global variable). But there are rumors that this may be seen as a
427    # 'performance feature' because of improved code locality of the symbols used in a
428    # compilation unit.
429    PICFLAG="-qpic"
430    JVM_CFLAGS="$JVM_CFLAGS $PICFLAG"
431    C_FLAG_REORDER=''
432    CXX_FLAG_REORDER=''
433    SHARED_LIBRARY_FLAGS="-qmkshrobj -bM:SRE -bnoentry"
434    SET_EXECUTABLE_ORIGIN=""
435    SET_SHARED_LIBRARY_ORIGIN=''
436    SET_SHARED_LIBRARY_NAME=''
437    SET_SHARED_LIBRARY_MAPFILE=''
438  elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
439    PICFLAG=""
440    C_FLAG_REORDER=''
441    CXX_FLAG_REORDER=''
442    SHARED_LIBRARY_FLAGS="-dll"
443    SET_EXECUTABLE_ORIGIN=''
444    SET_SHARED_LIBRARY_ORIGIN=''
445    SET_SHARED_LIBRARY_NAME=''
446    SET_SHARED_LIBRARY_MAPFILE='-def:[$]1'
447  fi
448
449  AC_SUBST(C_FLAG_REORDER)
450  AC_SUBST(CXX_FLAG_REORDER)
451  AC_SUBST(SET_EXECUTABLE_ORIGIN)
452  AC_SUBST(SET_SHARED_LIBRARY_ORIGIN)
453  AC_SUBST(SET_SHARED_LIBRARY_NAME)
454  AC_SUBST(SET_SHARED_LIBRARY_MAPFILE)
455  AC_SUBST(SHARED_LIBRARY_FLAGS)
456
457  # The (cross) compiler is now configured, we can now test capabilities
458  # of the target platform.
459])
460
461# Documentation on common flags used for solstudio in HIGHEST.
462#
463# WARNING: Use of OPTIMIZATION_LEVEL=HIGHEST in your Makefile needs to be
464#          done with care, there are some assumptions below that need to
465#          be understood about the use of pointers, and IEEE behavior.
466#
467# -fns: Use non-standard floating point mode (not IEEE 754)
468# -fsimple: Do some simplification of floating point arithmetic (not IEEE 754)
469# -fsingle: Use single precision floating point with 'float'
470# -xalias_level=basic: Assume memory references via basic pointer types do not alias
471#   (Source with excessing pointer casting and data access with mixed
472#    pointer types are not recommended)
473# -xbuiltin=%all: Use intrinsic or inline versions for math/std functions
474#   (If you expect perfect errno behavior, do not use this)
475# -xdepend: Loop data dependency optimizations (need -xO3 or higher)
476# -xrestrict: Pointer parameters to functions do not overlap
477#   (Similar to -xalias_level=basic usage, but less obvious sometimes.
478#    If you pass in multiple pointers to the same data, do not use this)
479# -xlibmil: Inline some library routines
480#   (If you expect perfect errno behavior, do not use this)
481# -xlibmopt: Use optimized math routines (CURRENTLY DISABLED)
482#   (If you expect perfect errno behavior, do not use this)
483#  Can cause undefined external on Solaris 8 X86 on __sincos, removing for now
484
485    # FIXME: this will never happen since sparc != sparcv9, ie 32 bit, which we don't build anymore.
486    # Bug?
487    #if test "x$OPENJDK_TARGET_CPU" = xsparc; then
488    #  CFLAGS_JDK="${CFLAGS_JDK} -xmemalign=4s"
489    #  CXXFLAGS_JDK="${CXXFLAGS_JDK} -xmemalign=4s"
490    #fi
491
492AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_OPTIMIZATION],
493[
494
495  ###############################################################################
496  #
497  # Setup the opt flags for different compilers
498  # and different operating systems.
499  #
500
501  # FIXME: this was indirectly the old default, but just inherited.
502  # if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
503  #   C_FLAG_DEPS="-MMD -MF"
504  # fi
505
506  # Generate make dependency files
507  if test "x$TOOLCHAIN_TYPE" = xgcc; then
508    C_FLAG_DEPS="-MMD -MF"
509  elif test "x$TOOLCHAIN_TYPE" = xclang; then
510    C_FLAG_DEPS="-MMD -MF"
511  elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
512    C_FLAG_DEPS="-xMMD -xMF"
513  elif test "x$TOOLCHAIN_TYPE" = xxlc; then
514    C_FLAG_DEPS="-qmakedep=gcc -MF"
515  fi
516  CXX_FLAG_DEPS="$C_FLAG_DEPS"
517  AC_SUBST(C_FLAG_DEPS)
518  AC_SUBST(CXX_FLAG_DEPS)
519
520  # Debug symbols
521  if test "x$TOOLCHAIN_TYPE" = xgcc; then
522    if test "x$OPENJDK_TARGET_CPU_BITS" = "x64" && test "x$DEBUG_LEVEL" = "xfastdebug"; then
523      # reduce from default "-g2" option to save space
524      CFLAGS_DEBUG_SYMBOLS="-g1"
525      CXXFLAGS_DEBUG_SYMBOLS="-g1"
526    else
527      CFLAGS_DEBUG_SYMBOLS="-g"
528      CXXFLAGS_DEBUG_SYMBOLS="-g"
529    fi
530  elif test "x$TOOLCHAIN_TYPE" = xclang; then
531    CFLAGS_DEBUG_SYMBOLS="-g"
532    CXXFLAGS_DEBUG_SYMBOLS="-g"
533  elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
534    CFLAGS_DEBUG_SYMBOLS="-g -xs"
535    # -g0 enables debug symbols without disabling inlining.
536    CXXFLAGS_DEBUG_SYMBOLS="-g0 -xs"
537  elif test "x$TOOLCHAIN_TYPE" = xxlc; then
538    CFLAGS_DEBUG_SYMBOLS="-g"
539    CXXFLAGS_DEBUG_SYMBOLS="-g"
540  elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
541    CFLAGS_DEBUG_SYMBOLS="-Zi"
542    CXXFLAGS_DEBUG_SYMBOLS="-Zi"
543  fi
544  AC_SUBST(CFLAGS_DEBUG_SYMBOLS)
545  AC_SUBST(CXXFLAGS_DEBUG_SYMBOLS)
546
547  # Debug symbols for JVM_CFLAGS
548  if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
549    JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -xs"
550    if test "x$DEBUG_LEVEL" = xslowdebug; then
551      JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -g"
552    else
553      # -g0 does not disable inlining, which -g does.
554      JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -g0"
555    fi
556  elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
557    JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -Z7 -d2Zi+"
558  else
559    JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -g"
560  fi
561  AC_SUBST(JVM_CFLAGS_SYMBOLS)
562
563  # bounds, memory and behavior checking options
564  if test "x$TOOLCHAIN_TYPE" = xgcc; then
565    case $DEBUG_LEVEL in
566    release )
567      # no adjustment
568      ;;
569    fastdebug )
570      # no adjustment
571      ;;
572    slowdebug )
573      # FIXME: By adding this to C(XX)FLAGS_DEBUG_OPTIONS/JVM_CFLAGS_SYMBOLS it
574      # get's added conditionally on whether we produce debug symbols or not.
575      # This is most likely not really correct.
576
577      # Add runtime stack smashing and undefined behavior checks.
578      # Not all versions of gcc support -fstack-protector
579      STACK_PROTECTOR_CFLAG="-fstack-protector-all"
580      FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$STACK_PROTECTOR_CFLAG -Werror], IF_FALSE: [STACK_PROTECTOR_CFLAG=""])
581
582      CFLAGS_DEBUG_OPTIONS="$STACK_PROTECTOR_CFLAG --param ssp-buffer-size=1"
583      CXXFLAGS_DEBUG_OPTIONS="$STACK_PROTECTOR_CFLAG --param ssp-buffer-size=1"
584      if test "x$STACK_PROTECTOR_CFLAG" != x; then
585        JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS $STACK_PROTECTOR_CFLAG --param ssp-buffer-size=1"
586      fi
587      ;;
588    esac
589  fi
590
591  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
592    if test "x$DEBUG_LEVEL" != xrelease; then
593      if test "x$OPENJDK_TARGET_CPU" = xx86_64; then
594        JVM_CFLAGS="$JVM_CFLAGS -homeparams"
595      fi
596    fi
597  fi
598
599  # Optimization levels
600  if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
601    CC_HIGHEST="$CC_HIGHEST -fns -fsimple -fsingle -xbuiltin=%all -xdepend -xrestrict -xlibmil"
602
603    if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86"; then
604      # FIXME: seems we always set -xregs=no%frameptr; put it elsewhere more global?
605      C_O_FLAG_HIGHEST_JVM="-xO4"
606      C_O_FLAG_HIGHEST="-xO4 -Wu,-O4~yz $CC_HIGHEST -xalias_level=basic -xregs=no%frameptr"
607      C_O_FLAG_HI="-xO4 -Wu,-O4~yz -xregs=no%frameptr"
608      C_O_FLAG_NORM="-xO2 -Wu,-O2~yz -xregs=no%frameptr"
609      C_O_FLAG_DEBUG="-xregs=no%frameptr"
610      C_O_FLAG_DEBUG_JVM=""
611      C_O_FLAG_NONE="-xregs=no%frameptr"
612      CXX_O_FLAG_HIGHEST_JVM="-xO4"
613      CXX_O_FLAG_HIGHEST="-xO4 -Qoption ube -O4~yz $CC_HIGHEST -xregs=no%frameptr"
614      CXX_O_FLAG_HI="-xO4 -Qoption ube -O4~yz -xregs=no%frameptr"
615      CXX_O_FLAG_NORM="-xO2 -Qoption ube -O2~yz -xregs=no%frameptr"
616      CXX_O_FLAG_DEBUG="-xregs=no%frameptr"
617      CXX_O_FLAG_DEBUG_JVM=""
618      CXX_O_FLAG_NONE="-xregs=no%frameptr"
619      if test "x$OPENJDK_TARGET_CPU_BITS" = "x32"; then
620        C_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST -xchip=pentium"
621        CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_HIGHEST -xchip=pentium"
622      fi
623    elif test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then
624      C_O_FLAG_HIGHEST_JVM="-xO4"
625      C_O_FLAG_HIGHEST="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0 $CC_HIGHEST -xalias_level=basic -xprefetch=auto,explicit -xchip=ultra"
626      C_O_FLAG_HI="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0"
627      C_O_FLAG_NORM="-xO2 -Wc,-Qrm-s -Wc,-Qiselect-T0"
628      C_O_FLAG_DEBUG=""
629      C_O_FLAG_DEBUG_JVM=""
630      C_O_FLAG_NONE=""
631      CXX_O_FLAG_HIGHEST_JVM="-xO4"
632      CXX_O_FLAG_HIGHEST="-xO4 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0 $CC_HIGHEST -xprefetch=auto,explicit -xchip=ultra"
633      CXX_O_FLAG_HI="-xO4 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0"
634      CXX_O_FLAG_NORM="-xO2 -Qoption cg -Qrm-s -Qoption cg -Qiselect-T0"
635      CXX_O_FLAG_DEBUG=""
636      CXX_O_FLAG_DEBUG_JVM=""
637      CXX_O_FLAG_NONE=""
638    fi
639  else
640    # The remaining toolchains share opt flags between CC and CXX;
641    # setup for C and duplicate afterwards.
642    if test "x$TOOLCHAIN_TYPE" = xgcc; then
643      if test "x$OPENJDK_TARGET_OS" = xmacosx; then
644        # On MacOSX we optimize for size, something
645        # we should do for all platforms?
646        C_O_FLAG_HIGHEST_JVM="-Os"
647        C_O_FLAG_HIGHEST="-Os"
648        C_O_FLAG_HI="-Os"
649        C_O_FLAG_NORM="-Os"
650        C_O_FLAG_SIZE="-Os"
651      else
652        C_O_FLAG_HIGHEST_JVM="-O3"
653        C_O_FLAG_HIGHEST="-O3"
654        C_O_FLAG_HI="-O3"
655        C_O_FLAG_NORM="-O2"
656        C_O_FLAG_SIZE="-Os"
657      fi
658      C_O_FLAG_DEBUG="-O0"
659      if test "x$OPENJDK_TARGET_OS" = xmacosx; then
660        C_O_FLAG_DEBUG_JVM=""
661      elif test "x$OPENJDK_TARGET_OS" = xlinux; then
662        C_O_FLAG_DEBUG_JVM="-O0"
663      fi
664      C_O_FLAG_NONE="-O0"
665    elif test "x$TOOLCHAIN_TYPE" = xclang; then
666      if test "x$OPENJDK_TARGET_OS" = xmacosx; then
667        # On MacOSX we optimize for size, something
668        # we should do for all platforms?
669        C_O_FLAG_HIGHEST_JVM="-Os"
670        C_O_FLAG_HIGHEST="-Os"
671        C_O_FLAG_HI="-Os"
672        C_O_FLAG_NORM="-Os"
673        C_O_FLAG_SIZE="-Os"
674      else
675        C_O_FLAG_HIGHEST_JVM="-O3"
676        C_O_FLAG_HIGHEST="-O3"
677        C_O_FLAG_HI="-O3"
678        C_O_FLAG_NORM="-O2"
679        C_O_FLAG_SIZE="-Os"
680      fi
681      C_O_FLAG_DEBUG="-O0"
682      if test "x$OPENJDK_TARGET_OS" = xmacosx; then
683        C_O_FLAG_DEBUG_JVM=""
684      elif test "x$OPENJDK_TARGET_OS" = xlinux; then
685        C_O_FLAG_DEBUG_JVM="-O0"
686      fi
687      C_O_FLAG_NONE="-O0"
688    elif test "x$TOOLCHAIN_TYPE" = xxlc; then
689      C_O_FLAG_HIGHEST_JVM="-O3 -qhot=level=1 -qinline -qinlglue"
690      C_O_FLAG_HIGHEST="-O3 -qhot=level=1 -qinline -qinlglue"
691      C_O_FLAG_HI="-O3 -qinline -qinlglue"
692      C_O_FLAG_NORM="-O2"
693      C_O_FLAG_DEBUG="-qnoopt"
694      # FIXME: Value below not verified.
695      C_O_FLAG_DEBUG_JVM=""
696      C_O_FLAG_NONE="-qnoopt"
697    elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
698      C_O_FLAG_HIGHEST_JVM="-O2 -Oy-"
699      C_O_FLAG_HIGHEST="-O2"
700      C_O_FLAG_HI="-O1"
701      C_O_FLAG_NORM="-O1"
702      C_O_FLAG_DEBUG="-Od"
703      C_O_FLAG_DEBUG_JVM=""
704      C_O_FLAG_NONE="-Od"
705      C_O_FLAG_SIZE="-Os"
706    fi
707    CXX_O_FLAG_HIGHEST_JVM="$C_O_FLAG_HIGHEST_JVM"
708    CXX_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST"
709    CXX_O_FLAG_HI="$C_O_FLAG_HI"
710    CXX_O_FLAG_NORM="$C_O_FLAG_NORM"
711    CXX_O_FLAG_DEBUG="$C_O_FLAG_DEBUG"
712    CXX_O_FLAG_DEBUG_JVM="$C_O_FLAG_DEBUG_JVM"
713    CXX_O_FLAG_NONE="$C_O_FLAG_NONE"
714    CXX_O_FLAG_SIZE="$C_O_FLAG_SIZE"
715  fi
716
717  # Adjust optimization flags according to debug level.
718  case $DEBUG_LEVEL in
719    release )
720      # no adjustment
721      ;;
722    fastdebug )
723      # Not quite so much optimization
724      C_O_FLAG_HI="$C_O_FLAG_NORM"
725      CXX_O_FLAG_HI="$CXX_O_FLAG_NORM"
726      ;;
727    slowdebug )
728      # Disable optimization
729      C_O_FLAG_HIGHEST_JVM="$C_O_FLAG_DEBUG_JVM"
730      C_O_FLAG_HIGHEST="$C_O_FLAG_DEBUG"
731      C_O_FLAG_HI="$C_O_FLAG_DEBUG"
732      C_O_FLAG_NORM="$C_O_FLAG_DEBUG"
733      C_O_FLAG_SIZE="$C_O_FLAG_DEBUG"
734      CXX_O_FLAG_HIGHEST_JVM="$CXX_O_FLAG_DEBUG_JVM"
735      CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_DEBUG"
736      CXX_O_FLAG_HI="$CXX_O_FLAG_DEBUG"
737      CXX_O_FLAG_NORM="$CXX_O_FLAG_DEBUG"
738      CXX_O_FLAG_SIZE="$CXX_O_FLAG_DEBUG"
739      ;;
740  esac
741
742  AC_SUBST(C_O_FLAG_HIGHEST_JVM)
743  AC_SUBST(C_O_FLAG_HIGHEST)
744  AC_SUBST(C_O_FLAG_HI)
745  AC_SUBST(C_O_FLAG_NORM)
746  AC_SUBST(C_O_FLAG_DEBUG)
747  AC_SUBST(C_O_FLAG_NONE)
748  AC_SUBST(C_O_FLAG_SIZE)
749  AC_SUBST(CXX_O_FLAG_HIGHEST_JVM)
750  AC_SUBST(CXX_O_FLAG_HIGHEST)
751  AC_SUBST(CXX_O_FLAG_HI)
752  AC_SUBST(CXX_O_FLAG_NORM)
753  AC_SUBST(CXX_O_FLAG_DEBUG)
754  AC_SUBST(CXX_O_FLAG_NONE)
755  AC_SUBST(CXX_O_FLAG_SIZE)
756])
757
758
759AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK],
760[
761
762  FLAGS_SETUP_ABI_PROFILE
763  FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER([TARGET])
764  FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER([BUILD], [OPENJDK_BUILD_])
765
766  # Tests are only ever compiled for TARGET
767  # Flags for compiling test libraries
768  CFLAGS_TESTLIB="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA"
769  CXXFLAGS_TESTLIB="$COMMON_CCXXFLAGS_JDK $CXXFLAGS_JDK $PICFLAG $CXXFLAGS_JDKLIB_EXTRA"
770
771  # Flags for compiling test executables
772  CFLAGS_TESTEXE="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK"
773  CXXFLAGS_TESTEXE="$COMMON_CCXXFLAGS_JDK $CXXFLAGS_JDK"
774
775  AC_SUBST(CFLAGS_TESTLIB)
776  AC_SUBST(CFLAGS_TESTEXE)
777  AC_SUBST(CXXFLAGS_TESTLIB)
778  AC_SUBST(CXXFLAGS_TESTEXE)
779
780  LDFLAGS_TESTLIB="$LDFLAGS_JDKLIB"
781  LDFLAGS_TESTEXE="$LDFLAGS_JDKEXE $JAVA_BASE_LDFLAGS"
782
783  AC_SUBST(LDFLAGS_TESTLIB)
784  AC_SUBST(LDFLAGS_TESTEXE)
785
786])
787
788################################################################################
789# $1 - Either BUILD or TARGET to pick the correct OS/CPU variables to check
790#      conditionals against.
791# $2 - Optional prefix for each variable defined.
792AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER],
793[
794  # Special extras...
795  if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
796    if test "x$OPENJDK_$1_CPU_ARCH" = "xsparc"; then
797      $2CFLAGS_JDKLIB_EXTRA="${$2CFLAGS_JDKLIB_EXTRA} -xregs=no%appl"
798      $2CXXFLAGS_JDKLIB_EXTRA="${$2CXXFLAGS_JDKLIB_EXTRA} -xregs=no%appl"
799    fi
800    $2CFLAGS_JDKLIB_EXTRA="${$2CFLAGS_JDKLIB_EXTRA} -errtags=yes -errfmt"
801    $2CXXFLAGS_JDKLIB_EXTRA="${$2CXXFLAGS_JDKLIB_EXTRA} -errtags=yes -errfmt"
802  elif test "x$TOOLCHAIN_TYPE" = xxlc; then
803    $2CFLAGS_JDK="${$2CFLAGS_JDK} -qchars=signed -qfullpath -qsaveopt"
804    $2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} -qchars=signed -qfullpath -qsaveopt"
805  elif test "x$TOOLCHAIN_TYPE" = xgcc; then
806    $2CXXSTD_CXXFLAG="-std=gnu++98"
807    FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [[$]$2CXXSTD_CXXFLAG -Werror],
808    						 IF_FALSE: [$2CXXSTD_CXXFLAG=""])
809    $2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} ${$2CXXSTD_CXXFLAG}"
810    $2JVM_CFLAGS="${$2JVM_CFLAGS} ${$2CXXSTD_CXXFLAG}"
811    AC_SUBST($2CXXSTD_CXXFLAG)
812  fi
813  if test "x$OPENJDK_TARGET_OS" = xsolaris; then
814    $2CFLAGS_JDK="${$2CFLAGS_JDK} -D__solaris__"
815    $2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} -D__solaris__"
816  fi
817
818  $2CFLAGS_JDK="${$2CFLAGS_JDK} ${$2EXTRA_CFLAGS}"
819  $2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} ${$2EXTRA_CXXFLAGS}"
820  $2LDFLAGS_JDK="${$2LDFLAGS_JDK} ${$2EXTRA_LDFLAGS}"
821
822  ###############################################################################
823  #
824  # Now setup the CFLAGS and LDFLAGS for the JDK build.
825  # Later we will also have CFLAGS and LDFLAGS for the hotspot subrepo build.
826  #
827
828  # Setup compiler/platform specific flags into
829  #    $2CFLAGS_JDK    - C Compiler flags
830  #    $2CXXFLAGS_JDK  - C++ Compiler flags
831  #    $2COMMON_CCXXFLAGS_JDK - common to C and C++
832  if test "x$TOOLCHAIN_TYPE" = xgcc; then
833    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_GNU_SOURCE"
834    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_REENTRANT"
835    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -fcheck-new"
836    if test "x$OPENJDK_$1_CPU" = xx86; then
837      # Force compatibility with i586 on 32 bit intel platforms.
838      $2COMMON_CCXXFLAGS="${$2COMMON_CCXXFLAGS} -march=i586"
839      $2JVM_CFLAGS="[$]$2JVM_CFLAGS -march=i586"
840    fi
841    $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS [$]$2COMMON_CCXXFLAGS_JDK -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2 \
842        -pipe -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
843    case $OPENJDK_$1_CPU_ARCH in
844      arm )
845        # on arm we don't prevent gcc to omit frame pointer but do prevent strict aliasing
846        $2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
847        $2COMMON_CCXXFLAGS_JDK="${$2COMMON_CCXXFLAGS_JDK} -fsigned-char"
848        ;;
849      ppc )
850        # on ppc we don't prevent gcc to omit frame pointer but do prevent strict aliasing
851        $2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
852        ;;
853      s390 )
854        $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer -mbackchain -march=z10"
855        $2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
856        ;;
857      * )
858        $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer"
859        $2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
860        ;;
861    esac
862    TOOLCHAIN_CHECK_COMPILER_VERSION(VERSION: 6, PREFIX: $2, IF_AT_LEAST: FLAGS_SETUP_GCC6_COMPILER_FLAGS($2))
863  elif test "x$TOOLCHAIN_TYPE" = xclang; then
864    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_GNU_SOURCE"
865
866    # Restrict the debug information created by Clang to avoid
867    # too big object files and speed the build up a little bit
868    # (see http://llvm.org/bugs/show_bug.cgi?id=7554)
869    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -flimit-debug-info"
870    if test "x$OPENJDK_$1_OS" = xlinux; then
871      if test "x$OPENJDK_$1_CPU" = xx86; then
872        # Force compatibility with i586 on 32 bit intel platforms.
873        $2COMMON_CCXXFLAGS="${$2COMMON_CCXXFLAGS} -march=i586"
874        $2JVM_CFLAGS="[$]$2JVM_CFLAGS -march=i586"
875      fi
876      $2JVM_CFLAGS="[$]$2JVM_CFLAGS -Wno-sometimes-uninitialized"
877      $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS [$]$2COMMON_CCXXFLAGS_JDK -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2 \
878          -pipe -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
879      case $OPENJDK_$1_CPU_ARCH in
880        ppc )
881          # on ppc we don't prevent gcc to omit frame pointer but do prevent strict aliasing
882          $2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
883          ;;
884        * )
885          $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer"
886          $2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
887          ;;
888      esac
889    fi
890  elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
891    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -DSPARC_WORKS"
892    $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS [$]$2COMMON_CCXXFLAGS_JDK -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS"
893    if test "x$OPENJDK_$1_CPU_ARCH" = xx86; then
894      $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -DcpuIntel -Di586 -D$OPENJDK_$1_CPU_LEGACY_LIB"
895    fi
896
897    $2CFLAGS_JDK="[$]$2CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -W0,-noglobal"
898    $2CXXFLAGS_JDK="[$]$2CXXFLAGS_JDK -errtags=yes +w -mt -features=no%except -DCC_NOEX -norunpath -xnolib"
899  elif test "x$TOOLCHAIN_TYPE" = xxlc; then
900    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_REENTRANT -D__STDC_FORMAT_MACROS"
901    $2CFLAGS_JDK="[$]$2CFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
902    $2CXXFLAGS_JDK="[$]$2CXXFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
903  elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
904    $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS [$]$2COMMON_CCXXFLAGS_JDK \
905        -MD -Zc:wchar_t- -W3 -wd4800 \
906        -DWIN32_LEAN_AND_MEAN \
907        -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \
908        -D_WINSOCK_DEPRECATED_NO_WARNINGS \
909        -DWIN32 -DIAL"
910    if test "x$OPENJDK_$1_CPU" = xx86_64; then
911      $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_AMD64_ -Damd64"
912    else
913      $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_X86_ -Dx86"
914    fi
915    # If building with Visual Studio 2010, we can still use _STATIC_CPPLIB to
916    # avoid bundling msvcpNNN.dll. Doesn't work with newer versions of visual
917    # studio.
918    if test "x$TOOLCHAIN_VERSION" = "x2010"; then
919      STATIC_CPPLIB_FLAGS="-D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB"
920      $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK $STATIC_CPPLIB_FLAGS"
921      $2JVM_CFLAGS="[$]$2JVM_CFLAGS $STATIC_CPPLIB_FLAGS"
922    fi
923  fi
924
925  ###############################################################################
926
927  # Adjust flags according to debug level.
928  case $DEBUG_LEVEL in
929    fastdebug | slowdebug )
930      $2CFLAGS_JDK="[$]$2CFLAGS_JDK $CFLAGS_DEBUG_SYMBOLS $CFLAGS_DEBUG_OPTIONS"
931      $2CXXFLAGS_JDK="[$]$2CXXFLAGS_JDK $CXXFLAGS_DEBUG_SYMBOLS $CXXFLAGS_DEBUG_OPTIONS"
932      ;;
933    release )
934      ;;
935    * )
936      AC_MSG_ERROR([Unrecognized \$DEBUG_LEVEL: $DEBUG_LEVEL])
937      ;;
938  esac
939
940  # Set some common defines. These works for all compilers, but assume
941  # -D is universally accepted.
942
943  # Setup endianness
944  if test "x$OPENJDK_$1_CPU_ENDIAN" = xlittle; then
945    # The macro _LITTLE_ENDIAN needs to be defined the same to avoid the
946    #   Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN
947    #   (The Solaris X86 system defines this in file /usr/include/sys/isa_defs.h).
948    #   Note: -Dmacro         is the same as    #define macro 1
949    #         -Dmacro=        is the same as    #define macro
950    if test "x$OPENJDK_$1_OS" = xsolaris; then
951      $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_LITTLE_ENDIAN="
952    else
953      $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_LITTLE_ENDIAN"
954    fi
955  else
956    # Same goes for _BIG_ENDIAN. Do we really need to set *ENDIAN on Solaris if they
957    # are defined in the system?
958    if test "x$OPENJDK_$1_OS" = xsolaris; then
959      $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_BIG_ENDIAN="
960    else
961      $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_BIG_ENDIAN"
962    fi
963  fi
964
965  # Setup target OS define. Use OS target name but in upper case.
966  OPENJDK_$1_OS_UPPERCASE=`$ECHO $OPENJDK_$1_OS | $TR 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
967  $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D$OPENJDK_$1_OS_UPPERCASE"
968
969  # Setup target CPU
970  $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK \
971      $OPENJDK_$1_ADD_LP64 \
972      -DARCH='\"$OPENJDK_$1_CPU_LEGACY\"' -D$OPENJDK_$1_CPU_LEGACY"
973
974  # Setup debug/release defines
975  if test "x$DEBUG_LEVEL" = xrelease; then
976    $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -DNDEBUG"
977    if test "x$OPENJDK_$1_OS" = xsolaris; then
978      $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -DTRIMMED"
979    fi
980  else
981    $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -DDEBUG"
982  fi
983
984  # Set some additional per-OS defines.
985  if test "x$OPENJDK_$1_OS" = xlinux; then
986    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -DLINUX"
987    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -pipe $PICFLAG -fno-rtti -fno-exceptions \
988        -fvisibility=hidden -fno-strict-aliasing -fno-omit-frame-pointer"
989  elif test "x$OPENJDK_$1_OS" = xsolaris; then
990    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -DSOLARIS"
991    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -template=no%extdef -features=no%split_init \
992        -D_Crun_inline_placement -library=%none $PICFLAG -mt -features=no%except"
993  elif test "x$OPENJDK_$1_OS" = xmacosx; then
994    $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
995    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_ALLBSD_SOURCE"
996    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_DARWIN_C_SOURCE -D_XOPEN_SOURCE"
997    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -fno-rtti -fno-exceptions -fvisibility=hidden \
998        -mno-omit-leaf-frame-pointer -mstack-alignment=16 -pipe -fno-strict-aliasing \
999        -DMAC_OS_X_VERSION_MAX_ALLOWED=1070 -mmacosx-version-min=10.7.0 \
1000        -fno-omit-frame-pointer"
1001  elif test "x$OPENJDK_$1_OS" = xaix; then
1002    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -DAIX"
1003    # We may need '-qminimaltoc' or '-qpic=large -bbigtoc' if the TOC overflows.
1004    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -qtune=balanced \
1005        -qalias=noansi -qstrict -qtls=default -qlanglvl=c99vla \
1006        -qlanglvl=noredefmac -qnortti -qnoeh -qignerrno"
1007  elif test "x$OPENJDK_$1_OS" = xbsd; then
1008    $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_ALLBSD_SOURCE"
1009  elif test "x$OPENJDK_$1_OS" = xwindows; then
1010    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_WINDOWS -DWIN32 -D_JNI_IMPLEMENTATION_"
1011    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -nologo -W3 -MD -MP"
1012  fi
1013
1014  # Set some additional per-CPU defines.
1015  if test "x$OPENJDK_$1_OS-$OPENJDK_$1_CPU" = xwindows-x86; then
1016    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -arch:IA32"
1017  elif test "x$OPENJDK_$1_CPU" = xsparcv9; then
1018    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -xarch=sparc"
1019  elif test "x$OPENJDK_$1_CPU" = xppc64; then
1020    if test "x$OPENJDK_$1_OS" = xlinux; then
1021      $2JVM_CFLAGS="[$]$2JVM_CFLAGS -minsert-sched-nops=regroup_exact -mno-multiple -mno-string"
1022      # fixes `relocation truncated to fit' error for gcc 4.1.
1023      $2JVM_CFLAGS="[$]$2JVM_CFLAGS -mminimal-toc"
1024      # Use ppc64 instructions, but schedule for power5
1025      $2JVM_CFLAGS="[$]$2JVM_CFLAGS -mcpu=powerpc64 -mtune=power5"
1026    elif test "x$OPENJDK_$1_OS" = xaix; then
1027      $2JVM_CFLAGS="[$]$2JVM_CFLAGS -qarch=ppc64"
1028    fi
1029  elif test "x$OPENJDK_$1_CPU" = xppc64le; then
1030    if test "x$OPENJDK_$1_OS" = xlinux; then
1031      $2JVM_CFLAGS="[$]$2JVM_CFLAGS -minsert-sched-nops=regroup_exact -mno-multiple -mno-string"
1032      # Little endian machine uses ELFv2 ABI.
1033      $2JVM_CFLAGS="[$]$2JVM_CFLAGS -DABI_ELFv2"
1034      # Use Power8, this is the first CPU to support PPC64 LE with ELFv2 ABI.
1035      $2JVM_CFLAGS="[$]$2JVM_CFLAGS -mcpu=power8 -mtune=power8"
1036    fi
1037  elif test "x$OPENJDK_$1_CPU" = xs390x; then
1038    if test "x$OPENJDK_$1_OS" = xlinux; then
1039      $2JVM_CFLAGS="[$]$2JVM_CFLAGS -mbackchain -march=z10"
1040    fi
1041  fi
1042
1043  if test "x$OPENJDK_$1_CPU_ENDIAN" = xlittle; then
1044    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -DVM_LITTLE_ENDIAN"
1045  fi
1046
1047  if test "x$OPENJDK_$1_CPU_BITS" = x64; then
1048    if test "x$OPENJDK_$1_OS" != xsolaris && test "x$OPENJDK_$1_OS" != xaix; then
1049      # Solaris does not have _LP64=1 in the old build.
1050      # xlc on AIX defines _LP64=1 by default and issues a warning if we redefine it.
1051      $2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_LP64=1"
1052    fi
1053  fi
1054
1055  # Set $2JVM_CFLAGS warning handling
1056  if test "x$OPENJDK_$1_OS" = xlinux; then
1057    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -Wpointer-arith -Wsign-compare -Wunused-function \
1058        -Wunused-value -Woverloaded-virtual"
1059
1060    if test "x$TOOLCHAIN_TYPE" = xgcc; then
1061      TOOLCHAIN_CHECK_COMPILER_VERSION(VERSION: [4.8], PREFIX: $2,
1062          IF_AT_LEAST: [
1063            # These flags either do not work or give spurious warnings prior to gcc 4.8.
1064            $2JVM_CFLAGS="[$]$2JVM_CFLAGS -Wno-format-zero-length -Wtype-limits -Wuninitialized"
1065          ]
1066      )
1067    fi
1068    if ! HOTSPOT_CHECK_JVM_VARIANT(zero) && ! HOTSPOT_CHECK_JVM_VARIANT(zeroshark); then
1069      # Non-zero builds have stricter warnings
1070      $2JVM_CFLAGS="[$]$2JVM_CFLAGS -Wreturn-type -Wundef -Wformat=2"
1071    else
1072      if test "x$TOOLCHAIN_TYPE" = xclang; then
1073        # Some versions of llvm do not like -Wundef
1074        $2JVM_CFLAGS="[$]$2JVM_CFLAGS -Wno-undef"
1075      fi
1076    fi
1077  elif test "x$OPENJDK_$1_OS" = xmacosx; then
1078    $2JVM_CFLAGS="[$]$2JVM_CFLAGS -Wno-deprecated -Wpointer-arith \
1079        -Wsign-compare -Wundef -Wunused-function -Wformat=2"
1080  fi
1081
1082  # Additional macosx handling
1083  if test "x$OPENJDK_$1_OS" = xmacosx; then
1084    # Setting these parameters makes it an error to link to macosx APIs that are
1085    # newer than the given OS version and makes the linked binaries compatible
1086    # even if built on a newer version of the OS.
1087    # The expected format is X.Y.Z
1088    MACOSX_VERSION_MIN=10.7.0
1089    AC_SUBST(MACOSX_VERSION_MIN)
1090
1091    # The macro takes the version with no dots, ex: 1070
1092    # Let the flags variables get resolved in make for easier override on make
1093    # command line.
1094    $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
1095    $2LDFLAGS_JDK="[$]$2LDFLAGS_JDK -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
1096  fi
1097
1098  # Setup some hard coded includes
1099  $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK \
1100      -I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
1101      -I${JDK_TOPDIR}/src/java.base/share/native/include \
1102      -I${JDK_TOPDIR}/src/java.base/$OPENJDK_$1_OS/native/include \
1103      -I${JDK_TOPDIR}/src/java.base/$OPENJDK_$1_OS_TYPE/native/include \
1104      -I${JDK_TOPDIR}/src/java.base/share/native/libjava \
1105      -I${JDK_TOPDIR}/src/java.base/$OPENJDK_$1_OS_TYPE/native/libjava"
1106
1107  # The shared libraries are compiled using the picflag.
1108  $2CFLAGS_JDKLIB="[$]$2COMMON_CCXXFLAGS_JDK \
1109      [$]$2CFLAGS_JDK [$]$2EXTRA_CFLAGS_JDK $PICFLAG [$]$2CFLAGS_JDKLIB_EXTRA"
1110  $2CXXFLAGS_JDKLIB="[$]$2COMMON_CCXXFLAGS_JDK \
1111      [$]$2CXXFLAGS_JDK [$]$2EXTRA_CXXFLAGS_JDK $PICFLAG [$]$2CXXFLAGS_JDKLIB_EXTRA"
1112
1113  # Executable flags
1114  $2CFLAGS_JDKEXE="[$]$2COMMON_CCXXFLAGS_JDK [$]$2CFLAGS_JDK [$]$2EXTRA_CFLAGS_JDK"
1115  $2CXXFLAGS_JDKEXE="[$]$2COMMON_CCXXFLAGS_JDK [$]$2CXXFLAGS_JDK [$]$2EXTRA_CXXFLAGS_JDK"
1116
1117  AC_SUBST($2CFLAGS_JDKLIB)
1118  AC_SUBST($2CFLAGS_JDKEXE)
1119  AC_SUBST($2CXXFLAGS_JDKLIB)
1120  AC_SUBST($2CXXFLAGS_JDKEXE)
1121
1122  # Setup LDFLAGS et al.
1123  #
1124
1125  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
1126    LDFLAGS_MICROSOFT="-nologo -opt:ref"
1127    $2LDFLAGS_JDK="[$]$2LDFLAGS_JDK $LDFLAGS_MICROSOFT -incremental:no"
1128    $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LDFLAGS_MICROSOFT -opt:icf,8 -subsystem:windows -base:0x8000000"
1129    if test "x$OPENJDK_$1_CPU_BITS" = "x32"; then
1130      LDFLAGS_SAFESH="-safeseh"
1131      $2LDFLAGS_JDK="[$]$2LDFLAGS_JDK $LDFLAGS_SAFESH"
1132      $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LDFLAGS_SAFESH"
1133      # NOTE: Old build added -machine. Probably not needed.
1134      $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -machine:I386"
1135    else
1136      $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -machine:AMD64"
1137    fi
1138  elif test "x$TOOLCHAIN_TYPE" = xclang; then
1139      $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -mno-omit-leaf-frame-pointer -mstack-alignment=16 -stdlib=libstdc++ -fPIC"
1140      if test "x$OPENJDK_$1_OS" = xmacosx; then
1141        # FIXME: We should really generalize SET_SHARED_LIBRARY_ORIGIN instead.
1142        $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/.."
1143    fi
1144  elif test "x$TOOLCHAIN_TYPE" = xgcc; then
1145    # If this is a --hash-style=gnu system, use --hash-style=both, why?
1146    # We have previously set HAS_GNU_HASH if this is the case
1147    if test -n "$HAS_GNU_HASH"; then
1148      $2LDFLAGS_HASH_STYLE="-Wl,--hash-style=both"
1149      $2LDFLAGS_JDK="${$2LDFLAGS_JDK} [$]$2LDFLAGS_HASH_STYLE"
1150      $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS [$]$2LDFLAGS_HASH_STYLE"
1151    fi
1152      if test "x$OPENJDK_$1_OS" = xmacosx; then
1153        $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/.."
1154    fi
1155    if test "x$OPENJDK_$1_OS" = xlinux; then
1156      # And since we now know that the linker is gnu, then add -z defs, to forbid
1157      # undefined symbols in object files.
1158      LDFLAGS_NO_UNDEF_SYM="-Wl,-z,defs"
1159      $2LDFLAGS_JDK="${$2LDFLAGS_JDK} $LDFLAGS_NO_UNDEF_SYM"
1160      $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS  $LDFLAGS_NO_UNDEF_SYM"
1161      LDFLAGS_NO_EXEC_STACK="-Wl,-z,noexecstack"
1162      $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LDFLAGS_NO_EXEC_STACK"
1163      if test "x$OPENJDK_$1_CPU" = xx86; then
1164        $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -march=i586"
1165      fi
1166      case $DEBUG_LEVEL in
1167        release )
1168          # tell linker to optimize libraries.
1169          # Should this be supplied to the OSS linker as well?
1170          LDFLAGS_DEBUGLEVEL_release="-Wl,-O1"
1171          $2LDFLAGS_JDK="${$2LDFLAGS_JDK} $LDFLAGS_DEBUGLEVEL_release"
1172          $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LDFLAGS_DEBUGLEVEL_release"
1173          if test "x$HAS_LINKER_RELRO" = "xtrue"; then
1174            $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LINKER_RELRO_FLAG"
1175          fi
1176          ;;
1177        slowdebug )
1178          # Hotspot always let the linker optimize
1179          $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -Wl,-O1"
1180          if test "x$HAS_LINKER_NOW" = "xtrue"; then
1181            # do relocations at load
1182            $2LDFLAGS_JDK="[$]$2LDFLAGS_JDK $LINKER_NOW_FLAG"
1183            $2LDFLAGS_CXX_JDK="[$]$2LDFLAGS_CXX_JDK $LINKER_NOW_FLAG"
1184            $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LINKER_NOW_FLAG"
1185          fi
1186          if test "x$HAS_LINKER_RELRO" = "xtrue"; then
1187            # mark relocations read only
1188            $2LDFLAGS_JDK="[$]$2LDFLAGS_JDK $LINKER_RELRO_FLAG"
1189            $2LDFLAGS_CXX_JDK="[$]$2LDFLAGS_CXX_JDK $LINKER_RELRO_FLAG"
1190            $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LINKER_RELRO_FLAG"
1191          fi
1192          ;;
1193        fastdebug )
1194          # Hotspot always let the linker optimize
1195          $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -Wl,-O1"
1196          if test "x$HAS_LINKER_RELRO" = "xtrue"; then
1197            # mark relocations read only
1198            $2LDFLAGS_JDK="[$]$2LDFLAGS_JDK $LINKER_RELRO_FLAG"
1199            $2LDFLAGS_CXX_JDK="[$]$2LDFLAGS_CXX_JDK $LINKER_RELRO_FLAG"
1200            $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LINKER_RELRO_FLAG"
1201          fi
1202          ;;
1203        * )
1204          AC_MSG_ERROR([Unrecognized \$DEBUG_LEVEL: $DEBUG_LEVEL])
1205          ;;
1206        esac
1207    fi
1208  elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
1209    LDFLAGS_SOLSTUDIO="-Wl,-z,defs"
1210    $2LDFLAGS_JDK="[$]$2LDFLAGS_JDK $LDFLAGS_SOLSTUDIO -ztext"
1211    LDFLAGS_CXX_SOLSTUDIO="-norunpath"
1212    $2LDFLAGS_CXX_JDK="[$]$2LDFLAGS_CXX_JDK $LDFLAGS_CXX_SOLSTUDIO -xnolib"
1213    $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LDFLAGS_SOLSTUDIO -library=%none -mt $LDFLAGS_CXX_SOLSTUDIO -z noversion"
1214    if test "x$OPENJDK_$1_CPU_ARCH" = "xsparc"; then
1215      $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -xarch=sparc"
1216    fi
1217  elif test "x$TOOLCHAIN_TYPE" = xxlc; then
1218    LDFLAGS_XLC="-b64 -brtl -bnolibpath -bexpall -bernotok"
1219    $2LDFLAGS_JDK="${$2LDFLAGS_JDK} $LDFLAGS_XLC"
1220    $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LDFLAGS_XLC"
1221  fi
1222
1223  # Customize LDFLAGS for executables
1224
1225  $2LDFLAGS_JDKEXE="${$2LDFLAGS_JDK}"
1226
1227  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
1228    if test "x$OPENJDK_$1_CPU_BITS" = "x64"; then
1229      LDFLAGS_STACK_SIZE=1048576
1230    else
1231      LDFLAGS_STACK_SIZE=327680
1232    fi
1233    $2LDFLAGS_JDKEXE="${$2LDFLAGS_JDKEXE} /STACK:$LDFLAGS_STACK_SIZE"
1234  elif test "x$OPENJDK_$1_OS" = xlinux; then
1235    $2LDFLAGS_JDKEXE="[$]$2LDFLAGS_JDKEXE -Wl,--allow-shlib-undefined"
1236  fi
1237
1238  $2LDFLAGS_JDKEXE="${$2LDFLAGS_JDKEXE} ${$2EXTRA_LDFLAGS_JDK}"
1239
1240  # Customize LDFLAGS for libs
1241  $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDK}"
1242
1243  $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} ${SHARED_LIBRARY_FLAGS}"
1244  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
1245    $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} \
1246        -libpath:${OUTPUT_ROOT}/support/modules_libs/java.base"
1247    $2JDKLIB_LIBS=""
1248  else
1249    $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} \
1250        -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base"
1251
1252    if test "x$1" = "xTARGET"; then
1253      # On some platforms (mac) the linker warns about non existing -L dirs.
1254      # For any of the variants server, client or minimal, the dir matches the
1255      # variant name. The "main" variant should be used for linking. For the
1256      # rest, the dir is just server.
1257      if HOTSPOT_CHECK_JVM_VARIANT(server) || HOTSPOT_CHECK_JVM_VARIANT(client) \
1258          || HOTSPOT_CHECK_JVM_VARIANT(minimal); then
1259        $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} \
1260            -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/$JVM_VARIANT_MAIN"
1261      else
1262        $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} \
1263            -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/server"
1264      fi
1265    elif test "x$1" = "xBUILD"; then
1266      # When building a buildjdk, it's always only the server variant
1267      $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} \
1268          -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/server"
1269    fi
1270
1271    $2JDKLIB_LIBS="-ljava -ljvm"
1272    if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
1273      $2JDKLIB_LIBS="[$]$2JDKLIB_LIBS -lc"
1274    fi
1275
1276  fi
1277
1278$2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} ${$2JAVA_BASE_LDFLAGS}"
1279
1280  # Set $2JVM_LIBS (per os)
1281  if test "x$OPENJDK_$1_OS" = xlinux; then
1282    $2JVM_LIBS="[$]$2JVM_LIBS -lm -ldl -lpthread"
1283  elif test "x$OPENJDK_$1_OS" = xsolaris; then
1284    # FIXME: This hard-coded path is not really proper.
1285    if test "x$OPENJDK_$1_CPU" = xx86_64; then
1286      $2SOLARIS_LIBM_LIBS="/usr/lib/amd64/libm.so.1"
1287    elif test "x$OPENJDK_$1_CPU" = xsparcv9; then
1288      $2SOLARIS_LIBM_LIBS="/usr/lib/sparcv9/libm.so.1"
1289    fi
1290    $2JVM_LIBS="[$]$2JVM_LIBS -lsocket -lsched -ldl $SOLARIS_LIBM_LIBS -lCrun \
1291        -lthread -ldoor -lc -ldemangle -lnsl -lkstat -lrt"
1292  elif test "x$OPENJDK_$1_OS" = xmacosx; then
1293    $2JVM_LIBS="[$]$2JVM_LIBS -lm"
1294  elif test "x$OPENJDK_$1_OS" = xaix; then
1295    $2JVM_LIBS="[$]$2JVM_LIBS -Wl,-lC_r -lm -ldl -lpthread"
1296  elif test "x$OPENJDK_$1_OS" = xbsd; then
1297    $2JVM_LIBS="[$]$2JVM_LIBS -lm"
1298  elif test "x$OPENJDK_$1_OS" = xwindows; then
1299    $2JVM_LIBS="[$]$2JVM_LIBS kernel32.lib user32.lib gdi32.lib winspool.lib \
1300        comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib \
1301        wsock32.lib winmm.lib version.lib psapi.lib"
1302    fi
1303
1304  # Set $2JVM_ASFLAGS
1305  if test "x$OPENJDK_$1_OS" = xlinux; then
1306    if test "x$OPENJDK_$1_CPU" = xx86; then
1307      $2JVM_ASFLAGS="[$]$2JVM_ASFLAGS -march=i586"
1308    fi
1309  elif test "x$OPENJDK_$1_OS" = xmacosx; then
1310    $2JVM_ASFLAGS="[$]$2JVM_ASFLAGS -x assembler-with-cpp -mno-omit-leaf-frame-pointer -mstack-alignment=16"
1311  fi
1312
1313  $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} ${$2EXTRA_LDFLAGS_JDK}"
1314
1315  AC_SUBST($2LDFLAGS_JDKLIB)
1316  AC_SUBST($2LDFLAGS_JDKEXE)
1317  AC_SUBST($2JDKLIB_LIBS)
1318  AC_SUBST($2JDKEXE_LIBS)
1319  AC_SUBST($2LDFLAGS_CXX_JDK)
1320  AC_SUBST($2LDFLAGS_HASH_STYLE)
1321
1322  AC_SUBST($2JVM_CFLAGS)
1323  AC_SUBST($2JVM_LDFLAGS)
1324  AC_SUBST($2JVM_ASFLAGS)
1325  AC_SUBST($2JVM_LIBS)
1326
1327])
1328
1329# FLAGS_C_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
1330#                                  IF_FALSE: [RUN-IF-FALSE])
1331# ------------------------------------------------------------
1332# Check that the C compiler supports an argument
1333BASIC_DEFUN_NAMED([FLAGS_C_COMPILER_CHECK_ARGUMENTS],
1334    [*ARGUMENT IF_TRUE IF_FALSE], [$@],
1335[
1336  AC_MSG_CHECKING([if the C compiler supports "ARG_ARGUMENT"])
1337  supports=yes
1338
1339  saved_cflags="$CFLAGS"
1340  CFLAGS="$CFLAGS ARG_ARGUMENT"
1341  AC_LANG_PUSH([C])
1342  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
1343      [supports=no])
1344  AC_LANG_POP([C])
1345  CFLAGS="$saved_cflags"
1346
1347  AC_MSG_RESULT([$supports])
1348  if test "x$supports" = "xyes" ; then
1349    :
1350    ARG_IF_TRUE
1351  else
1352    :
1353    ARG_IF_FALSE
1354  fi
1355])
1356
1357# FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
1358#                                    IF_FALSE: [RUN-IF-FALSE])
1359# ------------------------------------------------------------
1360# Check that the C++ compiler supports an argument
1361BASIC_DEFUN_NAMED([FLAGS_CXX_COMPILER_CHECK_ARGUMENTS],
1362    [*ARGUMENT IF_TRUE IF_FALSE], [$@],
1363[
1364  AC_MSG_CHECKING([if the C++ compiler supports "ARG_ARGUMENT"])
1365  supports=yes
1366
1367  saved_cxxflags="$CXXFLAGS"
1368  CXXFLAGS="$CXXFLAG ARG_ARGUMENT"
1369  AC_LANG_PUSH([C++])
1370  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
1371      [supports=no])
1372  AC_LANG_POP([C++])
1373  CXXFLAGS="$saved_cxxflags"
1374
1375  AC_MSG_RESULT([$supports])
1376  if test "x$supports" = "xyes" ; then
1377    :
1378    ARG_IF_TRUE
1379  else
1380    :
1381    ARG_IF_FALSE
1382  fi
1383])
1384
1385# FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
1386#                                IF_FALSE: [RUN-IF-FALSE])
1387# ------------------------------------------------------------
1388# Check that the C and C++ compilers support an argument
1389BASIC_DEFUN_NAMED([FLAGS_COMPILER_CHECK_ARGUMENTS],
1390    [*ARGUMENT IF_TRUE IF_FALSE], [$@],
1391[
1392  FLAGS_C_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARG_ARGUMENT],
1393  					     IF_TRUE: [C_COMP_SUPPORTS="yes"],
1394					     IF_FALSE: [C_COMP_SUPPORTS="no"])
1395  FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARG_ARGUMENT],
1396  					       IF_TRUE: [CXX_COMP_SUPPORTS="yes"],
1397					       IF_FALSE: [CXX_COMP_SUPPORTS="no"])
1398
1399  AC_MSG_CHECKING([if both compilers support "ARG_ARGUMENT"])
1400  supports=no
1401  if test "x$C_COMP_SUPPORTS" = "xyes" -a "x$CXX_COMP_SUPPORTS" = "xyes"; then supports=yes; fi
1402
1403  AC_MSG_RESULT([$supports])
1404  if test "x$supports" = "xyes" ; then
1405    :
1406    ARG_IF_TRUE
1407  else
1408    :
1409    ARG_IF_FALSE
1410  fi
1411])
1412
1413# FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
1414#                                   IF_FALSE: [RUN-IF-FALSE])
1415# ------------------------------------------------------------
1416# Check that the linker support an argument
1417BASIC_DEFUN_NAMED([FLAGS_LINKER_CHECK_ARGUMENTS],
1418    [*ARGUMENT IF_TRUE IF_FALSE], [$@],
1419[
1420  AC_MSG_CHECKING([if linker supports "ARG_ARGUMENT"])
1421  supports=yes
1422
1423  saved_ldflags="$LDFLAGS"
1424  LDFLAGS="$LDFLAGS ARG_ARGUMENT"
1425  AC_LANG_PUSH([C])
1426  AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
1427      [], [supports=no])
1428  AC_LANG_POP([C])
1429  LDFLAGS="$saved_ldflags"
1430
1431  AC_MSG_RESULT([$supports])
1432  if test "x$supports" = "xyes" ; then
1433    :
1434    ARG_IF_TRUE
1435  else
1436    :
1437    ARG_IF_FALSE
1438  fi
1439])
1440
1441AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_MISC],
1442[
1443  # Check that the compiler supports -mX (or -qX on AIX) flags
1444  # Set COMPILER_SUPPORTS_TARGET_BITS_FLAG to 'true' if it does
1445  FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}],
1446      IF_TRUE: [COMPILER_SUPPORTS_TARGET_BITS_FLAG=true],
1447      IF_FALSE: [COMPILER_SUPPORTS_TARGET_BITS_FLAG=false])
1448  AC_SUBST(COMPILER_SUPPORTS_TARGET_BITS_FLAG)
1449
1450  AC_ARG_ENABLE([warnings-as-errors], [AS_HELP_STRING([--disable-warnings-as-errors],
1451      [do not consider native warnings to be an error @<:@enabled@:>@])])
1452
1453  AC_MSG_CHECKING([if native warnings are errors])
1454  if test "x$enable_warnings_as_errors" = "xyes"; then
1455    AC_MSG_RESULT([yes (explicitly set)])
1456    WARNINGS_AS_ERRORS=true
1457  elif test "x$enable_warnings_as_errors" = "xno"; then
1458    AC_MSG_RESULT([no])
1459    WARNINGS_AS_ERRORS=false
1460  elif test "x$enable_warnings_as_errors" = "x"; then
1461    AC_MSG_RESULT([yes (default)])
1462    WARNINGS_AS_ERRORS=true
1463  else
1464    AC_MSG_ERROR([--enable-warnings-as-errors accepts no argument])
1465  fi
1466
1467  AC_SUBST(WARNINGS_AS_ERRORS)
1468
1469  case "${TOOLCHAIN_TYPE}" in
1470    microsoft)
1471      DISABLE_WARNING_PREFIX="-wd"
1472      CFLAGS_WARNINGS_ARE_ERRORS="-WX"
1473      ;;
1474    solstudio)
1475      DISABLE_WARNING_PREFIX="-erroff="
1476      CFLAGS_WARNINGS_ARE_ERRORS="-errtags -errwarn=%all"
1477      ;;
1478    gcc)
1479      # Prior to gcc 4.4, a -Wno-X where X is unknown for that version of gcc will cause an error
1480      FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [-Wno-this-is-a-warning-that-do-not-exist],
1481          IF_TRUE: [GCC_CAN_DISABLE_WARNINGS=true],
1482          IF_FALSE: [GCC_CAN_DISABLE_WARNINGS=false]
1483      )
1484      if test "x$GCC_CAN_DISABLE_WARNINGS" = "xtrue"; then
1485        DISABLE_WARNING_PREFIX="-Wno-"
1486      else
1487        DISABLE_WARNING_PREFIX=
1488      fi
1489      CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
1490      # Repeate the check for the BUILD_CC and BUILD_CXX. Need to also reset
1491      # CFLAGS since any target specific flags will likely not work with the
1492      # build compiler
1493      CC_OLD="$CC"
1494      CXX_OLD="$CXX"
1495      CC="$BUILD_CC"
1496      CXX="$BUILD_CXX"
1497      CFLAGS_OLD="$CFLAGS"
1498      CFLAGS=""
1499      FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [-Wno-this-is-a-warning-that-do-not-exist],
1500          IF_TRUE: [BUILD_CC_CAN_DISABLE_WARNINGS=true],
1501          IF_FALSE: [BUILD_CC_CAN_DISABLE_WARNINGS=false]
1502      )
1503      if test "x$BUILD_CC_CAN_DISABLE_WARNINGS" = "xtrue"; then
1504        BUILD_CC_DISABLE_WARNING_PREFIX="-Wno-"
1505      else
1506        BUILD_CC_DISABLE_WARNING_PREFIX=
1507      fi
1508      CC="$CC_OLD"
1509      CXX="$CXX_OLD"
1510      CFLAGS="$CFLAGS_OLD"
1511      ;;
1512    clang)
1513      DISABLE_WARNING_PREFIX="-Wno-"
1514      CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
1515      ;;
1516    xlc)
1517      DISABLE_WARNING_PREFIX="-qsuppress="
1518      CFLAGS_WARNINGS_ARE_ERRORS="-qhalt=w"
1519      ;;
1520  esac
1521  AC_SUBST(DISABLE_WARNING_PREFIX)
1522  AC_SUBST(BUILD_CC_DISABLE_WARNING_PREFIX)
1523  AC_SUBST(CFLAGS_WARNINGS_ARE_ERRORS)
1524])
1525
1526# FLAGS_SETUP_GCC6_COMPILER_FLAGS([PREFIX])
1527# Arguments:
1528# $1 - Optional prefix for each variable defined.
1529AC_DEFUN([FLAGS_SETUP_GCC6_COMPILER_FLAGS],
1530[
1531  # These flags are required for GCC 6 builds as undefined behaviour in OpenJDK code
1532  # runs afoul of the more aggressive versions of these optimisations.
1533  # Notably, value range propagation now assumes that the this pointer of C++
1534  # member functions is non-null.
1535  NO_DELETE_NULL_POINTER_CHECKS_CFLAG="-fno-delete-null-pointer-checks"
1536  dnl Argument check is disabled until FLAGS_COMPILER_CHECK_ARGUMENTS handles cross-compilation
1537  dnl FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_DELETE_NULL_POINTER_CHECKS_CFLAG -Werror],
1538  dnl					     IF_FALSE: [NO_DELETE_NULL_POINTER_CHECKS_CFLAG=""])
1539  NO_LIFETIME_DSE_CFLAG="-fno-lifetime-dse"
1540  dnl Argument check is disabled until FLAGS_COMPILER_CHECK_ARGUMENTS handles cross-compilation
1541  dnl FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_LIFETIME_DSE_CFLAG -Werror],
1542  dnl					     IF_FALSE: [NO_LIFETIME_DSE_CFLAG=""])
1543  AC_MSG_NOTICE([GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} and ${NO_LIFETIME_DSE_CFLAG}])
1544  $1CFLAGS_JDK="[$]$1CFLAGS_JDK ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
1545  $1JVM_CFLAGS="[$]$1JVM_CFLAGS ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
1546])
1547