### 1.2 Historical references ¶

Macro languages were invented early in the history of computing. In the 1950s Alan Perlis suggested that the macro language be independent of the language being processed. Techniques such as conditional and recursive macros, and using macros to define other macros, were described by Doug McIlroy of Bell Labs in “Macro Instruction Extensions of Compiler Languages”, Communications of the ACM 3, 4 (1960), 214–20, https://dl.acm.org/doi/10.1145/367177.367223.

An important precursor of `m4` was GPM; see C. Strachey, “A general purpose macrogenerator”, Computer Journal 8, 3 (1965), 225–41, https://academic.oup.com/comjnl/article/8/3/225/336044. GPM is also succinctly described in David Gries’s book Compiler Construction for Digital Computers, Wiley (1971). Strachey was a brilliant programmer: GPM fit into 250 machine instructions!

Inspired by GPM while visiting Strachey’s Lab in 1968, McIlroy wrote a model preprocessor in that fit into a page of Snobol 3 code, and McIlroy and Robert Morris developed a series of further models at Bell Labs. Andrew D. Hall followed up with M6, a general purpose macro processor used to port the Fortran source code of the Altran computer algebra system; see Hall’s “The M6 Macro Processor”, Computing Science Technical Report #2, Bell Labs (1972), http://cm.bell-labs.com/cm/cs/cstr/2.pdf. M6’s source code consisted of about 600 Fortran statements. Its name was the first of the `m4` line.

The Brian Kernighan and P.J. Plauger book Software Tools, Addison-Wesley (1976), describes and implements a Unix macro-processor language, which inspired Dennis Ritchie to write `m3`, a macro processor for the AP-3 minicomputer.

Kernighan and Ritchie then joined forces to develop the original `m4`, described in “The M4 Macro Processor”, Bell Laboratories (1977), https://wolfram.schneider.org/bsd/7thEdManVol2/m4/m4.pdf. It had only 21 builtin macros.

While `GPM` was more pure, `m4` is meant to deal with the true intricacies of real life: macros can be recognized without being pre-announced, skipping whitespace or end-of-lines is easier, more constructs are builtin instead of derived, etc.

Originally, the Kernighan and Plauger macro-processor, and then `m3`, formed the engine for the Rational FORTRAN preprocessor, that is, the `Ratfor` equivalent of `cpp`. Later, `m4` was used as a front-end for `Ratfor`, `C` and `Cobol`.

René Seindal released his implementation of `m4`, GNU `m4`, in 1990, with the aim of removing the artificial limitations in many of the traditional `m4` implementations, such as maximum line length, macro size, or number of macros.

The late Professor A. Dain Samples described and implemented a further evolution in the form of `M5`: “User’s Guide to the M5 Macro Language: 2nd edition”, Electronic Announcement on comp.compilers newsgroup (1992).

François Pinard took over maintenance of GNU `m4` in 1992, until 1994 when he released GNU `m4` 1.4, which was the stable release for 10 years. It was at this time that GNU Autoconf decided to require GNU `m4` as its underlying engine, since all other implementations of `m4` had too many limitations.

More recently, in 2004, Paul Eggert released 1.4.1 and 1.4.2 which addressed some long standing bugs in the venerable 1.4 release. Then in 2005, Gary V. Vaughan collected together the many patches to GNU `m4` 1.4 that were floating around the net and released 1.4.3 and 1.4.4. And in 2006, Eric Blake joined the team and prepared patches for the release of 1.4.5, with subsequent releases through intervening years, as recent as 1.4.20 in 2025.

Meanwhile, development has continued on new features for `m4`, such as dynamic module loading and additional builtins. When complete, GNU `m4` 2.0 will start a new series of releases.