1 | #! /bin/sh
|
---|
2 | # Copyright (C) 2002, 2003 Free Software Foundation, Inc.
|
---|
3 | #
|
---|
4 | # This file is part of GNU Automake.
|
---|
5 | #
|
---|
6 | # GNU Automake is free software; you can redistribute it and/or modify
|
---|
7 | # it under the terms of the GNU General Public License as published by
|
---|
8 | # the Free Software Foundation; either version 2, or (at your option)
|
---|
9 | # any later version.
|
---|
10 | #
|
---|
11 | # GNU Automake is distributed in the hope that it will be useful,
|
---|
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
14 | # GNU General Public License for more details.
|
---|
15 | #
|
---|
16 | # You should have received a copy of the GNU General Public License
|
---|
17 | # along with autoconf; see the file COPYING. If not, write to
|
---|
18 | # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
---|
19 | # Boston, MA 02111-1307, USA.
|
---|
20 |
|
---|
21 | # Make sure that we can enable or disable warnings on a per-file basis.
|
---|
22 |
|
---|
23 | . ./defs || exit 1
|
---|
24 |
|
---|
25 | set -e
|
---|
26 |
|
---|
27 |
|
---|
28 | cat >>configure.in <<END
|
---|
29 | AC_CONFIG_FILES([sub/Makefile])
|
---|
30 | AC_OUTPUT
|
---|
31 | END
|
---|
32 |
|
---|
33 | mkdir sub
|
---|
34 |
|
---|
35 | # These two Makefile contain the same errors, but have different
|
---|
36 | # warnings disabled.
|
---|
37 |
|
---|
38 | cat >Makefile.am <<END
|
---|
39 | AUTOMAKE_OPTIONS = -Wno-obsolete
|
---|
40 | INCLUDES = -Ifoo
|
---|
41 | foo_SOURCES = unused
|
---|
42 | SUBDIRS = sub
|
---|
43 | END
|
---|
44 |
|
---|
45 | cat >sub/Makefile.am <<END
|
---|
46 | AUTOMAKE_OPTIONS = -Wno-syntax
|
---|
47 | INCLUDES = -Ifoo
|
---|
48 | foo_SOURCES = unused
|
---|
49 | END
|
---|
50 |
|
---|
51 | $ACLOCAL
|
---|
52 | $AUTOMAKE 2>stderr && exit 1
|
---|
53 | cat stderr
|
---|
54 | # The expected diagnostic is
|
---|
55 | # Makefile.am:3: unused variable: `foo_SOURCES'
|
---|
56 | # sub/Makefile.am:2: `INCLUDES' is the old name for `AM_CPPFLAGS'
|
---|
57 | grep '^Makefile.am:.*foo_SOURCES' stderr
|
---|
58 | grep '^sub/Makefile.am:.*INCLUDES' stderr
|
---|
59 | grep '^sub/Makefile.am:.*foo_SOURCES' stderr && exit 1
|
---|
60 | grep '^Makefile.am:.*INCLUDES' stderr && exit 1
|
---|
61 | # Only two lines of warnings.
|
---|
62 | test `wc -l < stderr` = 2
|
---|
63 |
|
---|
64 | # On fast machines the autom4te.cache created during the above run of
|
---|
65 | # $AUTOMAKE is likely to have the same time stamp as the configure.in
|
---|
66 | # created below; thus causing traces for the old configure.in to be
|
---|
67 | # used. We could do `$sleep', but it's faster to erase the
|
---|
68 | # directory. (Erase autom4te*.cache, not autom4te.cache, because some
|
---|
69 | # bogus installations of Autoconf use a versioned cache.)
|
---|
70 | rm -rf autom4te*.cache
|
---|
71 |
|
---|
72 | # If we add a global -Wnone, all warnings should disappear.
|
---|
73 | cat >configure.in <<END
|
---|
74 | AC_INIT([warnopts], [1.0])
|
---|
75 | AM_INIT_AUTOMAKE([-Wnone])
|
---|
76 | AC_CONFIG_FILES([Makefile sub/Makefile])
|
---|
77 | AC_OUTPUT
|
---|
78 | END
|
---|
79 | $ACLOCAL
|
---|
80 | $AUTOMAKE
|
---|