The Recursive Nature of M4

Now we consider the recursive nature of the M4 input stream. Whenever a name token is expanded by a macro definition, the expansion text is pushed back onto the input stream for complete reprocessing. This recursive reprocessing continues to occur as long as there are macro calls found in the input stream that generate text.

For example:

$ m4
define(`macro', `expansion')dnl
macro ``quoted' text'
expansion `quoted' text

Here, I define a macro called macro, and then present this macro name on the input stream, followed by additional text, some of which is quoted, and some of which is double quoted.

The process used by M4 to parse this example is shown in Figure 10-1.

Figure 10-1. The procedure used by M4 to process ...

Get Autotools now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.