autoconf
[Top][All Lists]
Advanced

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

Re: produce *mod with fortran


From: Ralf Wildenhues
Subject: Re: produce *mod with fortran
Date: Fri, 14 Jan 2011 20:13:26 +0100
User-agent: Mutt/1.5.20 (2010-08-04)

Hello Eve-Marie,

addressing the remaining part of your question:

* Eve-Marie Devaliere wrote on Fri, Jan 14, 2011 at 05:32:58PM CET:
> I have created my makefiles and configure.ac...
> I have read in the tutorial that FCFLAG had to be set to -g (unless it
> is g77).. Well I need to create *.mod and *.o so I need another set of
> flags.....
[...]

> In my Makefile.am I have entries such as:(there are many more like that)
> bin_PROGRAMS = Type_Kinds
> Type_Kinds_SOURCES = Type_Kinds.f90
> ... is that wrong for modules?
> 
> I tried those macro too
> AC_PROG_FC_C_O
> AC_FC_MAIN
> in my configure.ac to try telling it it didn't have a main (I just want
> modules), but no luck.... (Please bear with me as I am new to Fortran
> too... )

Do you need the package to be very portable?  If so, I suggest you go to
the Autoconf Macro Archive and grab two Fortran-related macros,
AX_F90_MODULE_EXTENSION and AX_F90_MODULE_FLAG.

We then use roughly the following in configure.ac besides what you
already have:

# Find out how to add to the Fortran include path.
AX_F90_MODULE_FLAG
# The module flag may be "-I " or so, and some make implementations
# swallow trailing space in variable settings, so we employ a little
# trick.
AC_SUBST([empty], [""])
AC_SUBST([FC_MODINC], [$ax_f90_modflag'${empty}'])
# Find out the file name extensions of Fortran module files.
AX_F90_MODULE_EXTENSION
if test "x$ax_f90_modext" != xunknown; then
  FC_MODEXT=$ax_f90_modext
else
  FC_MODEXT=$ax_f90_modext
fi
AC_SUBST([FC_MODEXT])


And then we use the substituted variables in the Makefile.am files,
more or less like this:

# Find module files from the ../lib directory.
AM_FCFLAGS = $(FC_MODINC)../lib

# Clean up modules.
clean-local: clean-modules
clean-modules:
        test -z "$(FC_MODEXT)" || $(RM) *.$(FC_MODEXT)


Now, Automake doesn't (yet) have builtin support for Fortran module
dependencies, so you will have to write dependencies yourself, or use
one of the several scripts out there for them.  Sorry.  We would like to
change this in the near future ...

If you need to support long lines in Fortran sources (and can require
Autoconf >= 2.68), you can also use the new AC_FC_LINE_LENGTH macro.

Hope that helps.

Cheers,
Ralf



reply via email to

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