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

AC_PREREQ([2.71])
AC_INIT([Cego], [2.54.26], [lemke@lemke-it.com])
AC_CONFIG_AUX_DIR([build-aux])

AC_REQUIRE_AUX_FILE([tap-driver.sh])

AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADERS([config.h])

AC_CONFIG_MACRO_DIR([m4])

# Checks for programs.
AC_PROG_CXX
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET

AM_PROG_AR

AC_CANONICAL_HOST

case $host_os in
  *mingw* ) MINGW=yes;;
  *msys* ) MINGW=yes;;
        * ) MINGW=no;;
esac

if [[ "$MINGW" = "yes" ]]
then
   AC_SUBST(MINGWDEF, "-DHAVE_MINGW")
fi

AM_CONDITIONAL([HAS_MINGW], [test "$MINGW" = "yes"])	

# Get lfcbase library and include locations
AC_ARG_WITH([lfc-include-path],
  [AS_HELP_STRING([--with-lfc-include-path],
    [location of the LFC headers, defaults to /usr/local/include])],
  [LFC_CFLAGS="-I$withval"],
  [LFC_CFLAGS='-I/usr/local/include'])
AC_SUBST([LFC_CFLAGS])

AC_ARG_WITH([lfc-lib-path],
  [AS_HELP_STRING([--with-lfc-lib-path], [location of the LFC libraries])],
  [LFC_LIBS="-L$withval"],
  [LFC_LIBS='-L/usr/local/lib'])
AC_SUBST([LFC_LIBS])

LDFLAGS="$LDFLAGS $LFC_LIBS"

# Checks for libraries.
# FIXME: Replace `main' with a function in `-llfc':

# Checks for header files.
AC_CHECK_HEADERS([stdlib.h])

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

# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_REALLOC

AC_CHECK_LIB([ws2_32], [main])
AC_CHECK_LIB([systre], [main])
AC_CHECK_LIB([crypt], [main])
AC_CHECK_LIB([rt], [main])
AC_CHECK_LIB([pthread], [main])
AC_CHECK_LIB([socket], [main])
AC_CHECK_LIB([nsl], [main])
AC_CHECK_LIB([curses], [main])
AC_CHECK_LIB([ncurses], [main])
AC_CHECK_LIB([history], [main])
AC_CHECK_LIB([readline], [main])
AC_CHECK_LIB([lfcbase], [main]) 
AC_CHECK_LIB([lfcxml], [main])

AC_CONFIG_FILES([Makefile
                 src/Makefile
		 dbcheck/Makefile
		 cgpluscheck/Makefile
		 cgwrapcheck/Makefile])

LT_INIT
AC_SUBST([LIBTOOL_DEPS])


AC_OUTPUT
