Next: Ifelse, Up: Conditionals [Contents][Index]
There are two different builtin conditionals in m4
. The first is
ifdef
:
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