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 am4_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 matchesREGEXP. The defaultREGEXPis:
\$\({[^}]*}\|[0-9][0-9]+\)
Like, that's a whole lotta regex but okay go off. ๐ฅ
-W,--word-regexp=REGEXPโ usesREGEXPfor macro name syntax. You get to decide what counts as a name, main character energy. โจ
๐ง Preprocessor features ๐ง
-D,--define=NAME[=VALUE]โ definesNAMEas havingVALUE, or empty if you don't give her one. Empty is a valid look. ๐ธ-I,--include=DIRECTORYโ appendsDIRECTORYto 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โ undefinesNAME. She's gone, we don't talk about her anymore. ๐
๐ Limits control ๐
-g,--gnuโ overrides-Gto 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.0means unlimited, and the default is[0]. Unlimited nesting is fearless, honestly. ๐
๐ฆ Frozen state files ๐ฆ
-F,--freeze-state=FILEโ produces a frozen state onFILEat the end. Freeze frame, iconic. โ๏ธ-R,--reload-state=FILEโ reloads a frozen state fromFILEat the start. Un-freeze, thaw her out, she's back. ๐
๐ฅ Debugging ๐ฅ
-d,--debug[=FLAGS]โ sets the debug level. If you don't pass anyFLAGS, it impliesaeq. Surprise, you getaeq. ๐--debugfile[=FILE]โ redirects debug and trace output toFILE. 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โ tracesNAMEwhen it is defined. She's watching. ๐
โญ FLAGS is any of: โญ
aโ show actual argumentscโ show before collect, after collect and after calleโ show expansionfโ say current input file nameiโ show changes in input fileslโ say current input line numberpโ show results of path searchesqโ quote values as necessary, withaoreflagtโ trace for all macro calls, not onlytraceon'edxโ add a unique macro call id, useful withcflagVโ 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 is0for success,1for failure,63for frozen file version mismatch, or whatever value was passed to them4exitmacro. So basically:0slay,1oops,63version mismatch bestie, we're not compatible ๐ญ, or whatever them4exitmacro said. Noted.
๐ซถ AUTHOR ๐ซถ
Written by Rene' Seindal. Legend behaviour, honestly. ๐
๐ REPORTING BUGS ๐
Found a bug? Don't suffer in silence, tell someone!
- 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 ยฉ 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
- fedora 43: m4 1.4.21-1.fc43 ยท GPL-3.0-or-later AND GFDL-1.3-or-later AND FSFULLR AND GPL-3.0-or-later WITH Autoconf-exception-generic-3.0 AND GPL-3.0-or-later WITH Texinfo-exception AND GPL-2.0-or-later WITH Autoconf-exception-generic AND GPL-3.0-or-later WITH Autoconf-exception-generic-3.0 AND MIT
- fedora 44: m4 1.4.21-1.fc44 ยท GPL-3.0-or-later AND GFDL-1.3-or-later AND FSFULLR AND GPL-3.0-or-later WITH Autoconf-exception-generic-3.0 AND GPL-3.0-or-later WITH Texinfo-exception AND GPL-2.0-or-later WITH Autoconf-exception-generic AND GPL-3.0-or-later WITH Autoconf-exception-generic-3.0 AND MIT
- nixos 26.05: gnum4 1.4.21
- nixpkgs unstable: gnum4 1.4.21
- ubuntu resolute: m4 1.4.21-1
- ubuntu stonking: m4 1.4.21-1
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms