2 # Copyright (C) 2009, 2010, 2011 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)
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, with many languages at once.
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.
21 # This test should work with generic compilers; keep it in sync with
22 # sister test `silent-many-gcc.test', which requires the GNU compilers
23 # and forces the use of gcc depmode.
25 required
='cc c++ fortran fortran77 flex yacc'
28 # Avoids too much code duplication.
29 do_and_check_silent_build
()
32 --rebuild) rebuild
=true
;;
36 $MAKE >stdout ||
{ cat stdout
; Exit
1; }
38 # Avoid spurious failures with SunStudio Fortran compilers.
39 sed '/^NOTICE:/d' stdout
> t
43 $EGREP ' (-c|-o)' stdout
&& Exit
1
44 $EGREP '(mv|ylwrap) ' stdout
&& Exit
1
46 grep 'CXX .*foo1\.' stdout
47 grep 'CXX .*baz1\.' stdout
48 grep 'FC .*foo2\.' stdout
49 grep 'FC .*baz2\.' stdout
50 grep 'F77 .*foo3\.' stdout
51 grep 'F77 .*baz3\.' stdout
52 grep ' CC .*foo5\.' stdout
53 grep ' CC .*baz5\.' stdout
54 grep ' CC .*foo6\.' stdout
55 grep ' CC .*baz6\.' stdout
57 grep 'CXXLD .*foo' stdout
58 grep 'CCLD .*bar' stdout
59 grep 'CXXLD .*baz' stdout
60 grep 'CCLD .*bla' stdout
62 if $rebuild; then :; else
63 grep 'YACC .*foo6\.' stdout
64 grep 'YACC .*baz6\.' stdout
65 grep 'LEX .*foo5\.' stdout
66 grep 'LEX .*baz5\.' stdout
72 # Avoids too much code duplication.
73 do_and_check_verbose_build
()
77 --rebuild) rebuild
=true
;;
81 $MAKE V
=1 >stdout ||
{ cat stdout
; Exit
1; }
87 $EGREP '(CC|CXX|FC|F77|LD) ' stdout
&& Exit
1
89 if $rebuild; then :; else
91 $EGREP '(LEX|YACC) ' stdout
&& Exit
1
99 cat >>configure.
in <<'EOF'
108 # FIXME: remove this hack once the requirements c++, fortran and fortran77
109 # are implemented correctly.
110 test -n "`echo $CXX`" || AC_MSG_ERROR([C++ compiler not found], [77])
111 test -n "`echo $FC`" || AC_MSG_ERROR([Fortran compiler not found], [77])
112 test -n "`echo $F77`" || AC_MSG_ERROR([Fortran 77 compiler not found], [77])
114 # The SunStudio C++ compiler is unfortunately named `CC' (yuck!),
115 # and this can cause problems with our grepping checks on the
116 # output from make. Avoid these problems by invoking a wrapper
117 # script, as filtering the make output proved too fragile.
120 AC_MSG_WARN([the C++ compiler '$CXX' seems to be named 'CC'])
121 AC_MSG_WARN([it will be wrapped with the custom script 'am--cxx'])
122 echo '#!/bin/sh' > bin/am--cxx
123 echo 'PATH=$saved_PATH; export PATH' >> bin/am--cxx
124 echo "exec $CXX \${1+"\$@"}" >> bin/am--cxx
125 chmod a+x bin/am--cxx
129 AC_CONFIG_FILES([sub/Makefile])
133 cat > Makefile.am
<<'EOF'
134 # Need generic and non-generic rules.
135 bin_PROGRAMS = foo bar fo2
136 bar_CFLAGS = $(AM_CFLAGS)
137 foo_SOURCES = foo1.cpp foo2.f90 foo3.f foo5.l foo6.y
138 fo2_SOURCES = $(foo_SOURCES)
139 fo2_CPPFLAGS = $(AM_CPPFLAGS)
140 fo2_FFLAGS = $(AM_FFLAGS)
141 fo2_FCFLAGS = $(AM_FCFLAGS)
145 BUILT_SOURCES = foo6.h
148 cat > sub
/Makefile.am
<<'EOF'
149 AUTOMAKE_OPTIONS = subdir-objects
150 # Need generic and non-generic rules.
151 bin_PROGRAMS = baz bla ba2
152 bla_CFLAGS = $(AM_CFLAGS)
153 baz_SOURCES = baz1.cpp baz2.f90 baz3.f baz5.l baz6.y
154 ba2_SOURCES = $(baz_SOURCES)
155 ba2_CPPFLAGS = $(AM_CPPFLAGS)
156 ba2_FFLAGS = $(AM_FFLAGS)
157 ba2_FCFLAGS = $(AM_FCFLAGS)
160 BUILT_SOURCES = baz6.h
163 cat > foo1.cpp
<<'EOF'
169 cat > foo2.f90
<<'EOF'
184 /* Avoid possible link errors.
*/
192 void yyerror (char *s) {}
196 fubar
: 'f' 'o' 'o' 'b' 'a' 'r' EOF
{};
199 cp foo1.cpp sub
/baz.c
200 cp foo1.cpp sub
/bla.c
201 cp foo1.cpp sub
/baz1.cpp
202 cp foo2.f90 sub
/baz2.f90
208 saved_PATH
=$PATH; export saved_PATH
209 PATH
=`pwd`/bin
$PATH_SEPARATOR$PATH; export PATH
212 $AUTOMAKE --add-missing
215 # Force dependency tracking explicitly, so that slow dependency
216 # extractors are not rejected. Try also with dependency tracking
217 # explicitly disabled.
219 --enable-dependency-tracking --disable-dependency-tracking
222 .
/configure
$config_args --enable-silent-rules
224 do_and_check_silent_build
225 # Cleaning and then rebuilding with the same V flag (and without
226 # removing the generated sources in between) shouldn't trigger a
227 # different set of rules.
229 do_and_check_silent_build
--rebuild
231 # Ensure a clean rebuild.
233 # This is required, since these files are not removed by `make clean'
234 # (as dictated by the GNU Coding Standards).
235 rm -f foo5.c foo6.
[ch
] sub
/baz5.c sub
/baz6.
[ch
]
237 do_and_check_verbose_build
238 # Cleaning and then rebuilding with the same V flag (and without
239 # removing the generated sources in between) shouldn't trigger a
240 # different set of rules.
242 do_and_check_verbose_build
--rebuild
244 # Ensure a clean reconfiguration/rebuild.
246 $MAKE maintainer-clean