dnl initialize autoconf and automake

AC_PREREQ([2.57])
AC_INIT(clucene.i)

VERSION=0.1-cvs

dnl version info
PACKAGE=clucene-bindings
PROJECT=CLuceneBindings
PACKAGE_BUGREPORT=clucene-developers@lists.sourceforge.net
PACKAGE_NAME=CLuceneBindings

AC_CONFIG_SRCDIR([clucene.i])
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_HEADERS([clbnd_config.h])
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)

dnl Check for existence of a C and C++ compilers.
AC_PROG_CC
AC_PROG_CXX

dnl Check for existence of SWIG
AC_PROG_SWIG

dnl Check for nanosleep library
AC_SEARCH_LIBS([nanosleep], [rt],
  [AC_DEFINE([HAVE_NANOSLEEP], [1],
    [Define if you have the nanosleep function])])

dnl Use libtool to manage our libraries, but don't build static libraries as
dnl the bindings only have a use for dynamic ones.
AC_DISABLE_STATIC
AC_PROG_LIBTOOL

#todo: if withjava
  AC_PATH_PROG(JAVA, java, [],
  	[${JAVA_HOME+$JAVA_HOME/bin:}${JDK_HOME+$JDK_HOME/bin:}$PATH])
  AC_PATH_PROG(JAVAC, javac, [],
  	[${JAVA_HOME+$JAVA_HOME/bin:}${JDK_HOME+$JDK_HOME/bin:}$PATH])
  AC_PATH_PROG(JAR, jar, [],
  	[${JAVA_HOME+$JAVA_HOME/bin:}${JDK_HOME+$JDK_HOME/bin:}$PATH])
  if test -n "$JAVA" -a -n "$JAVAC" -a -n "$JAR" ; then
      dnl  The JNI library *requires* "Java 2", which is 1.2 or better.
      dnl
      AC_CHECK_HEADER(jni.h, [BINDINGS="$BINDINGS java"])
  fi
#todo: fi

AX_CONFIG_FEATURE(sumo, [Use compatibility mode], _SUMO, [Use compatibility mode])

echo configuring $PACKAGE version $VERSION

AC_CONFIG_FILES([Makefile COM/Makefile])
dnl csharp/Makefile java/Makefile java/java/org/apache/clucene/Makefile java/java/org/apache/clucene/support/Makefile java/java/org/apache/clucene/analysis/Makefile java/java/org/apache/clucene/document/Makefile java/java/org/apache/clucene/index/Makefile java/java/org/apache/clucene/queryParser/Makefile java/java/org/apache/clucene/search/Makefile java/java/org/apache/clucene/store/Makefile java/java/org/apache/clucene/util/Makefile java/demo/Makefile

AC_OUTPUT

echo ""
echo ""
echo "Now you must change directory into any of the SWIG languages and run 'make' followed by 'make install'"
echo ""

