2 # Copyright (C) 2002-2015 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)
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 <http://www.gnu.org/licenses/>.
17 # Check that Automake warns about variables containing spaces
18 # and other non-POSIX characters.
22 cat >Makefile.am
<<'EOF'
24 L02 = $$(not an error)
25 L03 = $$(this is)$${ok too}
26 L04 = $(nextvariableisbad)$(addsuffix .a, $(A))
29 L07 = ${three errors}${on this} $(long line)
30 L08$(o u c h): $(wildcard *.c)
38 # Make sure this warning is print in the 'portability' category.
39 $AUTOMAKE --warnings=no-error
,none
,portability
2>stderr \
40 ||
{ cat stderr
>&2; exit 1; }
43 # Lines number are printed in error message.
44 # Use them to make sure errors are diagnosed against the right lines.
46 # No error expected apart from those on these lines.
47 grep -v '^Makefile\.am:[145789]:' stderr |
grep .
&& exit 1
49 # Now check some individual values.
50 grep ':1:.*shell echo' stderr
51 grep 'nextvariableisbad' stderr
&& exit 1
52 grep ':4:.*addsuffix' stderr
53 grep ':5:.*bad boy' stderr
54 grep ':7:.*three errors' stderr
55 grep ':7:.*on this' stderr
56 grep ':7:.*long line' stderr
57 grep ':8:.*o u c h' stderr
58 grep ':8:.*wildcard' stderr
59 grep ':9:.*another Error' stderr
61 $EGREP 'ok|thisis|here' stderr
&& exit 1
63 # None of these errors be diagnosed with '-Wno-portability'.
64 $AUTOMAKE -Wno-portability
66 # Likewise if we add this in the Makefile.am
67 # (although this makes some difference internally: AUTOMAKE_OPTIONS is
68 # processed far later).
69 echo 'AUTOMAKE_OPTIONS = -Wno-portability' >> Makefile.am