Merge branch 'msvc'
[platform/upstream/automake.git] / tests / cond46.test
1 #! /bin/sh
2 # Copyright (C) 2009, 2010 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 3 of the License, or
7 # (at your option) 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 # Ensure the right condition is listed after `else' and `endif'.
18
19 . ./defs || Exit 1
20
21 set -e
22
23 cat >> configure.in << 'END'
24 AM_CONDITIONAL([USE_A],[test x = y])
25 AM_CONDITIONAL([USE_B],[test x = z])
26 AC_OUTPUT
27 END
28
29 $ACLOCAL
30
31 cat > Makefile.am << 'END'
32 if USE_A
33 endif !USE_A
34 END
35
36 AUTOMAKE_fails
37 grep 'endif.*incompatible with current conditional' stderr
38
39 cat > Makefile.am << 'END'
40 if USE_A
41 endif USE_B
42 END
43
44 AUTOMAKE_fails
45 grep 'endif.*incompatible with current conditional' stderr
46
47 cat > Makefile.am << 'END'
48 if USE_A
49 else
50 endif USE_A
51 END
52
53 AUTOMAKE_fails
54 grep 'endif.*incompatible with current conditional' stderr
55
56 cat > Makefile.am << 'END'
57 if USE_A
58 else
59 endif !USE_A
60 END
61
62 $AUTOMAKE
63
64 cat > Makefile.am << 'END'
65 if USE_A
66 if USE_B
67 else
68 endif !USE_A
69 endif
70 END
71
72 AUTOMAKE_fails
73 grep 'endif.*incompatible with current conditional' stderr
74
75 cat > Makefile.am << 'END'
76 if USE_A
77 else USE_A
78 endif
79 END
80
81 AUTOMAKE_fails
82 grep 'else.*incompatible with current conditional' stderr
83
84 cat > Makefile.am << 'END'
85 if USE_A
86 else USE_B
87 endif
88 END
89
90 AUTOMAKE_fails
91 grep 'else.*incompatible with current conditional' stderr
92
93 cat > Makefile.am << 'END'
94 if USE_A
95 if USE_B
96 else USE_A
97 endif
98 endif
99 END
100
101 AUTOMAKE_fails
102 grep 'else.*incompatible with current conditional' stderr
103
104 cat > Makefile.am << 'END'
105 if USE_A
106 else !USE_A
107 endif
108 END
109
110 $AUTOMAKE