tests: fix a timestamp-related spurious failures
[automake.git] / tests / fort5.test
blobd6151a714d0b168b65d23a7770831b48a9d8342d
1 #! /bin/sh
2 # Copyright (C) 2006, 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 # 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 # Ensure we use --tag for f90, too.
88 grep " --tag=FC" Makefile.in
90 # configure may Exit 77 if no compiler is found,
91 # or if the compiler cannot compile Fortran 90 files).
92 ./configure
93 $MAKE
94 subobjs=`echo sub/*.lo`
95 test "$subobjs" = 'sub/*.lo'
96 $MAKE distcheck
98 # The following will be fixed in a later patch:
99 $MAKE distclean
100 echo 'AUTOMAKE_OPTIONS = subdir-objects' >> Makefile.am
101 $AUTOMAKE -a
102 ./configure
103 $MAKE
104 test ! -f bar.lo
105 test ! -f baz.lo
106 test ! -f libgoodbye_la-baz.lo
107 $MAKE distcheck