maint: run "make update-copyright"
[platform/upstream/automake.git] / tests / vartypo2.test
1 #! /bin/sh
2 # Copyright (C) 2010-2012 Free Software Foundation, Inc.
3 #
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.
8 #
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.
13 #
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/>.
16
17 # Make sure we warn about possible variable typos when we should,
18 # Libtool variant.
19
20 required=libtoolize
21 . ./defs || Exit 1
22
23 cat >>configure.in <<'END'
24 AM_PROG_AR
25 AC_PROG_LIBTOOL
26 AC_OUTPUT
27 END
28
29 cat >Makefile.am <<'END'
30 libfoo_la_SOURCES = unused
31 nodist_libfoo_la_SOURCES = unused
32 EXTRA_libfoo_la_SOURCES = unused
33 libfoo_la_LIBADD = unused
34 libfoo_la_DEPENDENCIES = unused
35 EXTRA_libfoo_la_DEPENDENCIES = unused
36 END
37
38 libtoolize
39 $ACLOCAL
40 AUTOMAKE_fails --add-missing
41 # The expected diagnostic is:
42 # automake: warnings are treated as errors
43 # Makefile.am:3: warning: variable `EXTRA_libfoo_la_SOURCES' is defined but no program or
44 # Makefile.am:3: library has `libfoo_la' as canonical name (possible typo)
45 # Makefile.am:1: warning: variable `libfoo_la_SOURCES' is defined but no program or
46 # Makefile.am:1: library has `libfoo_la' as canonical name (possible typo)
47 # Makefile.am:2: warning: variable `nodist_libfoo_la_SOURCES' is defined but no program or
48 # Makefile.am:2: library has `libfoo_la' as canonical name (possible typo)
49 # Makefile.am:4: warning: variable `libfoo_la_LIBADD' is defined but no program or
50 # Makefile.am:4: library has `libfoo_la' as canonical name (possible typo)
51 # Makefile.am:6: warning: variable `EXTRA_libfoo_la_DEPENDENCIES' is defined but no program or
52 # Makefile.am:6: library has `libfoo_la' as canonical name (possible typo)
53 # Makefile.am:5: warning: variable `libfoo_la_DEPENDENCIES' is defined but no program or
54 # Makefile.am:5: library has `libfoo_la' as canonical name (possible typo)
55
56
57 grep 'as canonical' stderr | grep -v ' .libfoo_la. ' && Exit 1
58 test `grep 'variable.*is defined but' stderr | wc -l` = 6
59
60 # If we add a global -Wnone, all warnings should disappear.
61 $AUTOMAKE -Wnone
62
63 # Likewise, if matching programs or libraries are defined.
64 cat >>Makefile.am <<'END'
65 lib_LTLIBRARIES = libfoo.la
66 END
67
68 $AUTOMAKE
69
70 :