ant machine name property
On Windows the hostname is in the environment variable "COMPUTERNAME", on Linux the environment variable is "HOSTNAME". Because ant properties are immutable something like the following should work:
<property environment="env"/><property name="env.HOSTNAME" value="${env.COMPUTERNAME}"/><echo message="hostname = ${env.HOSTNAME}"/>
i.e. import the environment as properties prefixed with env. Then set env.HOSTNAME to be the value of env.COMPUTERNAME unless env.HOSTNAME is already set in which case the 2nd line will have no effect. After that use env.HOSTNAME where the hostname is required.