Next: Dependencies, Previous: Support for Other Languages, Up: Programs
The features described in this section are obsolete; you should not used any of them in new code, and they may be withdrawn in future Automake releases.
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 Options) 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 Macros).
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
)