M4(1)

๐Ÿ’– M4(1) โ€” like, the macro processor, bestie ๐Ÿ’–

User Commands energy, but make it โœจiconicโœจ. This is m4, and she processes macros, and honestly? She ate.


๐ŸŒธ NAME ๐ŸŒธ

m4 โ€” macro processor. That's it, that's the whole vibe. ๐Ÿฆ‹


โœจ SYNOPSIS โœจ

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

๐ŸŽ€ DESCRIPTION ๐ŸŽ€

Okay so real talk: m4 processes macros in the FILEs you hand her. If you give her no FILE, or if FILE is literally just -, she reads from standard input. Simple as that, no cap. ๐Ÿ’…

And listen โ€” mandatory or optional arguments to long options are mandatory or optional for short options too. Like, the rules are the rules for both versions, periodt.


๐Ÿ‘‘ Operation modes ๐Ÿ‘‘

  • --help โ€” shows you this help and dips. Bye bestie! ๐Ÿซถ
  • --version โ€” outputs the version info and exits. Iconic behaviour.
  • -E, --fatal-warnings โ€” once, and your warnings become errors. Twice, and she stops execution at the first error. She is not playing around. ๐Ÿ˜ญ
  • -i, --interactive โ€” unbuffers output and ignores interrupts. She's just gonna keep going, fr fr.
  • -P, --prefix-builtins โ€” forces a m4_ prefix onto all the builtins. Boundaries! ๐Ÿ’…
  • -Q, --quiet, --silent โ€” suppresses some warnings for builtins. Shhh, she's being chill about it. ๐Ÿคซ
  • --warn-macro-sequence[=REGEXP] โ€” warns you if a macro definition matches REGEXP. The default REGEXP is:
\$\({[^}]*}\|[0-9][0-9]+\)

Like, that's a whole lotta regex but okay go off. ๐Ÿ”ฅ

  • -W, --word-regexp=REGEXP โ€” uses REGEXP for macro name syntax. You get to decide what counts as a name, main character energy. โœจ

๐Ÿงš Preprocessor features ๐Ÿงš

  • -D, --define=NAME[=VALUE] โ€” defines NAME as having VALUE, or empty if you don't give her one. Empty is a valid look. ๐ŸŒธ
  • -I, --include=DIRECTORY โ€” appends DIRECTORY to the include path. More places to look, more chances to slay. ๐ŸŽ€
  • -s, --synclines โ€” generates #line NUM "FILE" lines. Very demure, very mindful. ๐Ÿ’œ
  • -U, --undefine=NAME โ€” undefines NAME. She's gone, we don't talk about her anymore. ๐Ÿ’€

๐Ÿ’… Limits control ๐Ÿ’…

  • -g, --gnu โ€” overrides -G to re-enable the GNU extensions. Come back bestie, the extensions missed you! ๐Ÿซถ
  • -G, --traditional โ€” suppresses all GNU extensions. Old school only, no extras. ๐Ÿ™ˆ
  • -H, --hashsize=PRIME โ€” sets the symbol lookup hash table size. Default is [65537]. Yes, that's a big number and yes, she chose it on purpose. โญ
  • -L, --nesting-limit=NUMBER โ€” changes the nesting limit. 0 means unlimited, and the default is [0]. Unlimited nesting is fearless, honestly. ๐ŸŒˆ

๐Ÿฆ‹ Frozen state files ๐Ÿฆ‹

  • -F, --freeze-state=FILE โ€” produces a frozen state on FILE at the end. Freeze frame, iconic. โ„๏ธ
  • -R, --reload-state=FILE โ€” reloads a frozen state from FILE at the start. Un-freeze, thaw her out, she's back. ๐Ÿ’–

๐Ÿ”ฅ Debugging ๐Ÿ”ฅ

  • -d, --debug[=FLAGS] โ€” sets the debug level. If you don't pass any FLAGS, it implies aeq. Surprise, you get aeq. ๐ŸŽ‰
  • --debugfile[=FILE] โ€” redirects debug and trace output to FILE. Default is stderr, and if you pass an empty string, it discards the output entirely. Poof. ๐Ÿ’จ
  • -l, --arglength=NUM โ€” restricts macro tracing size. Keep it short, keep it cute. โœ‚๏ธ
  • -t, --trace=NAME โ€” traces NAME when it is defined. She's watching. ๐Ÿ‘€

โญ FLAGS is any of: โญ

  • a โ€” show actual arguments
  • c โ€” show before collect, after collect and after call
  • e โ€” show expansion
  • f โ€” say current input file name
  • i โ€” show changes in input files
  • l โ€” say current input line number
  • p โ€” show results of path searches
  • q โ€” quote values as necessary, with a or e flag
  • t โ€” trace for all macro calls, not only traceon'ed
  • x โ€” add a unique macro call id, useful with c flag
  • V โ€” shorthand for all of the above flags. All of them. Every single one. Go big or go home. ๐Ÿ’…

If it's defined, the environment variable M4PATH is a colon-separated list of directories included after any specified by -I. Colons are the vibe separator, iykyk. ๐Ÿ’œ

Exit status is 0 for success, 1 for failure, 63 for frozen file version mismatch, or whatever value was passed to the m4exit macro. So basically: 0 slay, 1 oops, 63 version mismatch bestie, we're not compatible ๐Ÿ˜ญ, or whatever the m4exit macro said. Noted.

๐Ÿซถ AUTHOR ๐Ÿซถ

Written by Rene' Seindal. Legend behaviour, honestly. ๐Ÿ‘‘


๐Ÿ’€ REPORTING BUGS ๐Ÿ’€

Found a bug? Don't suffer in silence, tell someone!


Copyright ยฉ 2026 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. Like, zero. None. Don't come for her. ๐Ÿ™ˆ


๐ŸŒธ 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. Go read it, it's giving encyclopedia but make it fun. ๐Ÿ“–โœจ


Okay that's the whole page, bestie! This was GNU M4 version 1.4.21, dated February 2026. Thanks for reading, mwah ๐Ÿ’‹

๐Ÿ“ฆ where this page comes from