Back: Features of M4
Forward: Macro management
 
FastBack: Writing macros within the GNU Autotools framework
Up: Features of M4
FastForward: Writing macros within the GNU Autotools framework
Top: Autoconf, Automake, and Libtool
Contents: Table of Contents
Index: Index
About: About this document

21.4.1 Discarding input

A macro called dnl discards text from the input. The dnl macro takes no arguments and expands to the empty string, but it has the side effect of discarding all input up to and including the next newline character. Here is an example of dnl from the Autoconf source code:

 
# AC_LANG_POP
# -----------
# Restore the previous language.
define([AC_LANG_POP],
[popdef([_AC_LANG])dnl
ifelse(_AC_LANG, [_AC_LANG],
        [AC_FATAL([too many $0])])dnl
AC_LANG(_AC_LANG)])

It is important to remember dnl's behavior: it discards the newline character, which can have unexpected effects on generated `configure' scripts! If you want a newline to appear in the output, you must add an extra blank line to compensate.

dnl need not appear in the first column of a given line -- it will begin discarding input at any point that it is invoked in the input file. However, be aware of the newline eating problem again! In the example of AC_TRY_LINK_FUNC above, note the deliberate use of dnl to remove surplus newline characters.

In general, dnl makes sense for macro invocations that appear on a single line, where you would expect the whole line to simply vanish from the output. In the following subsections, dnl will be used to illustrate where it makes sense to use it.


This document was generated by Gary V. Vaughan on February, 8 2006 using texi2html