maint: Post-release administrivia
[automake.git] / t / cond42.sh
blob06f34fd5e3d70382e831c40cb038124060f1d5cc
1 #!/bin/sh
2 nfig
3 # Copyright (C) 2008-2018 Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
8 # any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <https://www.gnu.org/licenses/>.
18 # Ensure an error with inconsistent state of conditionals in configure.ac.
19 # This shouldn't happen with user input, as _AM_COND_* are not documented,
20 # but better to be safe.
22 . test-init.sh
24 cat >>configure.ac <<'END'
25 AM_CONDITIONAL([COND], [:])
26 # The next line is needed so that cond-if.m4 is pulled in.
27 AM_COND_IF([COND])
28 _AM_COND_IF([COND])
29 AC_OUTPUT
30 END
32 edit_configure_ac ()
34 sed "$@" < configure.ac >configure.tmp
35 mv -f configure.tmp configure.ac
36 rm -rf autom4te*.cache
39 : >Makefile.am
41 $ACLOCAL
42 AUTOMAKE_fails
43 grep '^configure\.ac:8:.* condition stack' stderr
45 edit_configure_ac 's/_AM_COND_IF/_AM_COND_ELSE/'
46 AUTOMAKE_fails
47 grep '^configure\.ac:7:.* else without if' stderr
49 edit_configure_ac 's/_AM_COND_ELSE/_AM_COND_ENDIF/'
50 AUTOMAKE_fails
51 grep '^configure\.ac:7:.* endif without if' stderr
53 edit_configure_ac 's/\(_AM_COND_ENDIF\).*/_AM_COND_IF\
54 _AM_COND_ENDIF/'
55 AUTOMAKE_fails
56 grep '^configure\.ac:7:.* not enough arguments.* _AM_COND_IF' stderr
57 grep '^configure\.ac:8:.* not enough arguments.* _AM_COND_ENDIF' stderr
58 test 2 -eq $($FGREP -c 'not enough arguments' stderr)