dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/gcm_input/message.h)
-AM_INIT_AUTOMAKE(GnuCoMo, 0.0.9)
+AM_INIT_AUTOMAKE(GnuCoMo, 0.0.10)
dnl Checks for programs.
#AC_CHECK_LIB(pthread, pthread_create)
AC_CHECK_LIB(xml2, xmlParseFile)
+# Find PostgreSQL includes and libraries
+AC_PATH_PROGS(PG_CONFIG, pqxx-config)
+if test -z "$PG_CONFIG" || test ! -r "$PG_CONFIG"; then
+ AC_MSG_ERROR([libpqxx configuration script was not found])
+fi
+with_postgres_include=`$PG_CONFIG --cflags`
+AC_MSG_NOTICE([using PostgreSQL headers at $with_postgres_include])
+with_postgres_lib=`$PG_CONFIG --libs`
+AC_MSG_NOTICE([using PostgreSQL libraries at $with_postgres_lib])
+
+AC_SUBST(with_postgres_lib)
+AC_SUBST(with_postgres_include)
+POSTGRES_LIB="${with_postgres_lib}"
+AC_SUBST(POSTGRES_LIB)
+POSTGRES_INCLUDE="${with_postgres_include}"
+AC_SUBST(POSTGRES_INCLUDE)
+
+
+# Checks for libraries.
+AC_CHECK_LIB([pq], [PQexec], [], [AC_MSG_ERROR([Failed to find a suitable libpq.
+
+PostgreSQL's libpq needs to be installed.
+Perhaps you need to specify --with-postgres-lib?
+])], -L${with_postgres_lib})
+
+
+CXXFLAGS="$CXXFLAGS $POSTGRES_INCLUDE"
+LIBS="$LIBS $POSTGRES_LIB"
#
# There is no convenient way to detect libpqxx, so we'll
CXXFLAGS="$CXXFLAGS -I/usr/local/pqxx/include"
LIBS="$LIBS -L/usr/local/pqxx/lib -lpqxx"
-AC_HAVE_LIBRARY(pq)
dnl Checks for header files.
AC_HEADER_DIRENT