Next Up Previous Contents
Next: A.14 STAR_CHECK_PROGS
Up: A The Starconf macros and variables
Previous: A.12 AC_PROG_FC
[ID index][Keyword index]

A.13 AC_PROG_FPP

AC_PROG_FPP(required-features,[FPP-SRC-EXT=F])

required-features is a space-separated list of features that the Fortran preprocessor must have for the code to compile. It is up to the package maintainer to properly set these requirements.

FPP-SRC-EXT is an optional specification of the file extension for preprocessable Fortran source files (without a leading dot). It defaults to F: There would appear to be a problem, here, with case-insensitive filesystems, such as the default HFS+ on MacOS X, and Windows filesystems, since the extension .F is indistinguishable from plain .f. However there is no problem in practice, since the Fortran compilers you are likely to encounter on these platforms are all capable of compiling preprocessable Fortran directly to object code, without requiring the intermediate .f file (and there is a check in autoconf to double-check that this is true).

The macro works out if the Fortran compiler discovered by macro AC_PROG_FC has the requested set of features. If so, it arranges for the compilation to be done `directly'; if not, it arranges for `indirect' compilation, where the preprocessable Fortran code is converted to pure Fortran code and only subsequently passed to the Fortran compiler.

The configure variables which this macro sets, and which are available for substitution, are as follows.

FPP
The Fortran preprocessor which the macro decides is suitable.
FPPFLAGS
The flags which will be given to the compiler (in direct mode) or preprocessor (in indirect mode).
FPP_SRC_EXT
This is the file extension (without a dot) of preprocessable Fortran files; by default this is `F'.
FPP_COMPILE_EXT
This contains the file extension which the Fortran compiler will accept. It is the same as FPP_SRC_EXT if the compiler itself can do preprocessing (`direct' compilation), or a dummy value (not .f, since that would conflict with the pre-existing rule for compiling Fortran) if it cannot, and the file must be preprocessed separately (`indirect').
FPP_PREPROCESS_EXT
The partner of FPP_COMPILE_EXT. This is FPP_SRC_EXT for indirect compilation, or a dummy value for direct compilation, when the corresponding separate-processing generated rule should be ignored.
FPP_MAKE_FLAGS
This is used to pass flags to the cpp or fpp command if we compile directly, and leave them out otherwise.
FPP_OUTPUT
This is used to redirect FPP output to the .f file in those cases where FPP writes to stdout rather than to a file: it is either blank or something like >$@
You do not generally need to know or care about the above variables, since if you have any preprocessable source files in your source set, then automake will insert appropriate build rules in the generated Makefile.in on your behalf. If, however, you need to run the preprocessor `by hand' for some reason (perhaps because you are using the preprocessor to do something other than compiling .F to .o, so that the .F file is not being mentioned in a _SOURCES primary), then a suitable stanza in a Makefile.am or Makefile.in would be:

file.f: file.$(FPP_SRC_EXT)
        $(FPP) $(FPPFLAGS) $(CPPFLAGS) file.$(FPP_SRC_EXT) $(FPP_OUTPUT)
where we have ensured that the input file has the extension $(FPP_SRC_EXT). You can add extra options such as -I. if necessary (automake puts these in the variable $(DEFAULT_INCLUDES)).

NOTE: There are some features of this macro support which are arguably bad autoconf style, and it is very likely that this macro will change. The documentation below is only for completeness, and you are advised not to pay any attention to it. See Appendix C.

Supported features are:

include
the preprocessor must correctly process #include directives and -I options
define
correctly process -D options
substitute
substitute macros in Fortran code (some preprocessors touch only lines starting with #)
wrap
wrap lines that become too long through macro substitution. fpp is probably the only preprocessor that does this.
cstyle
Do not suppress C style comments (the -C option in cpp)
CSTYLE
Do suppress C style comments (e.g. code contains C-style comments, and compiler may not know how to handle them)

Features can be abbreviated: i, in, inc etc. are equivalent to include. Features can be deselected (feature not needed) by prepending "no", e.g. nodef (=nodefine), now (=nowrap).

Default for the feature list is [include define substitute nowrap nocstyle noCSTYLE]

Feature requirements corresponding to the defaults may be omitted

Note that "wrap" implies "substitute", and CSTYLE and cstyle cannot be requested at the same time. The macro adjusts this automatically.


Next Up Previous Contents
Next: A.14 STAR_CHECK_PROGS
Up: A The Starconf macros and variables
Previous: A.12 AC_PROG_FC
[ID index][Keyword index]
The Starlink Build System
Starlink System Note 78
Norman Gray, Peter W Draper, Mark B Taylor, Steven E Rankin
11 April 2005. Release snapshot: $Revision: 1.116 $. Last updated 28 May 2006