Clarify overriding of `*_DEPENDENCIES' in LIBOBJS node.
[automake/ericb.git] / tests / fort5.test
blobd39bb215d95f5b22b163edc6128992c9c50732d2
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), libtool version.
19 # For now, require the GNU compilers (to avoid some Libtool/Autoconf
20 # issues).
21 required='libtoolize 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 call goodbye
33 stop
34 end
35 END
37 cat >bye.f90 <<'END'
38 subroutine goodbye
39 call baz
40 return
41 end
42 END
44 cat >foo.f90 <<'END'
45 subroutine foo
46 return
47 end
48 END
50 sed s,foo,bar, foo.f90 > sub/bar.f90
51 sed s,foo,baz, foo.f90 > sub/baz.f
53 cat >>configure.in <<'END'
54 AC_PROG_F77
55 AC_PROG_FC
56 AC_FC_SRCEXT([f90], [],
57 [AC_MSG_FAILURE([$FC compiler cannot create executables], 77)])
58 AC_FC_LIBRARY_LDFLAGS
59 LT_PREREQ([2.0])
60 AC_PROG_LIBTOOL
61 AC_OUTPUT
62 END
64 cat >Makefile.am <<'END'
65 bin_PROGRAMS = hello
66 lib_LTLIBRARIES = libhello.la
67 noinst_LTLIBRARIES = libgoodbye.la
68 hello_SOURCES = hello.f
69 hello_LDADD = libhello.la
70 libhello_la_SOURCES = foo.f90 sub/bar.f90
71 libhello_la_LIBADD = libgoodbye.la
72 libgoodbye_la_SOURCES = bye.f90 sub/baz.f
73 libgoodbye_la_FCFLAGS =
74 LDADD = $(FCLIBS)
75 END
77 libtoolize --force
78 $ACLOCAL
79 $AUTOMAKE -a
80 $AUTOCONF
82 # This test requires Libtool >= 2.0. Earlier Libtool does not
83 # have the LT_PREREQ macro to cause autoconf failure, so let's
84 # skip in this case:
85 grep LT_PREREQ configure && Exit 77
87 # configure may Exit 77 if no compiler is found,
88 # or if the compiler cannot compile Fortran 90 files).
89 ./configure
90 $MAKE
91 subobjs=`echo sub/*.lo`
92 test "$subobjs" = 'sub/*.lo'
93 $MAKE distcheck
95 # The following will be fixed in a later patch:
96 $MAKE distclean
97 echo 'AUTOMAKE_OPTIONS = subdir-objects' >> Makefile.am
98 $AUTOMAKE -a
99 ./configure
100 $MAKE
101 test ! -f bar.lo
102 test ! -f baz.lo
103 test ! -f libgoodbye_la-baz.lo
104 $MAKE distcheck