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