(m4.info)Ifdef


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

6.1 Testing if a macro is defined
=================================

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

 -- Builtin: ifdef (NAME, STRING-1, [STRING-2])
     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).

     The macro 'ifdef' is recognized only with parameters.

     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
     ifdef(`no_such_macro', `yes', `no', `extra argument')
     error->m4:stdin:4: Warning: excess arguments to builtin `ifdef' ignored
     =>no


automatically generated by info2www version 1.2.2.9