Merge branch 'micro' into maint
[platform/upstream/automake.git] / t / cond21.sh
1 #! /bin/sh
2 # Copyright (C) 2002-2013 Free Software Foundation, Inc.
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
7 # any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 # Check for use of = and += in different conditions.
18
19 . test-init.sh
20
21 cat >> configure.ac << 'END'
22 AM_CONDITIONAL([COND1], [true])
23 AM_CONDITIONAL([COND2], [true])
24 AM_CONDITIONAL([COND3], [true])
25 AC_OUTPUT
26 END
27
28 cat > Makefile.am << 'END'
29
30 FOO = foo
31 if COND1
32   FOO += foo1
33 else
34   FOO += foon1
35 endif
36 if COND2
37   FOO += foo2
38 else
39   FOO += foon2
40 endif
41 if COND1
42   FOO += foo1b
43 else
44   FOO += foon1b
45 endif
46
47 if COND1
48 if COND2
49   BAR = bar12
50 else
51   BAR = bar1n2
52 endif
53 else
54   BAR = barn1
55 endif
56
57 BAR += bar
58
59 if COND3
60   BAR += bar3
61 endif
62
63 .PHONY: test
64 test:
65         @echo BAR: $(BAR) :BAR
66         @echo FOO: $(FOO) :FOO
67 END
68
69 $ACLOCAL
70 $AUTOCONF
71 $AUTOMAKE -a
72 ./configure
73 $MAKE test | $FGREP 'BAR: bar12 bar bar3 :BAR'
74 $MAKE test | $FGREP 'FOO: foo foo1 foo2 foo1b :FOO'
75
76 :