]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
Better support for Fortran 9x.
authorAlexandre Duret-Lutz <adl@gnu.org>
Fri, 2 Apr 2004 07:14:27 +0000 (07:14 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Fri, 2 Apr 2004 07:14:27 +0000 (07:14 +0000)
* automake.in: Add "fc" and "ppfc" languages for Fortran 9x.
* doc/automake.texi (Fortran 9x Support): New section.
* lib/Automake/Variable.pm (%_ac_macro_for_var): Add AC_PROG_FC.
* tests/compile_f90_c_cxx.test: New file.
* tests/ext.test: Add AC_PROG_FC.
* tests/f90only.test: New file.
* tests/link_f90_only.test: New file.
* tests/Makefile.am (TESTS): Add new tests.

14 files changed:
ChangeLog
NEWS
THANKS
automake.in
doc/automake.texi
doc/stamp-vti
doc/version.texi
lib/Automake/Variable.pm
tests/Makefile.am
tests/Makefile.in
tests/compile_f90_c_cxx.test [new file with mode: 0755]
tests/ext.test
tests/f90only.test [new file with mode: 0755]
tests/link_f90_only.test [new file with mode: 0755]

index 145187990451f3d16e1c1613bc4b50929be7d1c6..98271fe81fc3d9f914fd6cf3b2aa48cc842db29d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2004-04-02  Mike Nolta  <mike@nolta.net>
+
+       Better support for Fortran 9x.
+       * automake.in: Add "fc" and "ppfc" languages for Fortran 9x.
+       * doc/automake.texi (Fortran 9x Support): New section.
+       * lib/Automake/Variable.pm (%_ac_macro_for_var): Add AC_PROG_FC.
+       * tests/compile_f90_c_cxx.test: New file.
+       * tests/ext.test: Add AC_PROG_FC.
+       * tests/f90only.test: New file.
+       * tests/link_f90_only.test: New file.
+       * tests/Makefile.am (TESTS): Add new tests.
+
 2004-04-01  Paul Eggert  <eggert@twinsun.com>
 
        * lib/install-sh: If "mv -f" works, use it, and fall back to
diff --git a/NEWS b/NEWS
index 7e9156c19edebdb3e6a8b663ca57c6e370a9f46a..c7021ccc87c5842f8f389e69a3bad32c0698acee 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,10 @@
 New in 1.8a:
 
+* Better support for Fortran 90/95 with the new "fc" and "ppfc" languages.
+  Works the same as the old Fortran 77 implementation; just replace F77
+  with FC everywhere (exception: FFLAGS becomes FCFLAGS).  Requires a
+  version of autoconf which provides AC_PROG_FC (>=2.59).
+
 * Libtool tags are used with libtool versions that support them.
   (I.e., with Libtool 1.5 or greater.)
 
diff --git a/THANKS b/THANKS
index 09cc4d52c8755b8e3cfc6dd2872f9d1531af1e88..e20d50b171d23280a9b2e8e91d857065a452184a 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -157,6 +157,7 @@ Merijn de Jonge             M.de.Jonge@cwi.nl
 Michael Brantley       Michael-Brantley@deshaw.com
 Michel de Ruiter       mdruiter@cs.vu.nl
 Mike Castle            dalgoda@ix.netcom.com
+Mike Nolta             mrnolta@princeton.edu
 Miles Bader            miles@ccs.mt.nec.co.jp
 Miloslav Trmac         trmac@popelka.ms.mff.cuni.cz
 Miodrag Vallat         miodrag@ifrance.com
index b27d3b1efa4eeb1c722cf87c079a8a75b071805b..c88f7dd3f453e8e35b26f2f0b7a5f20ce4d0c06a 100755 (executable)
@@ -805,7 +805,39 @@ register_language ('name' => 'f77',
                   'lder' => 'F77LD',
                   'ld' => '$(F77)',
                   'pure' => 1,
-                  'extensions' => ['.f', '.for', '.f90']);
+                  'extensions' => ['.f', '.for']);
+
+# Fortran
+register_language ('name' => 'fc',
+                  'Name' => 'Fortran',
+                  'linker' => 'FCLINK',
+                  'link' => '$(FCLD) $(AM_FCFLAGS) $(FCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
+                  'flags' => ['FCFLAGS'],
+                  'compile' => '$(FC) $(AM_FCFLAGS) $(FCFLAGS)',
+                  'compiler' => 'FCCOMPILE',
+                  'compile_flag' => '-c',
+                  'output_flag' => '-o',
+                  'lder' => 'FCLD',
+                  'ld' => '$(FC)',
+                  'pure' => 1,
+                  'extensions' => ['.f90', '.f95']);
+
+# Preprocessed Fortran
+register_language ('name' => 'ppfc',
+                  'Name' => 'Preprocessed Fortran',
+                  'config_vars' => ['FC'],
+                  'linker' => 'FCLINK',
+                  'link' => '$(FCLD) $(AM_FFLAGS) $(FCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
+                  'lder' => 'FCLD',
+                  'ld' => '$(FC)',
+                  'flags' => ['FCFLAGS', 'CPPFLAGS'],
+                  'compiler' => 'PPFCCOMPILE',
+                  'compile' => '$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS)',
+                  'compile_flag' => '-c',
+                  'output_flag' => '-o',
+                  'libtool_tag' => 'FC',
+                  'pure' => 1,
+                  'extensions' => ['.F90','.F95']);
 
 # Preprocessed Fortran 77
 #
@@ -5004,6 +5036,18 @@ sub lang_f77_rewrite
     return LANG_PROCESS;
 }
 
+# Rewrite a single Fortran file.
+sub lang_fc_rewrite
+{
+    return LANG_PROCESS;
+}
+
+# Rewrite a single preprocessed Fortran file.
+sub lang_ppfc_rewrite
+{
+    return LANG_PROCESS;
+}
+
 # Rewrite a single preprocessed Fortran 77 file.
 sub lang_ppf77_rewrite
 {
@@ -5196,7 +5240,7 @@ sub resolve_linker
 {
     my (%linkers) = @_;
 
-    foreach my $l (qw(GCJLINK CXXLINK F77LINK OBJCLINK))
+    foreach my $l (qw(GCJLINK CXXLINK F77LINK FCLINK OBJCLINK))
     {
        return $l if defined $linkers{$l};
     }
index fb96fc1f0bb5050659a61f49af34c090f89f967a..254c391350cd86c9608714a761170a0614e18038 100644 (file)
@@ -167,6 +167,7 @@ Building Programs and Libraries
 * C++ Support::                 Compiling C++ sources
 * Assembly Support::            Compiling assembly sources
 * Fortran 77 Support::          Compiling Fortran 77 sources
+* Fortran 9x Support::          Compiling Fortran 9x sources
 * Java Support::                Compiling Java sources
 * Support for Other Languages::  Compiling other languages
 * ANSI::                        Automatic de-ANSI-fication
@@ -202,6 +203,10 @@ Mixing Fortran 77 With C and C++
 
 * How the Linker is Chosen::    Automatic linker selection
 
+Fortran 9x Support
+
+* Compiling Fortran 9x Files::  Compiling Fortran 9x sources
+
 Other Derived Objects
 
 * Scripts::                     Executable scripts
@@ -1393,6 +1398,12 @@ languages that include Fortran 77 (@pxref{Mixing Fortran 77 With C and
 C++}).  @xref{Macros, , Autoconf macros supplied with Automake}.
 @cvindex AC_F77_LIBRARY_LDFLAGS
 
+@item AC_PROG_FC
+This is required if any Fortran 90/95 source is included.  This macro is
+distributed with Autoconf version 2.58 and later.  @xref{Particular
+Programs, , Particular Program Checks, autoconf, The Autoconf Manual}.
+@cvindex AC_PROG_FC
+
 @item AC_PROG_LIBTOOL
 Automake will turn on processing for @code{libtool} (@pxref{Top, ,
 Introduction, libtool, The Libtool Manual}).
@@ -2371,6 +2382,7 @@ to build programs and libraries.
 * C++ Support::                 Compiling C++ sources
 * Assembly Support::            Compiling assembly sources
 * Fortran 77 Support::          Compiling Fortran 77 sources
+* Fortran 9x Support::          Compiling Fortran 9x sources
 * Java Support::                Compiling Java sources
 * Support for Other Languages::  Compiling other languages
 * ANSI::                        Automatic de-ANSI-fication
@@ -3910,6 +3922,62 @@ included by the C++ linker, then they must be manually added to an
                         +---------+---------+---------+
 @end example
 
+@node Fortran 9x Support
+@comment  node-name,  next,  previous,  up
+@section Fortran 9x Support
+
+@cindex Fortran 9x support
+@cindex Support for Fortran 9x
+
+Automake includes full support for Fortran 9x.
+
+Any package including Fortran 9x code must define the output variable
+@samp{FC} in @file{configure.ac}; the simplest way to do this is to use
+the @code{AC_PROG_FC} macro (@pxref{Particular Programs, , Particular
+Program Checks, autoconf, The Autoconf Manual}).
+
+A few additional variables are defined when a Fortran 9x source file is
+seen:
+
+@vtable @code
+
+@item FC
+The name of the Fortran 9x compiler.
+
+@item FCFLAGS
+Any flags to pass to the Fortran 9x compiler.
+
+@item AM_FCFLAGS
+The maintainer's variant of @code{FCFLAGS}.
+
+@item FCCOMPILE
+The command used to actually compile a Fortran 9x source file.  The file
+name is appended to form the complete command line.
+
+@item FCLINK
+The command used to actually link a pure Fortran 9x program or shared
+library.
+
+@end vtable
+
+@menu
+* Compiling Fortran 9x Files::  Compiling Fortran 9x sources
+@end menu
+
+@node Compiling Fortran 9x Files
+@comment  node-name,  next,  previous,  up
+@subsection Compiling Fortran 9x Files
+
+@file{N.o} is made automatically from @file{N.f90} or @file{N.f95}
+by running the Fortran 9x compiler.  The precise command used
+is as follows:
+
+@table @file
+
+@item .f9x
+@code{$(FC) -c $(AM_FCFLAGS) $(FCFLAGS)}
+
+@end table
 
 @node Java Support
 @comment  node-name,  next,  previous,  up
@@ -3954,8 +4022,9 @@ the @code{_LDFLAGS} variable for the program.
 @section Support for Other Languages
 
 Automake currently only includes full support for C, C++ (@pxref{C++
-Support}), Fortran 77 (@pxref{Fortran 77 Support}), and Java
-(@pxref{Java Support}).  There is only rudimentary support for other
+Support}), Fortran 77 (@pxref{Fortran 77 Support}),
+Fortran 9x (@pxref{Fortran 9x Support}),
+and Java (@pxref{Java Support}).  There is only rudimentary support for other
 languages, support for which will be improved based on user demand.
 
 Some limited support for adding your own languages is available via the
index ae24e54dc6571c707b1221f2088daa3e6d8f9b66..a69465602ba855c9876ae2254f60106d0de9ce8f 100644 (file)
@@ -1,4 +1,4 @@
-@set UPDATED 16 February 2004
-@set UPDATED-MONTH February 2004
+@set UPDATED 2 April 2004
+@set UPDATED-MONTH April 2004
 @set EDITION 1.8a
 @set VERSION 1.8a
index ae24e54dc6571c707b1221f2088daa3e6d8f9b66..a69465602ba855c9876ae2254f60106d0de9ce8f 100644 (file)
@@ -1,4 +1,4 @@
-@set UPDATED 16 February 2004
-@set UPDATED-MONTH February 2004
+@set UPDATED 2 April 2004
+@set UPDATED-MONTH April 2004
 @set EDITION 1.8a
 @set VERSION 1.8a
index 332c5b44752e6d8d671ce3f1cbfc3ca62751db94..0bb14434febeb16cbf2dc0d9238a8acd3485287e 100644 (file)
@@ -175,6 +175,8 @@ my %_ac_macro_for_var =
    CXXFLAGS => 'AC_PROG_CXX',
    F77 => 'AC_PROG_F77',
    F77FLAGS => 'AC_PROG_F77',
+   FC => 'AC_PROG_FC',
+   FCFLAGS => 'AC_PROG_FC',
    RANLIB => 'AC_PROG_RANLIB',
    YACC => 'AC_PROG_YACC',
    );
index 67adfad7b6e27f97a608d48f2ce8692602b4c095..6d4e122b86d063362085383de05814a0ac085b3d 100644 (file)
@@ -87,6 +87,7 @@ comment4.test \
 comment5.test \
 comment6.test \
 comment7.test \
+compile_f90_c_cxx.test \
 compile_f_c_cxx.test \
 cond.test \
 cond2.test \
@@ -211,6 +212,7 @@ extra4.test \
 extra5.test \
 extra6.test \
 extra7.test \
+f90only.test \
 flibs.test \
 fnoc.test \
 fo.test        \
@@ -287,6 +289,7 @@ libtool8.test \
 license.test \
 link_c_cxx.test        \
 link_dist.test \
+link_f90_only.test \
 link_fc.test \
 link_fccxx.test \
 link_fcxx.test \
index 5ae0e5e8b8f9fc4a3817b2cabc80edce0c99f571..c67430ca5158fb664df3bf90de748b38a8194648 100644 (file)
@@ -202,6 +202,7 @@ comment4.test \
 comment5.test \
 comment6.test \
 comment7.test \
+compile_f90_c_cxx.test \
 compile_f_c_cxx.test \
 cond.test \
 cond2.test \
@@ -326,6 +327,7 @@ extra4.test \
 extra5.test \
 extra6.test \
 extra7.test \
+f90only.test \
 flibs.test \
 fnoc.test \
 fo.test        \
@@ -402,6 +404,7 @@ libtool8.test \
 license.test \
 link_c_cxx.test        \
 link_dist.test \
+link_f90_only.test \
 link_fc.test \
 link_fccxx.test \
 link_fcxx.test \
diff --git a/tests/compile_f90_c_cxx.test b/tests/compile_f90_c_cxx.test
new file mode 100755 (executable)
index 0000000..20809ad
--- /dev/null
@@ -0,0 +1,54 @@
+#! /bin/sh
+# Copyright (C) 1998, 1999, 2001, 2002  Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Automake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Automake; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Test to make sure rules to invoke all compilers are selected with
+# mixed source objects.
+# (copied from compile_f_c_cxx.test) Mike Nolta <mrnolta@princeton.edu>
+
+. ./defs || exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_CXX
+AC_PROG_FC
+AC_FC_LIBRARY_LDFLAGS
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo
+foo_SOURCES  = foo.f90 bar.c baz.cc
+foo_LDADD    = @FLIBS@
+END
+
+: > foo.f90
+: > bar.c
+: > baz.cc
+
+$ACLOCAL || exit 1
+$AUTOMAKE || exit 1
+
+
+# Look for the macros at the beginning of rules.  Be careful, as there
+# are literal tabs at the beginning of the search strings.
+grep ' \$(COMPILE)'     Makefile.in  || exit 1
+grep ' \$(CXXCOMPILE)'  Makefile.in  || exit 1
+grep ' \$(FCCOMPILE)'  Makefile.in  || exit 1
+
+exit 0
index a34b0b0481ddf3341806345d4a871fba8bd7cb9e..427957564e51499fbd975d9051e7f86b987db0a5 100755 (executable)
@@ -24,6 +24,7 @@
 
 cat >> configure.in << 'END'
 AC_PROG_F77
+AC_PROG_FC
 _AM_DEPENDENCIES(OBJC)
 AC_SUBST(OBJC)
 END
diff --git a/tests/f90only.test b/tests/f90only.test
new file mode 100755 (executable)
index 0000000..9b59f22
--- /dev/null
@@ -0,0 +1,54 @@
+#! /bin/sh
+# Copyright (C) 1998, 1999, 2001, 2002  Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Automake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Automake; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Make sure programs with only Fortran 90 source are handled properly.
+# (copied from fonly.test) Mike Nolta <mrnolta@princeton.edu>
+
+. ./defs || exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_FC
+END
+
+# Tue Aug 11 09:50:48 1998  Matthew D. Langston  <langston@SLAC.Stanford.EDU>
+#
+# This test currently fails with automake v. 1.3 since automake assumes
+# that elements of `bin_PROGRAMS' (e.g. zardoz) without a corresponding
+# `_SOURCES' (e.g. zardoz_SOURCES) should be compiled from `zardoz.c'
+# whether or not `zardoz.c' actually exists.  For example, even if the
+# file `zardoz.c' doesn't exist but the file `zardoz.f' does exist, this
+# tests would still fail.
+#
+# Therefore, for now I have put in the line `zardoz_SOURCES = zardoz.f'
+# (see below) so that automake's top-level `make check' won't fail, but
+# this line should be removed once automake handles this situation
+# correctly.
+
+cat > Makefile.am <<'END'
+bin_PROGRAMS = zardoz
+zardoz_SOURCES = zardoz.f90
+END
+
+: > zardoz.f90
+
+$ACLOCAL || exit 1
+$AUTOMAKE || exit 1
+
+grep 'zardoz.f90' Makefile.in
diff --git a/tests/link_f90_only.test b/tests/link_f90_only.test
new file mode 100755 (executable)
index 0000000..8d27835
--- /dev/null
@@ -0,0 +1,51 @@
+#! /bin/sh
+# Copyright (C) 1998, 1999, 2001, 2002  Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Automake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Automake; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Test to make sure the Fortran 90 linker is used when appropriate.
+# (copied from link_f_only.test) Mike Nolta <mrnolta@princeton.edu>
+
+. ./defs || exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_FC
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = lavalamp
+lavalamp_SOURCES = lamp.f90
+END
+
+: > lamp.f90
+
+$ACLOCAL || exit 1
+$AUTOMAKE || exit 1
+
+
+# We should only see the Fortran linker in the rules of `Makefile.in'.
+
+# Look for this macro not at the beginning of any line; that will have
+# to be good enough for now.
+grep '.\$(FCLINK)' Makefile.in  || exit 1
+
+# We should not see these patterns:
+grep '.\$(CXXLINK)' Makefile.in && exit 1
+grep '.\$(LINK)'    Makefile.in && exit 1
+
+exit 0