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 m4_include([flags-cflags.m4])
  27 m4_include([flags-ldflags.m4])
  28 m4_include([flags-other.m4])
  29 
  30 ################################################################################
  31 #
  32 # Setup ABI profile (for arm)
  33 #
  34 AC_DEFUN([FLAGS_SETUP_ABI_PROFILE],
  35 [
  36   AC_ARG_WITH(abi-profile, [AS_HELP_STRING([--with-abi-profile],
  37       [specify ABI profile for ARM builds (arm-vfp-sflt,arm-vfp-hflt,arm-sflt, armv5-vfp-sflt,armv6-vfp-hflt,aarch64) @<:@toolchain dependent@:>@ ])])
  38 
  39   if test "x$with_abi_profile" != x; then
  40     if test "x$OPENJDK_TARGET_CPU" != xarm && \
  41         test "x$OPENJDK_TARGET_CPU" != xaarch64; then
  42       AC_MSG_ERROR([--with-abi-profile only available on arm/aarch64])
  43     fi
  44 
  45     OPENJDK_TARGET_ABI_PROFILE=$with_abi_profile
  46     AC_MSG_CHECKING([for ABI profle])
  47     AC_MSG_RESULT([$OPENJDK_TARGET_ABI_PROFILE])
  48 
  49     # --- Arm-sflt CFLAGS and ASFLAGS ---
  50     # Armv5te is required for assembler, because pld insn used in arm32 hotspot is only in v5E and above.
  51     # However, there is also a GCC bug which generates unaligned strd/ldrd instructions on armv5te:
  52     # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82445, and it was fixed only quite recently.
  53     # The resulting compromise is to enable v5TE for assembler and let GCC generate code for v5T.
  54     if test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-vfp-sflt; then
  55       ARM_FLOAT_TYPE=vfp-sflt
  56       ARM_ARCH_TYPE_FLAGS='-march=armv7-a -mthumb'
  57       ARM_ARCH_TYPE_ASFLAGS='-march=armv7-a -mthumb'
  58     elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-vfp-hflt; then
  59       ARM_FLOAT_TYPE=vfp-hflt
  60       ARM_ARCH_TYPE_FLAGS='-march=armv7-a -mthumb'
  61       ARM_ARCH_TYPE_ASFLAGS='-march=armv7-a -mthumb'
  62     elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-sflt; then
  63       ARM_FLOAT_TYPE=sflt
  64       ARM_ARCH_TYPE_FLAGS='-march=armv5t -marm'
  65       ARM_ARCH_TYPE_ASFLAGS='-march=armv5te'
  66     elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarmv5-vfp-sflt; then
  67       ARM_FLOAT_TYPE=vfp-sflt
  68       ARM_ARCH_TYPE_FLAGS='-march=armv5t -marm'
  69       ARM_ARCH_TYPE_ASFLAGS='-march=armv5te'
  70     elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarmv6-vfp-hflt; then
  71       ARM_FLOAT_TYPE=vfp-hflt
  72       ARM_ARCH_TYPE_FLAGS='-march=armv6 -marm'
  73       ARM_ARCH_TYPE_ASFLAGS='-march=armv6'
  74     elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xaarch64; then
  75       # No special flags, just need to trigger setting JDK_ARCH_ABI_PROP_NAME
  76       ARM_FLOAT_TYPE=
  77       ARM_ARCH_TYPE_FLAGS=
  78       ARM_ARCH_TYPE_ASFLAGS=
  79     else
  80       AC_MSG_ERROR([Invalid ABI profile: "$OPENJDK_TARGET_ABI_PROFILE"])
  81     fi
  82 
  83     if test "x$ARM_FLOAT_TYPE" = xvfp-sflt; then
  84       ARM_FLOAT_TYPE_FLAGS='-mfloat-abi=softfp -mfpu=vfp -DFLOAT_ARCH=-vfp-sflt'
  85       ARM_FLOAT_TYPE_ASFLAGS="-mfloat-abi=softfp -mfpu=vfp"
  86     elif test "x$ARM_FLOAT_TYPE" = xvfp-hflt; then
  87       ARM_FLOAT_TYPE_FLAGS='-mfloat-abi=hard -mfpu=vfp -DFLOAT_ARCH=-vfp-hflt'
  88       ARM_FLOAT_TYPE_ASFLAGS="-mfloat-abi=hard -mfpu=vfp"
  89     elif test "x$ARM_FLOAT_TYPE" = xsflt; then
  90       ARM_FLOAT_TYPE_FLAGS='-msoft-float -mfpu=vfp'
  91       ARM_FLOAT_TYPE_ASFLAGS="-mfloat-abi=soft -mfpu=vfp"
  92     fi
  93     AC_MSG_CHECKING([for $ARM_FLOAT_TYPE floating point flags])
  94     AC_MSG_RESULT([$ARM_FLOAT_TYPE_FLAGS])
  95     AC_MSG_CHECKING([for $ARM_FLOAT_TYPE floating point flags for assembler])
  96     AC_MSG_RESULT([$ARM_FLOAT_TYPE_ASFLAGS])
  97 
  98     AC_MSG_CHECKING([for arch type flags])
  99     AC_MSG_RESULT([$ARM_ARCH_TYPE_FLAGS])
 100     AC_MSG_CHECKING([for arch type flags for assembler])
 101     AC_MSG_RESULT([$ARM_ARCH_TYPE_ASFLAGS])
 102 
 103     # Now set JDK_ARCH_ABI_PROP_NAME. This is equivalent to the last part of the
 104     # autoconf target triplet.
 105     [ JDK_ARCH_ABI_PROP_NAME=`$ECHO $OPENJDK_TARGET_AUTOCONF_NAME | $SED -e 's/.*-\([^-]*\)$/\1/'` ]
 106     # Sanity check that it is a known ABI.
 107     if test "x$JDK_ARCH_ABI_PROP_NAME" != xgnu && \
 108         test "x$JDK_ARCH_ABI_PROP_NAME" != xgnueabi  && \
 109         test "x$JDK_ARCH_ABI_PROP_NAME" != xgnueabihf; then
 110           AC_MSG_WARN([Unknown autoconf target triplet ABI: "$JDK_ARCH_ABI_PROP_NAME"])
 111     fi
 112     AC_MSG_CHECKING([for ABI property name])
 113     AC_MSG_RESULT([$JDK_ARCH_ABI_PROP_NAME])
 114     AC_SUBST(JDK_ARCH_ABI_PROP_NAME)
 115   fi
 116 
 117   # When building with an abi profile, the name of that profile is appended on the
 118   # bundle platform, which is used in bundle names.
 119   if test "x$OPENJDK_TARGET_ABI_PROFILE" != x; then
 120     OPENJDK_TARGET_BUNDLE_PLATFORM="$OPENJDK_TARGET_OS_BUNDLE-$OPENJDK_TARGET_ABI_PROFILE"
 121   fi
 122 ])
 123 
 124 AC_DEFUN([FLAGS_SETUP_MACOSX_VERSION],
 125 [
 126   # Additional macosx handling
 127   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
 128     # MACOSX_VERSION_MIN specifies the lowest version of Macosx that the built
 129     # binaries should be compatible with, even if compiled on a newer version
 130     # of the OS. It currently has a hard coded value. Setting this also limits
 131     # exposure to API changes in header files. Bumping this is likely to
 132     # require code changes to build.
 133     MACOSX_VERSION_MIN=10.9.0
 134     MACOSX_VERSION_MIN_NODOTS=${MACOSX_VERSION_MIN//\./}
 135 
 136     AC_SUBST(MACOSX_VERSION_MIN)
 137 
 138     # Setting --with-macosx-version-max=<version> makes it an error to build or
 139     # link to macosx APIs that are newer than the given OS version. The expected
 140     # format for <version> is either nn.n.n or nn.nn.nn. See /usr/include/AvailabilityMacros.h.
 141     AC_ARG_WITH([macosx-version-max], [AS_HELP_STRING([--with-macosx-version-max],
 142         [error on use of newer functionality. @<:@macosx@:>@])],
 143         [
 144           if echo "$with_macosx_version_max" | $GREP -q "^[[0-9]][[0-9]]\.[[0-9]]\.[[0-9]]\$"; then
 145               MACOSX_VERSION_MAX=$with_macosx_version_max
 146           elif echo "$with_macosx_version_max" | $GREP -q "^[[0-9]][[0-9]]\.[[0-9]][[0-9]]\.[[0-9]][[0-9]]\$"; then
 147               MACOSX_VERSION_MAX=$with_macosx_version_max
 148           elif test "x$with_macosx_version_max" = "xno"; then
 149               # Use build system default
 150               MACOSX_VERSION_MAX=
 151           else
 152               AC_MSG_ERROR([osx version format must be nn.n.n or nn.nn.nn])
 153           fi
 154         ],
 155         [MACOSX_VERSION_MAX=]
 156     )
 157     MACOSX_VERSION_MAX_NODOTS=${MACOSX_VERSION_MAX//\./}
 158 
 159     AC_SUBST(MACOSX_VERSION_MAX)
 160   fi
 161 ])
 162 
 163 # Reset the global CFLAGS/LDFLAGS variables and initialize them with the
 164 # corresponding configure arguments instead
 165 AC_DEFUN_ONCE([FLAGS_SETUP_USER_SUPPLIED_FLAGS],
 166 [
 167   if test "x$CFLAGS" != "x"; then
 168     AC_MSG_WARN([Ignoring CFLAGS($CFLAGS) found in environment. Use --with-extra-cflags])
 169   fi
 170 
 171   if test "x$CXXFLAGS" != "x"; then
 172     AC_MSG_WARN([Ignoring CXXFLAGS($CXXFLAGS) found in environment. Use --with-extra-cxxflags])
 173   fi
 174 
 175   if test "x$LDFLAGS" != "x"; then
 176     AC_MSG_WARN([Ignoring LDFLAGS($LDFLAGS) found in environment. Use --with-extra-ldflags])
 177   fi
 178 
 179   AC_ARG_WITH(extra-cflags, [AS_HELP_STRING([--with-extra-cflags],
 180       [extra flags to be used when compiling jdk c-files])])
 181 
 182   AC_ARG_WITH(extra-cxxflags, [AS_HELP_STRING([--with-extra-cxxflags],
 183       [extra flags to be used when compiling jdk c++-files])])
 184 
 185   AC_ARG_WITH(extra-ldflags, [AS_HELP_STRING([--with-extra-ldflags],
 186       [extra flags to be used when linking jdk])])
 187 
 188   USER_CFLAGS="$with_extra_cflags"
 189   USER_CXXFLAGS="$with_extra_cxxflags"
 190   USER_LDFLAGS="$with_extra_ldflags"
 191 ])
 192 
 193 # Setup the sysroot flags and add them to global CFLAGS and LDFLAGS so
 194 # that configure can use them while detecting compilers.
 195 # TOOLCHAIN_TYPE is available here.
 196 # Param 1 - Optional prefix to all variables. (e.g BUILD_)
 197 AC_DEFUN([FLAGS_SETUP_SYSROOT_FLAGS],
 198 [
 199   if test "x[$]$1SYSROOT" != "x"; then
 200     if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
 201       if test "x$OPENJDK_TARGET_OS" = xsolaris; then
 202         # Solaris Studio does not have a concept of sysroot. Instead we must
 203         # make sure the default include and lib dirs are appended to each
 204         # compile and link command line. Must also add -I-xbuiltin to enable
 205         # inlining of system functions and intrinsics.
 206         $1SYSROOT_CFLAGS="-I-xbuiltin -I[$]$1SYSROOT/usr/include"
 207         $1SYSROOT_LDFLAGS="-L[$]$1SYSROOT/usr/lib$OPENJDK_TARGET_CPU_ISADIR \
 208             -L[$]$1SYSROOT/lib$OPENJDK_TARGET_CPU_ISADIR"
 209         # If the devkit contains the ld linker, make sure we use it.
 210         AC_PATH_PROG(SOLARIS_LD, ld, , $DEVKIT_TOOLCHAIN_PATH:$DEVKIT_EXTRA_PATH)
 211         # Make sure this ld is runnable.
 212         if test -f "$SOLARIS_LD"; then
 213           if "$SOLARIS_LD" -V > /dev/null 2> /dev/null; then
 214             $1SYSROOT_LDFLAGS="[$]$1SYSROOT_LDFLAGS -Yl,$(dirname $SOLARIS_LD)"
 215           else
 216             AC_MSG_WARN([Could not run $SOLARIS_LD found in devkit, reverting to system ld])
 217           fi
 218         fi
 219       fi
 220     elif test "x$TOOLCHAIN_TYPE" = xgcc; then
 221       $1SYSROOT_CFLAGS="--sysroot=[$]$1SYSROOT"
 222       $1SYSROOT_LDFLAGS="--sysroot=[$]$1SYSROOT"
 223     elif test "x$TOOLCHAIN_TYPE" = xclang; then
 224       $1SYSROOT_CFLAGS="-isysroot [$]$1SYSROOT"
 225       $1SYSROOT_LDFLAGS="-isysroot [$]$1SYSROOT"
 226     fi
 227   fi
 228 
 229   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
 230     # We also need -iframework<path>/System/Library/Frameworks
 231     $1SYSROOT_CFLAGS="[$]$1SYSROOT_CFLAGS -iframework [$]$1SYSROOT/System/Library/Frameworks"
 232     $1SYSROOT_LDFLAGS="[$]$1SYSROOT_LDFLAGS -iframework [$]$1SYSROOT/System/Library/Frameworks"
 233     # These always need to be set, or we can't find the frameworks embedded in JavaVM.framework
 234     # set this here so it doesn't have to be peppered throughout the forest
 235     $1SYSROOT_CFLAGS="[$]$1SYSROOT_CFLAGS -F [$]$1SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks"
 236     $1SYSROOT_LDFLAGS="[$]$1SYSROOT_LDFLAGS -F [$]$1SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks"
 237   fi
 238 
 239   AC_SUBST($1SYSROOT_CFLAGS)
 240   AC_SUBST($1SYSROOT_LDFLAGS)
 241 ])
 242 
 243 AC_DEFUN_ONCE([FLAGS_PRE_TOOLCHAIN],
 244 [
 245   # We should always include user supplied flags
 246   FLAGS_SETUP_USER_SUPPLIED_FLAGS
 247   # The sysroot flags are needed for configure to be able to run the compilers
 248   FLAGS_SETUP_SYSROOT_FLAGS
 249 
 250   # For solstudio and xlc, the word size flag is required for correct behavior.
 251   # For clang/gcc, the flag is only strictly required for reduced builds, but
 252   # set it always where possible (x86, sparc and ppc).
 253   if test "x$TOOLCHAIN_TYPE" = xxlc; then
 254     MACHINE_FLAG="-q${OPENJDK_TARGET_CPU_BITS}"
 255   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
 256     MACHINE_FLAG="-m${OPENJDK_TARGET_CPU_BITS}"
 257   elif test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
 258     if test "x$OPENJDK_TARGET_CPU_ARCH" = xx86 &&
 259         test "x$OPENJDK_TARGET_CPU" != xx32 ||
 260         test "x$OPENJDK_TARGET_CPU_ARCH" = xsparc ||
 261         test "x$OPENJDK_TARGET_CPU_ARCH" = xppc; then
 262       MACHINE_FLAG="-m${OPENJDK_TARGET_CPU_BITS}"
 263     fi
 264   fi
 265 
 266   # FIXME: global flags are not used yet...
 267   # The "global" flags will *always* be set. Without them, it is not possible to
 268   # get a working compilation.
 269   GLOBAL_CFLAGS="$MACHINE_FLAG $SYSROOT_CFLAGS $USER_CFLAGS"
 270   GLOBAL_CXXFLAGS="$MACHINE_FLAG $SYSROOT_CFLAGS $USER_CXXFLAGS"
 271   GLOBAL_LDFLAGS="$MACHINE_FLAG $SYSROOT_LDFLAGS $USER_LDFLAGS"
 272   # FIXME: Don't really know how to do with this, but this was the old behavior
 273   GLOBAL_CPPFLAGS="$SYSROOT_CFLAGS"
 274   AC_SUBST(GLOBAL_CFLAGS)
 275   AC_SUBST(GLOBAL_CXXFLAGS)
 276   AC_SUBST(GLOBAL_LDFLAGS)
 277   AC_SUBST(GLOBAL_CPPFLAGS)
 278 
 279   # FIXME: For compatilibity, export this as EXTRA_CFLAGS for now.
 280   EXTRA_CFLAGS="$MACHINE_FLAG $USER_CFLAGS"
 281   EXTRA_CXXFLAGS="$MACHINE_FLAG $USER_CXXFLAGS"
 282   EXTRA_LDFLAGS="$MACHINE_FLAG $USER_LDFLAGS"
 283 
 284   AC_SUBST(EXTRA_CFLAGS)
 285   AC_SUBST(EXTRA_CXXFLAGS)
 286   AC_SUBST(EXTRA_LDFLAGS)
 287 
 288   # For autoconf testing to work, the global flags must also be stored in the
 289   # "unnamed" CFLAGS etc.
 290   CFLAGS="$GLOBAL_CFLAGS"
 291   CXXFLAGS="$GLOBAL_CXXFLAGS"
 292   LDFLAGS="$GLOBAL_LDFLAGS"
 293   CPPFLAGS="$GLOBAL_CPPFLAGS"
 294 ])
 295 
 296 AC_DEFUN([FLAGS_SETUP_TOOLCHAIN_CONTROL],
 297 [
 298   # COMPILER_TARGET_BITS_FLAG  : option for selecting 32- or 64-bit output
 299   # COMPILER_COMMAND_FILE_FLAG : option for passing a command file to the compiler
 300   # COMPILER_BINDCMD_FILE_FLAG : option for specifying a file which saves the binder
 301   #                              commands produced by the link step (currently AIX only)
 302   if test "x$TOOLCHAIN_TYPE" = xxlc; then
 303     COMPILER_TARGET_BITS_FLAG="-q"
 304     COMPILER_COMMAND_FILE_FLAG="-f"
 305     COMPILER_BINDCMD_FILE_FLAG="-bloadmap:"
 306   else
 307     COMPILER_TARGET_BITS_FLAG="-m"
 308     COMPILER_COMMAND_FILE_FLAG="@"
 309     COMPILER_BINDCMD_FILE_FLAG=""
 310 
 311     # The solstudio linker does not support @-files.
 312     if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
 313       COMPILER_COMMAND_FILE_FLAG=
 314     fi
 315 
 316     # Check if @file is supported by gcc
 317     if test "x$TOOLCHAIN_TYPE" = xgcc; then
 318       AC_MSG_CHECKING([if @file is supported by gcc])
 319       # Extra emtpy "" to prevent ECHO from interpreting '--version' as argument
 320       $ECHO "" "--version" > command.file
 321       if $CXX @command.file 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD; then
 322         AC_MSG_RESULT(yes)
 323         COMPILER_COMMAND_FILE_FLAG="@"
 324       else
 325         AC_MSG_RESULT(no)
 326         COMPILER_COMMAND_FILE_FLAG=
 327       fi
 328       $RM command.file
 329     fi
 330   fi
 331 
 332   AC_SUBST(COMPILER_TARGET_BITS_FLAG)
 333   AC_SUBST(COMPILER_COMMAND_FILE_FLAG)
 334   AC_SUBST(COMPILER_BINDCMD_FILE_FLAG)
 335 
 336   # Check that the compiler supports -mX (or -qX on AIX) flags
 337   # Set COMPILER_SUPPORTS_TARGET_BITS_FLAG to 'true' if it does
 338   FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}],
 339       IF_TRUE: [COMPILER_SUPPORTS_TARGET_BITS_FLAG=true],
 340       IF_FALSE: [COMPILER_SUPPORTS_TARGET_BITS_FLAG=false])
 341   AC_SUBST(COMPILER_SUPPORTS_TARGET_BITS_FLAG)
 342 
 343   if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
 344     CC_OUT_OPTION=-Fo
 345     LD_OUT_OPTION=-out:
 346     AR_OUT_OPTION=-out:
 347   else
 348     # The option used to specify the target .o,.a or .so file.
 349     # When compiling, how to specify the to be created object file.
 350     CC_OUT_OPTION='-o$(SPACE)'
 351     # When linking, how to specify the output
 352     LD_OUT_OPTION='-o$(SPACE)'
 353     # When archiving, how to specify the destination static archive.
 354     if test "x$OPENJDK_TARGET_OS" = xmacosx; then
 355       AR_OUT_OPTION='-r -cs$(SPACE)'
 356     else
 357       AR_OUT_OPTION='-rcs$(SPACE)'
 358     fi
 359   fi
 360   AC_SUBST(CC_OUT_OPTION)
 361   AC_SUBST(LD_OUT_OPTION)
 362   AC_SUBST(AR_OUT_OPTION)
 363 
 364   # Generate make dependency files
 365   if test "x$TOOLCHAIN_TYPE" = xgcc; then
 366     C_FLAG_DEPS="-MMD -MF"
 367   elif test "x$TOOLCHAIN_TYPE" = xclang; then
 368     C_FLAG_DEPS="-MMD -MF"
 369   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
 370     C_FLAG_DEPS="-xMMD -xMF"
 371   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
 372     C_FLAG_DEPS="-qmakedep=gcc -MF"
 373   fi
 374   CXX_FLAG_DEPS="$C_FLAG_DEPS"
 375   AC_SUBST(C_FLAG_DEPS)
 376   AC_SUBST(CXX_FLAG_DEPS)
 377 ])
 378 
 379 AC_DEFUN_ONCE([FLAGS_POST_TOOLCHAIN],
 380 [
 381   FLAGS_SETUP_TOOLCHAIN_CONTROL
 382 
 383   if test "x$BUILD_SYSROOT" != x; then
 384     FLAGS_SETUP_SYSROOT_FLAGS([BUILD_])
 385   else
 386     if test "x$COMPILE_TYPE" != "xcross"; then
 387       BUILD_SYSROOT_CFLAGS="$SYSROOT_CFLAGS"
 388       BUILD_SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS"
 389     fi
 390   fi
 391   AC_SUBST(BUILD_SYSROOT_CFLAGS)
 392   AC_SUBST(BUILD_SYSROOT_LDFLAGS)
 393 
 394 ])
 395 
 396 AC_DEFUN([FLAGS_SETUP_FLAGS],
 397 [
 398   FLAGS_SETUP_MACOSX_VERSION
 399   FLAGS_SETUP_ABI_PROFILE
 400 
 401   FLAGS_SETUP_SHARED_LIBS
 402   FLAGS_SETUP_DEBUG_SYMBOLS
 403   FLAGS_SETUP_WARNINGS
 404   FLAGS_SETUP_QUALITY_CHECKS
 405   FLAGS_SETUP_OPTIMIZATION
 406 
 407   FLAGS_SETUP_CFLAGS
 408   FLAGS_SETUP_LDFLAGS
 409 
 410   FLAGS_SETUP_ARFLAGS
 411   FLAGS_SETUP_STRIPFLAGS
 412   FLAGS_SETUP_RCFLAGS
 413 
 414   FLAGS_SETUP_ASFLAGS
 415   FLAGS_SETUP_ASFLAGS_CPU_DEP([TARGET])
 416   FLAGS_SETUP_ASFLAGS_CPU_DEP([BUILD], [OPENJDK_BUILD_])
 417 ])
 418 
 419 # FLAGS_C_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
 420 #                                  IF_FALSE: [RUN-IF-FALSE])
 421 # ------------------------------------------------------------
 422 # Check that the C compiler supports an argument
 423 BASIC_DEFUN_NAMED([FLAGS_C_COMPILER_CHECK_ARGUMENTS],
 424     [*ARGUMENT IF_TRUE IF_FALSE PREFIX], [$@],
 425 [
 426   AC_MSG_CHECKING([if ARG_PREFIX[CC] supports "ARG_ARGUMENT"])
 427   supports=yes
 428 
 429   saved_cflags="$CFLAGS"
 430   saved_cc="$CC"
 431   CFLAGS="$CFLAGS ARG_ARGUMENT"
 432   CC="$ARG_PREFIX[CC]"
 433   AC_LANG_PUSH([C])
 434   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
 435       [supports=no])
 436   AC_LANG_POP([C])
 437   CC="$saved_cc"
 438   CFLAGS="$saved_cflags"
 439 
 440   AC_MSG_RESULT([$supports])
 441   if test "x$supports" = "xyes" ; then
 442     :
 443     ARG_IF_TRUE
 444   else
 445     :
 446     ARG_IF_FALSE
 447   fi
 448 ])
 449 
 450 # FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
 451 #                                    IF_FALSE: [RUN-IF-FALSE])
 452 # ------------------------------------------------------------
 453 # Check that the C++ compiler supports an argument
 454 BASIC_DEFUN_NAMED([FLAGS_CXX_COMPILER_CHECK_ARGUMENTS],
 455     [*ARGUMENT IF_TRUE IF_FALSE PREFIX], [$@],
 456 [
 457   AC_MSG_CHECKING([if ARG_PREFIX[CXX] supports "ARG_ARGUMENT"])
 458   supports=yes
 459 
 460   saved_cxxflags="$CXXFLAGS"
 461   saved_cxx="$CXX"
 462   CXXFLAGS="$CXXFLAG ARG_ARGUMENT"
 463   CXX="$ARG_PREFIX[CXX]"
 464   AC_LANG_PUSH([C++])
 465   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
 466       [supports=no])
 467   AC_LANG_POP([C++])
 468   CXX="$saved_cxx"
 469   CXXFLAGS="$saved_cxxflags"
 470 
 471   AC_MSG_RESULT([$supports])
 472   if test "x$supports" = "xyes" ; then
 473     :
 474     ARG_IF_TRUE
 475   else
 476     :
 477     ARG_IF_FALSE
 478   fi
 479 ])
 480 
 481 # FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
 482 #                                IF_FALSE: [RUN-IF-FALSE])
 483 # ------------------------------------------------------------
 484 # Check that the C and C++ compilers support an argument
 485 BASIC_DEFUN_NAMED([FLAGS_COMPILER_CHECK_ARGUMENTS],
 486     [*ARGUMENT IF_TRUE IF_FALSE PREFIX], [$@],
 487 [
 488   FLAGS_C_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARG_ARGUMENT],
 489       IF_TRUE: [C_COMP_SUPPORTS="yes"],
 490       IF_FALSE: [C_COMP_SUPPORTS="no"],
 491       PREFIX: [ARG_PREFIX])
 492   FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARG_ARGUMENT],
 493       IF_TRUE: [CXX_COMP_SUPPORTS="yes"],
 494       IF_FALSE: [CXX_COMP_SUPPORTS="no"],
 495       PREFIX: [ARG_PREFIX])
 496 
 497   AC_MSG_CHECKING([if both ARG_PREFIX[CC] and ARG_PREFIX[CXX] support "ARG_ARGUMENT"])
 498   supports=no
 499   if test "x$C_COMP_SUPPORTS" = "xyes" -a "x$CXX_COMP_SUPPORTS" = "xyes"; then
 500     supports=yes;
 501   fi
 502 
 503   AC_MSG_RESULT([$supports])
 504   if test "x$supports" = "xyes" ; then
 505     :
 506     ARG_IF_TRUE
 507   else
 508     :
 509     ARG_IF_FALSE
 510   fi
 511 ])
 512 
 513 # FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
 514 #                                   IF_FALSE: [RUN-IF-FALSE])
 515 # ------------------------------------------------------------
 516 # Check that the linker support an argument
 517 BASIC_DEFUN_NAMED([FLAGS_LINKER_CHECK_ARGUMENTS],
 518     [*ARGUMENT IF_TRUE IF_FALSE], [$@],
 519 [
 520   AC_MSG_CHECKING([if linker supports "ARG_ARGUMENT"])
 521   supports=yes
 522 
 523   saved_ldflags="$LDFLAGS"
 524   LDFLAGS="$LDFLAGS ARG_ARGUMENT"
 525   AC_LANG_PUSH([C])
 526   AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
 527       [], [supports=no])
 528   AC_LANG_POP([C])
 529   LDFLAGS="$saved_ldflags"
 530 
 531   AC_MSG_RESULT([$supports])
 532   if test "x$supports" = "xyes" ; then
 533     :
 534     ARG_IF_TRUE
 535   else
 536     :
 537     ARG_IF_FALSE
 538   fi
 539 ])