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
FPPFLAGS
FPP_SRC_EXT
FPP_COMPILE_EXT
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
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
cpp
or
fpp
command if we compile directly, and
leave them out otherwise.FPP_OUTPUT
>$@
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:
where we have ensured that the input file has the extensionfile.f: file.$(FPP_SRC_EXT) $(FPP) $(FPPFLAGS) $(CPPFLAGS) file.$(FPP_SRC_EXT) $(FPP_OUTPUT)
$(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
directives and
-I
options-D
optionsfpp
is probably the
only preprocessor that does this.-C
option in cpp)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.