Listing D: SoundConditional
 
<project name="hasSound" default="cond" basedir=".">
 <property name="ExampleVersion" value="1.0"/>
 <target name="UnixSound">
  <condition property="hasUnixSound">
   <and>
    <available classname="org.apache.tools.ant.taskdefs.optional.sound.SoundTask"/>
    <os family="unix"/>
   </and>
  </condition>
 </target>
 <target name="WinSound">
  <condition property="hasWinSound">
   <and>
    <available classname="org.apache.tools.ant.taskdefs.optional.sound.SoundTask"/>
    <os family="windows"/>
   </and>
  </condition>
 </target>
 <target name="condUnixSound" if="hasUnixSound" depends="UnixSound">
  <echo>
        Has Unix Sound
  </echo>
 </target>
 <target name="condWinSound" if="hasWinSound" depends="WinSound">
  <echo>
        Has Windows Sound
  </echo>
 </target>
 <target name="cond">
  <antcall target="condWinSound"/>
  <antcall target="condUnixSound"/>
 </target>
</project>