Scroll to navigation

M4(1) User Commands M4(1)

NAME

m4 - macro processor

SYNOPSIS

m4 [OPTION]... [FILE]...

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:

display this help and exit
output version information and exit
once: warnings become errors, twice: stop execution at first error
-i, --interactive
unbuffer output, ignore interrupts
force a `m4_' prefix to all builtins
suppress some warnings for builtins
warn if macro definition matches REGEXP,
default \$\({[^}]*}\|[0-9][0-9]+\)
use REGEXP for macro name syntax

Preprocessor features:

define NAME as having VALUE, or empty
append DIRECTORY to include path
generate `#line NUM "FILE"' lines
undefine NAME

Limits control:

override -G to re-enable GNU extensions
suppress all GNU extensions
set symbol lookup hash table size [509]
change nesting limit, 0 for unlimited [0]

Frozen state files:

produce a frozen state on FILE at end
reload a frozen state from FILE at start

Debugging:

set debug level (no FLAGS implies `aeq')
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:

show actual arguments
show before collect, after collect and after call
show expansion
say current input file name
show changes in input files
say current input line number
show results of path searches
quote values as necessary, with a or e flag
trace for all macro calls, not only traceon'ed
add a unique macro call id, useful with c flag
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

Written by Rene' Seindal.

REPORTING BUGS

Report bugs to: bug-m4@gnu.org
GNU M4 home page: <https://www.gnu.org/software/m4/>
General help using GNU software: <https://www.gnu.org/gethelp/>

COPYRIGHT

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

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.

May 2021 GNU M4 1.4.19