1 | ## $Id: yat_add_flag.m4 1503 2008-09-16 15:43:57Z 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$ |
---|
20 | # |
---|
21 | # COPYLEFT |
---|
22 | # |
---|
23 | # Copyright (C) 2008 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 0 |
---|
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 | YAT_FIND_STR([$1], [$2], , [AX_CXXCPP_CHECK_FLAG([$2], ,, [$1="$$1 $2"])]) |
---|
50 | ]) # YAT_CPP_ADD_FLAG |
---|
51 | |
---|
52 | |
---|
53 | AC_DEFUN([YAT_CXX_ADD_FLAG], |
---|
54 | [ |
---|
55 | AC_REQUIRE([AX_CXX_CHECK_FLAG]) |
---|
56 | YAT_FIND_STR([$1], [$2], , [AX_CXX_CHECK_FLAG([$2], ,, [$1="$$1 $2"])]) |
---|
57 | ]) # YAT_CXX_ADD_FLAG |
---|
58 | |
---|
59 | AC_DEFUN([YAT_LD_ADD_FLAG], |
---|
60 | [ |
---|
61 | AC_REQUIRE([AX_LD_CHECK_FLAG]) |
---|
62 | YAT_FIND_STR([$1], [$2], , [AX_LD_CHECK_FLAG([$2], ,, [$1="$$1 $2"])]) |
---|
63 | ]) # YAT_LD_ADD_FLAG |
---|
64 | |
---|
65 | AC_DEFUN([YAT_FIND_STR], |
---|
66 | [ |
---|
67 | # YAT_FIND_STR |
---|
68 | found=no; |
---|
69 | for a in $1; do |
---|
70 | if test "$f" = "$2"; then |
---|
71 | found=yes; |
---|
72 | fi |
---|
73 | done |
---|
74 | |
---|
75 | |
---|
76 | |
---|
77 | # ACTION |
---|
78 | if test "$found" = "yes" ; then |
---|
79 | ifelse([$3], , :, [$3]) |
---|
80 | else |
---|
81 | ifelse([$4], , :, [$4]) |
---|
82 | fi |
---|
83 | |
---|
84 | ]) # YAT_FIND_STR |
---|
85 | |
---|