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