manpagez: man pages & more
info m4
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.2 Command line options for preprocessor features

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]

This enters name into the symbol table. If ‘=value’ is missing, the value is taken to be the empty string. The value can be any string, and the macro can be defined to take arguments, just as if it was defined from within the input. This option may be given more than once; order with respect to file names is significant, and redefining the same name loses the previous value.

-I directory
--include=directory

Make m4 search directory for included files that are not found in the current working directory. See section Searching for include files, for more details. This option may be given more than once.

-s
--synclines

Generate synchronization lines, for use by the C preprocessor or other similar tools. Order is significant with respect to file names. This option is useful, for example, when m4 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

This deletes any predefined meaning name might have. Obviously, only predefined macros can be deleted in this way. This option may be given more than once; undefining a name that does not have a definition is silently ignored. Order is significant with respect to file names.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on September 29, 2013 using texi2html 5.0.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.