<project>
	<target name="load-env">
		<property environment="env"/>
		<echo>WTK_HOME from env ${env.WTK_HOME}</echo>
	</target>
	
	<target name="try-default-wtk-path" depends="load-env" unless="env.WTK_HOME">
		<available property="env.WTK_HOME" value="c:\WTK-2.2" file="c:\WTK-2.2\lib\cldcapi11.jar"/>
		<available property="env.WTK_HOME" value="/opt/WTK2.2" file="/opt/WTK2.2/lib/cldcapi11.jar"/>
	</target>
	
	<target name="find-wtk" depends="try-default-wtk-path" unless="wtk.home" if="env.WTK_HOME">
		<property name="wtk.home" value="${env.WTK_HOME}"/>
	</target>
	
	<target name="wtk-or-fail" depends="find-wtk">
		<fail unless="wtk.home" message="Sun Wireless Toolkit required to build component jars."/>
		<echo>Using WTK found in ${wtk.home}</echo>
		<path id="wtk-libs">
			<pathelement path="${wtk.home}/lib/cldcapi11.jar"/>
			<pathelement path="${wtk.home}/lib/midpapi20.jar"/>
			<pathelement path="${wtk.home}/lib/mmapi.jar"/>
		</path>
	</target>
</project>
