source: trunk/m4/yat_add_flag.m4 @ 798

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

new version of yat_add_flag.m4

  • Property svn:eol-style set to native
File size: 2.0 KB
Line 
1## $Id: yat_add_flag.m4 1780 2009-02-06 18:13:22Z peter $
2
3# SYNOPSIS
4#
5#   YAT_CPP_ADD_FLAG([FLAGS], [FLAG])
6#
7#   YAT_CXX_ADD_FLAG([FLAGS], [FLAG])
8#
9#   YAT_LD_ADD_FLAG([FLAGS], [FLAG])
10#
11# DESCRIPTION
12#
13#   Check that FLAG is not already included in FLAGS and test that
14#   FLAG is supported by C++ compiler. If true FLAG is appended to
15#   FLAGS.
16#
17# LAST MODIFICATION
18#
19#   $Date: 2009-02-06 13:13:22 -0500 (Fri, 06 Feb 2009) $
20#
21# COPYLEFT
22#
23#   Copyright (C) 2008, 2009 Peter Johansson
24#
25#   This file is part of the yat library, http://dev.thep.lu.se/yat
26#
27#   The yat library is free software; you can redistribute it and/or
28#   modify it under the terms of the GNU General Public License as
29#   published by the Free Software Foundation; either version 3 of the
30#   License, or (at your option) any later version.
31#
32#   The yat library is distributed in the hope that it will be useful,
33#   but WITHOUT ANY WARRANTY; without even the implied warranty of
34#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
35#   General Public License for more details.
36#
37#   You should have received a copy of the GNU General Public License
38#   along with yat. If not, see <http://www.gnu.org/licenses/>.
39#
40
41#
42# serial 2 
43#
44# see http://www.gnu.org/software/automake/manual/automake.html#Serials
45
46AC_DEFUN([YAT_CPP_ADD_FLAG],
47[
48  for i in $2; do
49    YAT_FIND_STR([$1], [$i], , [AX_CXXCPP_CHECK_FLAG([$i], ,, [$1="$$1 $i"])])
50  done
51]) # YAT_CPP_ADD_FLAG
52
53
54AC_DEFUN([YAT_CXX_ADD_FLAG],
55[
56  for i in $2; do
57    YAT_FIND_STR([$1], [$i], , [AX_CXX_CHECK_FLAG([$i], ,, [$1="$$1 $i"])])
58  done
59]) # YAT_CXX_ADD_FLAG
60
61AC_DEFUN([YAT_LD_ADD_FLAG],
62[
63  for i in $2; do
64    YAT_FIND_STR([$1], [$i], , [AX_LD_CHECK_FLAG([$i], ,, [$1="$$1 $i"])])
65  done
66]) # YAT_LD_ADD_FLAG
67
68AC_DEFUN([YAT_FIND_STR],
69[
70  # YAT_FIND_STR
71  found=no;       
72  for a in $$1; do
73    AS_IF([test "x$a" = "x$2"],[found=yes])
74  done
75
76  # ACTION
77  AS_IF([test "$found" = "yes"], [m4_default([$3], [:])],
78        [m4_default([$4], [:])])
79
80]) # YAT_FIND_STR
81
Note: See TracBrowser for help on using the repository browser.