Next: Limits control, Previous: Operation modes, Up: Invoking m4
Several options allow m4 to behave more like a preprocessor.
Macro definitions and deletions can be made on the command line, the
search path can be altered, and the output file can track where the
input came from. These features occur with the following options:
-D NAME[=VALUE]--define=NAME[=VALUE]-I DIRECTORY--include=DIRECTORYm4 search DIRECTORY for included files that are not
found in the current working directory. See Search Path, for more
details. This option may be given more than once.
-s--synclinesm4 is used as a
front end to a compiler. Source file name and line number information
is conveyed by directives of the form `#line linenum
"file"', which are inserted as needed into the middle of the
output. Such directives mean that the following line originated or was
expanded from the contents of input file file at line
linenum. The `"file"' part is often omitted when
the file name did not change from the previous directive.
Synchronization directives are always given on complete lines by themselves. When a synchronization discrepancy occurs in the middle of an output line, the associated synchronization directive is delayed until the next newline that does not occur in the middle of a quoted string or comment.
define(`twoline', `1
2')
=>#line 2 "stdin"
=>
changecom(`/*', `*/')
=>
define(`comment', `/*1
2*/')
=>#line 5
=>
dnl no line
hello
=>#line 7
=>hello
twoline
=>1
=>#line 8
=>2
comment
=>/*1
=>2*/
one comment `two
three'
=>#line 10
=>one /*1
=>2*/ two
=>three
goodbye
=>#line 12
=>goodbye
-U NAME--undefine=NAME