dnl Process this file with autoconf to produce a configure script.

AC_PREREQ(2.59)
AC_INIT([PROJ.4 Projections], 4.6.0, [warmerdam@pobox.com], proj)
AC_LANG(C)


AM_INIT_AUTOMAKE
AM_MAINTAINER_MODE
AM_CONFIG_HEADER(src/proj_config.h)

dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AM_PROG_LIBTOOL

dnl Checks for libraries.
AC_CHECK_LIB(m,exp,,,)

dnl We check for headers
AC_HEADER_STDC

dnl ---------------------------------------------------------------------------
dnl Check for JNI support.
dnl ---------------------------------------------------------------------------

JNI_INCLUDE=
export JNI_INCLUDE

AC_ARG_WITH(jni,
[  --with-jni=dir          Include Java/JNI support, add optional include dir],,)

if test "$with_jni" = "yes" ; then

  AC_DEFINE(JNI_ENABLED,1,[Enabled for Java/JNI Support])

  AC_MSG_CHECKING(whether to enable Java/JNI support)

  AC_MSG_RESULT([enabled])

elif test "$with_jni" != "no" -a "$with_jni" != "" ; then

  AC_MSG_CHECKING(whether to enable Java/JNI support)

  if test \! -r "$with_jni/jni.h" ; then
    AC_MSG_ERROR(Did not find $with_jni/jni.h)
  fi
   
  AC_DEFINE(JNI_ENABLED,1,[Enabled for Java/JNI Support])

  AC_MSG_RESULT([enabled])

  JNI_INCLUDE="-I$with_jni"

elif test "$with_jni" = "" ; then
  AC_CHECK_HEADERS(jni.h)

  AC_MSG_CHECKING(whether to enable Java/JNI support)

  if test "$ac_cv_header_jni_h" = "no" ; then   
    AC_MSG_RESULT([disabled])
  else
    AC_MSG_RESULT([enabled])
    AC_DEFINE(JNI_ENABLED,1,[Enabled for Java/JNI Support])
  fi

else
  AC_MSG_CHECKING(whether to enable Java/JNI support)

  AC_MSG_RESULT([disabled])
fi

AC_SUBST(JNI_INCLUDE,$JNI_INCLUDE)




AC_OUTPUT(Makefile src/Makefile man/Makefile man/man1/Makefile \
	man/man3/Makefile nad/Makefile \
	jniwrap/Makefile jniwrap/org/Makefile jniwrap/org/proj4/Makefile)
