1 ##### http://autoconf-archive.cryp.to/ax_cxx_check_flag.html
5 # AX_CXX_CHECK_FLAG(FLAG-TO-CHECK,[PROLOGUE],[BODY],[ACTION-IF-SUCCESS],[ACTION-IF-FAILURE])
9 # This macro tests if the C++ compiler supports the flag
10 # FLAG-TO-CHECK. If successfull execute ACTION-IF-SUCCESS otherwise
11 # ACTION-IF-FAILURE. PROLOGUE and BODY are optional and should be
12 # used as in AC_LANG_PROGRAM macro.
14 # This code is inspired from KDE_CHECK_COMPILER_FLAG macro. Thanks to
15 # Bogdan Drozdowski <bogdandr@op.pl> for testing and bug fixes.
23 # Copyright (c) 2007 Francesco Salvestrini <salvestrini@users.sourceforge.net>
25 # This program is free software; you can redistribute it and/or
26 # modify it under the terms of the GNU General Public License as
27 # published by the Free Software Foundation; either version 2 of the
28 # License, or (at your option) any later version.
30 # This program is distributed in the hope that it will be useful, but
31 # WITHOUT ANY WARRANTY; without even the implied warranty of
32 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
33 # General Public License for more details.
35 # You should have received a copy of the GNU General Public License
36 # along with this program; if not, write to the Free Software
37 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
39 # As a special exception, the respective Autoconf Macro's copyright
40 # owner gives unlimited permission to copy, distribute and modify the
41 # configure scripts that are the output of Autoconf when processing
42 # the Macro. You need not follow the terms of the GNU General Public
43 # License when using or distributing such scripts, even though
44 # portions of the text of the Macro appear in them. The GNU General
45 # Public License (GPL) does govern all other use of the material that
46 # constitutes the Autoconf Macro.
48 # This special exception to the GPL applies to versions of the
49 # Autoconf Macro released by the Autoconf Macro Archive. When you
50 # make and distribute a modified version of the Autoconf Macro, you
51 # may extend this special exception to the GPL to apply to your
52 # modified version as well.
54 AC_DEFUN([AX_CXX_CHECK_FLAG],[
56 AC_REQUIRE([AC_PROG_CXX])
57 AC_REQUIRE([AC_PROG_SED])
59 flag=`echo "$1" | $SED 'y% .=/+-(){}<>:*,%_______________%'`
61 AC_CACHE_CHECK([whether the C++ compiler accepts the $1 flag],
62 [ax_cv_cxx_check_flag_$flag],[
66 save_CXXFLAGS="$CXXFLAGS"
67 CXXFLAGS="$CXXFLAGS $1"
69 AC_LANG_PROGRAM([$2],[$3])
71 eval "ax_cv_cxx_check_flag_$flag=yes"
73 eval "ax_cv_cxx_check_flag_$flag=no"
76 CXXFLAGS="$save_CXXFLAGS"
82 AS_IF([eval "test \"`echo '$ax_cv_cxx_check_flag_'$flag`\" = yes"],[