Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / silentf77.test
1 #!/bin/sh
2 # Copyright (C) 2010 Free Software Foundation, Inc.
3 #
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.
8 #
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.
13 #
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/>.
16
17 # Check silent-rules mode for Fortran 77.
18 # Keep this ins sync with the sister test silentf90.test.
19
20 required='gfortran' # FIXME: any working Fortran compiler should be OK!
21 . ./defs || Exit 1
22
23 set -e
24
25 mkdir sub
26
27 cat >>configure.in <<'EOF'
28 AM_SILENT_RULES
29 AC_PROG_F77
30 AC_CONFIG_FILES([sub/Makefile])
31 AC_OUTPUT
32 EOF
33
34 cat > Makefile.am <<'EOF'
35 # Need generic and non-generic rules.
36 bin_PROGRAMS = foo1 foo2
37 foo1_SOURCES = foo.f
38 foo2_SOURCES = $(foo1_SOURCES)
39 foo2_FFLAGS = $(AM_FFLAGS)
40 SUBDIRS = sub
41 EOF
42
43 cat > sub/Makefile.am <<'EOF'
44 AUTOMAKE_OPTIONS = subdir-objects
45 # Need generic and non-generic rules.
46 bin_PROGRAMS = bar1 bar2
47 bar1_SOURCES = bar.f
48 bar2_SOURCES = $(bar1_SOURCES)
49 bar2_FFLAGS = $(AM_FFLAGS)
50 EOF
51
52 cat > foo.f <<'EOF'
53       program foo
54       stop
55       end
56 EOF
57 cp foo.f sub/bar.f
58
59 $ACLOCAL
60 $AUTOMAKE --add-missing
61 $AUTOCONF
62
63 ./configure --enable-silent-rules
64 $MAKE >stdout || { cat stdout; Exit 1; }
65 cat stdout
66 # Avoid spurious failures with SunStudio Fortran compilers.
67 sed '/^NOTICE:/d' stdout > t
68 mv -f t stdout
69 cat stdout
70
71 $EGREP ' (-c|-o)' stdout && Exit 1
72 grep 'mv ' stdout && Exit 1
73
74 grep 'F77 .*foo\.'  stdout
75 grep 'F77 .*bar\.'  stdout
76 grep 'F77LD .*foo1' stdout
77 grep 'F77LD .*bar1' stdout
78 grep 'F77LD .*foo2' stdout
79 grep 'F77LD .*bar2' stdout
80
81 $EGREP '(FC|FCLD) ' stdout && Exit 1
82
83 # Ensure a clean rebuild.
84 $MAKE clean
85
86 $MAKE V=1 >stdout || { cat stdout; Exit 1; }
87 cat stdout
88
89 grep ' -c ' stdout
90 grep ' -o ' stdout
91
92 $EGREP '(F77|FC|LD) ' stdout && Exit 1
93
94 :