1503 |
16 Sep 08 |
peter |
## $Id$ |
1503 |
16 Sep 08 |
peter |
2 |
|
1503 |
16 Sep 08 |
peter |
# SYNOPSIS |
1503 |
16 Sep 08 |
peter |
4 |
# |
1503 |
16 Sep 08 |
peter |
# YAT_CPP_ADD_FLAG([FLAGS], [FLAG]) |
1503 |
16 Sep 08 |
peter |
6 |
# |
1503 |
16 Sep 08 |
peter |
# YAT_CXX_ADD_FLAG([FLAGS], [FLAG]) |
1503 |
16 Sep 08 |
peter |
8 |
# |
1503 |
16 Sep 08 |
peter |
# YAT_LD_ADD_FLAG([FLAGS], [FLAG]) |
1503 |
16 Sep 08 |
peter |
10 |
# |
1503 |
16 Sep 08 |
peter |
# DESCRIPTION |
1503 |
16 Sep 08 |
peter |
12 |
# |
1503 |
16 Sep 08 |
peter |
# Check that FLAG is not already included in FLAGS and test that |
1503 |
16 Sep 08 |
peter |
# FLAG is supported by C++ compiler. If true FLAG is appended to |
1503 |
16 Sep 08 |
peter |
# FLAGS. |
1503 |
16 Sep 08 |
peter |
16 |
# |
1503 |
16 Sep 08 |
peter |
# LAST MODIFICATION |
1503 |
16 Sep 08 |
peter |
18 |
# |
1503 |
16 Sep 08 |
peter |
# $Date$ |
1503 |
16 Sep 08 |
peter |
20 |
# |
1503 |
16 Sep 08 |
peter |
# COPYLEFT |
1503 |
16 Sep 08 |
peter |
22 |
# |
4359 |
23 Aug 23 |
peter |
# Copyright (C) 2008, 2009, 2011 Peter Johansson |
1503 |
16 Sep 08 |
peter |
24 |
# |
1503 |
16 Sep 08 |
peter |
# This file is part of the yat library, http://dev.thep.lu.se/yat |
1503 |
16 Sep 08 |
peter |
26 |
# |
1503 |
16 Sep 08 |
peter |
# The yat library is free software; you can redistribute it and/or |
1503 |
16 Sep 08 |
peter |
# modify it under the terms of the GNU General Public License as |
1503 |
16 Sep 08 |
peter |
# published by the Free Software Foundation; either version 3 of the |
1503 |
16 Sep 08 |
peter |
# License, or (at your option) any later version. |
1503 |
16 Sep 08 |
peter |
31 |
# |
1503 |
16 Sep 08 |
peter |
# The yat library is distributed in the hope that it will be useful, |
1503 |
16 Sep 08 |
peter |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1503 |
16 Sep 08 |
peter |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1503 |
16 Sep 08 |
peter |
# General Public License for more details. |
1503 |
16 Sep 08 |
peter |
36 |
# |
1503 |
16 Sep 08 |
peter |
# You should have received a copy of the GNU General Public License |
1503 |
16 Sep 08 |
peter |
# along with yat. If not, see <http://www.gnu.org/licenses/>. |
1503 |
16 Sep 08 |
peter |
39 |
# |
1503 |
16 Sep 08 |
peter |
40 |
|
1503 |
16 Sep 08 |
peter |
41 |
# |
4200 |
19 Aug 22 |
peter |
# serial 6 |
1503 |
16 Sep 08 |
peter |
43 |
# |
1503 |
16 Sep 08 |
peter |
# see http://www.gnu.org/software/automake/manual/automake.html#Serials |
1503 |
16 Sep 08 |
peter |
45 |
|
1503 |
16 Sep 08 |
peter |
46 |
AC_DEFUN([YAT_CPP_ADD_FLAG], |
1503 |
16 Sep 08 |
peter |
47 |
[ |
2093 |
24 Oct 09 |
peter |
48 |
AC_PREREQ([2.63]) dnl we use AS_VAR_IF |
2083 |
19 Oct 09 |
peter |
49 |
AC_REQUIRE([AC_PROG_SED]) |
1981 |
07 Jun 09 |
peter |
50 |
for yat_flag in $2; do |
1856 |
07 Mar 09 |
peter |
# ignore flag if |
1856 |
07 Mar 09 |
peter |
# 1) it is -I/usr/include |
1856 |
07 Mar 09 |
peter |
# 2) it is -I/usr/local/include and CXX is g++ |
2087 |
20 Oct 09 |
peter |
# 3) it is -D* and * is already defined in $1, $CPPFLAGS, or AC_DEFINE |
2083 |
19 Oct 09 |
peter |
55 |
ignore=no |
2083 |
19 Oct 09 |
peter |
56 |
AS_CASE([$yat_flag], |
2083 |
19 Oct 09 |
peter |
57 |
[-I/usr/include], [ignore=yes], |
2083 |
19 Oct 09 |
peter |
58 |
[-I/usr/local/include],[AS_IF([test "x$CXX" = "xg++"],[ignore=yes])], |
2088 |
21 Oct 09 |
peter |
59 |
[-D*], [yat_def=`AS_ECHO([$yat_flag]) | $SED 's,^-D,,;s,=.*,,'`; |
2087 |
20 Oct 09 |
peter |
60 |
yat_save_CPPFLAGS="$CPPFLAGS" |
2087 |
20 Oct 09 |
peter |
61 |
m4_if([$1], [CPPFLAGS], [], [CPPFLAGS="$$1 $CPPFLAGS"]) |
2107 |
07 Nov 09 |
peter |
62 |
AC_CHECK_DECL([$yat_def],[ignore=yes]) |
2087 |
20 Oct 09 |
peter |
63 |
CPPFLAGS="$yat_save_CPPFLAGS"]) |
2083 |
19 Oct 09 |
peter |
64 |
|
2088 |
21 Oct 09 |
peter |
65 |
AS_VAR_IF([ignore], [no], |
4200 |
19 Aug 22 |
peter |
66 |
[AX_CHECK_PREPROC_FLAG([$yat_flag], |
2497 |
26 Jun 11 |
peter |
67 |
[AX_APPEND_FLAG([$yat_flag], [$1])])]) |
1756 |
27 Jan 09 |
peter |
68 |
done |
1503 |
16 Sep 08 |
peter |
69 |
]) # YAT_CPP_ADD_FLAG |
1503 |
16 Sep 08 |
peter |
70 |
|
1503 |
16 Sep 08 |
peter |
71 |
|
1503 |
16 Sep 08 |
peter |
72 |
AC_DEFUN([YAT_CXX_ADD_FLAG], |
1503 |
16 Sep 08 |
peter |
73 |
[ |
4200 |
19 Aug 22 |
peter |
74 |
AC_PREREQ([2.59]) dnl we use AX_APPEND_COMPILE_FLAGS |
2497 |
26 Jun 11 |
peter |
75 |
AX_APPEND_COMPILE_FLAGS([$2], [$1]) |
1503 |
16 Sep 08 |
peter |
76 |
]) # YAT_CXX_ADD_FLAG |
1503 |
16 Sep 08 |
peter |
77 |
|
1503 |
16 Sep 08 |
peter |
78 |
AC_DEFUN([YAT_LD_ADD_FLAG], |
1503 |
16 Sep 08 |
peter |
79 |
[ |
2497 |
26 Jun 11 |
peter |
80 |
AC_PREREQ([2.59]) dnl we use AX_APPEND_LINK_FLAGS |
1981 |
07 Jun 09 |
peter |
81 |
for yat_flag in $2; do |
1856 |
07 Mar 09 |
peter |
# ignore flag if |
1856 |
07 Mar 09 |
peter |
# 1) it is -L/usr/lib |
1856 |
07 Mar 09 |
peter |
# 2) it is -L/usr/local/lib and CXX is g++ |
1981 |
07 Jun 09 |
peter |
85 |
AS_IF([test "x$yat_flag" = "x-L/usr/lib"],, |
1981 |
07 Jun 09 |
peter |
86 |
[test "x$CXX" = "xg++" && test "x$yat_flag" = "x-L/usr/local/lib"],, |
2497 |
26 Jun 11 |
peter |
87 |
[AX_APPEND_LINK_FLAGS([$yat_flag], [$1])]) |
1756 |
27 Jan 09 |
peter |
88 |
done |
1503 |
16 Sep 08 |
peter |
89 |
]) # YAT_LD_ADD_FLAG |