To execute an Ant target based on condition, use the “if” attribute of the target,

if the module-A-present property is set (to any value, e.g. false), the target will be run.

http://ant.apache.org/manual/targets.html#targets

As of Ant 1.8.0, you may instead use property expansion; a value of true (or on or yes) will enable the item, while false (or off or no) will disable it. Other values are still assumed to be property names and so the item is enabled only if the named property is defined.

http://ant.apache.org/manual/properties.html#if+unless