Skip to content
Snippets Groups Projects
Commit f1885400 authored by Danny Auble's avatar Danny Auble
Browse files

different check for postgres

parent 944fc6b8
No related branches found
No related tags found
No related merge requests found
......@@ -67,40 +67,28 @@ AC_DEFUN([X_AC_DATABASES],
save_CFLAGS="$CFLAGS"
CFLAGS="$PGSQL_CFLAGS $save_CFLAGS"
AC_CHECK_HEADERS($PGSQL_INCLUDEDIR/libpq-fe.h,
[has_pgsql_header="true"],
[has_pgsql_header="false"])
if test "$has_pgsql_header" = "true"; then
AC_CHECK_LIB(pq, PQconnectdb, [has_pgsql_lib="true"], [has_pgsql_lib="false"])
if test "$has_pgsql_lib" = "true"; then
PGSQL_LIBS=" -lpq"
save_LIBS="$LIBS"
LIBS="$PGSQL_LIBS $save_LIBS"
AC_TRY_LINK([#include <libpq-fe.h>],[
int main()
{
PGconn *conn;
conn = PQconnectdb("dbname = postgres");
(void) PQfinish(conn);
}
],
[ac_have_pgsql="yes"],
[ac_have_pgsql="no"])
LIBS="$save_LIBS"
if test "$ac_have_pgsql" == "yes"; then
AC_MSG_RESULT([PostgreSQL test program built properly.])
AC_SUBST(PGSQL_LIBS)
AC_SUBST(PGSQL_CFLAGS)
AC_DEFINE(HAVE_PGSQL, 1, [Define to 1 if using PostgreSQL libaries])
else
AC_MSG_WARN([*** PostgreSQL test program execution failed.])
fi
else
AC_MSG_WARN(libpq not found: PostgreSQL support not available)
fi
else
AC_MSG_WARN(libpq-fe.h header not found: PostgreSQL support not available)
fi
CFLAGS="$save_CFLAGS"
fi
PGSQL_LIBS=" -lpq"
save_LIBS="$LIBS"
LIBS="$PGSQL_LIBS $save_LIBS"
AC_TRY_LINK([#include <libpq-fe.h>],[
int main()
{
PGconn *conn;
conn = PQconnectdb("dbname = postgres");
(void) PQfinish(conn);
}
],
[ac_have_pgsql="yes"],
[ac_have_pgsql="no"])
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
if test "$ac_have_pgsql" == "yes"; then
AC_MSG_RESULT([PostgreSQL test program built properly.])
AC_SUBST(PGSQL_LIBS)
AC_SUBST(PGSQL_CFLAGS)
AC_DEFINE(HAVE_PGSQL, 1, [Define to 1 if using PostgreSQL libaries])
else
AC_MSG_WARN([*** PostgreSQL test program execution failed.])
fi
fi
])
......@@ -106,7 +106,6 @@ libspank_la_SOURCES = \
libcommon_la_LIBADD = $(SSL_LIBS) -ldl $(PGSQL_LIBS) $(MYSQL_LIBS)
libcommon_la_LDFLAGS = $(LIB_LDFLAGS) $(SSL_LDFLAGS)
libcommon_la_LIBS = $(PGSQL_LIBS) $(MYSQL_LIBS)
libcommon_la_CFLAGS = $(PGSQL_CFLAGS) $(MYSQL_CFLAGS)
global_defaults.c : $(top_builddir)/config.h Makefile
......
......@@ -430,7 +430,6 @@ libspank_la_SOURCES = \
libcommon_la_LIBADD = $(SSL_LIBS) -ldl $(PGSQL_LIBS) $(MYSQL_LIBS)
libcommon_la_LDFLAGS = $(LIB_LDFLAGS) $(SSL_LDFLAGS)
libcommon_la_LIBS = $(PGSQL_LIBS) $(MYSQL_LIBS)
libcommon_la_CFLAGS = $(PGSQL_CFLAGS) $(MYSQL_CFLAGS)
all: all-am
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment