Next: Automatic dependency tracking, Previous: Support for Other Languages, Up: Building Programs and Libraries [Contents][Index]
The features described in this section are deprecated; you must not use any of them in new code, and remove their use from older but still maintained code: they will be withdrawn in the next major Automake release.
When the C language was standardized in 1989, there was a long transition period where package developers needed to worry about porting to older systems that did not support ANSI C by default. These older systems are no longer in practical use and are no longer supported by their original suppliers, so developers need not worry about this problem any more.
Automake allows you to write packages that are portable to K&R C by de-ANSI-fying each source file before the actual compilation takes place.
If the Makefile.am variable AUTOMAKE_OPTIONS
(see Changing Automake’s Behavior) contains the option ansi2knr then code to
handle de-ANSI-fication is inserted into the generated
Makefile.in.
This causes each C source file in the directory to be treated as ANSI C.
If an ANSI C compiler is available, it is used. If no ANSI C compiler
is available, the ansi2knr
program is used to convert the source
files into K&R C, which is then compiled.
The ansi2knr
program is simple-minded. It assumes the source
code will be formatted in a particular way; see the ansi2knr
man
page for details.
Support for the obsolete de-ANSI-fication feature
requires the source files ansi2knr.c
and ansi2knr.1 to be in the same package as the ANSI C source;
these files are distributed with Automake. Also, the package
configure.ac must call the macro AM_C_PROTOTYPES
(see Autoconf macros supplied with Automake).
Automake also handles finding the ansi2knr
support files in some
other directory in the current package. This is done by prepending the
relative path to the appropriate directory to the ansi2knr
option. For instance, suppose the package has ANSI C code in the
src and lib subdirectories. The files ansi2knr.c and
ansi2knr.1 appear in lib. Then this could appear in
src/Makefile.am:
AUTOMAKE_OPTIONS = ../lib/ansi2knr
If no directory prefix is given, the files are assumed to be in the current directory.
Note that automatic de-ANSI-fication will not work when the package is
being built for a different host architecture. That is because
automake
currently has no way to build ansi2knr
for the build machine.
Using LIBOBJS
with source de-ANSI-fication used to require
hand-crafted code in configure to append ‘$U’ to basenames
in LIBOBJS
. This is no longer true today. Starting with version
2.54, Autoconf takes care of rewriting LIBOBJS
and
LTLIBOBJS
. (see AC_LIBOBJ
vs. LIBOBJS
in The Autoconf Manual)
Next: Automatic dependency tracking, Previous: Support for Other Languages, Up: Building Programs and Libraries [Contents][Index]