The if directive allows for conditional processing of directives in configuration files.
This diagram shows the syntax of the if directive: 
The if directive has the following parameters:
expression
This parameter determines what directive is processed after the
expression is evaluated. If the expression is a string, it is
converted to a decimal integer value. Zero, an empty string, and
the keyword null are equivalent to false and all other values are
interpreted as true.
directive
directive_block
If the expression is true, the directive or directive block
immediately following the expression is processed. If the
expression is false and the optional else clause is included, the
directive or directive block immediately following else is
processed. If the expression is false and the else clause is
omitted, no more processing occurs for the if directive.
A single directive can follow the expression or optional else without being enclosed between braces, { and }. This is the only situation when a subdirective need not be part of a directive block delimited by braces
An else clause is always paired with the nearest preceding if directive that does not already have an else clause..
Here is an example that processes different option directives depending on whether an environment variable named WIN is set. The dollar sign ($) indicates that WIN is an environment variable and not a local variable:
generalopt = null // make sure generalopt is always defined
if $WIN option targetops = link(linkWithMultiThreadLib)
else {
option generalopt = incl(searchPath, ".")
option targetops = link(linkWithMultiThreadLib), opt(size)
}
// following lines can use generalopt and targetopt
![]()
Configuration Files
How Configuration Files Are
Processed
Conditional
Processing in Builds
![]()
Configuration File Directives
Predefined Build Environment Variabless
