[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
>>
>>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) ...
>
> 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"
AC_SUBST([MY_FPPFLAGS])
This doesn't work because the final makefile compile lines are
FCLD = $(FC)
FCLINK = $(FCLD) $(AM_FCFLAGS) $(FCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
FCCOMPILE = $(FC) $(AM_FCFLAGS) $(FCFLAGS)
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])
However,
AM_FCFLAGS="-x f95-cpp-input"
AC_SUBST([AM_FCFLAGS])
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?
Thanks,
John
- autotools, preprocessors, and fortran 90, John, 2006/12/10
- Re: autotools, preprocessors, and fortran 90, Ralf Wildenhues, 2006/12/10
- Message not available
- Re: autotools, preprocessors, and fortran 90,
John <=
- Re: autotools, preprocessors, and fortran 90, Ralf Wildenhues, 2006/12/11
- Message not available
- Re: autotools, preprocessors, and fortran 90, John, 2006/12/12
- Re: autotools, preprocessors, and fortran 90, Ralf Wildenhues, 2006/12/12
- Message not available
- Re: autotools, preprocessors, and fortran 90, John, 2006/12/12