Preprocesses files, expanding macro definitions.
m4 [ -e] [ -l ] [ -s ] [ -B Number ] [ -D Name [ =Value ] ] ... [ -H Number ] [ -I Directory ] [ -S Number ] [ -T Number ] [ -U Name ] ... [ File ... ]
The m4 command is a macro processor used as a preprocessor for C and other languages. You can use it to process built-in macros or user-defined macros.
Each File parameter is processed in order. If you do not specify a File parameter or if you specify the - (dash) as a file name, the m4 command reads standard input. It writes the processed macros to standard output. Macro calls follow the form:
macroname(argument . . . )
The left parenthesis must immediately follow macroname. If the left parenthesis does not follow the name of a defined macro, the m4 command reads it as a macro call with no arguments. Macro names consist of ASCII alphabetic letters, digits, and the _ (underscore) character. Extended characters are not allowed in macro names. The first character cannot be a digit.
While collecting arguments, the m4 command ignores unquoted leading blanks, tabs, and new-line characters. Use single quotation marks to quote strings. The value of a quoted string is the string with the quotation marks stripped off.
When the m4 command recognizes a macro, it collects arguments by searching for a matching right parenthesis. If you supply fewer arguments than appear in the macro definition, the m4 command considers the trailing arguments in the definition to be null. Macro evaluation proceeds normally during the collection of the arguments. All commas or right parentheses within the value of a nested call are translated literally; they do not need an escape character or quotation marks. After collecting arguments, the m4 command pushes the value of the macro back onto the input stream and scans again.
The m4 command makes
available the following built-in macros. You may redefine them, but you
will lose the original meaning. The values of these macros are null
unless otherwise stated:
The preceding flags must appear
before any file names and before any -D or -U
flags.
This command returns the following
exit values:
0 | Successful completion. |
>0 | An error occurred. |
If the m4exit macro is used, the exit value can be specified by the input file.
To preprocess a C language program with the m4 command and compile it, enter:
m4 prog.m4 > prog.c cc prog.c
/usr/ccs/bin/m4 | Contains the m4 command. |
The m4 Macro Processor Overview in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs.
The Commands Overview in AIX 5L Version 5.1 System User's Guide: Operating System and Devices.
The as command, cc command, cpp command.