tests: tweaks and minimal improvements to t/insthook.sh
[automake.git] / t / silent-lt.sh
blobdc9bf2acc8fe49b6e3acb165d90cf8796d76395e
1 #!/bin/sh
2 # Copyright (C) 2009-2013 Free Software Foundation, Inc.
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.
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.
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/>.
17 # Check silent-rules mode for C, with libtool, both with and without
18 # automatic dependency tracking.
20 required='cc libtoolize'
21 . test-init.sh
23 mkdir sub
25 cat >>configure.ac <<'EOF'
26 AC_CONFIG_FILES([sub/Makefile])
27 AC_PROG_CC
28 AM_PROG_AR
29 AM_PROG_CC_C_O
30 AC_PROG_LIBTOOL
31 AC_OUTPUT
32 EOF
34 cat > Makefile.am <<'EOF'
35 # Need generic and non-generic rules.
36 lib_LTLIBRARIES = libfoo.la libbar.la
37 libbar_la_CFLAGS = $(AM_CFLAGS)
38 SUBDIRS = sub
39 EOF
41 cat > sub/Makefile.am <<'EOF'
42 AUTOMAKE_OPTIONS = subdir-objects
43 # Need generic and non-generic rules.
44 lib_LTLIBRARIES = libbaz.la libbla.la
45 libbla_la_CFLAGS = $(AM_CFLAGS)
46 EOF
48 cat > libfoo.c <<'EOF'
49 int main ()
51 return 0;
53 EOF
54 cp libfoo.c libbar.c
55 cp libfoo.c sub/libbaz.c
56 cp libfoo.c sub/libbla.c
58 libtoolize
59 $ACLOCAL
60 $AUTOMAKE --add-missing
61 $AUTOCONF
63 for config_args in \
64 '--enable-dependency-tracking' \
65 '--disable-dependency-tracking' \
66 ; do
68 ./configure --enable-silent-rules $config_args
70 $MAKE >stdout || { cat stdout; exit 1; }
71 cat stdout
73 $EGREP ' (-c|-o)' stdout && exit 1
74 grep 'mv ' stdout && exit 1
75 grep ' CC .*foo\.' stdout
76 grep ' CC .*bar\.' stdout
77 grep ' CC .*baz\.' stdout
78 grep ' CC .*bla\.' stdout
79 grep ' CCLD .*foo' stdout
80 grep ' CCLD .*bar' stdout
81 grep ' CCLD .*baz' stdout
82 grep ' CCLD .*bla' stdout
84 $MAKE clean
85 $MAKE V=1 >stdout || { cat stdout; exit 1; }
86 cat stdout
87 grep ' -c' stdout
88 grep ' -o libfoo' stdout
89 # The libtool command line can contain e.g. a '--tag=CC' option.
90 sed 's/--tag=[^ ]*/--tag=x/g' stdout | $EGREP '(CC|LD) ' && exit 1
92 $MAKE distclean
94 done