Autoconf, Automake, and Libtool: How GNU Autotools uses M4

| ## 21.2 How GNU Autotools uses M4 The GNU Autotools may all appear to use M4, but in actual fact, it all boils down to `autoconf` that invokes `m4` to generate your ``configure'` script. You might be surprised to learn that the shell code in ``configure'` does not use `m4` to generate a final ``Makefile'` from ``Makefile.in'`. Instead, it uses `sed`, since that is more likely to be present on an end-user's system and thereby removes the dependency on `m4`. Automake and Libtool include a lot of M4 input files. These are macros provided with each package that you can use directly (or indirectly) from your ``configure.in'`. These packages don't invoke `m4` themselves. If you have already installed Autoconf on your system, you may have encountered problems due to its strict M4 requirements. Autoconf demands to use GNU M4, mostly due to it exceeding limitations present in other M4 implementations. As noted by the Autoconf manual, this is not an onerous requirement, as it only affects package maintainers who must regenerate ``configure'` scripts. Autoconf's own ``Makefile'` will freeze some of the Autoconf ``.m4'` files containing macros as it builds Autoconf. When M4 freezes an input file, it produces another file which represents the internal state of the M4 processor so that the input file does not need to be parsed again. This helps to reduce the startup time for `autoconf`.

This document was generated by Gary V. Vaughan on February, 8 2006 using texi2html