source: trunk/build_support/ax_cxxcpp_check_flag.m4 @ 774

Last change on this file since 774 was 774, checked in by Peter Johansson, 15 years ago

fixes #378 and also fixed so -lapr ends up in LIBS and not LDFLAGS

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Date
File size: 3.0 KB
Line 
1# ===========================================================================
2#          http://autoconf-archive.cryp.to/ax_cxxcpp_check_flag.html
3# ===========================================================================
4#
5# SYNOPSIS
6#
7#   AX_CXXCPP_CHECK_FLAG(FLAG-TO-CHECK,[PROLOGUE],[BODY],[ACTION-IF-SUCCESS],[ACTION-IF-FAILURE])
8#
9# DESCRIPTION
10#
11#   This macro tests if the C++ preprocessor supports the flag
12#   FLAG-TO-CHECK. If successfull execute ACTION-IF-SUCCESS otherwise
13#   ACTION-IF-FAILURE. PROLOGUE and BODY are optional and should be used as
14#   in AC_LANG_PROGRAM macro.
15#
16#   This code is inspired from KDE_CHECK_COMPILER_FLAG macro. Thanks to
17#   Bogdan Drozdowski <bogdandr@op.pl> for testing and bug fixes.
18#
19# LAST MODIFICATION
20#
21#   2008-04-12
22#
23# COPYLEFT
24#
25#   Copyright (c) 2008 Francesco Salvestrini <salvestrini@users.sourceforge.net>
26#
27#   This program is free software; you can redistribute it and/or modify it
28#   under the terms of the GNU General Public License as published by the
29#   Free Software Foundation; either version 2 of the License, or (at your
30#   option) any later version.
31#
32#   This program is distributed in the hope that it will be useful, but
33#   WITHOUT ANY WARRANTY; without even the implied warranty of
34#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
35#   Public License for more details.
36#
37#   You should have received a copy of the GNU General Public License along
38#   with this program. If not, see <http://www.gnu.org/licenses/>.
39#
40#   As a special exception, the respective Autoconf Macro's copyright owner
41#   gives unlimited permission to copy, distribute and modify the configure
42#   scripts that are the output of Autoconf when processing the Macro. You
43#   need not follow the terms of the GNU General Public License when using
44#   or distributing such scripts, even though portions of the text of the
45#   Macro appear in them. The GNU General Public License (GPL) does govern
46#   all other use of the material that constitutes the Autoconf Macro.
47#
48#   This special exception to the GPL applies to versions of the Autoconf
49#   Macro released by the Autoconf Macro Archive. When you make and
50#   distribute a modified version of the Autoconf Macro, you may extend this
51#   special exception to the GPL to apply to your modified version as well.
52
53AC_DEFUN([AX_CXXCPP_CHECK_FLAG],[
54  AC_PREREQ([2.61])
55  AC_REQUIRE([AC_PROG_CXXCPP])
56  AC_REQUIRE([AC_PROG_SED])
57
58  flag=`echo "$1" | $SED 'y% .=/+-(){}<>:*,%_______________%'`
59
60  AC_CACHE_CHECK([whether the C++ preprocessor accepts the $1 flag],
61    [ax_cv_cxxcpp_check_flag_$flag],[
62
63    AC_LANG_PUSH([C++])
64
65    save_CXXFLAGS="$CXXFLAGS"
66    CXXFLAGS="$CXXFLAGS $1"
67    AC_PREPROC_IFELSE([
68      AC_LANG_PROGRAM([$2],[$3])
69    ],[
70      eval "ax_cv_cxxcpp_check_flag_$flag=yes"
71    ],[
72      eval "ax_cv_cxxcpp_check_flag_$flag=no"
73    ])
74
75    CXXFLAGS="$save_CXXFLAGS"
76
77    AC_LANG_POP
78
79  ])
80
81  AS_IF([eval "test \"`echo '$ax_cv_cxxcpp_check_flag_'$flag`\" = yes"],[
82    :
83    $4
84  ],[
85    :
86    $5
87  ])
88])
Note: See TracBrowser for help on using the repository browser.