#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.57)
AC_INIT(cpindex, 0.0.1, psha@voodoo.lz)
AC_CONFIG_SRCDIR([hsrc/mnet.lhs])
#AM_CONFIG_HEADER([config.h])

AM_INIT_AUTOMAKE(cpindex, 0.0.1)

# Checks for programs.
#CC=gcc-3.3
#CXX=g++-3.3

AC_PROG_CC
AC_PROG_CXX
AC_PROG_RANLIB

AC_ARG_WITH( docs, 
    [  --with-docs                   Build documentation (from doc/ subdir)],
    enable_docs=yes)

AC_ARG_WITH( gcc3, 
    [  --with-gcc3                   Build SSL connections],
    [CC=gcc-3.3; CXX=g++-3.3;])

AC_ARG_WITH( ssl, 
    [  --with-ssl                    Build SSL connections],
    enable_ssl=yes)

#AC_CHECK_HEADER(mpi.h)

#CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
#AC_CHECK_FUNCS(open64 fstat64 lseek64, __largefile="yes", __largefile="no")

# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE

AM_CONDITIONAL(WITH_DOCS, test x"$enable_docs" = xyes)
AM_CONDITIONAL(WITH_SSL, test x"$enable_ssl" = xyes)
test x"$enable_ssl" = xyes || AC_DEFINE(CPI_NOSSL, 1,[Disable SSL support])

# Checks for library functions.
AC_CONFIG_SUBDIRS([libccp2 libbio])
AC_OUTPUT([Makefile doc/Makefile hsrc/Makefile])

test x"$enable_docs" = xyes || echo "Documentation is disabled";
