m4: Ifdef

1 
1 6.1 Testing if a macro is defined
1 =================================
1 
1 There are two different builtin conditionals in 'm4'.  The first is
1 'ifdef':
1 
1  -- Builtin: ifdef (NAME, STRING-1, [STRING-2])
1      If NAME is defined as a macro, 'ifdef' expands to STRING-1,
1      otherwise to STRING-2.  If STRING-2 is omitted, it is taken to be
1      the empty string (according to the normal rules).
1 
1      The macro 'ifdef' is recognized only with parameters.
1 
1      ifdef(`foo', ``foo' is defined', ``foo' is not defined')
1      =>foo is not defined
1      define(`foo', `')
1      =>
1      ifdef(`foo', ``foo' is defined', ``foo' is not defined')
1      =>foo is defined
1      ifdef(`no_such_macro', `yes', `no', `extra argument')
1      error->m4:stdin:4: Warning: excess arguments to builtin `ifdef' ignored
1      =>no
1