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 &&
 241         test "x$OPENJDK_TARGET_CPU" != xriscv64; then
 242       MACHINE_FLAG="-m${OPENJDK_TARGET_CPU_BITS}"
 243     fi
 244   fi
 245 
 246   # FIXME: global flags are not used yet...
 247   # The "global" flags will *always* be set. Without them, it is not possible to
 248   # get a working compilation.
 249   GLOBAL_CFLAGS="$MACHINE_FLAG $SYSROOT_CFLAGS $USER_CFLAGS"
 250   GLOBAL_CXXFLAGS="$MACHINE_FLAG $SYSROOT_CFLAGS $USER_CXXFLAGS"
 251   GLOBAL_LDFLAGS="$MACHINE_FLAG $SYSROOT_LDFLAGS $USER_LDFLAGS"
 252   # FIXME: Don't really know how to do with this, but this was the old behavior
 253   GLOBAL_CPPFLAGS="$SYSROOT_CFLAGS"
 254   AC_SUBST(GLOBAL_CFLAGS)
 255   AC_SUBST(GLOBAL_CXXFLAGS)
 256   AC_SUBST(GLOBAL_LDFLAGS)
 257   AC_SUBST(GLOBAL_CPPFLAGS)
 258 
 259   # FIXME: For compatilibity, export this as EXTRA_CFLAGS for now.
 260   EXTRA_CFLAGS="$MACHINE_FLAG $USER_CFLAGS"
 261   EXTRA_CXXFLAGS="$MACHINE_FLAG $USER_CXXFLAGS"
 262   EXTRA_LDFLAGS="$MACHINE_FLAG $USER_LDFLAGS"
 263 
 264   AC_SUBST(EXTRA_CFLAGS)
 265   AC_SUBST(EXTRA_CXXFLAGS)
 266   AC_SUBST(EXTRA_LDFLAGS)
 267 
 268   # For autoconf testing to work, the global flags must also be stored in the
 269   # "unnamed" CFLAGS etc.
 270   CFLAGS="$GLOBAL_CFLAGS"
 271   CXXFLAGS="$GLOBAL_CXXFLAGS"
 272   LDFLAGS="$GLOBAL_LDFLAGS"
 273   CPPFLAGS="$GLOBAL_CPPFLAGS"
 274 ])
 275 
 276 AC_DEFUN([FLAGS_SETUP_TOOLCHAIN_CONTROL],
 277 [
 278   # COMPILER_TARGET_BITS_FLAG  : option for selecting 32- or 64-bit output
 279   # COMPILER_COMMAND_FILE_FLAG : option for passing a command file to the compiler
 280   # COMPILER_BINDCMD_FILE_FLAG : option for specifying a file which saves the binder
 281   #                              commands produced by the link step (currently AIX only)
 282   if test "x$TOOLCHAIN_TYPE" = xxlc; then
 283     COMPILER_TARGET_BITS_FLAG="-q"
 284     COMPILER_COMMAND_FILE_FLAG="-f"
 285     COMPILER_BINDCMD_FILE_FLAG="-bloadmap:"
 286   else
 287     COMPILER_TARGET_BITS_FLAG="-m"
 288     COMPILER_COMMAND_FILE_FLAG="@"
 289     COMPILER_BINDCMD_FILE_FLAG=""
 290 
 291     # The solstudio linker does not support @-files.
 292     if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
 293       COMPILER_COMMAND_FILE_FLAG=
 294     fi
 295 
 296     # Check if @file is supported by gcc
 297     if test "x$TOOLCHAIN_TYPE" = xgcc; then
 298       AC_MSG_CHECKING([if @file is supported by gcc])
 299       # Extra emtpy "" to prevent ECHO from interpreting '--version' as argument
 300       $ECHO "" "--version" > command.file
 301       if $CXX @command.file 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD; then
 302         AC_MSG_RESULT(yes)
 303         COMPILER_COMMAND_FILE_FLAG="@"
 304       else
 305         AC_MSG_RESULT(no)
 306         COMPILER_COMMAND_FILE_FLAG=
 307       fi
 308       $RM command.file
 309     fi
 310   fi
 311 
 312   AC_SUBST(COMPILER_TARGET_BITS_FLAG)
 313   AC_SUBST(COMPILER_COMMAND_FILE_FLAG)
 314   AC_SUBST(COMPILER_BINDCMD_FILE_FLAG)
 315 
 316   # Check that the compiler supports -mX (or -qX on AIX) flags
 317   # Set COMPILER_SUPPORTS_TARGET_BITS_FLAG to 'true' if it does
 318   FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}],
 319       IF_TRUE: [COMPILER_SUPPORTS_TARGET_BITS_FLAG=true],
 320       IF_FALSE: [COMPILER_SUPPORTS_TARGET_BITS_FLAG=false])
 321   AC_SUBST(COMPILER_SUPPORTS_TARGET_BITS_FLAG)
 322 
 323   if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
 324     CC_OUT_OPTION=-Fo
 325     EXE_OUT_OPTION=-out:
 326     LD_OUT_OPTION=-out:
 327     AR_OUT_OPTION=-out:
 328   else
 329     # The option used to specify the target .o,.a or .so file.
 330     # When compiling, how to specify the to be created object file.
 331     CC_OUT_OPTION='-o$(SPACE)'
 332     # When linking, how to specify the to be created executable.
 333     EXE_OUT_OPTION='-o$(SPACE)'
 334     # When linking, how to specify the to be created dynamically linkable library.
 335     LD_OUT_OPTION='-o$(SPACE)'
 336     # When archiving, how to specify the to be create static archive for object files.
 337     AR_OUT_OPTION='rcs$(SPACE)'
 338   fi
 339   AC_SUBST(CC_OUT_OPTION)
 340   AC_SUBST(EXE_OUT_OPTION)
 341   AC_SUBST(LD_OUT_OPTION)
 342   AC_SUBST(AR_OUT_OPTION)
 343 
 344   # Generate make dependency files
 345   if test "x$TOOLCHAIN_TYPE" = xgcc; then
 346     C_FLAG_DEPS="-MMD -MF"
 347   elif test "x$TOOLCHAIN_TYPE" = xclang; then
 348     C_FLAG_DEPS="-MMD -MF"
 349   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
 350     C_FLAG_DEPS="-xMMD -xMF"
 351   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
 352     C_FLAG_DEPS="-qmakedep=gcc -MF"
 353   fi
 354   CXX_FLAG_DEPS="$C_FLAG_DEPS"
 355   AC_SUBST(C_FLAG_DEPS)
 356   AC_SUBST(CXX_FLAG_DEPS)
 357 ])
 358 
 359 AC_DEFUN_ONCE([FLAGS_POST_TOOLCHAIN],
 360 [
 361   FLAGS_SETUP_TOOLCHAIN_CONTROL
 362 
 363   if test "x$BUILD_SYSROOT" != x; then
 364     FLAGS_SETUP_SYSROOT_FLAGS([BUILD_])
 365   else
 366     if test "x$COMPILE_TYPE" != "xcross"; then
 367       BUILD_SYSROOT_CFLAGS="$SYSROOT_CFLAGS"
 368       BUILD_SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS"
 369     fi
 370   fi
 371   AC_SUBST(BUILD_SYSROOT_CFLAGS)
 372   AC_SUBST(BUILD_SYSROOT_LDFLAGS)
 373 
 374 ])
 375 
 376 AC_DEFUN([FLAGS_SETUP_FLAGS],
 377 [
 378   FLAGS_SETUP_MACOSX_VERSION
 379   FLAGS_SETUP_ABI_PROFILE
 380 
 381   FLAGS_SETUP_SHARED_LIBS
 382   FLAGS_SETUP_DEBUG_SYMBOLS
 383   FLAGS_SETUP_WARNINGS
 384   FLAGS_SETUP_QUALITY_CHECKS
 385   FLAGS_SETUP_OPTIMIZATION
 386 
 387   FLAGS_SETUP_CFLAGS
 388   FLAGS_SETUP_LDFLAGS
 389 
 390   FLAGS_SETUP_ARFLAGS
 391   FLAGS_SETUP_STRIPFLAGS
 392   FLAGS_SETUP_RCFLAGS
 393 
 394   FLAGS_SETUP_ASFLAGS
 395   FLAGS_SETUP_ASFLAGS_CPU_DEP([TARGET])
 396   FLAGS_SETUP_ASFLAGS_CPU_DEP([BUILD], [OPENJDK_BUILD_])
 397 ])
 398 
 399 # FLAGS_C_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
 400 #                                  IF_FALSE: [RUN-IF-FALSE])
 401 # ------------------------------------------------------------
 402 # Check that the C compiler supports an argument
 403 BASIC_DEFUN_NAMED([FLAGS_C_COMPILER_CHECK_ARGUMENTS],
 404     [*ARGUMENT IF_TRUE IF_FALSE], [$@],
 405 [
 406   AC_MSG_CHECKING([if the C compiler supports "ARG_ARGUMENT"])
 407   supports=yes
 408 
 409   saved_cflags="$CFLAGS"
 410   CFLAGS="$CFLAGS ARG_ARGUMENT"
 411   AC_LANG_PUSH([C])
 412   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
 413       [supports=no])
 414   AC_LANG_POP([C])
 415   CFLAGS="$saved_cflags"
 416 
 417   AC_MSG_RESULT([$supports])
 418   if test "x$supports" = "xyes" ; then
 419     :
 420     ARG_IF_TRUE
 421   else
 422     :
 423     ARG_IF_FALSE
 424   fi
 425 ])
 426 
 427 # FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
 428 #                                    IF_FALSE: [RUN-IF-FALSE])
 429 # ------------------------------------------------------------
 430 # Check that the C++ compiler supports an argument
 431 BASIC_DEFUN_NAMED([FLAGS_CXX_COMPILER_CHECK_ARGUMENTS],
 432     [*ARGUMENT IF_TRUE IF_FALSE], [$@],
 433 [
 434   AC_MSG_CHECKING([if the C++ compiler supports "ARG_ARGUMENT"])
 435   supports=yes
 436 
 437   saved_cxxflags="$CXXFLAGS"
 438   CXXFLAGS="$CXXFLAG ARG_ARGUMENT"
 439   AC_LANG_PUSH([C++])
 440   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
 441       [supports=no])
 442   AC_LANG_POP([C++])
 443   CXXFLAGS="$saved_cxxflags"
 444 
 445   AC_MSG_RESULT([$supports])
 446   if test "x$supports" = "xyes" ; then
 447     :
 448     ARG_IF_TRUE
 449   else
 450     :
 451     ARG_IF_FALSE
 452   fi
 453 ])
 454 
 455 # FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
 456 #                                IF_FALSE: [RUN-IF-FALSE])
 457 # ------------------------------------------------------------
 458 # Check that the C and C++ compilers support an argument
 459 BASIC_DEFUN_NAMED([FLAGS_COMPILER_CHECK_ARGUMENTS],
 460     [*ARGUMENT IF_TRUE IF_FALSE], [$@],
 461 [
 462   FLAGS_C_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARG_ARGUMENT],
 463                                              IF_TRUE: [C_COMP_SUPPORTS="yes"],
 464                                              IF_FALSE: [C_COMP_SUPPORTS="no"])
 465   FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARG_ARGUMENT],
 466                                                IF_TRUE: [CXX_COMP_SUPPORTS="yes"],
 467                                                IF_FALSE: [CXX_COMP_SUPPORTS="no"])
 468 
 469   AC_MSG_CHECKING([if both compilers support "ARG_ARGUMENT"])
 470   supports=no
 471   if test "x$C_COMP_SUPPORTS" = "xyes" -a "x$CXX_COMP_SUPPORTS" = "xyes"; then supports=yes; fi
 472 
 473   AC_MSG_RESULT([$supports])
 474   if test "x$supports" = "xyes" ; then
 475     :
 476     ARG_IF_TRUE
 477   else
 478     :
 479     ARG_IF_FALSE
 480   fi
 481 ])
 482 
 483 # FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
 484 #                                   IF_FALSE: [RUN-IF-FALSE])
 485 # ------------------------------------------------------------
 486 # Check that the linker support an argument
 487 BASIC_DEFUN_NAMED([FLAGS_LINKER_CHECK_ARGUMENTS],
 488     [*ARGUMENT IF_TRUE IF_FALSE], [$@],
 489 [
 490   AC_MSG_CHECKING([if linker supports "ARG_ARGUMENT"])
 491   supports=yes
 492 
 493   saved_ldflags="$LDFLAGS"
 494   LDFLAGS="$LDFLAGS ARG_ARGUMENT"
 495   AC_LANG_PUSH([C])
 496   AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
 497       [], [supports=no])
 498   AC_LANG_POP([C])
 499   LDFLAGS="$saved_ldflags"
 500 
 501   AC_MSG_RESULT([$supports])
 502   if test "x$supports" = "xyes" ; then
 503     :
 504     ARG_IF_TRUE
 505   else
 506     :
 507     ARG_IF_FALSE
 508   fi
 509 ])