[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

21. M4

M4 is a general purpose tool for processing text and has existed on Unix systems of all kinds for many years, rarely catching the attention of users. Text generation through macro processing is not a new concept. Originally M4 was designed as the preprocessor for the Rational FORTRAN system and was influenced by the General Purpose Macro generator, GPM, first described by Stratchey in 1965! GNU M4 is the GNU project’s implementation of M4 and was written by René Seindal in 1990.

In recent years, awareness of M4 has grown through its use by popular free software packages. The Sendmail package incorporates a configuration system that uses M4 to generate its complex ‘sendmail.cf’ file from a simple specification of the desired configuration. Autoconf uses M4 to generate output files such as a ‘configure’ script.

It is somewhat unfortunate that users of GNU Autotools need to know so much about M4, because it has been too exposed. Many of these tools’ implementation details were simply left up to M4, forcing the user to know about M4 in order to use them. It is a well-known problem and there is a movement amongst the development community to improve this shortcoming in the future. This deficiency is the primary reason that this chapter exists—it is important to have a good working knowledge of M4 in order to use the GNU Autotools and to extend it with your own macros (see section Writing New Macros for Autoconf).

The GNU M4 manual provides a thorough tutorial on M4. Please refer to it for additional information.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated by Ben Elliston on July 10, 2015 using texi2html 1.82.