GNU Info

Info Node: (m4.info)Ifdef

(m4.info)Ifdef


Next: Ifelse Prev: Conditionals Up: Conditionals
Enter node , (file) or (file)node

Testing macro definitions
=========================

   There are two different builtin conditionals in `m4'.  The first is
`ifdef':

     ifdef(NAME, STRING-1, opt STRING-2)

which makes it possible to test whether a macro is defined or not.  If
NAME is defined as a macro, `ifdef' expands to STRING-1, otherwise to
STRING-2.  If STRING-2 is omitted, it is taken to be the empty string
(according to the normal rules).

     ifdef(`foo', ``foo' is defined', ``foo' is not defined')
     =>foo is not defined
     define(`foo', `')
     =>
     ifdef(`foo', ``foo' is defined', ``foo' is not defined')
     =>foo is defined

   The macro `ifdef' is recognized only with parameters.


automatically generated by info2www version 1.2.2.9