(m4.info)Top


Next: Preliminaries Up: (dir)

GNU M4
******

This manual is for GNU M4 (version 1.4.11, 29 March 2008), a package
containing an implementation of the m4 macro language.

   Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2004, 2005, 2006,
2007, 2008 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 Rene' Seindal, with subsequent
changes by Franc,ois Pinard and other volunteers on the Internet.  All
names and email addresses can be found in the files `m4-1.4.11/AUTHORS'
and `m4-1.4.11/THANKS' from the GNU M4 distribution.

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

* Preliminaries
Introduction and preliminaries
* Invoking m4
Invoking `m4'
* Syntax
Lexical and syntactic conventions
* Macros
How to invoke macros
* Definitions
How to define new macros
* Conditionals
Conditionals, loops, and recursion
* Debugging
How to debug macros and input
* Input Control
Input control
* File Inclusion
File inclusion
* Diversions
Diverting and undiverting output
* Text handling
Macros for text handling
* Arithmetic
Macros for doing arithmetic
* Shell commands
Macros for running shell commands
* Miscellaneous
Miscellaneous builtin macros
* Frozen files
Fast loading of frozen state
* Compatibility
Compatibility with other versions of `m4'
* Answers
Correct version of some examples
* Copying This Package
How to make copies of the overall M4 package
* Copying This Manual
How to make copies of this manual
* Indices
Indices of concepts and macros
 --- The Detailed Node Listing ---

Introduction and preliminaries

* Intro
Introduction to `m4'
* History
Historical references
* Bugs
Problems and bugs
* Manual
Using this manual
Invoking `m4'

* Operation modes
Command line options for operation modes
* Preprocessor features
Command line options for preprocessor features
* Limits control
Command line options for limits control
* Frozen state
Command line options for frozen state
* Debugging options
Command line options for debugging
* Command line files
Specifying input files on the command line
Lexical and syntactic conventions

* Names
Macro names
* Quoted strings
Quoting input to `m4'
* Comments
Comments in `m4' input
* Other tokens
Other kinds of input tokens
* Input processing
How `m4' copies input to output
How to invoke macros

* Invocation
Macro invocation
* Inhibiting Invocation
Preventing macro invocation
* Macro Arguments
Macro arguments
* Quoting Arguments
On Quoting Arguments to macros
* Macro expansion
Expanding macros
How to define new macros

* Define
Defining a new macro
* Arguments
Arguments to macros
* Pseudo Arguments
Special arguments to macros
* Undefine
Deleting a macro
* Defn
Renaming macros
* Pushdef
Temporarily redefining macros
* Indir
Indirect call of macros
* Builtin
Indirect call of builtins
Conditionals, loops, and recursion

* Ifdef
Testing if a macro is defined
* Ifelse
If-else construct, or multibranch
* Shift
Recursion in `m4'
* Forloop
Iteration by counting
* Foreach
Iteration by list contents
How to debug macros and input

* Dumpdef
Displaying macro definitions
* Trace
Tracing macro calls
* Debug Levels
Controlling debugging output
* Debug Output
Saving debugging output
Input control

* Dnl
Deleting whitespace in input
* Changequote
Changing the quote characters
* Changecom
Changing the comment delimiters
* Changeword
Changing the lexical structure of words
* M4wrap
Saving text until end of input
File inclusion

* Include
Including named files
* Search Path
Searching for include files
Diverting and undiverting output

* Divert
Diverting output
* Undivert
Undiverting output
* Divnum
Diversion numbers
* Cleardivert
Discarding diverted text
Macros for text handling

* Len
Calculating length of strings
* Index macro
Searching for substrings
* Regexp
Searching for regular expressions
* Substr
Extracting substrings
* Translit
Translating characters
* Patsubst
Substituting text by regular expression
* Format
Formatting strings (printf-like)
Macros for doing arithmetic

* Incr
Decrement and increment operators
* Eval
Evaluating integer expressions
Macros for running shell commands

* Platform macros
Determining the platform
* Syscmd
Executing simple commands
* Esyscmd
Reading the output of commands
* Sysval
Exit status
* Mkstemp
Making temporary files
Miscellaneous builtin macros

* Errprint
Printing error messages
* Location
Printing current location
* M4exit
Exiting from `m4'
Fast loading of frozen state

* Using frozen files
Using frozen files
* Frozen file format
Frozen file format
Compatibility with other versions of `m4'

* Extensions
Extensions in GNU M4
* Incompatibilities
Facilities in System V m4 not in GNU M4
* Other Incompatibilities
Other incompatibilities
Correct version of some examples

* Improved exch
Solution for `exch'
* Improved forloop
Solution for `forloop'
* Improved foreach
Solution for `foreach'
* Improved m4wrap
Solution for `m4wrap'
* Improved cleardivert
Solution for `cleardivert'
* Improved capitalize
Solution for `capitalize'
* Improved fatal_error
Solution for `fatal_error'
How to make copies of the overall M4 package

* GNU General Public License
License for copying the M4 package
How to make copies of this manual

* GNU Free Documentation License
License for copying this manual
Indices of concepts and macros

* Macro index
Index for all `m4' macros
* Concept index
Index for many concepts

automatically generated by info2www