dnl
dnl Autoconf script for NMSTL
dnl

AC_INIT(Makefile.in)

PACKAGE=nmstl
AC_SUBST(PACKAGE)
VERSION=0.5
AC_SUBST(VERSION)

AC_ARG_WITH(rootdir, dnl
  --with-rootdir=DIR      root dir for installation (default is \"\"))
AC_ARG_WITH(docdir, dnl
  --with-docdir=DIR       directory for docs (default is \$prefix/share/doc))

rootdir=$with_rootdir
AC_SUBST(rootdir)

pref=$prefix
test "$pref" = NONE && pref=$ac_default_prefix
docdir=$with_docdir
test "$with_docdir" = "" && docdir=$pref/share/doc
AC_SUBST(docdir)

dnl Checks for programs.
AC_PROG_CC
AC_PROG_CXX

AC_MSG_CHECKING([for Java compiler])
rm -f conftest.java conftest.class
echo 'public class conftest {}' > conftest.java

with_javac=no
for javac in javac jikes; do
    $javac conftest.java 2>&5
    if test -e conftest.class; then
        with_javac=$javac
        break
    fi
done
rm -f conftest.java conftest.class

AC_MSG_RESULT([$with_javac])
if test "$with_javac" != no; then
    JAVAC="$with_javac"
fi
AC_SUBST(JAVAC)

AC_OUTPUT(Makefile Makefile.defs nmstl.spec test/Makefile example/Makefile doc/Makefile java/Makefile src/Makefile)
