automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: subdir-objects for Fortran


From: Ralf Wildenhues
Subject: Re: subdir-objects for Fortran
Date: Sat, 14 Oct 2006 10:09:36 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

[ http://lists.gnu.org/archive/html/automake-patches/2006-09/msg00005.html
  
http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=automake&pr=480
 ]

Apologies for the long delay.

Just to decouple this from other Fortran changes, here's the previous
proposed patch with 
  required='g77 gfortran'

added, so that it works even although FCFLAGS_f90 is not set (for
gfortran, any of those FCFLAGS_* are empty), and one bugfix: if
AC_FC_SRCEXT fails (happens if only a Fortran 77 compiler but no Fortran
90 one is found), let configure exit with 77.
(Of course the bugfix only really comes into play once the requirement
to gfortran is not present any more, or the user has set $FC.)

OK to apply?

Cheers,
Ralf

2006-10-14   Ralf Wildenhues  <address@hidden>

        For PR automake/480.
        * automake.in (lang_f77_rewrite, lang_fc_rewrite)
        (lang_ppfc_rewrite, lang_ppf77_rewrite, lang_ratfor_rewrite):
        return `lang_sub_obj' to support subdir-object mode for the
        Fortran dialects.
        * tests/fort4.test, tests/fort5.test: New tests.
        * tests/Makefile.am: Update.
        * NEWS: Update.
        Report by Davyd Madeley <address@hidden> and
        address@hidden

Index: NEWS
===================================================================
RCS file: /cvs/automake/automake/NEWS,v
retrieving revision 1.315
diff -u -r1.315 NEWS
--- NEWS        5 Sep 2006 18:58:16 -0000       1.315
+++ NEWS        14 Oct 2006 08:06:44 -0000
@@ -1,5 +1,10 @@
 New in 1.9c:
 
+* Languages changes:
+
+  - subdir-object mode works now with Fortran (F77, FC, preprocessed
+    Fortran, and Ratfor).
+
 * Miscellaneous changes:
 
   - The script `install-sh' needs to have executable permissions for
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1632
diff -u -r1.1632 automake.in
--- automake.in 10 Oct 2006 21:34:11 -0000      1.1632
+++ automake.in 14 Oct 2006 08:06:47 -0000
@@ -5330,31 +5330,31 @@
 # Rewrite a single Fortran 77 file.
 sub lang_f77_rewrite
 {
-    return LANG_PROCESS;
+    return &lang_sub_obj;
 }
 
 # Rewrite a single Fortran file.
 sub lang_fc_rewrite
 {
-    return LANG_PROCESS;
+    return &lang_sub_obj;
 }
 
 # Rewrite a single preprocessed Fortran file.
 sub lang_ppfc_rewrite
 {
-    return LANG_PROCESS;
+    return &lang_sub_obj;
 }
 
 # Rewrite a single preprocessed Fortran 77 file.
 sub lang_ppf77_rewrite
 {
-    return LANG_PROCESS;
+    return &lang_sub_obj;
 }
 
 # Rewrite a single ratfor file.
 sub lang_ratfor_rewrite
 {
-    return LANG_PROCESS;
+    return &lang_sub_obj;
 }
 
 # Rewrite a single Objective C file.
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.609
diff -u -r1.609 Makefile.am
--- tests/Makefile.am   30 Aug 2006 20:35:56 -0000      1.609
+++ tests/Makefile.am   14 Oct 2006 08:06:53 -0000
@@ -245,6 +245,8 @@
 fnoc.test \
 fo.test        \
 fort1.test \
+fort4.test \
+fort5.test \
 fonly.test \
 fortdep.test \
 fpinst2.test \
--- /dev/null   2006-10-09 01:10:44.864355000 +0200
+++ tests/fort4.test    2006-10-14 10:05:53.000000000 +0200
@@ -0,0 +1,98 @@
+#! /bin/sh
+# Copyright (C) 2006  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., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# Test mixing Fortran 77 and Fortran (FC).
+
+# For now, require the GNU compilers (to avoid some Libtool/Autoconf
+# issues).
+required='g77 gfortran'
+. ./defs || exit 1
+
+set -e
+
+mkdir sub
+
+cat >hello.f <<'END'
+      program hello
+      call foo
+      call bar
+      stop
+      end
+END
+
+cat >bye.f90 <<'END'
+program goodbye
+  call baz
+  stop
+end
+END
+
+cat >foo.f90 <<'END'
+      subroutine foo
+      return
+      end
+END
+
+sed s,foo,bar, foo.f90 > sub/bar.f90
+sed s,foo,baz, foo.f90 > sub/baz.f
+
+cat >>configure.in <<'END'
+AC_PROG_F77
+AC_PROG_FC
+AC_FC_SRCEXT([f90], [],
+  [AC_MSG_FAILURE([$FC compiler cannot create executables], 77)])
+AC_FC_LIBRARY_LDFLAGS
+AC_OUTPUT
+END
+
+cat >Makefile.am <<'END'
+bin_PROGRAMS = hello goodbye
+hello_SOURCES = hello.f foo.f90 sub/bar.f90
+goodbye_SOURCES = bye.f90 sub/baz.f
+goodbye_FCFLAGS = 
+LDADD = $(FCLIBS)
+END
+
+$ACLOCAL
+$AUTOMAKE
+# The Fortran 77 linker should be preferred:
+grep '.\$(FCLINK)' Makefile.in && exit 1
+
+$AUTOCONF
+# configure may exit 77 if no compiler is found,
+# or if the compiler cannot compile Fortran 90 files).
+./configure
+$MAKE
+subobjs=`echo sub/*.o sub/*.obj`
+test "$subobjs" = 'sub/*.o sub/*.obj'
+$MAKE distcheck
+
+$MAKE distclean
+echo 'AUTOMAKE_OPTIONS = subdir-objects' >> Makefile.am
+$AUTOMAKE
+./configure
+$MAKE
+test ! -f bar.o
+test ! -f bar.obj
+test ! -f baz.o
+test ! -f baz.obj
+test ! -f goodbye-baz.o
+test ! -f goodbye-baz.obj
+$MAKE distcheck
--- /dev/null   2006-10-09 01:10:44.864355000 +0200
+++ tests/fort5.test    2006-10-14 10:05:53.000000000 +0200
@@ -0,0 +1,108 @@
+#! /bin/sh
+# Copyright (C) 2006  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., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# Test mixing Fortran 77 and Fortran (FC), libtool version.
+
+# For now, require the GNU compilers (to avoid some Libtool/Autoconf
+# issues).
+required='libtoolize g77 gfortran'
+. ./defs || exit 1
+
+set -e
+
+mkdir sub
+
+cat >hello.f <<'END'
+      program hello
+      call foo
+      call bar
+      call goodbye
+      stop
+      end
+END
+
+cat >bye.f90 <<'END'
+subroutine goodbye
+  call baz
+  return
+end
+END
+
+cat >foo.f90 <<'END'
+      subroutine foo
+      return
+      end
+END
+
+sed s,foo,bar, foo.f90 > sub/bar.f90
+sed s,foo,baz, foo.f90 > sub/baz.f
+
+cat >>configure.in <<'END'
+AC_PROG_F77
+AC_PROG_FC
+AC_FC_SRCEXT([f90], [],
+  [AC_MSG_FAILURE([$FC compiler cannot create executables], 77)])
+AC_FC_LIBRARY_LDFLAGS
+LT_PREREQ([2.0])
+AC_PROG_LIBTOOL
+AC_OUTPUT
+END
+
+cat >Makefile.am <<'END'
+bin_PROGRAMS = hello
+lib_LTLIBRARIES = libhello.la
+noinst_LTLIBRARIES = libgoodbye.la
+hello_SOURCES = hello.f
+hello_LDADD = libhello.la
+libhello_la_SOURCES = foo.f90 sub/bar.f90
+libhello_la_LIBADD = libgoodbye.la
+libgoodbye_la_SOURCES = bye.f90 sub/baz.f
+libgoodbye_la_FCFLAGS = 
+LDADD = $(FCLIBS)
+END
+
+libtoolize --force
+$ACLOCAL
+$AUTOMAKE -a
+$AUTOCONF
+
+# This test requires Libtool >= 2.0.  Earlier Libtool does not
+# have the LT_PREREQ macro to cause autoconf failure, so let's
+# skip in this case:
+grep LT_PREREQ configure && exit 77
+
+# configure may exit 77 if no compiler is found,
+# or if the compiler cannot compile Fortran 90 files).
+./configure
+$MAKE
+subobjs=`echo sub/*.lo`
+test "$subobjs" = 'sub/*.lo'
+$MAKE distcheck
+
+# The following will be fixed in a later patch:
+$MAKE distclean
+echo 'AUTOMAKE_OPTIONS = subdir-objects' >> Makefile.am
+$AUTOMAKE -a
+./configure
+$MAKE
+test ! -f bar.lo
+test ! -f baz.lo
+test ! -f libgoodbye_la-baz.lo
+$MAKE distcheck




reply via email to

[Prev in Thread] Current Thread [Next in Thread]