--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
+"http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en">
+ <head>
+ <title>
+ Autoconf Macro: ax_cflags_gcc_option
+ </title>
+ <link rel="stylesheet" type="text/css" href="autoconf-archive.css">
+ </head>
+ <body>
+ <table summary="web navigation" style="width:100%;">
+ <tbody>
+ <tr>
+ <td style="width:25%;" align="center" valign="top">
+ <a href=
+ "http://autoconf-archive.cryp.to/ax_cflags_gcc_option.m4">Download M4
+ Source</a>
+ </td>
+ <td style="width:25%;" align="center" valign="top">
+ <a href=
+ "http://git.cryp.to/?p=autoconf-archive;a=history;f=ax_cflags_gcc_option.m4">
+ Macro History</a>
+ </td>
+ <td style="width:25%;" align="center" valign="top">
+ <a href="macros-by-category.html">Category Index</a>
+ </td>
+ <td style="width:25%;" align="center" valign="top">
+ <form method="get" action="http://www.google.com/search">
+ <div>
+ <input name="sitesearch" value="autoconf-archive.cryp.to" type=
+ "hidden"><a href="http://www.google.com/">Search</a>: <input name="q"
+ size="10" maxlength="255" type="text">
+ </div>
+ </form>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <hr>
+ <h1>
+ ax_cflags_gcc_option
+ </h1>
+ <h2>
+ Synopsis
+ </h2>
+ <p class="indent" style="white-space:nowrap;">
+ <code>AX_CFLAGS_GCC_OPTION (optionflag [,[shellvar][,[A][,[NA]]])</code>
+ </p>
+ <h2>
+ Description
+ </h2>
+ <div class="indent">
+ <p>
+ AX_CFLAGS_GCC_OPTION(-fvomit-frame) would show a message as like "checking
+ CFLAGS for gcc -fvomit-frame ... yes" and adds the optionflag to CFLAGS if
+ it is understood. You can override the shellvar-default of CFLAGS of
+ course. The order of arguments stems from the explicit macros like <a href=
+ "ax_cflags_warn_all.html">AX_CFLAGS_WARN_ALL</a>.
+ </p>
+ <p>
+ The cousin AX_CXXFLAGS_GCC_OPTION would check for an option to add to
+ CXXFLAGS - and it uses the autoconf setup for C++ instead of C (since it is
+ possible to use different compilers for C and C++).
+ </p>
+ <p>
+ The macro is a lot simpler than any special AX_CFLAGS_* macro (or
+ ac_cxx_rtti.m4 macro) but allows to check for arbitrary options. However,
+ if you use this macro in a few places, it would be great if you would make
+ up a new function-macro and submit it to the ac-archive.
+ </p>
+ <pre>
+ - $1 option-to-check-for : required ("-option" as non-value)
+ - $2 shell-variable-to-add-to : CFLAGS (or CXXFLAGS in the other case)
+ - $3 action-if-found : add value to shellvariable
+ - $4 action-if-not-found : nothing
+</pre>
+ <p>
+ Note: in earlier versions, $1-$2 were swapped. We try to detect the
+ situation and accept a $2=~/-/ as being the old option-to-check-for.
+ </p>
+ <p>
+ There are other variants that emerged from the original macro variant which
+ did just test an option to be possibly added. However, some compilers
+ accept an option silently, or possibly for just another option that was not
+ intended. Therefore, we have to do a generic test for a compiler family.
+ For gcc we check "-pedantic" being accepted which is also understood by
+ compilers who just want to be compatible with gcc even when not being made
+ from gcc sources.
+ </p>
+ <p>
+ See also: <a href="ax_cflags_sun_option.html">AX_CFLAGS_SUN_OPTION</a>,
+ <a href="ax_cflags_hpux_option.html">AX_CFLAGS_HPUX_OPTION</a>, <a href=
+ "ax_cflags_aix_option.html">AX_CFLAGS_AIX_OPTION</a>, and <a href=
+ "ax_cflags_irix_option.html">AX_CFLAGS_IRIX_OPTION</a>.
+ </p>
+ </div>
+ <h2>
+ Author
+ </h2>
+ <p class="indent">
+ Guido U. Draheim <guidod@gmx.de>
+ </p>
+ <h2>
+ Last Modified
+ </h2>
+ <p class="indent">
+ 2007-07-27
+ </p>
+ <h2>
+ Cross References
+ </h2>
+ <p class="indent">
+ <img src="group8-xrefs.png" alt="group8-xrefs.png" usemap="#group8"><map id=
+ "group8" name="group8">
+ <area shape="poly" href="ac_cxx_rtti.html" title="ac_cxx_rtti" alt=""
+ coords=
+ "814,172 817,180 825,186 838,192 855,195 873,196 892,195 908,192 921,186 930,180 933,172 930,165 921,158 908,153 892,150 873,148 855,150 838,153 825,158 817,165">
+ <area shape="poly" href="ax_cflags_aix_option.html" title=
+ "ax_cflags_aix_option" alt="" coords=
+ "5,275 10,282 24,289 45,294 73,298 103,299 133,298 160,294 181,289 195,282 200,275 195,268 181,261 160,256 133,252 103,251 73,252 45,256 24,261 10,268">
+ <area shape="poly" href="ax_cflags_gcc_option.html" title=
+ "ax_cflags_gcc_option" alt="" coords=
+ "249,275 254,282 268,289 290,294 318,298 349,299 380,298 408,294 431,289 445,282 450,275 445,268 431,261 408,256 380,252 349,251 318,252 290,256 268,261 254,268">
+ <area shape="poly" href="ax_cflags_warn_all.html" title=
+ "ax_cflags_warn_all" alt="" coords=
+ "784,347 789,354 801,361 821,366 846,370 873,371 901,370 926,366 945,361 958,354 962,347 958,340 945,333 926,328 901,324 873,323 846,324 821,328 801,333 789,340">
+ <area shape="poly" href="ax_cflags_hpux_option.html" title=
+ "ax_cflags_hpux_option" alt="" coords=
+ "512,203 517,210 532,217 555,222 585,226 617,227 650,226 679,222 703,217 718,210 723,203 718,196 703,189 679,184 650,180 617,179 585,180 555,184 532,189 517,196">
+ <area shape="poly" href="ax_cflags_irix_option.html" title=
+ "ax_cflags_irix_option" alt="" coords=
+ "519,275 524,282 538,289 559,294 587,298 617,299 648,298 675,294 697,289 711,282 716,275 711,268 697,261 675,256 648,252 617,251 587,252 559,256 538,261 524,268">
+ <area shape="poly" href="ax_cflags_sun_option.html" title=
+ "ax_cflags_sun_option" alt="" coords=
+ "517,347 522,354 536,361 559,366 586,370 617,371 648,370 676,366 698,361 712,354 717,347 712,340 698,333 676,328 648,324 617,323 586,324 559,328 536,333 522,340">
+ <area shape="poly" href="ax_cflags_warn_all_ansi.html" title=
+ "ax_cflags_warn_all_ansi" alt="" coords=
+ "1012,347 1017,354 1032,361 1056,366 1086,370 1120,371 1154,370 1184,366 1208,361 1223,354 1228,347 1223,340 1208,333 1184,328 1154,324 1120,323 1086,324 1056,328 1032,333 1017,340">
+ <area shape="poly" href="vl_prog_cc_warnings.html" title=
+ "vl_prog_cc_warnings" alt="" coords=
+ "1278,316 1282,324 1296,330 1318,336 1346,339 1376,340 1406,339 1434,336 1456,330 1470,324 1474,316 1470,309 1456,302 1434,297 1406,294 1376,292 1346,294 1318,297 1296,302 1282,309">
+ <area shape="poly" href="ax_cxx_gcc_abi_demangle.html" title=
+ "ax_cxx_gcc_abi_demangle" alt="" coords=
+ "498,30 504,37 521,44 547,49 581,52 617,54 654,52 687,49 714,44 730,37 736,30 730,22 714,16 687,10 654,7 617,6 581,7 547,10 521,16 504,22">
+ </map>
+ </p>
+ <h2>
+ M4 Source Code
+ </h2>
+ <div class="indent">
+ <pre class="m4source">
+AC_DEFUN([AX_CFLAGS_GCC_OPTION_OLD], [dnl
+AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
+AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_gcc_option_$2])dnl
+AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for gcc m4_ifval($2,$2,-option)],
+VAR,[VAR="no, unknown"
+ AC_LANG_SAVE
+ AC_LANG_C
+ ac_save_[]FLAGS="$[]FLAGS"
+for ac_arg dnl
+in "-pedantic -Werror % m4_ifval($2,$2,-option)" dnl GCC
+ "-pedantic % m4_ifval($2,$2,-option) %% no, obsolete" dnl new GCC
+ #
+do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
+ AC_TRY_COMPILE([],[return 0;],
+ [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
+done
+ FLAGS="$ac_save_[]FLAGS"
+ AC_LANG_RESTORE
+])
+case ".$VAR" in
+ .ok|.ok,*) m4_ifvaln($3,$3) ;;
+ .|.no|.no,*) m4_ifvaln($4,$4) ;;
+ *) m4_ifvaln($3,$3,[
+ if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
+ then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
+ else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
+ m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
+ fi ]) ;;
+esac
+AS_VAR_POPDEF([VAR])dnl
+AS_VAR_POPDEF([FLAGS])dnl
+])
+
+
+dnl the only difference - the LANG selection... and the default FLAGS
+
+AC_DEFUN([AX_CXXFLAGS_GCC_OPTION_OLD], [dnl
+AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
+AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_gcc_option_$2])dnl
+AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for gcc m4_ifval($2,$2,-option)],
+VAR,[VAR="no, unknown"
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ ac_save_[]FLAGS="$[]FLAGS"
+for ac_arg dnl
+in "-pedantic -Werror % m4_ifval($2,$2,-option)" dnl GCC
+ "-pedantic % m4_ifval($2,$2,-option) %% no, obsolete" dnl new GCC
+ #
+do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
+ AC_TRY_COMPILE([],[return 0;],
+ [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
+done
+ FLAGS="$ac_save_[]FLAGS"
+ AC_LANG_RESTORE
+])
+case ".$VAR" in
+ .ok|.ok,*) m4_ifvaln($3,$3) ;;
+ .|.no|.no,*) m4_ifvaln($4,$4) ;;
+ *) m4_ifvaln($3,$3,[
+ if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
+ then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
+ else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
+ m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
+ fi ]) ;;
+esac
+AS_VAR_POPDEF([VAR])dnl
+AS_VAR_POPDEF([FLAGS])dnl
+])
+
+dnl -------------------------------------------------------------------------
+
+AC_DEFUN([AX_CFLAGS_GCC_OPTION_NEW], [dnl
+AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
+AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_gcc_option_$1])dnl
+AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for gcc m4_ifval($1,$1,-option)],
+VAR,[VAR="no, unknown"
+ AC_LANG_SAVE
+ AC_LANG_C
+ ac_save_[]FLAGS="$[]FLAGS"
+for ac_arg dnl
+in "-pedantic -Werror % m4_ifval($1,$1,-option)" dnl GCC
+ "-pedantic % m4_ifval($1,$1,-option) %% no, obsolete" dnl new GCC
+ #
+do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
+ AC_TRY_COMPILE([],[return 0;],
+ [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
+done
+ FLAGS="$ac_save_[]FLAGS"
+ AC_LANG_RESTORE
+])
+case ".$VAR" in
+ .ok|.ok,*) m4_ifvaln($3,$3) ;;
+ .|.no|.no,*) m4_ifvaln($4,$4) ;;
+ *) m4_ifvaln($3,$3,[
+ if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
+ then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR])
+ else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"])
+ m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"
+ fi ]) ;;
+esac
+AS_VAR_POPDEF([VAR])dnl
+AS_VAR_POPDEF([FLAGS])dnl
+])
+
+
+dnl the only difference - the LANG selection... and the default FLAGS
+
+AC_DEFUN([AX_CXXFLAGS_GCC_OPTION_NEW], [dnl
+AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
+AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_gcc_option_$1])dnl
+AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for gcc m4_ifval($1,$1,-option)],
+VAR,[VAR="no, unknown"
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ ac_save_[]FLAGS="$[]FLAGS"
+for ac_arg dnl
+in "-pedantic -Werror % m4_ifval($1,$1,-option)" dnl GCC
+ "-pedantic % m4_ifval($1,$1,-option) %% no, obsolete" dnl new GCC
+ #
+do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
+ AC_TRY_COMPILE([],[return 0;],
+ [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
+done
+ FLAGS="$ac_save_[]FLAGS"
+ AC_LANG_RESTORE
+])
+case ".$VAR" in
+ .ok|.ok,*) m4_ifvaln($3,$3) ;;
+ .|.no|.no,*) m4_ifvaln($4,$4) ;;
+ *) m4_ifvaln($3,$3,[
+ if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
+ then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR])
+ else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"])
+ m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"
+ fi ]) ;;
+esac
+AS_VAR_POPDEF([VAR])dnl
+AS_VAR_POPDEF([FLAGS])dnl
+])
+
+AC_DEFUN([AX_CFLAGS_GCC_OPTION],[ifelse(m4_bregexp([$2],[-]),-1,
+[AX_CFLAGS_GCC_OPTION_NEW($@)],[AX_CFLAGS_GCC_OPTION_OLD($@)])])
+
+AC_DEFUN([AX_CXXFLAGS_GCC_OPTION],[ifelse(m4_bregexp([$2],[-]),-1,
+[AX_CXXFLAGS_GCC_OPTION_NEW($@)],[AX_CXXFLAGS_GCC_OPTION_OLD($@)])])
+</pre>
+ </div>
+ <h2>
+ License
+ </h2>
+ <div class="indent">
+ <span style="white-space:nowrap;">Copyright © 2007 Guido U. Draheim
+ <guidod@gmx.de></span>
+ <p>
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at your option)
+ any later version.
+ </p>
+ <p>
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+ </p>
+ <p>
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc., 59
+ Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ </p>
+ <p>
+ As a special exception, the respective Autoconf Macro's copyright owner
+ gives unlimited permission to copy, distribute and modify the configure
+ scripts that are the output of Autoconf when processing the Macro. You need
+ not follow the terms of the GNU General Public License when using or
+ distributing such scripts, even though portions of the text of the Macro
+ appear in them. The GNU General Public License (GPL) does govern all other
+ use of the material that constitutes the Autoconf Macro.
+ </p>
+ <p>
+ This special exception to the GPL applies to versions of the Autoconf Macro
+ released by the Autoconf Macro Archive. When you make and distribute a
+ modified version of the Autoconf Macro, you may extend this special
+ exception to the GPL to apply to your modified version as well.
+ </p>
+ </div>
+ </body>
+</html>
--- /dev/null
+##### http://autoconf-archive.cryp.to/ax_cflags_gcc_option.html
+#
+# SYNOPSIS
+#
+# AX_CFLAGS_GCC_OPTION (optionflag [,[shellvar][,[A][,[NA]]])
+#
+# DESCRIPTION
+#
+# AX_CFLAGS_GCC_OPTION(-fvomit-frame) would show a message as like
+# "checking CFLAGS for gcc -fvomit-frame ... yes" and adds the
+# optionflag to CFLAGS if it is understood. You can override the
+# shellvar-default of CFLAGS of course. The order of arguments stems
+# from the explicit macros like AX_CFLAGS_WARN_ALL.
+#
+# The cousin AX_CXXFLAGS_GCC_OPTION would check for an option to add
+# to CXXFLAGS - and it uses the autoconf setup for C++ instead of C
+# (since it is possible to use different compilers for C and C++).
+#
+# The macro is a lot simpler than any special AX_CFLAGS_* macro (or
+# ac_cxx_rtti.m4 macro) but allows to check for arbitrary options.
+# However, if you use this macro in a few places, it would be great
+# if you would make up a new function-macro and submit it to the
+# ac-archive.
+#
+# - $1 option-to-check-for : required ("-option" as non-value)
+# - $2 shell-variable-to-add-to : CFLAGS (or CXXFLAGS in the other case)
+# - $3 action-if-found : add value to shellvariable
+# - $4 action-if-not-found : nothing
+#
+# Note: in earlier versions, $1-$2 were swapped. We try to detect the
+# situation and accept a $2=~/-/ as being the old
+# option-to-check-for.
+#
+# There are other variants that emerged from the original macro
+# variant which did just test an option to be possibly added.
+# However, some compilers accept an option silently, or possibly for
+# just another option that was not intended. Therefore, we have to do
+# a generic test for a compiler family. For gcc we check "-pedantic"
+# being accepted which is also understood by compilers who just want
+# to be compatible with gcc even when not being made from gcc
+# sources.
+#
+# See also: AX_CFLAGS_SUN_OPTION, AX_CFLAGS_HPUX_OPTION,
+# AX_CFLAGS_AIX_OPTION, and AX_CFLAGS_IRIX_OPTION.
+#
+# LAST MODIFICATION
+#
+# 2007-07-27
+#
+# COPYLEFT
+#
+# Copyright (c) 2007 Guido U. Draheim <guidod@gmx.de>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+#
+# As a special exception, the respective Autoconf Macro's copyright
+# owner gives unlimited permission to copy, distribute and modify the
+# configure scripts that are the output of Autoconf when processing
+# the Macro. You need not follow the terms of the GNU General Public
+# License when using or distributing such scripts, even though
+# portions of the text of the Macro appear in them. The GNU General
+# Public License (GPL) does govern all other use of the material that
+# constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the
+# Autoconf Macro released by the Autoconf Macro Archive. When you
+# make and distribute a modified version of the Autoconf Macro, you
+# may extend this special exception to the GPL to apply to your
+# modified version as well.
+
+AC_DEFUN([AX_CFLAGS_GCC_OPTION_OLD], [dnl
+AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
+AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_gcc_option_$2])dnl
+AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for gcc m4_ifval($2,$2,-option)],
+VAR,[VAR="no, unknown"
+ AC_LANG_SAVE
+ AC_LANG_C
+ ac_save_[]FLAGS="$[]FLAGS"
+for ac_arg dnl
+in "-pedantic -Werror % m4_ifval($2,$2,-option)" dnl GCC
+ "-pedantic % m4_ifval($2,$2,-option) %% no, obsolete" dnl new GCC
+ #
+do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
+ AC_TRY_COMPILE([],[return 0;],
+ [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
+done
+ FLAGS="$ac_save_[]FLAGS"
+ AC_LANG_RESTORE
+])
+case ".$VAR" in
+ .ok|.ok,*) m4_ifvaln($3,$3) ;;
+ .|.no|.no,*) m4_ifvaln($4,$4) ;;
+ *) m4_ifvaln($3,$3,[
+ if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
+ then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
+ else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
+ m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
+ fi ]) ;;
+esac
+AS_VAR_POPDEF([VAR])dnl
+AS_VAR_POPDEF([FLAGS])dnl
+])
+
+
+dnl the only difference - the LANG selection... and the default FLAGS
+
+AC_DEFUN([AX_CXXFLAGS_GCC_OPTION_OLD], [dnl
+AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
+AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_gcc_option_$2])dnl
+AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for gcc m4_ifval($2,$2,-option)],
+VAR,[VAR="no, unknown"
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ ac_save_[]FLAGS="$[]FLAGS"
+for ac_arg dnl
+in "-pedantic -Werror % m4_ifval($2,$2,-option)" dnl GCC
+ "-pedantic % m4_ifval($2,$2,-option) %% no, obsolete" dnl new GCC
+ #
+do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
+ AC_TRY_COMPILE([],[return 0;],
+ [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
+done
+ FLAGS="$ac_save_[]FLAGS"
+ AC_LANG_RESTORE
+])
+case ".$VAR" in
+ .ok|.ok,*) m4_ifvaln($3,$3) ;;
+ .|.no|.no,*) m4_ifvaln($4,$4) ;;
+ *) m4_ifvaln($3,$3,[
+ if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
+ then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
+ else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
+ m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
+ fi ]) ;;
+esac
+AS_VAR_POPDEF([VAR])dnl
+AS_VAR_POPDEF([FLAGS])dnl
+])
+
+dnl -------------------------------------------------------------------------
+
+AC_DEFUN([AX_CFLAGS_GCC_OPTION_NEW], [dnl
+AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
+AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_gcc_option_$1])dnl
+AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for gcc m4_ifval($1,$1,-option)],
+VAR,[VAR="no, unknown"
+ AC_LANG_SAVE
+ AC_LANG_C
+ ac_save_[]FLAGS="$[]FLAGS"
+for ac_arg dnl
+in "-pedantic -Werror % m4_ifval($1,$1,-option)" dnl GCC
+ "-pedantic % m4_ifval($1,$1,-option) %% no, obsolete" dnl new GCC
+ #
+do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
+ AC_TRY_COMPILE([],[return 0;],
+ [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
+done
+ FLAGS="$ac_save_[]FLAGS"
+ AC_LANG_RESTORE
+])
+case ".$VAR" in
+ .ok|.ok,*) m4_ifvaln($3,$3) ;;
+ .|.no|.no,*) m4_ifvaln($4,$4) ;;
+ *) m4_ifvaln($3,$3,[
+ if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
+ then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR])
+ else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"])
+ m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"
+ fi ]) ;;
+esac
+AS_VAR_POPDEF([VAR])dnl
+AS_VAR_POPDEF([FLAGS])dnl
+])
+
+
+dnl the only difference - the LANG selection... and the default FLAGS
+
+AC_DEFUN([AX_CXXFLAGS_GCC_OPTION_NEW], [dnl
+AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
+AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_gcc_option_$1])dnl
+AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for gcc m4_ifval($1,$1,-option)],
+VAR,[VAR="no, unknown"
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ ac_save_[]FLAGS="$[]FLAGS"
+for ac_arg dnl
+in "-pedantic -Werror % m4_ifval($1,$1,-option)" dnl GCC
+ "-pedantic % m4_ifval($1,$1,-option) %% no, obsolete" dnl new GCC
+ #
+do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
+ AC_TRY_COMPILE([],[return 0;],
+ [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
+done
+ FLAGS="$ac_save_[]FLAGS"
+ AC_LANG_RESTORE
+])
+case ".$VAR" in
+ .ok|.ok,*) m4_ifvaln($3,$3) ;;
+ .|.no|.no,*) m4_ifvaln($4,$4) ;;
+ *) m4_ifvaln($3,$3,[
+ if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
+ then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR])
+ else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"])
+ m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"
+ fi ]) ;;
+esac
+AS_VAR_POPDEF([VAR])dnl
+AS_VAR_POPDEF([FLAGS])dnl
+])
+
+AC_DEFUN([AX_CFLAGS_GCC_OPTION],[ifelse(m4_bregexp([$2],[-]),-1,
+[AX_CFLAGS_GCC_OPTION_NEW($@)],[AX_CFLAGS_GCC_OPTION_OLD($@)])])
+
+AC_DEFUN([AX_CXXFLAGS_GCC_OPTION],[ifelse(m4_bregexp([$2],[-]),-1,
+[AX_CXXFLAGS_GCC_OPTION_NEW($@)],[AX_CXXFLAGS_GCC_OPTION_OLD($@)])])