* automake.in (scan_aclocal_m4): Define ACLOCAL_M4 even in
[automake.git] / tests / warnopts.test
blobd33b801eff65fc6c6864dca8186c902480d94502
1 #! /bin/sh
2 # Copyright (C) 2002, 2003 Free Software Foundation, Inc.
4 # This file is part of GNU Automake.
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.
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.
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.
21 # Make sure that we can enable or disable warnings on a per-file basis.
23 . ./defs || exit 1
25 set -e
28 cat >>configure.in <<END
29 AC_CONFIG_FILES([sub/Makefile])
30 AC_OUTPUT
31 END
33 mkdir sub
35 # These two Makefile contain the same errors, but have different
36 # warnings disabled.
38 cat >Makefile.am <<END
39 AUTOMAKE_OPTIONS = -Wno-obsolete
40 INCLUDES = -Ifoo
41 foo_SOURCES = unused
42 SUBDIRS = sub
43 END
45 cat >sub/Makefile.am <<END
46 AUTOMAKE_OPTIONS = -Wno-syntax
47 INCLUDES = -Ifoo
48 foo_SOURCES = unused
49 END
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
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
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