compile: implement library search to support MSVC static linking
[automake.git] / tests / silent5.test
blobe29f48faff7b67761bac3761c25aedc1aa567987
1 #!/bin/sh
2 # Copyright (C) 2009, 2010 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, languages other than C.
18 # This test partly overlaps with other silent*.test, but it serves as
19 # a stress test by using many different languages at once -- so don't
20 # remove this test script.
22 # FIXME: generic C++/Fortran compilers should suffice here
23 required='g++ gfortran flex bison'
24 . ./defs
26 set -e
28 # Avoids too much code duplication.
29 do_and_check_silent_build ()
31 case $1 in
32 --rebuild) rebuild=true;;
33 *) rebuild=false;;
34 esac
36 $MAKE >stdout || { cat stdout; Exit 1; }
37 cat stdout
39 $EGREP ' (-c|-o)' stdout && Exit 1
40 $EGREP '(mv|ylwrap) ' stdout && Exit 1
42 grep 'CXX .*foo1\.' stdout
43 grep 'CXX .*baz1\.' stdout
44 grep 'FC .*foo2\.' stdout
45 grep 'FC .*baz2\.' stdout
46 grep 'F77 .*foo3\.' stdout
47 grep 'F77 .*baz3\.' stdout
48 grep ' CC .*foo5\.' stdout
49 grep ' CC .*baz5\.' stdout
50 grep ' CC .*foo6\.' stdout
51 grep ' CC .*baz6\.' stdout
53 grep 'CXXLD .*foo' stdout
54 grep 'CCLD .*bar' stdout
55 grep 'CXXLD .*baz' stdout
56 grep 'CCLD .*bla' stdout
58 if $rebuild; then :; else
59 grep 'YACC .*foo6\.' stdout
60 grep 'YACC .*baz6\.' stdout
61 grep 'LEX .*foo5\.' stdout
62 grep 'LEX .*baz5\.' stdout
65 unset rebuild
68 # Avoids too much code duplication.
69 do_and_check_verbose_build ()
72 case $1 in
73 --rebuild) rebuild=true;;
74 *) rebuild=false;;
75 esac
77 $MAKE V=1 >stdout || { cat stdout; Exit 1; }
78 cat stdout
80 grep ' -c ' stdout
81 grep ' -o ' stdout
83 $EGREP '(CC|CXX|FC|F77|LD) ' stdout && Exit 1
85 if $rebuild; then :; else
86 grep 'ylwrap ' stdout
87 $EGREP '(LEX|YACC) ' stdout && Exit 1
90 unset rebuild
93 mkdir sub
95 cat >>configure.in <<'EOF'
96 AM_SILENT_RULES
97 AM_PROG_CC_C_O
98 AC_PROG_CXX
99 AC_PROG_F77
100 AC_PROG_FC
101 AC_PROG_LEX
102 AC_PROG_YACC
103 AC_CONFIG_FILES([sub/Makefile])
104 AC_OUTPUT
107 cat > Makefile.am <<'EOF'
108 # Need generic and non-generic rules.
109 bin_PROGRAMS = foo bar fo2
110 bar_CFLAGS = $(AM_CFLAGS)
111 foo_SOURCES = foo1.cpp foo2.f90 foo3.f foo5.l foo6.y
112 fo2_SOURCES = $(foo_SOURCES)
113 fo2_CPPFLAGS = $(AM_CPPFLAGS)
114 fo2_FFLAGS = $(AM_FFLAGS)
115 fo2_FCFLAGS = $(AM_FCFLAGS)
116 SUBDIRS = sub
117 AM_YFLAGS = -d
118 LDADD = $(LEXLIB)
119 BUILT_SOURCES = foo6.h
122 cat > sub/Makefile.am <<'EOF'
123 AUTOMAKE_OPTIONS = subdir-objects
124 # Need generic and non-generic rules.
125 bin_PROGRAMS = baz bla ba2
126 bla_CFLAGS = $(AM_CFLAGS)
127 baz_SOURCES = baz1.cpp baz2.f90 baz3.f baz5.l baz6.y
128 ba2_SOURCES = $(baz_SOURCES)
129 ba2_CPPFLAGS = $(AM_CPPFLAGS)
130 ba2_FFLAGS = $(AM_FFLAGS)
131 ba2_FCFLAGS = $(AM_FCFLAGS)
132 AM_YFLAGS = -d
133 LDADD = $(LEXLIB)
134 BUILT_SOURCES = baz6.h
137 cat > foo1.cpp <<'EOF'
138 int main ()
140 return 0;
143 cat > foo2.f90 <<'EOF'
144 subroutine foo2
145 return
148 cat > foo3.f <<'EOF'
149 subroutine foo3
150 return
153 cat > foo5.l <<'EOF'
155 "END" return EOF;
159 cat > foo6.y <<'EOF'
161 void yyerror (char *s) {}
163 %token EOF
165 fubar : 'f' 'o' 'o' 'b' 'a' 'r' EOF {};
167 cp foo1.cpp bar.c
168 cp foo1.cpp sub/baz.c
169 cp foo1.cpp sub/bla.c
170 cp foo1.cpp sub/baz1.cpp
171 cp foo2.f90 sub/baz2.f90
172 cp foo3.f sub/baz3.f
173 cp foo5.l sub/baz5.l
174 cp foo6.y sub/baz6.y
176 $ACLOCAL
177 $AUTOMAKE --add-missing
178 $AUTOCONF
180 # configure once for fastdep, once for non-fastdep, once for nodep
181 for config_args in \
182 '' \
183 am_cv_CC_dependencies_compiler_type=gcc \
184 --disable-dependency-tracking
187 ./configure $config_args --enable-silent-rules
189 do_and_check_silent_build
190 # Cleaning and then rebuilding with the same V flag (and without
191 # removing the generated sources in between) shouldn't trigger a
192 # different set of rules.
193 $MAKE clean
194 do_and_check_silent_build --rebuild
196 # Ensure a clean rebuild.
197 $MAKE clean
198 # This is required, since these files are not removed by `make clean'
199 # (as dictated by the GNU Coding Standards).
200 rm -f foo5.c foo6.[ch] sub/baz5.c sub/baz6.[ch]
202 do_and_check_verbose_build
203 # Cleaning and then rebuilding with the same V flag (and without
204 # removing the generated sources in between) shouldn't trigger a
205 # different set of rules.
206 $MAKE clean
207 do_and_check_verbose_build --rebuild
209 # Ensure a clean reconfiguration/rebuild.
210 $MAKE clean
211 $MAKE maintainer-clean
213 done