1 #
   2 # Copyright (c) 2011, 2018, 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 flags for C/C++ compiler
  29 #
  30 
  31 ###############################################################################
  32 #
  33 # How to compile shared libraries.
  34 #
  35 AC_DEFUN([FLAGS_SETUP_SHARED_LIBS],
  36 [
  37   if test "x$TOOLCHAIN_TYPE" = xgcc; then
  38     C_FLAG_REORDER=''
  39 
  40     # Default works for linux, might work on other platforms as well.
  41     SHARED_LIBRARY_FLAGS='-shared'
  42     SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$ORIGIN[$]1'
  43     SET_SHARED_LIBRARY_ORIGIN="-Wl,-z,origin $SET_EXECUTABLE_ORIGIN"
  44     SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
  45     SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=[$]1'
  46 
  47   elif test "x$TOOLCHAIN_TYPE" = xclang; then
  48     C_FLAG_REORDER=''
  49 
  50     if test "x$OPENJDK_TARGET_OS" = xmacosx; then
  51       # Linking is different on MacOSX
  52       SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0"
  53       SET_EXECUTABLE_ORIGIN='-Wl,-rpath,@loader_path$(or [$]1,/.)'
  54       SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
  55       SET_SHARED_LIBRARY_NAME='-Wl,-install_name,@rpath/[$]1'
  56       SET_SHARED_LIBRARY_MAPFILE='-Wl,-exported_symbols_list,[$]1'
  57 
  58     else
  59       # Default works for linux, might work on other platforms as well.
  60       SHARED_LIBRARY_FLAGS='-shared'
  61       SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$ORIGIN[$]1'
  62       SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
  63       SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=[$]1'
  64 
  65       # arm specific settings
  66       if test "x$OPENJDK_TARGET_CPU" = "xarm"; then
  67         # '-Wl,-z,origin' isn't used on arm.
  68         SET_SHARED_LIBRARY_ORIGIN='-Wl,-rpath,\$$$$ORIGIN[$]1'
  69       else
  70         SET_SHARED_LIBRARY_ORIGIN="-Wl,-z,origin $SET_EXECUTABLE_ORIGIN"
  71       fi
  72     fi
  73 
  74   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
  75     C_FLAG_REORDER='-xF'
  76     SHARED_LIBRARY_FLAGS="-G"
  77     SET_EXECUTABLE_ORIGIN='-R\$$ORIGIN[$]1'
  78     SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
  79     SET_SHARED_LIBRARY_NAME='-h [$]1'
  80     SET_SHARED_LIBRARY_MAPFILE='-M[$]1'
  81 
  82   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
  83     C_FLAG_REORDER=''
  84     SHARED_LIBRARY_FLAGS="-qmkshrobj -bM:SRE -bnoentry"
  85     SET_EXECUTABLE_ORIGIN=""
  86     SET_SHARED_LIBRARY_ORIGIN=''
  87     SET_SHARED_LIBRARY_NAME=''
  88     SET_SHARED_LIBRARY_MAPFILE=''
  89 
  90   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
  91     C_FLAG_REORDER=''
  92     SHARED_LIBRARY_FLAGS="-dll"
  93     SET_EXECUTABLE_ORIGIN=''
  94     SET_SHARED_LIBRARY_ORIGIN=''
  95     SET_SHARED_LIBRARY_NAME=''
  96     SET_SHARED_LIBRARY_MAPFILE='-def:[$]1'
  97   fi
  98 
  99   AC_SUBST(C_FLAG_REORDER)
 100   AC_SUBST(SET_EXECUTABLE_ORIGIN)
 101   AC_SUBST(SET_SHARED_LIBRARY_ORIGIN)
 102   AC_SUBST(SET_SHARED_LIBRARY_NAME)
 103   AC_SUBST(SET_SHARED_LIBRARY_MAPFILE)
 104   AC_SUBST(SHARED_LIBRARY_FLAGS)
 105 ])
 106 
 107 AC_DEFUN([FLAGS_SETUP_DEBUG_SYMBOLS],
 108 [
 109   # By default don't set any specific assembler debug
 110   # info flags for toolchains unless we know they work.
 111   # See JDK-8207057.
 112   ASFLAGS_DEBUG_SYMBOLS=""
 113   # Debug symbols
 114   if test "x$TOOLCHAIN_TYPE" = xgcc; then
 115     CFLAGS_DEBUG_SYMBOLS="-g"
 116     ASFLAGS_DEBUG_SYMBOLS="-g"
 117   elif test "x$TOOLCHAIN_TYPE" = xclang; then
 118     CFLAGS_DEBUG_SYMBOLS="-g"
 119     ASFLAGS_DEBUG_SYMBOLS="-g"
 120   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
 121     # -g0 enables debug symbols without disabling inlining.
 122     CFLAGS_DEBUG_SYMBOLS="-g0 -xs"
 123   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
 124     if test "x$XLC_USES_CLANG" = xtrue; then
 125       CFLAGS_DEBUG_SYMBOLS="-g1"
 126     else
 127       CFLAGS_DEBUG_SYMBOLS="-g"
 128     fi
 129   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
 130     CFLAGS_DEBUG_SYMBOLS="-Z7 -d2Zi+"
 131   fi
 132 
 133   AC_SUBST(CFLAGS_DEBUG_SYMBOLS)
 134   AC_SUBST(ASFLAGS_DEBUG_SYMBOLS)
 135 ])
 136 
 137 AC_DEFUN([FLAGS_SETUP_WARNINGS],
 138 [
 139   AC_ARG_ENABLE([warnings-as-errors], [AS_HELP_STRING([--disable-warnings-as-errors],
 140       [do not consider native warnings to be an error @<:@enabled@:>@])])
 141 
 142   # Set default value.
 143   if test "x$TOOLCHAIN_TYPE" = xxlc; then
 144     WARNINGS_AS_ERRORS=false
 145   else
 146     WARNINGS_AS_ERRORS=true
 147   fi
 148 
 149   AC_MSG_CHECKING([if native warnings are errors])
 150   if test "x$enable_warnings_as_errors" = "xyes"; then
 151     AC_MSG_RESULT([yes (explicitly set)])
 152     WARNINGS_AS_ERRORS=true
 153   elif test "x$enable_warnings_as_errors" = "xno"; then
 154     AC_MSG_RESULT([no (explicitly set)])
 155     WARNINGS_AS_ERRORS=false
 156   elif test "x$enable_warnings_as_errors" = "x"; then
 157     AC_MSG_RESULT([${WARNINGS_AS_ERRORS} (default)])
 158   else
 159     AC_MSG_ERROR([--enable-warnings-as-errors accepts no argument])
 160   fi
 161 
 162   AC_SUBST(WARNINGS_AS_ERRORS)
 163 
 164   case "${TOOLCHAIN_TYPE}" in
 165     microsoft)
 166       DISABLE_WARNING_PREFIX="-wd"
 167       CFLAGS_WARNINGS_ARE_ERRORS="-WX"
 168 
 169       WARNINGS_ENABLE_ALL="-W3"
 170       DISABLED_WARNINGS="4800"
 171       ;;
 172 
 173     solstudio)
 174       DISABLE_WARNING_PREFIX="-erroff="
 175       CFLAGS_WARNINGS_ARE_ERRORS="-errwarn=%all"
 176 
 177       WARNINGS_ENABLE_ALL_CFLAGS="-v"
 178       WARNINGS_ENABLE_ALL_CXXFLAGS="+w"
 179 
 180       DISABLED_WARNINGS_C=""
 181       DISABLED_WARNINGS_CXX=""
 182       ;;
 183 
 184     gcc)
 185       DISABLE_WARNING_PREFIX="-Wno-"
 186       CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
 187 
 188       # Additional warnings that are not activated by -Wall and -Wextra
 189       WARNINGS_ENABLE_ADDITIONAL="-Wpointer-arith -Wsign-compare \
 190           -Wunused-function -Wundef -Wunused-value -Wreturn-type \
 191           -Wtrampolines"
 192       WARNINGS_ENABLE_ADDITIONAL_CXX="-Woverloaded-virtual -Wreorder"
 193       WARNINGS_ENABLE_ALL_CFLAGS="-Wall -Wextra -Wformat=2 $WARNINGS_ENABLE_ADDITIONAL"
 194       WARNINGS_ENABLE_ALL_CXXFLAGS="$WARNINGS_ENABLE_ALL_CFLAGS $WARNINGS_ENABLE_ADDITIONAL_CXX"
 195 
 196       DISABLED_WARNINGS="unused-parameter unused"
 197 
 198       # Repeate the check for the BUILD_CC and BUILD_CXX. Need to also reset
 199       # CFLAGS since any target specific flags will likely not work with the
 200       # build compiler
 201       CC_OLD="$CC"
 202       CXX_OLD="$CXX"
 203       CC="$BUILD_CC"
 204       CXX="$BUILD_CXX"
 205       CFLAGS_OLD="$CFLAGS"
 206       CFLAGS=""
 207       BUILD_CC_DISABLE_WARNING_PREFIX="-Wno-"
 208       CC="$CC_OLD"
 209       CXX="$CXX_OLD"
 210       CFLAGS="$CFLAGS_OLD"
 211       ;;
 212 
 213     clang)
 214       DISABLE_WARNING_PREFIX="-Wno-"
 215       CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
 216 
 217       # Additional warnings that are not activated by -Wall and -Wextra
 218       WARNINGS_ENABLE_ADDITIONAL="-Wpointer-arith -Wsign-compare -Wreorder \
 219           -Wunused-function -Wundef -Wunused-value -Woverloaded-virtual"
 220       WARNINGS_ENABLE_ALL="-Wall -Wextra -Wformat=2 $WARNINGS_ENABLE_ADDITIONAL"
 221 
 222       DISABLED_WARNINGS="unused-parameter unused"
 223 
 224       if test "x$OPENJDK_TARGET_OS" = xmacosx; then
 225         # missing-method-return-type triggers in JavaNativeFoundation framework
 226         DISABLED_WARNINGS="$DISABLED_WARNINGS missing-method-return-type"
 227       fi
 228 
 229       ;;
 230 
 231     xlc)
 232       DISABLE_WARNING_PREFIX="-qsuppress="
 233       CFLAGS_WARNINGS_ARE_ERRORS="-qhalt=w"
 234 
 235       # Possibly a better subset than "all" is "lan:trx:ret:zea:cmp:ret"
 236       WARNINGS_ENABLE_ALL="-qinfo=all -qformat=all"
 237       DISABLED_WARNINGS=""
 238       ;;
 239   esac
 240   AC_SUBST(DISABLE_WARNING_PREFIX)
 241   AC_SUBST(BUILD_CC_DISABLE_WARNING_PREFIX)
 242   AC_SUBST(CFLAGS_WARNINGS_ARE_ERRORS)
 243   AC_SUBST(DISABLED_WARNINGS)
 244   AC_SUBST(DISABLED_WARNINGS_C)
 245   AC_SUBST(DISABLED_WARNINGS_CXX)
 246 ])
 247 
 248 AC_DEFUN([FLAGS_SETUP_QUALITY_CHECKS],
 249 [
 250   # bounds, memory and behavior checking options
 251   if test "x$TOOLCHAIN_TYPE" = xgcc; then
 252     case $DEBUG_LEVEL in
 253     release )
 254       # no adjustment
 255       ;;
 256     fastdebug )
 257       # no adjustment
 258       ;;
 259     slowdebug )
 260       # FIXME: By adding this to C(XX)FLAGS_DEBUG_OPTIONS/JVM_CFLAGS_SYMBOLS it
 261       # get's added conditionally on whether we produce debug symbols or not.
 262       # This is most likely not really correct.
 263 
 264       # Add runtime stack smashing and undefined behavior checks.
 265       CFLAGS_DEBUG_OPTIONS="-fstack-protector-all --param ssp-buffer-size=1"
 266       CXXFLAGS_DEBUG_OPTIONS="-fstack-protector-all --param ssp-buffer-size=1"
 267 
 268       JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -fstack-protector-all --param ssp-buffer-size=1"
 269       ;;
 270     esac
 271   fi
 272 ])
 273 
 274 AC_DEFUN([FLAGS_SETUP_OPTIMIZATION],
 275 [
 276   if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
 277     CC_HIGHEST="-fns -fsimple -fsingle -xbuiltin=%all -xdepend -xrestrict -xlibmil"
 278 
 279     C_O_FLAG_HIGHEST_JVM="-xO4"
 280     C_O_FLAG_DEBUG_JVM=""
 281     C_O_FLAG_SIZE=""
 282     C_O_FLAG_DEBUG=""
 283     C_O_FLAG_NONE=""
 284     if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86"; then
 285       C_O_FLAG_HIGHEST="-xO4 -Wu,-O4~yz $CC_HIGHEST"
 286       C_O_FLAG_HI="-xO4 -Wu,-O4~yz"
 287       C_O_FLAG_NORM="-xO2 -Wu,-O2~yz"
 288     elif test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then
 289       C_O_FLAG_HIGHEST="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0 \
 290           -xprefetch=auto,explicit $CC_HIGHEST"
 291       C_O_FLAG_HI="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0"
 292       C_O_FLAG_NORM="-xO2 -Wc,-Qrm-s -Wc,-Qiselect-T0"
 293     fi
 294   elif test "x$TOOLCHAIN_TYPE" = xgcc; then
 295     C_O_FLAG_HIGHEST_JVM="-O3"
 296     C_O_FLAG_HIGHEST="-O3"
 297     C_O_FLAG_HI="-O3"
 298     C_O_FLAG_NORM="-O2"
 299     C_O_FLAG_SIZE="-Os"
 300     C_O_FLAG_DEBUG="-O0"
 301     C_O_FLAG_DEBUG_JVM="-O0"
 302     C_O_FLAG_NONE="-O0"














 303   elif test "x$TOOLCHAIN_TYPE" = xclang; then
 304     if test "x$OPENJDK_TARGET_OS" = xmacosx; then
 305       # On MacOSX we optimize for size, something
 306       # we should do for all platforms?
 307       C_O_FLAG_HIGHEST_JVM="-Os"
 308       C_O_FLAG_HIGHEST="-Os"
 309       C_O_FLAG_HI="-Os"
 310       C_O_FLAG_NORM="-Os"
 311       C_O_FLAG_DEBUG_JVM=""
 312     else
 313       C_O_FLAG_HIGHEST_JVM="-O3"
 314       C_O_FLAG_HIGHEST="-O3"
 315       C_O_FLAG_HI="-O3"
 316       C_O_FLAG_NORM="-O2"
 317       C_O_FLAG_DEBUG_JVM="-O0"
 318     fi
 319     C_O_FLAG_SIZE="-Os"
 320     C_O_FLAG_DEBUG="-O0"
 321     C_O_FLAG_NONE="-O0"
 322   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
 323     C_O_FLAG_HIGHEST_JVM="-O3 -qhot=level=1 -qinline -qinlglue"
 324     C_O_FLAG_HIGHEST="-O3 -qhot=level=1 -qinline -qinlglue"
 325     C_O_FLAG_HI="-O3 -qinline -qinlglue"
 326     C_O_FLAG_NORM="-O2"
 327     C_O_FLAG_DEBUG="-qnoopt"
 328     # FIXME: Value below not verified.
 329     C_O_FLAG_DEBUG_JVM=""
 330     C_O_FLAG_NONE="-qnoopt"
 331   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
 332     C_O_FLAG_HIGHEST_JVM="-O2 -Oy-"
 333     C_O_FLAG_HIGHEST="-O2"
 334     C_O_FLAG_HI="-O1"
 335     C_O_FLAG_NORM="-O1"
 336     C_O_FLAG_DEBUG="-Od"
 337     C_O_FLAG_DEBUG_JVM=""
 338     C_O_FLAG_NONE="-Od"
 339     C_O_FLAG_SIZE="-Os"
 340   fi
 341 
 342   # Now copy to C++ flags
 343   CXX_O_FLAG_HIGHEST_JVM="$C_O_FLAG_HIGHEST_JVM"
 344   CXX_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST"
 345   CXX_O_FLAG_HI="$C_O_FLAG_HI"
 346   CXX_O_FLAG_NORM="$C_O_FLAG_NORM"
 347   CXX_O_FLAG_DEBUG="$C_O_FLAG_DEBUG"
 348   CXX_O_FLAG_DEBUG_JVM="$C_O_FLAG_DEBUG_JVM"
 349   CXX_O_FLAG_NONE="$C_O_FLAG_NONE"
 350   CXX_O_FLAG_SIZE="$C_O_FLAG_SIZE"
 351 
 352   if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
 353     # In solstudio, also add this to C (but not C++) flags...
 354     C_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST -xalias_level=basic"
 355   fi
 356 
 357   # Adjust optimization flags according to debug level.
 358   case $DEBUG_LEVEL in
 359     release )
 360       # no adjustment
 361       ;;
 362     fastdebug )
 363       # Not quite so much optimization
 364       C_O_FLAG_HI="$C_O_FLAG_NORM"
 365       CXX_O_FLAG_HI="$CXX_O_FLAG_NORM"
 366       ;;
 367     slowdebug )
 368       # Disable optimization
 369       C_O_FLAG_HIGHEST_JVM="$C_O_FLAG_DEBUG_JVM"
 370       C_O_FLAG_HIGHEST="$C_O_FLAG_DEBUG"
 371       C_O_FLAG_HI="$C_O_FLAG_DEBUG"
 372       C_O_FLAG_NORM="$C_O_FLAG_DEBUG"
 373       C_O_FLAG_SIZE="$C_O_FLAG_DEBUG"
 374       CXX_O_FLAG_HIGHEST_JVM="$CXX_O_FLAG_DEBUG_JVM"
 375       CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_DEBUG"
 376       CXX_O_FLAG_HI="$CXX_O_FLAG_DEBUG"
 377       CXX_O_FLAG_NORM="$CXX_O_FLAG_DEBUG"
 378       CXX_O_FLAG_SIZE="$CXX_O_FLAG_DEBUG"
 379       ;;
 380   esac
 381 
 382   AC_SUBST(C_O_FLAG_HIGHEST_JVM)
 383   AC_SUBST(C_O_FLAG_HIGHEST)
 384   AC_SUBST(C_O_FLAG_HI)
 385   AC_SUBST(C_O_FLAG_NORM)
 386   AC_SUBST(C_O_FLAG_NONE)
 387   AC_SUBST(C_O_FLAG_SIZE)
 388   AC_SUBST(CXX_O_FLAG_HIGHEST_JVM)
 389   AC_SUBST(CXX_O_FLAG_HIGHEST)
 390   AC_SUBST(CXX_O_FLAG_HI)
 391   AC_SUBST(CXX_O_FLAG_NORM)
 392   AC_SUBST(CXX_O_FLAG_NONE)
 393   AC_SUBST(CXX_O_FLAG_SIZE)
 394 ])
 395 
 396 AC_DEFUN([FLAGS_SETUP_CFLAGS],
 397 [
 398   ### CFLAGS
 399 
 400   FLAGS_SETUP_CFLAGS_HELPER
 401 
 402   FLAGS_OS=$OPENJDK_TARGET_OS
 403   FLAGS_OS_TYPE=$OPENJDK_TARGET_OS_TYPE
 404   FLAGS_CPU=$OPENJDK_TARGET_CPU
 405   FLAGS_CPU_ARCH=$OPENJDK_TARGET_CPU_ARCH
 406   FLAGS_CPU_BITS=$OPENJDK_TARGET_CPU_BITS
 407   FLAGS_CPU_ENDIAN=$OPENJDK_TARGET_CPU_ENDIAN
 408   FLAGS_CPU_LEGACY=$OPENJDK_TARGET_CPU_LEGACY
 409   FLAGS_CPU_LEGACY_LIB=$OPENJDK_TARGET_CPU_LEGACY_LIB
 410 
 411   FLAGS_SETUP_CFLAGS_CPU_DEP([TARGET])
 412 
 413   FLAGS_OS=$OPENJDK_BUILD_OS
 414   FLAGS_OS_TYPE=$OPENJDK_BUILD_OS_TYPE
 415   FLAGS_CPU=$OPENJDK_BUILD_CPU
 416   FLAGS_CPU_ARCH=$OPENJDK_BUILD_CPU_ARCH
 417   FLAGS_CPU_BITS=$OPENJDK_BUILD_CPU_BITS
 418   FLAGS_CPU_ENDIAN=$OPENJDK_BUILD_CPU_ENDIAN
 419   FLAGS_CPU_LEGACY=$OPENJDK_BUILD_CPU_LEGACY
 420   FLAGS_CPU_LEGACY_LIB=$OPENJDK_BUILD_CPU_LEGACY_LIB
 421 
 422   FLAGS_SETUP_CFLAGS_CPU_DEP([BUILD], [OPENJDK_BUILD_], [BUILD_])
 423 ])
 424 
 425 ################################################################################
 426 # platform independent
 427 AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
 428 [
 429   #### OS DEFINES, these should be independent on toolchain
 430   if test "x$OPENJDK_TARGET_OS" = xlinux; then
 431     CFLAGS_OS_DEF_JVM="-DLINUX"
 432     CFLAGS_OS_DEF_JDK="-D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
 433   elif test "x$OPENJDK_TARGET_OS" = xsolaris; then
 434     CFLAGS_OS_DEF_JVM="-DSOLARIS"
 435     CFLAGS_OS_DEF_JDK="-D__solaris__"
 436   elif test "x$OPENJDK_TARGET_OS" = xmacosx; then
 437     CFLAGS_OS_DEF_JVM="-D_ALLBSD_SOURCE -D_DARWIN_C_SOURCE -D_XOPEN_SOURCE"
 438     CFLAGS_OS_DEF_JDK="-D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
 439   elif test "x$OPENJDK_TARGET_OS" = xaix; then
 440     CFLAGS_OS_DEF_JVM="-DAIX"
 441   elif test "x$OPENJDK_TARGET_OS" = xbsd; then
 442     CFLAGS_OS_DEF_JDK="-D_ALLBSD_SOURCE"
 443   elif test "x$OPENJDK_TARGET_OS" = xwindows; then
 444     CFLAGS_OS_DEF_JVM="-D_WINDOWS -DWIN32 -D_JNI_IMPLEMENTATION_"
 445   fi
 446 
 447   CFLAGS_OS_DEF_JDK="$CFLAGS_OS_DEF_JDK -D$OPENJDK_TARGET_OS_UPPERCASE"
 448 
 449   #### GLOBAL DEFINES
 450   # Set some common defines. These works for all compilers, but assume
 451   # -D is universally accepted.
 452 
 453   # Always enable optional macros for VM.
 454   ALWAYS_CFLAGS_JVM="-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS"
 455 
 456   # Setup some hard coded includes
 457   ALWAYS_CFLAGS_JDK=" \
 458       -I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
 459       -I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base/\$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \
 460       -I${TOPDIR}/src/java.base/share/native/libjava \
 461       -I${TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/libjava \
 462       -I${TOPDIR}/src/hotspot/share/include \
 463       -I${TOPDIR}/src/hotspot/os/${HOTSPOT_TARGET_OS_TYPE}/include"
 464 
 465   ###############################################################################
 466 
 467   # Adjust flags according to debug level.
 468   # Setup debug/release defines
 469   if test "x$DEBUG_LEVEL" = xrelease; then
 470     DEBUG_CFLAGS_JDK="-DNDEBUG"
 471     if test "x$OPENJDK_TARGET_OS" = xsolaris; then
 472       DEBUG_CFLAGS_JDK="$DEBUG_CFLAGS_JDK -DTRIMMED"
 473     fi
 474   else
 475     DEBUG_CFLAGS_JDK="-DDEBUG"
 476 
 477     if test "x$TOOLCHAIN_TYPE" = xxlc; then
 478       # We need '-qminimaltoc' or '-qpic=large -bbigtoc' if the TOC overflows.
 479       # Hotspot now overflows its 64K TOC (currently only for debug),
 480       # so for debug we build with '-qpic=large -bbigtoc'.
 481       DEBUG_CFLAGS_JVM="-qpic=large"
 482     fi
 483   fi
 484 
 485   if test "x$DEBUG_LEVEL" != xrelease; then
 486     DEBUG_OPTIONS_FLAGS_JDK="$CFLAGS_DEBUG_OPTIONS"
 487     DEBUG_SYMBOLS_CFLAGS_JDK="$CFLAGS_DEBUG_SYMBOLS"
 488   fi
 489 
 490   #### TOOLCHAIN DEFINES
 491 
 492   if test "x$TOOLCHAIN_TYPE" = xgcc; then
 493     ALWAYS_DEFINES_JVM="-D_GNU_SOURCE -D_REENTRANT"
 494   elif test "x$TOOLCHAIN_TYPE" = xclang; then
 495     ALWAYS_DEFINES_JVM="-D_GNU_SOURCE"
 496   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
 497     ALWAYS_DEFINES_JVM="-DSPARC_WORKS -D_Crun_inline_placement"
 498     ALWAYS_DEFINES_JDK="-DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS"
 499     ALWAYS_DEFINES_JDK_CXXONLY="-DCC_NOEX"
 500   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
 501     ALWAYS_DEFINES_JVM="-D_REENTRANT"
 502     ALWAYS_DEFINES_JDK="-D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
 503   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
 504     ALWAYS_DEFINES_JDK="-DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_DEPRECATE \
 505         -D_CRT_NONSTDC_NO_DEPRECATE -DWIN32 -DIAL"
 506     ALWAYS_DEFINES_JVM="-DNOMINMAX -DWIN32_LEAN_AND_MEAN"
 507   fi
 508 
 509   ###############################################################################
 510   #
 511   #
 512   # CFLAGS BASIC
 513   if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
 514     # COMMON to gcc and clang
 515     TOOLCHAIN_CFLAGS_JVM="-pipe -fno-rtti -fno-exceptions \
 516         -fvisibility=hidden -fno-strict-aliasing -fno-omit-frame-pointer"
 517   fi
 518 
 519   if test "x$TOOLCHAIN_TYPE" = xgcc; then
 520     TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -fcheck-new -fstack-protector"
 521     TOOLCHAIN_CFLAGS_JDK="-pipe -fstack-protector"
 522     # technically NOT for CXX (but since this gives *worse* performance, use
 523     # no-strict-aliasing everywhere!)
 524     TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing"
 525 
 526   elif test "x$TOOLCHAIN_TYPE" = xclang; then
 527     # Restrict the debug information created by Clang to avoid
 528     # too big object files and speed the build up a little bit
 529     # (see http://llvm.org/bugs/show_bug.cgi?id=7554)
 530     TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -flimit-debug-info"
 531 
 532     # In principle the stack alignment below is cpu- and ABI-dependent and
 533     # should agree with values of StackAlignmentInBytes in various
 534     # src/hotspot/cpu/*/globalDefinitions_*.hpp files, but this value currently
 535     # works for all platforms.
 536     TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -mno-omit-leaf-frame-pointer -mstack-alignment=16"
 537 
 538     if test "x$OPENJDK_TARGET_OS" = xlinux; then






 539       TOOLCHAIN_CFLAGS_JDK="-pipe"
 540       TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing" # technically NOT for CXX
 541     fi
 542   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
 543     TOOLCHAIN_FLAGS="-errtags -errfmt"
 544     TOOLCHAIN_CFLAGS="-errshort=tags"
 545 
 546     TOOLCHAIN_CFLAGS_JDK="-mt $TOOLCHAIN_FLAGS"
 547     TOOLCHAIN_CFLAGS_JDK_CONLY="-xCC -Xa -W0,-noglobal $TOOLCHAIN_CFLAGS" # C only
 548     TOOLCHAIN_CFLAGS_JDK_CXXONLY="-features=no%except -norunpath -xnolib" # CXX only
 549     TOOLCHAIN_CFLAGS_JVM="-template=no%extdef -features=no%split_init \
 550         -library=stlport4 -mt -features=no%except $TOOLCHAIN_FLAGS"
 551     if test "x$DEBUG_LEVEL" = xslowdebug; then
 552       # Previously -g was used instead of -g0 for slowdebug; this is equivalent
 553       # to setting +d.
 554       TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM +d"
 555     fi
 556 
 557   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
 558     # Suggested additions: -qsrcmsg to get improved error reporting
 559     TOOLCHAIN_CFLAGS_JDK="-qchars=signed -qfullpath -qsaveopt -qstackprotect"  # add on both CFLAGS
 560     TOOLCHAIN_CFLAGS_JVM="-qtune=balanced \
 561         -qalias=noansi -qstrict -qtls=default -qlanglvl=c99vla \
 562         -qlanglvl=noredefmac -qnortti -qnoeh -qignerrno -qstackprotect"
 563   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
 564     TOOLCHAIN_CFLAGS_JVM="-nologo -MD -MP"
 565     TOOLCHAIN_CFLAGS_JDK="-nologo -MD -Zc:wchar_t-"
 566   fi
 567 
























 568   # CFLAGS WARNINGS STUFF
 569   # Set JVM_CFLAGS warning handling
 570   if test "x$TOOLCHAIN_TYPE" = xgcc; then
 571     WARNING_CFLAGS_JDK_CONLY="$WARNINGS_ENABLE_ALL_CFLAGS"
 572     WARNING_CFLAGS_JDK_CXXONLY="$WARNINGS_ENABLE_ALL_CXXFLAGS"
 573     WARNING_CFLAGS_JVM="$WARNINGS_ENABLE_ALL_CXXFLAGS"
 574 
 575   elif test "x$TOOLCHAIN_TYPE" = xclang; then
 576     WARNING_CFLAGS="$WARNINGS_ENABLE_ALL"
 577 
 578   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
 579     WARNING_CFLAGS_JDK_CONLY="$WARNINGS_ENABLE_ALL_CFLAGS"
 580     WARNING_CFLAGS_JDK_CXXONLY="$WARNINGS_ENABLE_ALL_CXXFLAGS"
 581     WARNING_CFLAGS_JVM="$WARNINGS_ENABLE_ALL_CXXFLAGS"
 582 
 583   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
 584     WARNING_CFLAGS="$WARNINGS_ENABLE_ALL"
 585 
 586   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
 587     WARNING_CFLAGS=""  # currently left empty
 588   fi
 589 
 590   # Set some additional per-OS defines.
 591 
 592   # Additional macosx handling
 593   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
 594     OS_CFLAGS="-DMAC_OS_X_VERSION_MIN_REQUIRED=$MACOSX_VERSION_MIN_NODOTS \
 595         -mmacosx-version-min=$MACOSX_VERSION_MIN"
 596 
 597     if test -n "$MACOSX_VERSION_MAX"; then
 598         OS_CFLAGS="$OS_CFLAGS \
 599             -DMAC_OS_X_VERSION_MAX_ALLOWED=$MACOSX_VERSION_MAX_NODOTS"
 600     fi
 601   fi
 602 
 603   # Where does this really belong??
 604   if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
 605     PICFLAG="-fPIC"
 606   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
 607     PICFLAG="-KPIC"
 608   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
 609     # '-qpic' defaults to 'qpic=small'. This means that the compiler generates only
 610     # one instruction for accessing the TOC. If the TOC grows larger than 64K, the linker
 611     # will have to patch this single instruction with a call to some out-of-order code which
 612     # does the load from the TOC. This is of course slower, and we also would have
 613     # to use '-bbigtoc' for linking anyway so we could also change the PICFLAG to 'qpic=large'.
 614     # With 'qpic=large' the compiler will by default generate a two-instruction sequence which
 615     # can be patched directly by the linker and does not require a jump to out-of-order code.
 616     #
 617     # Since large TOC causes perf. overhead, only pay it where we must. Currently this is
 618     # for all libjvm variants (both gtest and normal) but no other binaries. So, build
 619     # libjvm with -qpic=large and link with -bbigtoc.
 620     JVM_PICFLAG="-qpic=large"
 621     JDK_PICFLAG="-qpic"
 622   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
 623     PICFLAG=""
 624   fi
 625 
 626   if test "x$TOOLCHAIN_TYPE" != xxlc; then
 627     JVM_PICFLAG="$PICFLAG"
 628     JDK_PICFLAG="$PICFLAG"
 629   fi
 630 
 631   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
 632     # Linking is different on MacOSX
 633     JDK_PICFLAG=''
 634     if test "x$STATIC_BUILD" = xtrue; then
 635       JVM_PICFLAG=""
 636     fi
 637   fi
 638 
 639   # Optional POSIX functionality needed by the JVM
 640   #
 641   # Check if clock_gettime is available and in which library. This indicates
 642   # availability of CLOCK_MONOTONIC for hotspot. But we don't need to link, so
 643   # don't let it update LIBS.
 644   save_LIBS="$LIBS"
 645   AC_SEARCH_LIBS(clock_gettime, rt, [HAS_CLOCK_GETTIME=true], [])
 646   if test "x$LIBS" = "x-lrt "; then
 647     CLOCK_GETTIME_IN_LIBRT=true
 648   fi
 649   LIBS="$save_LIBS"
 650 
 651   if test "x$HAS_CLOCK_GETTIME" = "xtrue"; then
 652     OS_CFLAGS_JVM="$OS_CFLAGS_JVM -DSUPPORTS_CLOCK_MONOTONIC"
 653     if test "x$CLOCK_GETTIME_IN_LIBRT" = "xtrue"; then
 654       OS_CFLAGS_JVM="$OS_CFLAGS_JVM -DNEEDS_LIBRT"
 655     fi
 656   fi
 657 ])
 658 
 659 ################################################################################
 660 # $1 - Either BUILD or TARGET to pick the correct OS/CPU variables to check
 661 #      conditionals against.
 662 # $2 - Optional prefix for each variable defined.
 663 # $3 - Optional prefix for compiler variables (either BUILD_ or nothing).
 664 AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
 665 [
 666   #### CPU DEFINES, these should (in theory) be independent on toolchain
 667 
 668   # Setup target CPU
 669   # Setup endianness
 670   if test "x$FLAGS_CPU_ENDIAN" = xlittle; then
 671     $1_DEFINES_CPU_JVM="-DVM_LITTLE_ENDIAN"
 672   fi
 673   if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
 674     # The macro _LITTLE_ENDIAN needs to be defined the same to avoid the
 675     #   Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN
 676     if test "x$FLAGS_CPU_ENDIAN" = xlittle; then
 677       $1_DEFINES_CPU_JDK="-D_LITTLE_ENDIAN="
 678     else
 679       $1_DEFINES_CPU_JDK="-D_BIG_ENDIAN="
 680     fi
 681   else
 682     if test "x$FLAGS_CPU_ENDIAN" = xlittle; then
 683       $1_DEFINES_CPU_JDK="-D_LITTLE_ENDIAN"
 684     else
 685       $1_DEFINES_CPU_JDK="-D_BIG_ENDIAN"
 686     fi
 687   fi
 688 
 689   # setup CPU bit size
 690   $1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -DARCH='\"$FLAGS_CPU_LEGACY\"' \
 691       -D$FLAGS_CPU_LEGACY"
 692 
 693   if test "x$FLAGS_CPU_BITS" = x64; then
 694     # -D_LP64=1 is only set on linux and mac. Setting on windows causes diff in
 695     # unpack200.exe.
 696     if test "x$FLAGS_OS" = xlinux || test "x$FLAGS_OS" = xmacosx; then
 697       $1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -D_LP64=1"
 698     fi
 699     if test "x$FLAGS_OS" != xsolaris && test "x$FLAGS_OS" != xaix; then
 700       # Solaris does not have _LP64=1 in the old build.
 701       # xlc on AIX defines _LP64=1 by default and issues a warning if we redefine it.
 702       $1_DEFINES_CPU_JVM="${$1_DEFINES_CPU_JVM} -D_LP64=1"
 703     fi
 704   fi
 705 
 706   # toolchain dependend, per-cpu
 707   if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
 708     if test "x$FLAGS_CPU_ARCH" = xx86; then
 709       $1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -DcpuIntel -Di586 -D$FLAGS_CPU_LEGACY_LIB"
 710     fi
 711   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
 712     if test "x$FLAGS_CPU" = xx86_64; then
 713       $1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -D_AMD64_ -Damd64"
 714     else
 715       $1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -D_X86_ -Dx86"
 716     fi
 717   fi
 718 
 719   # CFLAGS PER CPU
 720   if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
 721     # COMMON to gcc and clang
 722     if test "x$FLAGS_CPU" = xx86; then
 723       # Force compatibility with i586 on 32 bit intel platforms.
 724       $1_CFLAGS_CPU="-march=i586"
 725     fi
 726   fi
 727 
 728   if test "x$TOOLCHAIN_TYPE" = xgcc; then
 729     if test "x$FLAGS_CPU" = xarm; then
 730       # -Wno-psabi to get rid of annoying "note: the mangling of 'va_list' has changed in GCC 4.4"
 731       $1_CFLAGS_CPU="-fsigned-char -Wno-psabi $ARM_ARCH_TYPE_FLAGS $ARM_FLOAT_TYPE_FLAGS -DJDK_ARCH_ABI_PROP_NAME='\"\$(JDK_ARCH_ABI_PROP_NAME)\"'"
 732       $1_CFLAGS_CPU_JVM="-DARM"
 733     elif test "x$FLAGS_CPU_ARCH" = xppc; then
 734       $1_CFLAGS_CPU_JVM="-minsert-sched-nops=regroup_exact -mno-multiple -mno-string"
 735       if test "x$FLAGS_CPU" = xppc64; then
 736         # -mminimal-toc fixes `relocation truncated to fit' error for gcc 4.1.
 737         # Use ppc64 instructions, but schedule for power5
 738         $1_CFLAGS_CPU_JVM="${$1_CFLAGS_CPU_JVM} -mminimal-toc -mcpu=powerpc64 -mtune=power5"
 739       elif test "x$FLAGS_CPU" = xppc64le; then
 740         # Little endian machine uses ELFv2 ABI.
 741         # Use Power8, this is the first CPU to support PPC64 LE with ELFv2 ABI.
 742         $1_CFLAGS_CPU_JVM="${$1_CFLAGS_CPU_JVM} -DABI_ELFv2 -mcpu=power8 -mtune=power8"
 743       fi
 744     elif test "x$FLAGS_CPU" = xs390x; then
 745       $1_CFLAGS_CPU="-mbackchain -march=z10"
 746     fi
 747 
 748     if test "x$FLAGS_CPU_ARCH" != xarm &&  test "x$FLAGS_CPU_ARCH" != xppc; then
 749       # for all archs except arm and ppc, prevent gcc to omit frame pointer
 750       $1_CFLAGS_CPU_JDK="${$1_CFLAGS_CPU_JDK} -fno-omit-frame-pointer"
 751     fi
 752 
 753     $1_CXXSTD_CXXFLAG="-std=gnu++98"
 754     FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${$1_CXXSTD_CXXFLAG} -Werror],
 755         PREFIX: $3, IF_FALSE: [$1_CXXSTD_CXXFLAG=""])
 756     $1_TOOLCHAIN_CFLAGS_JDK_CXXONLY="${$1_CXXSTD_CXXFLAG}"
 757     $1_TOOLCHAIN_CFLAGS_JVM="${$1_TOOLCHAIN_CFLAGS_JVM} ${$1_CXXSTD_CXXFLAG}"
 758     $2ADLC_CXXFLAG="${$1_CXXSTD_CXXFLAG}"
 759 
 760   elif test "x$TOOLCHAIN_TYPE" = xclang; then
 761     if test "x$FLAGS_OS" = xlinux; then
 762       # ppc test not really needed for clang
 763       if test "x$FLAGS_CPU_ARCH" != xarm &&  test "x$FLAGS_CPU_ARCH" != xppc; then
 764         # for all archs except arm and ppc, prevent gcc to omit frame pointer
 765         $1_CFLAGS_CPU_JDK="${$1_CFLAGS_CPU_JDK} -fno-omit-frame-pointer"
 766       fi
 767     fi
 768 
 769   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
 770     if test "x$FLAGS_CPU" = xx86_64; then
 771       # NOTE: -xregs=no%frameptr is supposed to be default on x64
 772       $1_CFLAGS_CPU_JDK="-xregs=no%frameptr"
 773     elif test "x$FLAGS_CPU" = xsparcv9; then
 774       $1_CFLAGS_CPU_JVM="-xarch=sparc"
 775       $1_CFLAGS_CPU_JDK_LIBONLY="-xregs=no%appl"
 776     fi
 777 
 778   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
 779     if test "x$FLAGS_CPU" = xppc64; then
 780       $1_CFLAGS_CPU_JVM="-qarch=ppc64"
 781     fi
 782 
 783   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
 784     if test "x$FLAGS_CPU" = xx86; then
 785       $1_CFLAGS_CPU_JVM="-arch:IA32"
 786     elif test "x$OPENJDK_TARGET_CPU" = xx86_64; then
 787       if test "x$DEBUG_LEVEL" != xrelease; then
 788         # NOTE: This is probably redundant; -homeparams is default on
 789         # non-release builds.
 790         $1_CFLAGS_CPU_JVM="-homeparams"
 791       fi
 792     fi
 793   fi
 794 
 795   if test "x$TOOLCHAIN_TYPE" = xgcc; then
 796     FLAGS_SETUP_GCC6_COMPILER_FLAGS($1, $3)
 797     $1_TOOLCHAIN_CFLAGS="${$1_GCC6_CFLAGS}"
 798 
 799     $1_WARNING_CFLAGS_JVM="-Wno-format-zero-length -Wtype-limits -Wuninitialized"
 800   fi
 801 













 802   # EXPORT to API
 803   CFLAGS_JVM_COMMON="$ALWAYS_CFLAGS_JVM $ALWAYS_DEFINES_JVM \
 804       $TOOLCHAIN_CFLAGS_JVM ${$1_TOOLCHAIN_CFLAGS_JVM} \
 805       $OS_CFLAGS $OS_CFLAGS_JVM $CFLAGS_OS_DEF_JVM $DEBUG_CFLAGS_JVM \
 806       $WARNING_CFLAGS $WARNING_CFLAGS_JVM $JVM_PICFLAG"
 807 
 808   CFLAGS_JDK_COMMON="$ALWAYS_CFLAGS_JDK $ALWAYS_DEFINES_JDK $TOOLCHAIN_CFLAGS_JDK \
 809       $OS_CFLAGS $CFLAGS_OS_DEF_JDK $DEBUG_CFLAGS_JDK $DEBUG_OPTIONS_FLAGS_JDK \
 810       $WARNING_CFLAGS $WARNING_CFLAGS_JDK $DEBUG_SYMBOLS_CFLAGS_JDK"

 811 
 812   # Use ${$2EXTRA_CFLAGS} to block EXTRA_CFLAGS to be added to build flags.
 813   # (Currently we don't have any OPENJDK_BUILD_EXTRA_CFLAGS, but that might
 814   # change in the future.)
 815 
 816   CFLAGS_JDK_COMMON_CONLY="$TOOLCHAIN_CFLAGS_JDK_CONLY  \
 817       $WARNING_CFLAGS_JDK_CONLY ${$2EXTRA_CFLAGS}"
 818   CFLAGS_JDK_COMMON_CXXONLY="$ALWAYS_DEFINES_JDK_CXXONLY \
 819       $TOOLCHAIN_CFLAGS_JDK_CXXONLY \
 820       ${$1_TOOLCHAIN_CFLAGS_JDK_CXXONLY} \
 821       $WARNING_CFLAGS_JDK_CXXONLY ${$2EXTRA_CXXFLAGS}"
 822 
 823   $1_CFLAGS_JVM="${$1_DEFINES_CPU_JVM} ${$1_CFLAGS_CPU} ${$1_CFLAGS_CPU_JVM} ${$1_TOOLCHAIN_CFLAGS} ${$1_WARNING_CFLAGS_JVM}"
 824   $1_CFLAGS_JDK="${$1_DEFINES_CPU_JDK} ${$1_CFLAGS_CPU} ${$1_CFLAGS_CPU_JDK} ${$1_TOOLCHAIN_CFLAGS}"
 825 
 826   $2JVM_CFLAGS="$CFLAGS_JVM_COMMON ${$1_CFLAGS_JVM} ${$2EXTRA_CXXFLAGS}"
 827 
 828   $2CFLAGS_JDKEXE="$CFLAGS_JDK_COMMON $CFLAGS_JDK_COMMON_CONLY ${$1_CFLAGS_JDK}"
 829   $2CXXFLAGS_JDKEXE="$CFLAGS_JDK_COMMON $CFLAGS_JDK_COMMON_CXXONLY ${$1_CFLAGS_JDK}"
 830   $2CFLAGS_JDKLIB="${$2CFLAGS_JDKEXE} $JDK_PICFLAG ${$1_CFLAGS_CPU_JDK_LIBONLY}"
 831   $2CXXFLAGS_JDKLIB="${$2CXXFLAGS_JDKEXE} $JDK_PICFLAG ${$1_CFLAGS_CPU_JDK_LIBONLY}"
 832 
 833   AC_SUBST($2JVM_CFLAGS)
 834   AC_SUBST($2CFLAGS_JDKLIB)
 835   AC_SUBST($2CFLAGS_JDKEXE)
 836   AC_SUBST($2CXXFLAGS_JDKLIB)
 837   AC_SUBST($2CXXFLAGS_JDKEXE)
 838   AC_SUBST($2ADLC_CXXFLAG)
 839 
 840   COMPILER_FP_CONTRACT_OFF_FLAG="-ffp-contract=off"
 841   # Check that the compiler supports -ffp-contract=off flag
 842   # Set FDLIBM_CFLAGS to -ffp-contract=off if it does. Empty
 843   # otherwise.
 844   # These flags are required for GCC-based builds of
 845   # fdlibm with optimization without losing precision.
 846   # Notably, -ffp-contract=off needs to be added for GCC >= 4.6.
 847   if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
 848     FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${COMPILER_FP_CONTRACT_OFF_FLAG}],
 849         PREFIX: $3,
 850         IF_TRUE: [$2FDLIBM_CFLAGS=${COMPILER_FP_CONTRACT_OFF_FLAG}],
 851         IF_FALSE: [$2FDLIBM_CFLAGS=""])
 852   fi
 853   AC_SUBST($2FDLIBM_CFLAGS)
 854 ])
 855 
 856 # FLAGS_SETUP_GCC6_COMPILER_FLAGS([PREFIX])
 857 # Arguments:
 858 # $1 - Prefix for each variable defined.
 859 # $2 - Prefix for compiler variables (either BUILD_ or nothing).
 860 AC_DEFUN([FLAGS_SETUP_GCC6_COMPILER_FLAGS],
 861 [
 862   # These flags are required for GCC 6 builds as undefined behaviour in OpenJDK code
 863   # runs afoul of the more aggressive versions of these optimisations.
 864   # Notably, value range propagation now assumes that the this pointer of C++
 865   # member functions is non-null.
 866   NO_DELETE_NULL_POINTER_CHECKS_CFLAG="-fno-delete-null-pointer-checks"
 867   FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_DELETE_NULL_POINTER_CHECKS_CFLAG -Werror],
 868       PREFIX: $2, IF_FALSE: [NO_DELETE_NULL_POINTER_CHECKS_CFLAG=""])
 869   NO_LIFETIME_DSE_CFLAG="-fno-lifetime-dse"
 870   FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_LIFETIME_DSE_CFLAG -Werror],
 871       PREFIX: $2, IF_FALSE: [NO_LIFETIME_DSE_CFLAG=""])
 872   $1_GCC6_CFLAGS="${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
 873 ])
 874 
 875 # Documentation on common flags used for solstudio in HIGHEST.
 876 #
 877 # WARNING: Use of OPTIMIZATION_LEVEL=HIGHEST in your Makefile needs to be
 878 #          done with care, there are some assumptions below that need to
 879 #          be understood about the use of pointers, and IEEE behavior.
 880 #
 881 # -fns: Use non-standard floating point mode (not IEEE 754)
 882 # -fsimple: Do some simplification of floating point arithmetic (not IEEE 754)
 883 # -fsingle: Use single precision floating point with 'float'
 884 # -xalias_level=basic: Assume memory references via basic pointer types do not alias
 885 #   (Source with excessing pointer casting and data access with mixed
 886 #    pointer types are not recommended)
 887 # -xbuiltin=%all: Use intrinsic or inline versions for math/std functions
 888 #   (If you expect perfect errno behavior, do not use this)
 889 # -xdepend: Loop data dependency optimizations (need -xO3 or higher)
 890 # -xrestrict: Pointer parameters to functions do not overlap
 891 #   (Similar to -xalias_level=basic usage, but less obvious sometimes.
 892 #    If you pass in multiple pointers to the same data, do not use this)
 893 # -xlibmil: Inline some library routines
 894 #   (If you expect perfect errno behavior, do not use this)
 895 # -xlibmopt: Use optimized math routines (CURRENTLY DISABLED)
 896 #   (If you expect perfect errno behavior, do not use this)
 897 #  Can cause undefined external on Solaris 8 X86 on __sincos, removing for now
--- EOF ---