#########################################################################
# configure.in, from GATE 1 configure.in
#########################################################################
# Hamish, 23/1/01, 12/6/96
# $Id: configure.in,v 1.13 2003/01/17 16:41:50 valyt Exp $
#########################################################################
# Process this file with autoconf to produce a configure script, e.g.
# autoconf configure.in >configure
#########################################################################


# config.cache anyone? not for me, thank you
define([AC_CACHE_LOAD], )dnl
define([AC_CACHE_SAVE], )dnl


# Source availability check
AC_INIT(../src/gate/TestGate.java)


# Say hello
echo '***' 1>&2
echo '*** this is GATE auto-configuration, from GNU autoconf' 1>&2
echo '*** good luck and all who sail in her' 1>&2
echo '***' 1>&2


# Chumley St. John
AC_PATH_PROG(JAVAC, javac javac.exe, javac, ${JAVA_HOME}/bin:/usr/local/java/bin:/bin:/usr/bin://w/jdk/jdk1.4/bin://w/jdk/jdk1.3/bin)
AC_PATH_PROG(JAVA, java java.exe, java, ${JAVA_HOME}/bin:/usr/local/java/bin:/bin:/usr/bin://w/jdk/jdk1.4/bin://w/jdk/jdk1.3/bin)
AC_PATH_PROG(JAR, jar jar.exe, jar, ${JAVA_HOME}/bin:/usr/local/java/bin:/bin:/usr/bin://w/jdk/jdk1.4/bin://w/jdk/jdk1.3/bin)
AC_PATH_PROG(JAVADOC, javadoc javadoc.exe, javadoc, ${JAVA_HOME}/bin:/usr/local/java/bin:/bin:/usr/bin://w/jdk/jdk1.4/bin://w/jdk/jdk1.3/bin)
CYGPATH=echo
AC_PATH_PROG(CYGPATH, cygpath, echo)
CYGPATHP=$CYGPATH


# tools.jar
#JAVAC_DIR=`dirname \`dirname $JAVAC\``
#if test ${JAVAC_DIR} = . -o ${JAVAC_DIR} = /usr/local -o  ${JAVAC_DIR} = /usr -o  ${JAVAC_DIR} = /bin
#then
#  echo "can't find tools.jar in the tree with javac; trying to guess java version"
#  JVER=`${JAVA} -version 2>&1`
#  case ${JVER} in
#    java\ version\ "1.4*) TVER=tools14.jar ;;
#    java\ version\ "1.3*) TVER=tools13.jar ;;
#   *1.4*) TVER=tools14.jar ;;
#    *1.3*) TVER=tools13.jar ;;
#    *) TVER=tools14.jar ;;
#  esac
#  TOOLSJAR=../bin/${TVER}
#else
#  TOOLSJAR=`find $JAVAC_DIR -follow -name tools.jar -print`
#fi
#if test ! -f "$TOOLSJAR"
#then
#  echo "Can't find tools.jar; JAVAC_DIR=${JAVAC_DIR}; TOOLSJAR=${TOOLSJAR}; try setting JAVA_HOME?"
#  exit 1
#fi
#echo tools.jar is ${TOOLSJAR}


# Just what is this beast we're running on?
AC_CANONICAL_SYSTEM
case "$host" in
  sparc-sun-solaris2.*)	SH_OS=SOLARIS ;;
  sparc-sun-sunos*)    	SH_OS=SUNOS ;;
  *linux*)		SH_OS=LINUX ;;
  *aix*)		SH_OS=AIX ;;
  *irix*)		SH_OS=IRIX ;;
  *cygwin*)		SH_OS=CYGWIN ;;
  *)			SH_OS=UNKNOWN ;;
esac
case "$host_alias" in
  *cygwin*)		SH_OS=CYGWIN ;;
esac
echo Your OS seems to be $SH_OS

# system-specific stuff
if test $SH_OS = SOLARIS
then
  :
elif test $SH_OS = SUNOS
then
  :
elif test $SH_OS = LINUX
then
  :
elif test $SH_OS = AIX
then
  :
elif test $SH_OS = IRIX
then
  :
elif test $SH_OS = CYGWIN
then
  CYGPATH="$CYGPATH -w"
  CYGPATHP="$CYGPATH -p"
  :
elif test $SH_OS = UNKNOWN
then
  echo "don't recognise your OS - please take a day off"
fi


# Create an empty Makefile.dep
echo '# Makefile.dep - do not edit' >Makefile.dep


# Set up the sustitutions for Makefile creation
ECHON=$ac_n
ECHOC=$ac_c
AC_SUBST(ECHON)
AC_SUBST(ECHOC)
AC_SUBST(JAVA)
AC_SUBST(JAVAC)
AC_SUBST(TOOLSJAR)
AC_SUBST(JAR)
AC_SUBST(JAVADOC)
AC_SUBST(build)
AC_SUBST(SH_OS)
AC_SUBST(CYGPATH)
AC_SUBST(CYGPATHP)


# Create the configured Makefile
AC_OUTPUT(Makefile)

# now go home and have a nice cup of tea
echo '***' 1>&2
echo "*** you may think you're clever" 1>&2
echo '***   but plenty more can go wrong yet' 1>&2
echo '***' 1>&2
