Replace 'configure' with '@command{configure}' as appropriate.
[automake/ericb.git] / tests / fort4.test
blobd6740cabca19f658de9112c90d2803eb608cb6d8
1 #! /bin/sh
2 # Copyright (C) 2006 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 3, 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 # Test mixing Fortran 77 and Fortran (FC).
19 # For now, require the GNU compilers (to avoid some Libtool/Autoconf
20 # issues).
21 required='g77 gfortran'
22 . ./defs || Exit 1
24 set -e
26 mkdir sub
28 cat >hello.f <<'END'
29 program hello
30 call foo
31 call bar
32 stop
33 end
34 END
36 cat >bye.f90 <<'END'
37 program goodbye
38 call baz
39 stop
40 end
41 END
43 cat >foo.f90 <<'END'
44 subroutine foo
45 return
46 end
47 END
49 sed s,foo,bar, foo.f90 > sub/bar.f90
50 sed s,foo,baz, foo.f90 > sub/baz.f
52 cat >>configure.in <<'END'
53 AC_PROG_F77
54 AC_PROG_FC
55 AC_FC_SRCEXT([f90], [],
56 [AC_MSG_FAILURE([$FC compiler cannot create executables], 77)])
57 AC_FC_LIBRARY_LDFLAGS
58 AC_OUTPUT
59 END
61 cat >Makefile.am <<'END'
62 bin_PROGRAMS = hello goodbye
63 hello_SOURCES = hello.f foo.f90 sub/bar.f90
64 goodbye_SOURCES = bye.f90 sub/baz.f
65 goodbye_FCFLAGS =
66 LDADD = $(FCLIBS)
67 END
69 $ACLOCAL
70 $AUTOMAKE
71 # The Fortran 77 linker should be preferred:
72 grep '.\$(FCLINK)' Makefile.in && Exit 1
74 $AUTOCONF
75 # configure may Exit 77 if no compiler is found,
76 # or if the compiler cannot compile Fortran 90 files).
77 ./configure
78 $MAKE
79 subobjs=`echo sub/*.o sub/*.obj`
80 test "$subobjs" = 'sub/*.o sub/*.obj'
81 $MAKE distcheck
83 $MAKE distclean
84 echo 'AUTOMAKE_OPTIONS = subdir-objects' >> Makefile.am
85 $AUTOMAKE
86 ./configure
87 $MAKE
88 test ! -f bar.o
89 test ! -f bar.obj
90 test ! -f baz.o
91 test ! -f baz.obj
92 test ! -f goodbye-baz.o
93 test ! -f goodbye-baz.obj
94 $MAKE distcheck