diff options
author | Jeremy Sowden <jeremy@azazel.net> | 2022-01-09 11:57:48 +0000 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2022-01-11 22:15:33 +0100 |
commit | 20727ab8b9fcadb9d5fa514979b48c42c9be989f (patch) | |
tree | 750a59460c7bceb3ab427a6ad15d53b43e030112 /configure.ac | |
parent | be4df8f66eb843dc19c7d1fed7c33fd7a40c2e21 (diff) |
build: use pkg-config or pg_config for libpq
Recent versions of postgresql support pkg-config. Use pkg-config if
available, otherwise fall back to pg_config.
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac index 6909ea4..75764db 100644 --- a/configure.ac +++ b/configure.ac @@ -80,10 +80,35 @@ AM_CONDITIONAL([BUILD_NFACCT], [test "x$enable_nfacct" = "xyes"]) AC_ARG_ENABLE([pgsql], [AS_HELP_STRING([--enable-pgsql], [Enable PostgreSQL output plugin [default=test]])]) -AS_IF([test "x$enable_pgsql" != "xno"], - [CT_CHECK_POSTGRES_DB()]) -AS_IF([test "x$PQLIBPATH" != "x"], [enable_pgsql=yes], [enable_pgsql=no]) -AM_CONDITIONAL([HAVE_PGSQL], [test "x$PQLIBPATH" != "x"]) +AS_IF([test "x$enable_pgsql" != "xno"], [ + + PKG_CHECK_EXISTS([libpq], [PKG_CHECK_MODULES([libpq], [libpq])], [ + + AC_ARG_WITH([pg_config], + [AS_HELP_STRING([--with-pg-config=PATH], [Path to the pg_config script])], + [pg_config="$withval"], [pg_config=pg_config]) + + AC_MSG_CHECKING([for pg_config]) + + AS_IF([command -v "$pg_config" >/dev/null], [ + + libpq_CFLAGS="`$pg_config --includedir`" + libpq_LIBS="`$pg_config --libdir` -lpq" + + AC_SUBST([libpq_CFLAGS]) + AC_SUBST([libpq_LIBS]) + + AC_MSG_RESULT([$pg_config]) + + ], [ + AC_MSG_RESULT([no]) + ]) + + ]) + +]) +AS_IF([test "x$libpq_LIBS" != "x"], [enable_pgsql=yes], [enable_pgsql=no]) +AM_CONDITIONAL([HAVE_PGSQL], [test "x$libpq_LIBS" != "x"]) AC_ARG_ENABLE([mysql], [AS_HELP_STRING([--enable-mysql], [Enable MySQL output plugin [default=test]])]) |