Back: M4
Forward: How GNU Autotools uses M4
 
FastBack: M4
Up: M4
FastForward: Writing Portable Bourne Shell
Top: Autoconf, Automake, and Libtool
Contents: Table of Contents
Index: Index
About: About this document

21.1 What does M4 do?

m4 is a general purpose tool suitable for all kinds of text processing applications--not unlike the C preprocessor, cpp, with which you are probably familiar. Its obvious application is as a front-end for a compiler---m4 is in many ways superior to cpp.

Briefly, m4 reads text from the input and writes processed text to the output. Symbolic macros may be defined which have replacement text. As macro invocations are encountered in the input, they are replaced (`expanded') with the macro's definition. Macros may be defined with a set of parameters and the definition can specify where the actual parameters will appear in the expansion. These concepts will be elaborated on in 21.3 Fundamentals of M4 processing.

M4 includes a set of pre-defined macros that make it substantially more useful. The most important ones will be discussed in 21.4 Features of M4. These macros perform functions such as arithmetic, conditional expansion, string manipulation and running external shell commands.


This document was generated by Gary V. Vaughan on May, 24 2001 using texi2html