LinuxCommandLibrary

m4

macro processor

TLDR

Process file

$ m4 [input.m4]
copy
Output to file
$ m4 [input.m4] > [output.txt]
copy
Define macro
$ m4 -D [NAME=value] [input.m4]
copy
Include directory
$ m4 -I [/path/to/includes] [input.m4]
copy
Prefix builtins
$ m4 -P [input.m4]
copy
Debug output
$ m4 -d [input.m4]
copy

SYNOPSIS

m4 [options] [files]

DESCRIPTION

m4 is a macro processor. It expands macros in text files to generate output.
The tool is used to preprocess configuration files and source code. It's part of autoconf.

PARAMETERS

FILES

Input files to process.
-D NAME=VALUE
Define macro.
-U NAME
Undefine macro.
-I DIR
Add include path.
-P
Prefix builtins with m4_.
-d
Enable debug output.
--help
Display help information.

CAVEATS

POSIX standard. Quoting rules can be tricky. Used by autoconf extensively.

HISTORY

m4 was developed at Bell Labs in the 1970s. The GNU version extends the original POSIX specification.

SEE ALSO

autoconf(1), cpp(1), make(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community