[Top][All Lists]

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

Re: autotools, preprocessors, and fortran 90

From: John
Subject: Re: autotools, preprocessors, and fortran 90
Date: Mon, 11 Dec 2006 21:33:39 +0900
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.13) Gecko/20060909

Ralf Wildenhues wrote:
> Hello John,

>>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
> You can set the variable from, 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, if your project consists only of Fortran
> source, or, if you have other directories with different
> source languages.  For example, you could have this in
>   MY_FPPFLAGS="-x f95-cpp-input"
> and this in src/f90/
> Hope that helps.
> Cheers,
> Ralf

Hi Ralf,

First of all, thanks for your help.  But, I'm still having some trouble.

MY_FPPFLAGS="-x f95-cpp-input"

This doesn't work because the final makefile compile lines are

FCLD = $(FC)

I don't know how to get the MY_FPPFLAGS into the compile line flags.

I could never get the following line to produce the substitution.
AC_SUBST([AM_FCFLAGS], [-x f95-cpp-input])


AM_FCFLAGS="-x f95-cpp-input"

did produce the right substitution.  But, in either case of the
AM_FCFLAGS, I still have the original problem of the -x f95-cpp-input
getting passed to the linker, which completely doesn't work since the
preprocessor tries to process object files while linking.  How do I get
the build system to add compile flags that aren't link flags?  As you
can see above, all the compile flags are also passed to the linker.

By the way, where is the Automake list?


reply via email to

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