A BRIEF INTRODUCTION TO M4
Sendmail uses the M4 macro processor to ``compile'' the configuration
files. The most important thing to know is that M4 is stream-based,
that is, it doesn't understand about lines. For this reason, in some
places you may see the word ``dnl'', which stands for ``delete
through newline''; essentially, it deletes all characters starting
at the ``dnl'' up to and including the next newline character. In
most cases sendmail uses this only to avoid lots of unnecessary
blank lines in the output.
Other important directives are define(A, B) which defines the macro
``A'' to have value ``B''. Macros are expanded as they are read, so
one normally quotes both values to prevent expansion. For example,
define(`SMART_HOST', `smart.foo.com')
One word of warning: M4 macros are expanded even in lines that appear
to be comments.
For example, if you have
# See FEATURE(`foo') above
it will not do what you expect, because the FEATURE(`foo') will be
expanded. This also applies to
# And then define the $X macro to be the return address
because ``define'' is an M4 keyword. If you want to use them, surround
them with directed quotes, `like this'.
Since m4 uses single quotes (opening "`" and closing "'") to quote
arguments, those quotes can't be used in arguments. For example,
it is not possible to define a rejection message containing a single
quote. Usually there are simple workarounds by changing those
messages; in the worst case it might be ok to change the value
directly in the generated .cf file, which however is not advised.
Notice
This package requires a post-V7 version of m4; if you are running the
4.2bsd, SysV.2, or 7th Edition version. SunOS's /usr/5bin/m4 or
BSD-Net/2's m4 both work. GNU m4 version 1.1 or later also works.
Unfortunately, the M4 on BSDI 1.0 doesn't work -- you'll have to use a
Net/2 or GNU version. GNU m4 is available from
ftp://ftp.gnu.org/pub/gnu/m4/ (check for the latest version).
EXCEPTIONS: DEC's m4 on Digital UNIX 4.x is broken (3.x is fine). Use GNU
m4 on this platform.
|