#!/bin/sh

if [ -f $HOME/.antrc ] ; then 
  . $HOME/.antrc
fi

# Cygwin support.
if [ "$OSTYPE" == "cygwin32" ] || [ "$OSTYPE" = "cygwin" ]; then
  if [ ! "$JAVA_HOME" = "" ]; then
    JAVA_HOME=`cygpath --path --unix $JAVA_HOME`
  fi
fi

## resolve links - $0 may be a link to ant's home
PRG=$0
progname=`basename $0`
  
while [ -h "$PRG" ] ; do
  ls=`ls -ld "$PRG"`
  link=`expr "$ls" : '.*-> \(.*\)$'`
  if expr "$link" : '.*/.*' > /dev/null; then
    PRG="$link"
  else
    PRG="`dirname $PRG`/$link"
  fi
done
  
ANT_HOME=`dirname "$PRG"`/..

if [ "$JAVA_HOME" == "" ] ; then

  echo "Warning: JAVA_HOME environment variable is not set."
  echo "  If build fails because sun.* classes could not be found"
  echo "  you will need to set the JAVA_HOME environment variable"
  echo "  to the installation directory of java."
  if [ "$JAVACMD" = "" ] ; then 
    JAVACMD=java
  fi
else
  if [ "$JAVACMD" = "" ] ; then 
    JAVACMD=$JAVA_HOME/bin/java
  fi
fi

$JAVACMD $ANT_OPTS -jar $ANT_HOME/lib/ant.jar $@
