GNU M4 1.4.16 macro processor

Table of Contents

Next: , Up: (dir)


GNU M4

This manual (28 February 2011) is for GNU M4 (version 1.4.16), a package containing an implementation of the m4 macro language.

Copyright © 1989-1994, 2004-2011 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation License.”

GNU m4 is an implementation of the traditional UNIX macro processor. It is mostly SVR4 compatible, although it has some extensions (for example, handling more than 9 positional parameters to macros). m4 also has builtin functions for including files, running shell commands, doing arithmetic, etc. Autoconf needs GNU m4 for generating configure scripts, but not for running them.

GNU m4 was originally written by René Seindal, with subsequent changes by François Pinard and other volunteers on the Internet. All names and email addresses can be found in the files m4-1.4.16/AUTHORS and m4-1.4.16/THANKS from the GNU M4 distribution.

This is release 1.4.16. It is now considered stable: future releases in the 1.4.x series are only meant to fix bugs, increase speed, or improve documentation. However...

An experimental feature, which would improve m4 usefulness, allows for changing the syntax for what is a word in m4. You should use:

     ./configure --enable-changeword

if you want this feature compiled in. The current implementation slows down m4 considerably and is hardly acceptable. In the future, m4 2.0 will come with a different set of new features that provide similar capabilities, but without the inefficiencies, so changeword will go away and you should not count on it.

--- The Detailed Node Listing ---

Introduction and preliminaries

Invoking m4

Lexical and syntactic conventions

How to invoke macros

How to define new macros

Conditionals, loops, and recursion

How to debug macros and input

Input control

File inclusion

Diverting and undiverting output

Macros for text handling

Macros for doing arithmetic

Macros for running shell commands

Miscellaneous builtin macros

Fast loading of frozen state

Compatibility with other versions of m4

Correct version of some examples

How to make copies of the overall M4 package

How to make copies of this manual

Indices of concepts and macros