M4(1) User Commands M4(1)

# [NAME](#NAME)

m4 - macro processor

# [SYNOPSIS](#SYNOPSIS)

**m4** \[*OPTION*]... \[*FILE*]...

# [DESCRIPTION](#DESCRIPTION)

Process macros in FILEs. If no FILE or if FILE is \`-', standard input is read.

Mandatory or optional arguments to long options are mandatory or optional for short options too.

## [Operation modes:](#Operation_modes:)

[**--help**](#help)

display this help and exit

[**--version**](#version)

output version information and exit

[**-E**, **--fatal-warnings**](#E)

once: warnings become errors, twice: stop execution at first error

**-i**, **--interactive**

unbuffer output, ignore interrupts

[**-P**, **--prefix-builtins**](#P)

force a \`m4\_' prefix to all builtins

[**-Q**, **--quiet**, **--silent**](#Q)

suppress some warnings for builtins

[**--warn-macro-sequence**\[=*REGEXP*\]](#warn)

warn if macro definition matches REGEXP,

default \\$\\({\[^}]\*}\\|\[0-9]\[0-9]+\\)

## [Preprocessor features:](#Preprocessor_features:)

[**-D**, **--define=NAME**\[=*VALUE*\]](#D)

define NAME as having VALUE, or empty

[**-I**, **--include**=*DIRECTORY*](#I)

append DIRECTORY to include path

[**-s**, **--synclines**](#s)

generate \`#line NUM "FILE"' lines

[**-U**, **--undefine**=*NAME*](#U)

undefine NAME

## [Limits control:](#Limits_control:)

[**-g**, **--gnu**](#g)

override **-G** to re-enable GNU extensions

[**-G**, **--traditional**](#G)

suppress all GNU extensions

[**-H**, **--hashsize**=*PRIME*](#H)

set symbol lookup hash table size \[65537]

[**-L**, **--nesting-limit**=*NUMBER*](#L)

change nesting limit, 0 for unlimited \[0]

## [Frozen state files:](#Frozen_state_files:)

[**-F**, **--freeze-state**=*FILE*](#F)

produce a frozen state on FILE at end

[**-R**, **--reload-state**=*FILE*](#R)

reload a frozen state from FILE at start

## [Debugging:](#Debugging:)

[**-d**, **--debug**\[=*FLAGS*\]](#d)

set debug level (no FLAGS implies \`aeq')

[**--debugfile**\[=*FILE*\]](#debugfile)

redirect debug and trace output to FILE (default stderr, discard if empty string)

**-l**, **--arglength**=*NUM*

restrict macro tracing size

**-t**, **--trace**=*NAME*

trace NAME when it is defined

## [FLAGS is any of:](#FLAGS_is_any_of:)

[a](#a)

show actual arguments

[c](#c)

show before collect, after collect and after call

[e](#e)

show expansion

[f](#f)

say current input file name

[i](#i)

show changes in input files

[l](#l)

say current input line number

[p](#p)

show results of path searches

[q](#q)

quote values as necessary, with a or e flag

[t](#t)

trace for all macro calls, not only traceon'ed

[x](#x)

add a unique macro call id, useful with c flag

[V](#V)

shorthand for all of the above flags

If defined, the environment variable \`M4PATH' is a colon-separated list of directories included after any specified by \`-I'.

Exit status is 0 for success, 1 for failure, 63 for frozen file version mismatch, or whatever value was passed to the m4exit macro.

# [AUTHOR](#AUTHOR)

Written by Rene' Seindal.

# [REPORTING BUGS](#REPORTING_BUGS)

Report bugs to: bug-m4@gnu.org  
GNU M4 home page: &lt;https://www.gnu.org/software/m4/&gt;  
General help using GNU software: &lt;https://www.gnu.org/gethelp/&gt;

# [COPYRIGHT](#COPYRIGHT)

Copyright © 2026 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later &lt;https://gnu.org/licenses/gpl.html&gt;.  
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

# [SEE ALSO](#SEE_ALSO)

The full documentation for **m4** is maintained as a Texinfo manual. If the **info** and **m4** programs are properly installed at your site, the command

**info m4**

should give you access to the complete manual.

October 2026 GNU M4 1.4.21

---

Document: m4(1) from m4 1.4.21-r10 (Chainguard OS)
Source: https://git.savannah.gnu.org/git/m4.git
