Use AC_TRY_LINK to check if the PostgreSQL library is linkable.

git-svn-id: http://voip.null.ro/svn/yate@5853 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2014-06-24 12:35:11 +00:00
parent 200931fdfb
commit a92946bf0e
1 changed files with 14 additions and 2 deletions

View File

@ -602,10 +602,22 @@ done
if [[ ! -f "$incpq/libpq-fe.h" ]]; then
incpq="$incpq/pgsql"
fi
if [[ -f "$incpq/libpq-fe.h" -a -f "$libpq" ]]; then
HAVE_PGSQL=yes
if [[ -f "$incpq/libpq-fe.h" ]]; then
if [[ -f "$libpq" ]]; then
HAVE_PGSQL=yes
else
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -I$incpq"
SAVE_LIBS="$LIBS"
LIBS="$LIBS -lpq"
AC_TRY_LINK([#include <libpq-fe.h>],[PQconnectStart("");],[HAVE_PGSQL=yes])
LIBS="$SAVE_LIBS"
CFLAGS="$SAVE_CFLAGS"
fi
if [[ "x$HAVE_PGSQL" = "xyes" ]]; then
PGSQL_INC="-I$incpq"
fi
fi
AC_MSG_RESULT([$HAVE_PGSQL])
fi
AC_SUBST(HAVE_PGSQL)