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)
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.
24 cat >>configure.ac
<<'END'
25 AM_CONDITIONAL([COND], [:])
26 # The next line is needed so that cond-if.m4 is pulled in.
34 sed "$@" < configure.ac
>configure.tmp
35 mv -f configure.tmp configure.ac
36 rm -rf autom4te
*.cache
43 grep '^configure\.ac:8:.* condition stack' stderr
45 edit_configure_ac
's/_AM_COND_IF/_AM_COND_ELSE/'
47 grep '^configure\.ac:7:.* else without if' stderr
49 edit_configure_ac
's/_AM_COND_ELSE/_AM_COND_ENDIF/'
51 grep '^configure\.ac:7:.* endif without if' stderr
53 edit_configure_ac
's/\(_AM_COND_ENDIF\).*/_AM_COND_IF\
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
)