1 | ## $Id: yat_add_flag.m4 1756 2009-01-27 22:35:10Z 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-01-27 17:35:10 -0500 (Tue, 27 Jan 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 1 |
---|
43 | # |
---|
44 | # see http://www.gnu.org/software/automake/manual/automake.html#Serials |
---|
45 | |
---|
46 | AC_DEFUN([YAT_CPP_ADD_FLAG], |
---|
47 | [ |
---|
48 | AC_REQUIRE([AX_CXXCPP_CHECK_FLAG]) |
---|
49 | for i in $2; do |
---|
50 | YAT_FIND_STR([$1], [$i], , [AX_CXXCPP_CHECK_FLAG([$i], ,, [$1="$$1 $i"])]) |
---|
51 | done |
---|
52 | ]) # YAT_CPP_ADD_FLAG |
---|
53 | |
---|
54 | |
---|
55 | AC_DEFUN([YAT_CXX_ADD_FLAG], |
---|
56 | [ |
---|
57 | AC_REQUIRE([AX_CXX_CHECK_FLAG]) |
---|
58 | for i in $2; do |
---|
59 | YAT_FIND_STR([$1], [$i], , [AX_CXX_CHECK_FLAG([$i], ,, [$1="$$1 $i"])]) |
---|
60 | done |
---|
61 | ]) # YAT_CXX_ADD_FLAG |
---|
62 | |
---|
63 | AC_DEFUN([YAT_LD_ADD_FLAG], |
---|
64 | [ |
---|
65 | AC_REQUIRE([AX_LD_CHECK_FLAG]) |
---|
66 | for i in $2; do |
---|
67 | YAT_FIND_STR([$1], [$i], , [AX_LD_CHECK_FLAG([$i], ,, [$1="$$1 $i"])]) |
---|
68 | done |
---|
69 | ]) # YAT_LD_ADD_FLAG |
---|
70 | |
---|
71 | AC_DEFUN([YAT_FIND_STR], |
---|
72 | [ |
---|
73 | # YAT_FIND_STR |
---|
74 | found=no; |
---|
75 | for a in $$1; do |
---|
76 | AS_IF([test "x$a" = "x$2"],[found=yes]) |
---|
77 | done |
---|
78 | |
---|
79 | # ACTION |
---|
80 | AS_IF([test "$found" = "yes"], [m4_default([$3], [:])], |
---|
81 | [m4_default([$4], [:])]) |
---|
82 | |
---|
83 | ]) # YAT_FIND_STR |
---|
84 | |
---|