Whole document tree
File inclusion
Including named files
There are two builtin macros in include(filename) sinclude(filename)
both of which cause the file named filename to be read by
The expansion of
It is an error for an include(`no-such-file') => error-->30.include:2: m4: Cannot open no-such-file: No such file or directory sinclude(`no-such-file') => Assume in the following that the file `incl.m4' contains the lines: Include file start foo Include file end
Normally file inclusion is used to insert the contents of a file
into the input stream. The contents of the file will be read by
define(`foo', `FOO') => include(`incl.m4') =>Include file start =>FOO =>Include file end =>
The fact that define(`bar', include(`incl.m4')) => This is `bar': >>>bar<<< =>This is bar: >>>Include file start =>foo =>Include file end =><<<
This use of
The builtin macros Searching for include files
GNU If a file is not found in the current working directory, and the file name is not absolute, the file will be looked for in a specified search path. First, the directories specified with the `-I' option will be searched, in the order found on the command line. Second, if the `M4PATH' environment variable is set, it is expected to contain a colon-separated list of directories, which will be searched in order. If the automatic search for include-files causes trouble, the `p' debug flag (see section Controlling debugging output) can help isolate the problem. Go to the first, previous, next, last section, table of contents. |