Next: History, Up: Preliminaries
m4
m4
is a macro processor, in the sense that it copies its
input to the output, expanding macros as it goes. Macros are either
builtin or user-defined, and can take any number of arguments.
Besides just doing macro expansion, m4
has builtin functions
for including named files, running shell commands, doing integer
arithmetic, manipulating text in various ways, performing recursion,
etc.... m4
can be used either as a front-end to a compiler,
or as a macro processor in its own right.
The m4
macro processor is widely available on all UNIXes, and has
been standardized by POSIX.
Usually, only a small percentage of users are aware of its existence.
However, those who find it often become committed users. The
popularity of GNU Autoconf, which requires GNU
m4
for generating configure scripts, is an incentive
for many to install it, while these people will not themselves
program in m4
. GNU m4
is mostly compatible with the
System V, Release 3 version, except for some minor differences.
See Compatibility, for more details.
Some people find m4
to be fairly addictive. They first use
m4
for simple problems, then take bigger and bigger challenges,
learning how to write complex sets of m4
macros along the way.
Once really addicted, users pursue writing of sophisticated m4
applications even to solve simple problems, devoting more time
debugging their m4
scripts than doing real work. Beware that
m4
may be dangerous for the health of compulsive programmers.