GNU M4 macro processor

Table of Contents

Next: , Up: (dir)


GNU M4

This manual is for GNU M4 (version 1.4.7, 23 September 2006), a package containing an implementation of the m4 macro language.

Copyright © 1989, 1990, 1991, 1992, 1993, 1994, 2004, 2005, 2006 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.2 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 AUTHORS and THANKS from the GNU M4 distribution.

This is release 1.4.7. 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

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

How to make copies of this manual

Indices of concepts and macros