Merge branch 'minor'
[automake.git] / t / cond21.sh
blob7aecdc24c493af6c9d9df85f8679c83199ce39f1
1 #! /bin/sh
2 # Copyright (C) 2002-2017 Free Software Foundation, Inc.
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.
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.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
17 # Check for use of = and += in different conditions.
19 . test-init.sh
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
28 cat > Makefile.am << 'END'
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
47 if COND1
48 if COND2
49 BAR = bar12
50 else
51 BAR = bar1n2
52 endif
53 else
54 BAR = barn1
55 endif
57 BAR += bar
59 if COND3
60 BAR += bar3
61 endif
63 .PHONY: test
64 test:
65 @echo BAR: $(BAR) :BAR
66 @echo FOO: $(FOO) :FOO
67 END
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'