Merge branch 'minor'
[automake.git] / t / silent-lt.sh
bloba5dbb00fe223ec9bb2ddf2196e7dca0f46d9f9e3
1 #!/bin/sh
2 # Copyright (C) 2009-2017 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 <https://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 AC_PROG_LIBTOOL
30 AC_OUTPUT
31 EOF
33 cat > Makefile.am <<'EOF'
34 # Need generic and non-generic rules.
35 lib_LTLIBRARIES = libfoo.la libbar.la
36 libbar_la_CFLAGS = $(AM_CFLAGS)
37 SUBDIRS = sub
38 EOF
40 cat > sub/Makefile.am <<'EOF'
41 AUTOMAKE_OPTIONS = subdir-objects
42 # Need generic and non-generic rules.
43 lib_LTLIBRARIES = libbaz.la libbla.la
44 libbla_la_CFLAGS = $(AM_CFLAGS)
45 EOF
47 cat > libfoo.c <<'EOF'
48 int main ()
50 return 0;
52 EOF
53 cp libfoo.c libbar.c
54 cp libfoo.c sub/libbaz.c
55 cp libfoo.c sub/libbla.c
57 libtoolize
58 $ACLOCAL
59 $AUTOMAKE --add-missing
60 $AUTOCONF
62 for config_args in \
63 '--enable-dependency-tracking' \
64 '--disable-dependency-tracking' \
65 ; do
67 ./configure --enable-silent-rules $config_args
69 run_make -O
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
82 $MAKE clean
83 run_make -O V=1
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
89 $MAKE distclean
91 done