Merge branch 'msvc'
[platform/upstream/automake.git] / tests / location.test
1 #! /bin/sh
2 # Copyright (C) 2002, 2003, 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 # Test for locations in error messages.
18
19 . ./defs || Exit 1
20
21 set -e
22
23 cat >> configure.in << 'END'
24 AM_CONDITIONAL([COND1], [true])
25 AM_CONDITIONAL([COND2], [true])
26 AC_PROG_CC
27 AC_PROG_RANLIB
28 END
29
30 cat > Makefile.am << 'END'
31 bin_PROGRAMS = libfoo.a
32 if COND2
33   lib_LIBRARIES = libfoo.a
34 endif
35 if COND1
36   bin_PROGRAMS += ctags
37 endif
38 VAR = 1 \
39       2 \
40       3
41
42 VAR = 1 \
43       2 \
44       3
45 END
46
47 $ACLOCAL
48 AUTOMAKE_fails -Wno-error
49
50 # Smash the useless difference of lib file locations.
51 sed 's,^.*lib/am/\([a-z]*\.am\),\1,' stderr >observed
52 cat >expected <<\EOF
53 Makefile.am:12: warning: VAR multiply defined in condition TRUE ...
54 Makefile.am:8: ... `VAR' previously defined here
55 automake: error: libfoo_a_OBJECTS should not be defined
56 Makefile.am:3:   while processing library `libfoo.a'
57 automake: error: use `libfoo_a_LDADD', not `libfoo_a_LIBADD'
58 Makefile.am:3:   while processing library `libfoo.a'
59 library.am: warning: deprecated feature: target `libfoo.a' overrides `libfoo.a$(EXEEXT)'
60 library.am: change your target to read `libfoo.a$(EXEEXT)'
61 Makefile.am:3:   while processing library `libfoo.a'
62 program.am: target `libfoo.a$(EXEEXT)' was defined here
63 Makefile.am:1:   while processing program `libfoo.a'
64 program.am: warning: redefinition of `libfoo.a$(EXEEXT)' ...
65 Makefile.am:1:   while processing program `libfoo.a'
66 library.am: ... `libfoo.a' previously defined here
67 Makefile.am:3:   while processing library `libfoo.a'
68 tags.am: warning: redefinition of `ctags' ...
69 program.am: ... `ctags$(EXEEXT)' previously defined here
70 Makefile.am:6:   while processing program `ctags'
71 EOF
72
73 diff expected observed || Exit 1
74
75 AUTOMAKE_fails -Werror
76 sed 's,^.*lib/am/\([a-z]*\.am\),\1,' stderr >observed
77 ( echo 'automake: warnings are treated as errors'; cat expected ) \
78   | diff - observed || Exit 1
79 :