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

AC_INIT(configure.in)
AM_INIT_AUTOMAKE(gODBCConfig, 1.8.8)
AM_CONFIG_HEADER(config.h)

dnl Pick up the Gnome macros.
dnl AM_ACLOCAL_INCLUDE(macros)

AM_MAINTAINER_MODE

GNOME_INIT
AC_ISC_POSIX
AC_PROG_CC
AM_PROG_CC_STDC
AC_HEADER_STDC
AM_PROG_LIBTOOL

GNOME_COMPILE_WARNINGS
GNOME_X_CHECKS

dnl Add the languages which your application supports here.
ALL_LINGUAS=""
AM_GNU_GETTEXT([external])

dnl Set PACKAGE_LOCALE_DIR in config.h.
if test "x${prefix}" = "xNONE"; then
  AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR, "${ac_default_prefix}/${DATADIRNAME}/locale")
else
  AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR, "${prefix}/${DATADIRNAME}/locale")
fi

dnl Subst PACKAGE_PIXMAPS_DIR.
PACKAGE_PIXMAPS_DIR="`gnome-config --datadir`/pixmaps/${PACKAGE}"
AC_SUBST(PACKAGE_PIXMAPS_DIR)

dnl
dnl test for ODBC
dnl
AC_ARG_WITH(odbc,
[  --with-odbc=<directory> use ODBC libraries in <directory>],[
if test $withval != yes
then
	dir=$withval
else
	dir="/usr/local"
fi
])
odbcdir=""
AC_MSG_CHECKING(for ODBC files)
for d in $dir /usr /usr/local
do
	if test -f $d/lib/libodbcinst.so 
	then
        AC_MSG_RESULT(found ODBC in $d)
        ODBCLIB="-lodbcinst"
        odbcdir=$d
        break
	fi
done
if test x$odbcdir = x
then
	AC_MSG_ERROR(ODBC backend not found)
else
	AC_DEFINE(HAVE_ODBC)
	ODBCINCLUDES=${odbcdir}/include
	ODBCLIBS=${odbcdir}/lib
fi

AC_SUBST(ODBCINCLUDES)
AC_SUBST(ODBCLIBS)
AC_SUBST(ODBCLIB)

dnl Keep autoheader happy
AC_DEFINE([ENABLE_NLS], [], [Description])
AC_DEFINE([HAVE_CATGETS], [], [Description])
AC_DEFINE([HAVE_GETTEXT], [], [Description])
AC_DEFINE([HAVE_LC_MESSAGES], [], [Description])
AC_DEFINE([HAVE_LIBSM], [], [Description])
AC_DEFINE([HAVE_ODBC], [], [Description])
AC_DEFINE([PACKAGE_LOCALE_DIR], [], [Description])

AC_OUTPUT([ Makefile 
src/Makefile
po/Makefile.in
])

