21.4.1 Discarding input

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 
 # 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)]) 
])])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 May, 24 2001 using texi2html


GNU Autoconf, Automake and Libtool
GNU Autoconf, Automake, and Libtool
ISBN: 1578701902
EAN: 2147483647
Year: 2002
Pages: 290

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net