sync: update files from upstream with "make fetch"
[automake.git] / t / vartypos.sh
blob16317fb32e7b7cbdaed04b48fccde4c5557a8715
1 #! /bin/sh
2 # Copyright (C) 2010-2012 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)
7 # 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 <http://www.gnu.org/licenses/>.
17 # Make sure we warn about possible variable typos when we should.
19 . ./defs || exit 1
21 cat >>configure.ac <<'END'
22 AC_PROG_RANLIB
23 AC_OUTPUT
24 END
26 cat >Makefile.am <<'END'
27 foo_SOURCES = unused
28 nodist_foo_SOURCES = unused
29 EXTRA_foo_SOURCES = unused
30 foo_LDADD = unused
31 foo_LDFLAGS = unused
32 foo_DEPENDENCIES = unused
33 EXTRA_foo_DEPENDENCIES = unused
35 libfoo_a_SOURCES = unused
36 nodist_libfoo_a_SOURCES = unused
37 EXTRA_libfoo_a_SOURCES = unused
38 libfoo_a_LIBADD = unused
39 libfoo_a_DEPENDENCIES = unused
40 EXTRA_libfoo_a_DEPENDENCIES = unused
41 END
43 $ACLOCAL
44 AUTOMAKE_fails -Wno-extra-portability
45 # The expected diagnostic is:
46 # automake: warnings are treated as errors
47 # Makefile.am:2: warning: variable 'nodist_foo_SOURCES' is defined but no program or
48 # Makefile.am:2: library has 'foo' as canonical name (possible typo)
49 # Makefile.am:1: warning: variable 'foo_SOURCES' is defined but no program or
50 # Makefile.am:1: library has 'foo' as canonical name (possible typo)
51 # Makefile.am:9: warning: variable 'libfoo_a_SOURCES' is defined but no program or
52 # Makefile.am:9: library has 'libfoo_a' as canonical name (possible typo)
53 # Makefile.am:10: warning: variable 'nodist_libfoo_a_SOURCES' is defined but no program or
54 # Makefile.am:10: library has 'libfoo_a' as canonical name (possible typo)
55 # Makefile.am:11: warning: variable 'EXTRA_libfoo_a_SOURCES' is defined but no program or
56 # Makefile.am:11: library has 'libfoo_a' as canonical name (possible typo)
57 # Makefile.am:3: warning: variable 'EXTRA_foo_SOURCES' is defined but no program or
58 # Makefile.am:3: library has 'foo' as canonical name (possible typo)
59 # Makefile.am:12: warning: variable 'libfoo_a_LIBADD' is defined but no program or
60 # Makefile.am:12: library has 'libfoo_a' as canonical name (possible typo)
61 # Makefile.am:4: warning: variable 'foo_LDADD' is defined but no program or
62 # Makefile.am:4: library has 'foo' as canonical name (possible typo)
63 # Makefile.am:5: warning: variable 'foo_LDFLAGS' is defined but no program or
64 # Makefile.am:5: library has 'foo' as canonical name (possible typo)
65 # Makefile.am:14: warning: variable 'EXTRA_libfoo_a_DEPENDENCIES' is defined but no program or
66 # Makefile.am:14: library has 'libfoo_a' as canonical name (possible typo)
67 # Makefile.am:7: warning: variable 'EXTRA_foo_DEPENDENCIES' is defined but no program or
68 # Makefile.am:7: library has 'foo' as canonical name (possible typo)
69 # Makefile.am:6: warning: variable 'foo_DEPENDENCIES' is defined but no program or
70 # Makefile.am:6: library has 'foo' as canonical name (possible typo)
71 # Makefile.am:13: warning: variable 'libfoo_a_DEPENDENCIES' is defined but no program or
72 # Makefile.am:13: library has 'libfoo_a' as canonical name (possible typo)
74 grep 'as canonical' stderr | grep -v ' .foo. ' | grep -v ' .libfoo_a. ' \
75 && exit 1
76 test $(grep -c 'variable.*is defined but' stderr) -eq 13
78 # If we add a global -Wnone, all warnings should disappear.
79 $AUTOMAKE -Wnone
81 # Likewise, if matching programs or libraries are defined.
82 cat >>Makefile.am <<'END'
83 bin_PROGRAMS = foo
84 lib_LIBRARIES = libfoo.a
85 END
87 $AUTOMAKE -Wno-extra-portability