[Top] [Contents] [Index] [ ? ]

GNU macro processor

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 Franc,ois Pinard and other volunteers on the Internet. All names and email addresses can be found in the file `THANKS' from the GNU m4 distribution.

This is release 1.4. It is now to be considered stable, future releases 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. So, it might go away, do not count on it yet.

1. Introduction and preliminaries  
2. Lexical and syntactic conventions  

3. How to invoke macros  
4. How to define new macros  
5. Conditionals, loops and recursion  Conditionals and loops

6. How to debug macros and input  

7. Input control  
8. File inclusion  
9. Diverting and undiverting output  

10. Macros for text handling  
11. Macros for doing arithmetic  
12. Running UNIX commands  Macros for running UNIX commands
13. Miscellaneous builtin macros  
14. Fast loading of frozen states  

15. Compatibility with other versions of m4  Compatibility with other versions of m4
Concept index  Index for many concepts
Macro index  Index for all m4 macros

 -- The Detailed Node Listing ---

Introduction and preliminaries

1.1 Introduction to m4  
1.2 Historical references  

1.3 Invoking m4  
1.4 Problems and bugs  
1.5 Using this manual  

Lexical and syntactic conventions

2.1 Names  Macro names
2.2 Quoted strings  Quoting input to m4
2.3 Other tokens  Other kinds of input tokens
2.4 Comments  Comments in m4 input

How to invoke macros

3.1 Macro invocation  
3.2 Preventing macro invocation  
3.3 Macro arguments  
3.4 Quoting macro arguments  On Quoting Arguments to macros
3.5 Macro expansion  Expanding macros

How to define new macros

4.1 Defining a macro  Defining a new macro
4.2 Arguments to macros  
4.3 Special arguments to macros  Pseudo arguments to macros
4.4 Deleting a macro  
4.5 Renaming macros  
4.6 Temporarily redefining macros  

4.7 Indirect call of macros  
4.8 Indirect call of builtins  

Conditionals, loops and recursion

5.1 Testing macro definitions  Testing if a macro is defined
5.2 Comparing strings  If-else construct, or multibranch
5.3 Loops and recursion  Loops and recursion in m4

How to debug macros and input

6.1 Displaying macro definitions  
6.2 Tracing macro calls  
6.3 Controlling debugging output  
6.4 Saving debugging output  

Input control

7.1 Deleting whitespace in input  
7.2 Changing the quote characters  
7.3 Changing comment delimiters  Changing the comment delimiters
7.4 Changing the lexical structure of words  
7.5 Saving input  Saving input until end of input

File inclusion

8.1 Including named files  
8.2 Searching for include files  

Diverting and undiverting output

9.1 Diverting output  
9.2 Undiverting output  
9.3 Diversion numbers  
9.4 Discarding diverted text  

Macros for text handling

10.1 Calculating length of strings  
10.2 Searching for substrings  
10.3 Searching for regular expressions  
10.4 Extracting substrings  
10.5 Translating characters  
10.6 Substituting text by regular expression  
10.7 Formatted output  Formatting strings (printf-like)

Macros for doing arithmetic

11.1 Decrement and increment operators  
11.2 Evaluating integer expressions  

Running UNIX commands

12.1 Executing simple commands  
12.2 Reading the output of commands  
12.3 Exit codes  
12.4 Making names for temporary files  

Miscellaneous builtin macros

13.1 Printing error messages  
13.2 Exiting from m4  Exiting from m4

Compatibility with other versions of m4

15.1 Extensions in GNU m4  Extensions in GNU m4
15.2 Facilities in System V m4 not in GNU m4  Facilities in System V m4 not in GNU m4
15.3 Other incompatibilities  

This document was generated by root l2-hrz on May, 9 2001 using texi2html