maint: Update HACKING
[automake.git] / t / vartypo2.sh
blob77c05a6d670fe3b436d221b576e6a4d2a50d306d
1 #! /bin/sh
2 # Copyright (C) 2010-2017 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 <https://www.gnu.org/licenses/>.
17 # Make sure we warn about possible variable typos when we should,
18 # Libtool variant.
20 required=libtoolize
21 . test-init.sh
23 cat >>configure.ac <<'END'
24 AM_PROG_AR
25 AC_PROG_LIBTOOL
26 AC_OUTPUT
27 END
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
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)
56 grep 'as canonical' stderr | grep -v ' .libfoo_la. ' && exit 1
57 test $(grep -c 'variable.*is defined but' stderr) -eq 6
59 # If we add a global -Wnone, all warnings should disappear.
60 $AUTOMAKE -Wnone
62 # Likewise, if matching programs or libraries are defined.
63 cat >>Makefile.am <<'END'
64 lib_LTLIBRARIES = libfoo.la
65 END
67 $AUTOMAKE