| 1 | #! /bin/sh
|
|---|
| 2 | # Copyright (C) 2002, 2003, 2004 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 Automake; see the file COPYING. If not, write to
|
|---|
| 18 | # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|---|
| 19 | # Boston, MA 02110-1301, 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 | cat >>configure.in <<END
|
|---|
| 28 | AC_CONFIG_FILES([sub/Makefile])
|
|---|
| 29 | AC_OUTPUT
|
|---|
| 30 | END
|
|---|
| 31 |
|
|---|
| 32 | mkdir sub
|
|---|
| 33 |
|
|---|
| 34 | # These two Makefile contain the same errors, but have different
|
|---|
| 35 | # warnings disabled.
|
|---|
| 36 |
|
|---|
| 37 | cat >Makefile.am <<END
|
|---|
| 38 | AUTOMAKE_OPTIONS = -Wno-obsolete
|
|---|
| 39 | INCLUDES = -Ifoo
|
|---|
| 40 | foo_SOURCES = unused
|
|---|
| 41 | SUBDIRS = sub
|
|---|
| 42 | END
|
|---|
| 43 |
|
|---|
| 44 | cat >sub/Makefile.am <<END
|
|---|
| 45 | AUTOMAKE_OPTIONS = -Wno-syntax
|
|---|
| 46 | INCLUDES = -Ifoo
|
|---|
| 47 | foo_SOURCES = unused
|
|---|
| 48 | END
|
|---|
| 49 |
|
|---|
| 50 | $ACLOCAL
|
|---|
| 51 | AUTOMAKE_fails
|
|---|
| 52 | # The expected diagnostic is
|
|---|
| 53 | # Makefile.am:3: unused variable: `foo_SOURCES'
|
|---|
| 54 | # sub/Makefile.am:2: `INCLUDES' is the old name for `AM_CPPFLAGS'
|
|---|
| 55 | grep '^Makefile.am:.*foo_SOURCES' stderr
|
|---|
| 56 | grep '^sub/Makefile.am:.*INCLUDES' stderr
|
|---|
| 57 | grep '^sub/Makefile.am:.*foo_SOURCES' stderr && exit 1
|
|---|
| 58 | grep '^Makefile.am:.*INCLUDES' stderr && exit 1
|
|---|
| 59 | # Only three lines of warnings.
|
|---|
| 60 | test `wc -l < stderr` = 3
|
|---|
| 61 |
|
|---|
| 62 | # On fast machines the autom4te.cache created during the above run of
|
|---|
| 63 | # $AUTOMAKE is likely to have the same time stamp as the configure.in
|
|---|
| 64 | # created below; thus causing traces for the old configure.in to be
|
|---|
| 65 | # used. We could do `$sleep', but it's faster to erase the
|
|---|
| 66 | # directory. (Erase autom4te*.cache, not autom4te.cache, because some
|
|---|
| 67 | # bogus installations of Autoconf use a versioned cache.)
|
|---|
| 68 | rm -rf autom4te*.cache
|
|---|
| 69 |
|
|---|
| 70 | # If we add a global -Wnone, all warnings should disappear.
|
|---|
| 71 | cat >configure.in <<END
|
|---|
| 72 | AC_INIT([warnopts], [1.0])
|
|---|
| 73 | AM_INIT_AUTOMAKE([-Wnone])
|
|---|
| 74 | AC_CONFIG_FILES([Makefile sub/Makefile])
|
|---|
| 75 | AC_OUTPUT
|
|---|
| 76 | END
|
|---|
| 77 | $ACLOCAL
|
|---|
| 78 | $AUTOMAKE
|
|---|