Revert Automake license to GPLv2+.
[automake.git] / tests / silent5.test
blob8d517be030de3d691972a60f7e8f68ed46bf86ee
1 #!/bin/sh
2 # Copyright (C) 2009 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.
19 required='g++ gfortran flex bison'
20 . ./defs
22 set -e
24 mkdir sub
26 cat >>configure.in <<'EOF'
27 AM_SILENT_RULES
28 AM_PROG_CC_C_O
29 AC_PROG_CXX
30 AC_PROG_F77
31 AC_PROG_FC
32 AC_PROG_LEX
33 AC_PROG_YACC
34 AC_CONFIG_FILES([sub/Makefile])
35 AC_OUTPUT
36 EOF
38 cat > Makefile.am <<'EOF'
39 # Need generic and non-generic rules.
40 bin_PROGRAMS = foo bar
41 bar_CFLAGS = $(AM_CFLAGS)
42 foo_SOURCES = foo1.cpp foo2.f90 foo3.f foo5.l foo6.y
43 SUBDIRS = sub
44 AM_YFLAGS = -d
45 LDADD = $(LEXLIB)
46 BUILT_SOURCES = foo6.h
47 EOF
49 cat > sub/Makefile.am <<'EOF'
50 AUTOMAKE_OPTIONS = subdir-objects
51 # Need generic and non-generic rules.
52 bin_PROGRAMS = baz bla
53 bla_CFLAGS = $(AM_CFLAGS)
54 baz_SOURCES = baz1.cpp baz2.f90 baz3.f baz5.l baz6.y
55 AM_YFLAGS = -d
56 LDADD = $(LEXLIB)
57 BUILT_SOURCES = baz6.h
58 EOF
60 cat > foo1.cpp <<'EOF'
61 int main ()
63 return 0;
65 EOF
66 cat > foo2.f90 <<'EOF'
67 subroutine foo2
68 return
69 end
70 EOF
71 cat > foo3.f <<'EOF'
72 subroutine foo3
73 return
74 end
75 EOF
76 cat > foo5.l <<'EOF'
78 "END" return EOF;
81 EOF
82 cat > foo6.y <<'EOF'
84 void yyerror (char *s) {}
86 %token EOF
88 fubar : 'f' 'o' 'o' 'b' 'a' 'r' EOF {};
89 EOF
90 cp foo1.cpp bar.c
91 cp foo1.cpp sub/baz.c
92 cp foo1.cpp sub/bla.c
93 cp foo1.cpp sub/baz1.cpp
94 cp foo2.f90 sub/baz2.f90
95 cp foo3.f sub/baz3.f
96 cp foo5.l sub/baz5.l
97 cp foo6.y sub/baz6.y
99 $ACLOCAL
100 $AUTOMAKE --add-missing
101 $AUTOCONF
103 # configure once for fastdep, once for non-fastdep
104 for config_args in '' am_cv_CC_dependencies_compiler_type=gcc
106 ./configure $config_args --enable-silent-rules
107 $MAKE >stdout || { cat stdout; Exit 1; }
108 cat stdout
109 grep ' -c' stdout && Exit 1
110 grep ' -o ' stdout && Exit 1
111 grep mv stdout && Exit 1
113 grep 'CXX .*foo1\.' stdout
114 grep 'CXX .*baz1\.' stdout
115 grep 'FC .*foo2\.' stdout
116 grep 'FC .*baz2\.' stdout
117 grep 'F77 .*foo3\.' stdout
118 grep 'F77 .*baz3\.' stdout
119 grep 'LEX .*foo5\.' stdout
120 grep 'LEX .*baz5\.' stdout
121 grep ' CC .*foo5\.' stdout
122 grep ' CC .*baz5\.' stdout
123 grep 'YACC .*foo6\.' stdout
124 grep 'YACC .*baz6\.' stdout
125 grep ' CC .*foo6\.' stdout
126 grep ' CC .*baz6\.' stdout
128 grep 'CXXLD .*foo' stdout
129 grep 'CCLD .*bar' stdout
130 grep 'CXXLD .*baz' stdout
131 grep 'CCLD .*bla' stdout
133 $MAKE clean
134 $MAKE V=1 >stdout || { cat stdout; Exit 1; }
135 cat stdout
136 grep ' -c' stdout
137 grep ' -o ' stdout
139 grep 'CXX .*foo1\.' stdout && Exit 1
140 grep 'CXX .*baz1\.' stdout && Exit 1
141 grep 'FC .*foo2\.' stdout && Exit 1
142 grep 'FC .*baz2\.' stdout && Exit 1
143 grep 'F77 .*foo3\.' stdout && Exit 1
144 grep 'F77 .*baz3\.' stdout && Exit 1
145 grep 'LEX .*foo5\.' stdout && Exit 1
146 grep 'LEX .*baz5\.' stdout && Exit 1
147 grep ' CC .*foo5\.' stdout && Exit 1
148 grep ' CC .*baz5\.' stdout && Exit 1
149 grep 'YACC .*foo6\.' stdout && Exit 1
150 grep 'YACC .*baz6\.' stdout && Exit 1
151 grep ' CC .*foo6\.' stdout && Exit 1
152 grep ' CC .*baz6\.' stdout && Exit 1
154 grep 'CXXLD .*foo' stdout && Exit 1
155 grep 'CCLD .*bar' stdout && Exit 1
156 grep 'CXXLD .*baz' stdout && Exit 1
157 grep 'CCLD .*bla' stdout && Exit 1
158 $MAKE clean
159 $MAKE maintainer-clean
160 done