From 7a8e24ec1cf763226f4be31ba1018d888d4989f3 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Thu, 21 Mar 2019 14:21:27 +0100 Subject: [PATCH] build: adjust configure for postgresql 10/11 The openSUSE PostgreSQL 11 no longer ships the pg_config program. Instead, there exists a .pc file (likewise in pg10), so make use of that, by default. The old --with-pgsql-inc and --with-pgsql-lib option are going away and replaced by the standardized mechanisms pkg-config.m4 has in store for when there is no .pc file or an unusual location: ./configure --with-pgsql pgsql_CFLAGS="-I/opt/pgsql/include" \ pgsql_LIBS="-L/opt/pgsql/lib -lpq" --- acinclude.m4 | 66 ++++++--------------------------------- drivers/pgsql/Makefile.am | 4 +-- 2 files changed, 12 insertions(+), 58 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 85eec28..e99318f 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -154,64 +154,18 @@ AC_SUBST(MYSQL_TEST) AC_DEFUN([AC_CHECK_PGSQL], [ -AM_CONDITIONAL(HAVE_PGSQL, false) -ac_pgsql="no" -ac_pgsql_incdir="no" -ac_pgsql_libdir="no" -# exported variables -PGSQL_LIBS="" -PGSQL_LDFLAGS="" -PGSQL_INCLUDE="" -PGSQL_TEST="" +AC_ARG_WITH([pgsql], [AS_HELP_STRING([--without-pgsql], [Build without pgsql output plugin [default=test]])], + [ac_pgsql="$withval"], [ac_pgsql=auto]) +enable_pgsql=no +AS_IF([test "$ac_pgsql" = "auto"], [ + PKG_CHECK_MODULES([pgsql], [libpq], [enable_pgsql=yes], [:]) +], [test "$ac_pgsql" != "no"], [ + PKG_CHECK_MODULES([pgsql], [libpq], [enable_pgsql=yes]) +]) -AC_MSG_CHECKING(for PostgreSQL support) - -AC_ARG_WITH(pgsql, - [ --with-pgsql Include PostgreSQL support.], - [ ac_pgsql="$withval" ]) -AC_ARG_WITH(pgsql-incdir, - [ --with-pgsql-incdir Specifies where the PostgreSQL include files are.], - [ ac_pgsql_incdir="$withval" ]) -AC_ARG_WITH(pgsql-libdir, - [ --with-pgsql-libdir Specifies where the PostgreSQL libraries are.], - [ ac_pgsql_libdir="$withval" ]) - -if test "$ac_pgsql" = "yes"; then - AC_MSG_RESULT([yes]) - if test "$ac_pgsql_incdir" = "no" || test "$ac_pgsql_libdir" = "no"; then - AC_CHECK_PROG([PG_CONFIG], [pg_config], [yes], [no]) - if test "$PG_CONFIG" = "no"; then - AC_MSG_ERROR([cannot auto-configure PostgreSQL without pg_config]) - fi - fi - if test "$ac_pgsql_incdir" = "no"; then - PGSQL_INCLUDE="-I"`pg_config --includedir` - else - PGSQL_INCLUDE=-I$ac_pgsql_incdir - fi - if test "$ac_pgsql_libdir" = "no"; then - PGSQL_LDFLAGS=`pg_config --libdir` - else - PGSQL_LDFLAGS=-L$ac_pgsql_libdir - fi - - PGSQL_LIBS=-lpq - PGSQL_TEST="test_pgsql.sh" - - - AM_CONDITIONAL(HAVE_PGSQL, true) - - AC_SUBST(PGSQL_LIBS) - AC_SUBST(PGSQL_INCLUDE) - AC_MSG_CHECKING(for PostgreSQL includes) - AC_MSG_RESULT($PGSQL_INCLUDE) - AC_SUBST(PGSQL_LDFLAGS) - AC_MSG_CHECKING(for PostgreSQL libraries) - AC_MSG_RESULT($PGSQL_LDFLAGS) -else - AC_MSG_RESULT(no) -fi +AM_CONDITIONAL([HAVE_PGSQL], [test "$enable_pgsql" = yes]) +AS_IF([test "$enable_pgsql" = yes], [PGSQL_TEST="test_pgsql.sh"]) AC_SUBST(PGSQL_TEST) ]) diff --git a/drivers/pgsql/Makefile.am b/drivers/pgsql/Makefile.am index 058a9b5..f482eac 100644 --- a/drivers/pgsql/Makefile.am +++ b/drivers/pgsql/Makefile.am @@ -28,11 +28,11 @@ pgsql_sources = endif -AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/include @DBI_INCLUDE@ @PGSQL_INCLUDE@ +AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/include @DBI_INCLUDE@ ${pgsql_CFLAGS} driver_LTLIBRARIES = $(pgsql_ltlibs) libdbdpgsql_la_LDFLAGS = $(pgsql_ldflags) -libdbdpgsql_la_LIBADD = @PGSQL_LDFLAGS@ @PGSQL_LIBS@ @LIBADD_LIBDBI@ +libdbdpgsql_la_LIBADD = ${pgsql_LIBS} @LIBADD_LIBDBI@ libdbdpgsql_la_SOURCES = $(pgsql_sources) libdbdpgsql_la_DEPENDENCIES = dbd_pgsql.h -- 2.21.0