Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / silent3.test
1 #!/bin/sh
2 # Copyright (C) 2009, 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 # Check silent-rules mode, with libtool, standard depmode case.
18
19 # Please keep this file in sync with silent4.test and silent9.test.
20
21 required=libtoolize
22 . ./defs || Exit 1
23
24 set -e
25
26 mkdir sub
27
28 cat >>configure.in <<'EOF'
29 AM_SILENT_RULES
30 AC_CONFIG_FILES([sub/Makefile])
31 AC_PROG_CC
32 AM_PROG_AR
33 AM_PROG_CC_C_O
34 AC_PROG_LIBTOOL
35 AC_OUTPUT
36 EOF
37
38 cat > Makefile.am <<'EOF'
39 # Need generic and non-generic rules.
40 lib_LTLIBRARIES = libfoo.la libbar.la
41 libbar_la_CFLAGS = $(AM_CFLAGS)
42 SUBDIRS = sub
43 EOF
44
45 cat > sub/Makefile.am <<'EOF'
46 AUTOMAKE_OPTIONS = subdir-objects
47 # Need generic and non-generic rules.
48 lib_LTLIBRARIES = libbaz.la libbla.la
49 libbla_la_CFLAGS = $(AM_CFLAGS)
50 EOF
51
52 cat > libfoo.c <<'EOF'
53 int main ()
54 {
55   return 0;
56 }
57 EOF
58 cp libfoo.c libbar.c
59 cp libfoo.c sub/libbaz.c
60 cp libfoo.c sub/libbla.c
61
62 libtoolize
63 $ACLOCAL
64 $AUTOMAKE --add-missing
65 $AUTOCONF
66
67 ./configure --enable-silent-rules
68 $MAKE >stdout || { cat stdout; Exit 1; }
69 cat stdout
70 $EGREP ' (-c|-o)' stdout && Exit 1
71 grep 'mv ' stdout && Exit 1
72 grep ' CC .*foo\.' stdout
73 grep ' CC .*bar\.' stdout
74 grep ' CC .*baz\.' stdout
75 grep ' CC .*bla\.' stdout
76 grep ' CCLD .*foo' stdout
77 grep ' CCLD .*bar' stdout
78 grep ' CCLD .*baz' stdout
79 grep ' CCLD .*bla' stdout
80
81 $MAKE clean
82 $MAKE V=1 >stdout || { cat stdout; Exit 1; }
83 cat stdout
84 grep ' -c' stdout
85 grep ' -o libfoo' stdout
86 # The libtool command line can contain e.g. a `--tag=CC' option.
87 sed 's/--tag=[^ ]*/--tag=x/g' stdout | $EGREP '(CC|LD) ' && Exit 1
88
89 :