doc: update Vala documentation
[automake.git] / t / fort5.sh
blob6fc9945decfcb4619285efa8a08fbb7e9aed83f1
1 #! /bin/sh
2 # Copyright (C) 2006-2024 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 <https://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 . test-init.sh
24 mkdir sub
26 cat >hello.f <<'END'
27 program hello
28 call foo
29 call bar
30 call goodbye
31 stop
32 end
33 END
35 cat >bye.f90 <<'END'
36 subroutine goodbye
37 call baz
38 return
39 end
40 END
42 cat >foo.f90 <<'END'
43 subroutine foo
44 return
45 end
46 END
48 sed s,foo,bar, foo.f90 > sub/bar.f90
49 sed s,foo,baz, foo.f90 > sub/baz.f
51 cat >>configure.ac <<'END'
52 AC_PROG_F77
53 AC_PROG_FC
54 AC_FC_SRCEXT([f90], [],
55 [AC_MSG_FAILURE([$FC compiler cannot create executables], 77)])
56 AC_FC_LIBRARY_LDFLAGS
57 AM_PROG_AR
58 LT_PREREQ([2.0])
59 AC_PROG_LIBTOOL
60 AC_OUTPUT
61 END
63 cat >Makefile.am <<'END'
64 bin_PROGRAMS = hello
65 lib_LTLIBRARIES = libhello.la
66 noinst_LTLIBRARIES = libgoodbye.la
67 hello_SOURCES = hello.f
68 hello_LDADD = libhello.la
69 libhello_la_SOURCES = foo.f90 sub/bar.f90
70 libhello_la_LIBADD = libgoodbye.la
71 libgoodbye_la_SOURCES = bye.f90 sub/baz.f
72 libgoodbye_la_FCFLAGS =
73 LDADD = $(FCLIBS)
74 END
76 libtoolize --force
77 $ACLOCAL
78 # FIXME: stop disabling the warnings in the 'unsupported' category
79 # FIXME: once the 'subdir-objects' option has been mandatory.
80 $AUTOMAKE -a -Wno-unsupported
81 $AUTOCONF
83 # This test requires Libtool >= 2.0. Earlier Libtool does not
84 # have the LT_PREREQ macro to cause autoconf failure.
85 grep LT_PREREQ configure && skip_ "libtool is too old (probably < 2.0)"
87 # Ensure we use --tag for f90, too.
88 grep " --tag=FC" Makefile.in
90 # ./configure may exit with status 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 ! -e bar.lo
105 test ! -e baz.lo
106 test ! -e libgoodbye_la-baz.lo
107 $MAKE distcheck