dnl @synopsis AX_PROG_ANT([required-version]) dnl calls ant -version and parses the version string that is dnl printed. dnl MTH fixed sed command from: dnl sed -e "s/[[^0-9.]]*//g" dnl (which was returning version and compile date) to: dnl sed "s/^[[^0-9.]]*\([[0-9.]]*\)[[^0-9.]].*/\1/" dnl @category Java dnl @author Kevin Fowler kfowler@sdsc.edu dnl @author Mark Holder mholder@scs.fsu.edu dnl @version 2006-04-26 AC_DEFUN([AX_PROG_ANT],[ AC_PATH_PROG([ANT], [ant], [no], [${PATH}:$ANT_HOME/bin]) AC_SUBST([ANT]) if test "$ANT" = no; then AC_MSG_ERROR([ant is not found]) fi ant_version=`$ANT -version | sed "s/^[[^0-9.]]*\([[0-9.]]*\)[[^0-9.]].*/\1/"` AC_MSG_CHECKING(for ant $1 =< ($ant_version)) VERSION_CHECK=`expr $ant_version \>\= $1` if test "$VERSION_CHECK" = "1" ; then AC_MSG_RESULT(yes) else AC_MSG_ERROR($ANT is too old) fi AC_MSG_CHECKING(for if ant can fork) ANT_FORK_TEST="ant-fork-test.xml" cat << \EOF > $ANT_FORK_TEST EOF if AC_TRY_COMMAND($ANT $ANT_ARGS -f $ANT_FORK_TEST) >/dev/null 2>&1 ; then ac_ant_fork_works=yes else if test "x$ANT_HOME" = "x" ; then ac_ant_parent=`AS_DIRNAME("$ANT")` ANT_HOME=`AS_DIRNAME("$ac_ant_parent")` fi ANT_ARGS="-Dant.home=$ANT_HOME" if AC_TRY_COMMAND($ANT $ANT_ARGS -f $ANT_FORK_TEST) >/dev/null 2>&1; then ac_ant_fork_works=yes else AC_MSG_ERROR([$ANT cannot exec external commands outside of Java. Make sure that ANT_HOME is set and \$ANT_HOME/bin/antRun exists.]) fi fi if test $ac_ant_fork_works = "yes" ; then AC_MSG_RESULT(yes) fi rm -f $ANT_FORK_TEST AC_SUBST([ANT_ARGS]) ]) AC_PROVIDE([$0]) ])