GNU bug report logs - #8635
Some Fortran files don't have the extensions automake wants

Previous Next

Package: automake;

Reported by: Peter Williams <pwilliams <at> astro.berkeley.edu>

Date: Sat, 7 May 2011 17:14:02 UTC

Severity: wishlist

Full log


View this message in rfc822 format

From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
To: Peter Williams <pwilliams <at> astro.berkeley.edu>
Cc: 8635 <at> debbugs.gnu.org
Subject: bug#8635: Some Fortran files don't have the extensions automake wants
Date: Mon, 9 May 2011 14:11:53 +0200
[Message part 1 (text/plain, inline)]
severity 8635 wishlist
thanks

On Saturday 07 May 2011, Peter Williams wrote:
> I'm working on wrapping a large, preexisting piece of Fortran code with
> an Autotools-based build system. The code is written in Fortran 90 and
> uses ".for" for the file extension. Unfortunately, automake ...
>
I assume you are using automake 1.11.1, right?

> ... thinks that ".for" files are Fortran 77 code, so the wrong compiler
> gets used and chokes on the F90 constructs.
> 
> It's not practical for me to rename the files -- tracking upstream would
> become impossible. Would it be possible to provide a way for me to tell
> automake that my .for files are actually Fortran 90, not Fortran 77? As
> far as I can tell, this mapping is simply hardcoded in /usr/bin/automake.
>
You're right.

> It wouldn't be the most pleasant, but it'd suffice
> if there were some global variable that I could set that would say "hey,
> Automake, .for files are F90". One could imagine more generic solutions
> as well, but Fortran is probably the only language that has these kinds
> of problems.
>
Please try the attached patch (against the v1.11.1 tag in the automake git
repository).  I *think* it should solve your problem for what concerns
automake.  However, note that the GNU Fortran Compiler will still consider
`*.for' files to be Fortran 77 by default, so you'll have to instruct it
to explicitly assume free-form Fortran 90 input, with .e.g.:

  $ ./configure FCFLAGS='-ffree-form -x f95' LDFLAGS='-x none'

This solution is probably not the best one, and is certainly not pretty,
but it should work.  If you can come up with a more general one, I'd be
happy to hear about it.

> Thanks,
> 
> Peter
> 

HTH,
  Stefano
[fortran.patch (text/x-patch, inline)]
diff --git a/automake.in b/automake.in
index e934c5f..23392a8 100755
--- a/automake.in
+++ b/automake.in
@@ -939,7 +939,7 @@ register_language ('name' => 'f77',
 		   'lder' => 'F77LD',
 		   'ld' => '$(F77)',
 		   'pure' => 1,
-		   'extensions' => ['.f', '.for']);
+		   'extensions' => ['.f']);
 
 # Fortran
 register_language ('name' => 'fc',
@@ -957,7 +957,7 @@ register_language ('name' => 'fc',
 		   'lder' => 'FCLD',
 		   'ld' => '$(FC)',
 		   'pure' => 1,
-		   'extensions' => ['.f90', '.f95', '.f03', '.f08']);
+		   'extensions' => ['.for', '.f90', '.f95', '.f03', '.f08']);
 
 # Preprocessed Fortran
 register_language ('name' => 'ppfc',

This bug report was last modified 14 years and 38 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.