[build] prefer pkg-config for postgres (fixes
x-ref:
"pg_config is deprecated to build postgres client applications"
@@ -303,11 +303,16 @@ PGSQL_LIBS=
if test "$WITH_PGSQL" != no; then
if test "$WITH_PGSQL" = yes; then
+ PKG_CHECK_MODULES([PGSQL],[libpq],[
+ PGSQL_CONFIG=$PKG_CONFIG
+ ],[
AC_PATH_PROG([PGSQL_CONFIG], [pg_config])
+ ])
else
PGSQL_CONFIG=$WITH_PGSQL
fi
+ if test "$PGSQL_CONFIG" != "$PKG_CONFIG"; then
if test -z "$PGSQL_CONFIG"; then
AC_MSG_ERROR([pg_config is not found])
fi
@@ -317,6 +322,7 @@ if test "$WITH_PGSQL" != no; then
PGSQL_INCLUDE="-I`"$PGSQL_CONFIG" --includedir`"
PGSQL_LIBS="-L`"$PGSQL_CONFIG" --libdir` -lpq"
+ fi
AC_MSG_CHECKING([for PgSQL includes at])
AC_MSG_RESULT([$PGSQL_INCLUDE])
