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