doc: typos in test file.
[automake.git] / t / cond46.sh
blob5af3e75a3d2f9259f928901462dfe9c842e5747f
1 #! /bin/sh
2 # Copyright (C) 2009-2024 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 3 of the License, or
7 # (at your option) 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 # Ensure the right condition is listed after 'else' and 'endif'.
19 . test-init.sh
21 cat >> configure.ac << 'END'
22 AM_CONDITIONAL([USE_A], [test x = y])
23 AM_CONDITIONAL([USE_B], [test x = z])
24 AC_OUTPUT
25 END
27 notcompat="incompatible with current conditional"
29 $ACLOCAL
31 cat > Makefile.am << 'END'
32 if USE_A
33 endif !USE_A
34 END
36 AUTOMAKE_fails
37 grep "^Makefile\\.am:2:.*endif.*!USE_A.*$notcompat.*[^!]USE_A" stderr
39 cat > Makefile.am << 'END'
40 if USE_A
41 endif USE_B
42 END
44 AUTOMAKE_fails
45 grep "^Makefile\\.am:2:.*endif.*[^!]USE_B.*$notcompat.*[^!]USE_A" stderr
47 cat > Makefile.am << 'END'
48 if USE_A
49 else
50 endif USE_A
51 END
53 AUTOMAKE_fails
54 grep "^Makefile\\.am:3:.*endif.*[^!]USE_A.*$notcompat.*USE_A" stderr
56 cat > Makefile.am << 'END'
57 if USE_A
58 else
59 endif !USE_A
60 END
62 $AUTOMAKE
64 cat > Makefile.am << 'END'
65 if USE_A
66 if USE_B
67 else
68 endif !USE_A
69 endif
70 END
72 AUTOMAKE_fails
73 grep "^Makefile\\.am:4:.*endif.*!USE_A.*$notcompat.*USE_B" stderr
75 cat > Makefile.am << 'END'
76 if USE_A
77 else USE_A
78 endif
79 END
81 AUTOMAKE_fails
82 grep "^Makefile\\.am:2:.*else.*[^!]USE_A.*$notcompat.*[^!]USE_A" stderr
84 cat > Makefile.am << 'END'
85 if USE_A
86 else !USE_A
87 endif
88 END
90 $AUTOMAKE
92 cat > Makefile.am << 'END'
93 if USE_A
94 else USE_B
95 endif
96 END
98 AUTOMAKE_fails
99 grep "^Makefile\\.am:2:.*else.*[^!]USE_B.*$notcompat.*[^!]USE_A" stderr
101 cat > Makefile.am << 'END'
102 if USE_A
103 if USE_B
104 else USE_A
105 endif
106 endif
109 AUTOMAKE_fails
110 grep "^Makefile\\.am:3:.*else.*[^!]USE_A.*$notcompat.*[^!]USE_B" stderr