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 standards 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'.


[Back] [Next] [Up]