Contents | < Browse | Browse >
Testing macro definitions
=========================

   There are two different built-in 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