Merge branch 'msvc'
[platform/upstream/automake.git] / tests / werror4.test
1 #! /bin/sh
2 # Copyright (C) 2010  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 # -Werror and local -Werror settings should be flagged for the user.
18
19 . ./defs || Exit 1
20
21 set -e
22
23 cat >>configure.in <<\END
24 AC_CONFIG_FILES([sub/Makefile])
25 AC_OUTPUT
26 END
27
28 mkdir sub
29 cat >sub/Makefile.am <<\END
30 AUTOMAKE_OPTIONS = -Werror
31 SUB = foo
32 SUB = bar
33 END
34 cat >Makefile.am <<\END
35 AUTOMAKE_OPTIONS = -Werror
36 VAR = foo
37 VAR = bar
38 END
39
40 $ACLOCAL
41
42 AUTOMAKE_fails -Wno-error
43 grep 'VAR multiply defined' stderr
44 grep 'SUB multiply defined' stderr
45 test `grep -c 'warnings are treated as errors' stderr` -eq 1
46
47 sed '/AUTOMAKE_OPTIONS/d' sub/Makefile.am > t
48 mv -f t sub/Makefile.am
49
50 AUTOMAKE_fails -Wno-error
51 grep 'VAR multiply defined' stderr
52 grep 'SUB multiply defined' stderr
53 test `grep -c 'warnings are treated as errors' stderr` -eq 1
54
55 sed '/AUTOMAKE_OPTIONS/d' Makefile.am > t
56 mv -f t Makefile.am
57
58 AUTOMAKE_fails -Werror
59 grep 'VAR multiply defined' stderr
60 grep 'SUB multiply defined' stderr
61 test `grep -c 'warnings are treated as errors' stderr` -eq 1
62
63 AUTOMAKE_run 0 -Wno-error
64 grep 'VAR multiply defined' stderr
65 grep 'SUB multiply defined' stderr
66 grep 'warnings are treated as errors' stderr && Exit 1
67
68 :