help-gnu-utils
[Top][All Lists]
Advanced

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

Re: autotools, preprocessors, and fortran 90


From: Ralf Wildenhues
Subject: Re: autotools, preprocessors, and fortran 90
Date: Sun, 10 Dec 2006 16:47:49 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

Hello John,

* John wrote on Sun, Dec 10, 2006 at 01:37:41PM CET:
> 
> I don't know if this is the right place for this question, but ...

Probably the automake list would be more appropriate.  Anyway.

> I'm trying to set up a small fortran 90 project using the gnu
> auto-tools.  My fortran files (*.f90) require a preprocessor to
> interpret # directives.  In the case of gcc, I need to add the flag -x
> f95-cpp-input to force the use of the preprocessor.  I can do this
> by adding the line
> 
> AM_FCFLAGS = -x f95-cpp-input
> 
> to Makefile.am.

You can set the variable from configure.ac, e.g.,
  AC_SUBST([AM_FCFLAGS], [-x f95-cpp-input])

You could conditionalize it on the compiler there.  Note that Automake
assumes preprocessed Fortran with capitalized suffixes .F90, .F95.  So 
if you use them, you can stuff preprocessing flags in AM_CPPFLAGS, e.g.,
globally in configure.ac, if your project consists only of Fortran
source, or per-Makefile.am, if you have other directories with different
source languages.  For example, you could have this in configure.ac:
  MY_FPPFLAGS="-x f95-cpp-input"
  AC_SUBST([MY_FPPFLAGS])

and this in src/f90/Makefile.am:
  AM_CPPFLAGS = $(MY_FPPFLAGS) ...

Preprocessed Fortran support in Autoconf and Automake isn't yet as good
as it could be.  There's been some work done by the Starlink people that
would be nice to merge eventually (given enough time).  Search the net
for AC_PROG_FPP in case you're interested (but doing that work isn't
exactly a newbie task).

Hope that helps.

Cheers,
Ralf




reply via email to

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