* [PATCH] build: adjust configure for postgresql 11
@ 2019-03-21 11:54 Jan Engelhardt
2019-03-21 12:25 ` [PATCH] build: adjust configure for postgresql 10/11 Jan Engelhardt
2019-03-22 9:04 ` [PATCH] build: adjust configure for postgresql 11 Arturo Borrero Gonzalez
0 siblings, 2 replies; 6+ messages in thread
From: Jan Engelhardt @ 2019-03-21 11:54 UTC (permalink / raw)
To: netfilter-devel; +Cc: eric
At least in openSUSE, PostgreSQL 11 no longer ships the pg_config
program. Instead, there is has been a pkg-config file around for a
while (also 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:
./configure pgsql_CFLAGS="-I/opt/pgsql/include" \
pgsql_LIBS="-L/opt/pgsql/lib -lpq"
---
acinclude.m4 | 77 +---------------------------------------
configure.ac | 9 +++--
output/pgsql/Makefile.am | 4 +--
3 files changed, 7 insertions(+), 83 deletions(-)
diff --git a/acinclude.m4 b/acinclude.m4
index 8388c45..3813c6c 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -14,82 +14,7 @@ dnl @license AllPermissive
AC_DEFUN([CT_CHECK_POSTGRES_DB], [
-AC_ARG_WITH(pgsql,
- [ --with-pgsql=PREFIX Prefix of your PostgreSQL installation],
- [pg_prefix=$withval], [pg_prefix=])
-AC_ARG_WITH(pgsql-inc,
- [ --with-pgsql-inc=PATH Path to the include directory of PostgreSQL],
- [pg_inc=$withval], [pg_inc=])
-AC_ARG_WITH(pgsql-lib,
- [ --with-pgsql-lib=PATH Path to the libraries of PostgreSQL],
- [pg_lib=$withval], [pg_lib=])
-
-
-AC_SUBST(PQINCPATH)
-AC_SUBST(PQLIBPATH)
-AC_SUBST(PQLIBS)
-PQLIBS=-lpq
-
-if test "$pg_prefix" != "no"; then
-
-AC_MSG_CHECKING([for PostgreSQL pg_config program])
-for d in $pg_prefix/bin /usr/bin /usr/local/bin /usr/local/pgsql/bin /opt/pgsql/bin /opt/packages/pgsql/bin
-do
- if test -x $d/pg_config -a "$cross_compiling" = "no";
- then
- AC_MSG_RESULT(found pg_config in $d)
- PQINCPATH=`$d/pg_config --includedir`
- PQLIBPATH=`$d/pg_config --libdir`
- break
- fi
-done
-
-if test "$PQINCPATH" = ""; then
- if test "$pg_prefix" != ""; then
- AC_MSG_CHECKING([for PostgreSQL includes in $pg_prefix/include])
- if test -f "$pg_prefix/include/libpq-fe.h" ; then
- PQINCPATH="-I$pg_prefix/include"
- AC_MSG_RESULT([yes])
- else
- AC_MSG_WARN(libpq-fe.h not found)
- fi
- AC_MSG_CHECKING([for PostgreSQL libraries in $pg_prefix/lib])
- if test -f "$pg_prefix/lib/libpq.so" ; then
- PQLIBPATH="-L$pg_prefix/lib"
- AC_MSG_RESULT([yes])
- else
- AC_MSG_WARN(libpq.so not found)
- fi
- else
- if test "$pg_inc" != ""; then
- AC_MSG_CHECKING([for PostgreSQL includes in $pg_inc])
- if test -f "$pg_inc/libpq-fe.h" ; then
- PQINCPATH="-I$pg_inc"
- AC_MSG_RESULT([yes])
- else
- AC_MSG_WARN(libpq-fe.h not found)
- fi
- fi
- if test "$pg_lib" != ""; then
- AC_MSG_CHECKING([for PostgreSQL libraries in $pg_lib])
- if test -f "$pg_lib/libpq.so" ; then
- PQLIBPATH="-L$pg_lib"
- AC_MSG_RESULT([yes])
- else
- AC_MSG_WARN(libpq.so not found)
- fi
- fi
- fi
-fi
-
-if test "$PQINCPATH" = "" ; then
- AC_CHECK_HEADER([libpq-fe.h], [], AC_MSG_WARN(libpq-fe.h not found))
-fi
-if test "$PQLIBPATH" = "" ; then
- AC_CHECK_LIB(pq, PQconnectdb, [], AC_MSG_WARN(libpq.so not found))
-fi
-
-fi
+PKG_CHECK_MODULES([pgsql], [libpq])
])
diff --git a/configure.ac b/configure.ac
index 3aa0624..da46e09 100644
--- a/configure.ac
+++ b/configure.ac
@@ -86,12 +86,11 @@ AC_ARG_WITH([pgsql], AS_HELP_STRING([--without-pgsql], [Build without postgresql
AS_IF([test "x$with_pgsql" != "xno"], [
CT_CHECK_POSTGRES_DB()
])
-AM_CONDITIONAL(HAVE_PGSQL, test "x$PQLIBPATH" != "x")
-if test "x$PQLIBPATH" != "x"; then
- enable_pgsql="yes"
-else
- enable_pgsql="no"
+enable_pgsql="no"
+if test "x$pgsql_CFLAGS" != "x" || test "x$pgsql_LIBS" != "x"; then
+ enable_pgsql=yes
fi
+AM_CONDITIONAL([HAVE_PGSQL], [test "$enable_pgsql" = yes])
AC_ARG_WITH([mysql], AS_HELP_STRING([--without-mysql], [Build without mysql output plugin [default=test]]))
AS_IF([test "x$with_mysql" != "xno"], [
diff --git a/output/pgsql/Makefile.am b/output/pgsql/Makefile.am
index bdaf1d2..6c1d35a 100644
--- a/output/pgsql/Makefile.am
+++ b/output/pgsql/Makefile.am
@@ -1,5 +1,5 @@
-AM_CPPFLAGS = -I$(top_srcdir)/include -I$(PQINCPATH)
+AM_CPPFLAGS = -I$(top_srcdir)/include ${pgsql_CFLAGS}
AM_CFLAGS = ${regular_CFLAGS}
if HAVE_PGSQL
@@ -7,7 +7,7 @@ if HAVE_PGSQL
pkglib_LTLIBRARIES = ulogd_output_PGSQL.la
ulogd_output_PGSQL_la_SOURCES = ulogd_output_PGSQL.c ../../util/db.c
-ulogd_output_PGSQL_la_LIBADD = ${PQLIBS}
+ulogd_output_PGSQL_la_LIBADD = ${pgsql_LIBS}
ulogd_output_PGSQL_la_LDFLAGS = -avoid-version -module
endif
--
2.21.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] build: adjust configure for postgresql 10/11
2019-03-21 11:54 [PATCH] build: adjust configure for postgresql 11 Jan Engelhardt
@ 2019-03-21 12:25 ` Jan Engelhardt
2019-03-22 9:04 ` [PATCH] build: adjust configure for postgresql 11 Arturo Borrero Gonzalez
1 sibling, 0 replies; 6+ messages in thread
From: Jan Engelhardt @ 2019-03-21 12:25 UTC (permalink / raw)
To: netfilter-devel; +Cc: erig
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 | 84 ++++------------------------------------
configure.ac | 12 +-----
output/pgsql/Makefile.am | 4 +-
3 files changed, 12 insertions(+), 88 deletions(-)
diff --git a/acinclude.m4 b/acinclude.m4
index 8388c45..3b8b982 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -14,82 +14,14 @@ dnl @license AllPermissive
AC_DEFUN([CT_CHECK_POSTGRES_DB], [
-AC_ARG_WITH(pgsql,
- [ --with-pgsql=PREFIX Prefix of your PostgreSQL installation],
- [pg_prefix=$withval], [pg_prefix=])
-AC_ARG_WITH(pgsql-inc,
- [ --with-pgsql-inc=PATH Path to the include directory of PostgreSQL],
- [pg_inc=$withval], [pg_inc=])
-AC_ARG_WITH(pgsql-lib,
- [ --with-pgsql-lib=PATH Path to the libraries of PostgreSQL],
- [pg_lib=$withval], [pg_lib=])
-
-
-AC_SUBST(PQINCPATH)
-AC_SUBST(PQLIBPATH)
-AC_SUBST(PQLIBS)
-PQLIBS=-lpq
-
-if test "$pg_prefix" != "no"; then
-
-AC_MSG_CHECKING([for PostgreSQL pg_config program])
-for d in $pg_prefix/bin /usr/bin /usr/local/bin /usr/local/pgsql/bin /opt/pgsql/bin /opt/packages/pgsql/bin
-do
- if test -x $d/pg_config -a "$cross_compiling" = "no";
- then
- AC_MSG_RESULT(found pg_config in $d)
- PQINCPATH=`$d/pg_config --includedir`
- PQLIBPATH=`$d/pg_config --libdir`
- break
- fi
-done
-
-if test "$PQINCPATH" = ""; then
- if test "$pg_prefix" != ""; then
- AC_MSG_CHECKING([for PostgreSQL includes in $pg_prefix/include])
- if test -f "$pg_prefix/include/libpq-fe.h" ; then
- PQINCPATH="-I$pg_prefix/include"
- AC_MSG_RESULT([yes])
- else
- AC_MSG_WARN(libpq-fe.h not found)
- fi
- AC_MSG_CHECKING([for PostgreSQL libraries in $pg_prefix/lib])
- if test -f "$pg_prefix/lib/libpq.so" ; then
- PQLIBPATH="-L$pg_prefix/lib"
- AC_MSG_RESULT([yes])
- else
- AC_MSG_WARN(libpq.so not found)
- fi
- else
- if test "$pg_inc" != ""; then
- AC_MSG_CHECKING([for PostgreSQL includes in $pg_inc])
- if test -f "$pg_inc/libpq-fe.h" ; then
- PQINCPATH="-I$pg_inc"
- AC_MSG_RESULT([yes])
- else
- AC_MSG_WARN(libpq-fe.h not found)
- fi
- fi
- if test "$pg_lib" != ""; then
- AC_MSG_CHECKING([for PostgreSQL libraries in $pg_lib])
- if test -f "$pg_lib/libpq.so" ; then
- PQLIBPATH="-L$pg_lib"
- AC_MSG_RESULT([yes])
- else
- AC_MSG_WARN(libpq.so not found)
- fi
- fi
- fi
-fi
-
-if test "$PQINCPATH" = "" ; then
- AC_CHECK_HEADER([libpq-fe.h], [], AC_MSG_WARN(libpq-fe.h not found))
-fi
-if test "$PQLIBPATH" = "" ; then
- AC_CHECK_LIB(pq, PQconnectdb, [], AC_MSG_WARN(libpq.so not found))
-fi
-
-fi
+AC_ARG_WITH([pgsql], [AS_HELP_STRING([--without-pgsql], [Build without pgsql output plugin [default=test]])],
+ [want_pgsql="$withval"], [want_pgsql=auto])
+enable_pgsql=no
+AS_IF([test "$want_pgsql" = "auto"], [
+ PKG_CHECK_MODULES([pgsql], [libpq], [enable_pgsql=yes], [:])
+], [test "$want_pgsql" != "no"], [
+ PKG_CHECK_MODULES([pgsql], [libpq], [enable_pgsql=yes])
+])
])
diff --git a/configure.ac b/configure.ac
index 3aa0624..794cbbb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -82,16 +82,8 @@ if [! test "x$enable_nfacct" = "xyes"]; then
enable_nfacct="no"
fi
-AC_ARG_WITH([pgsql], AS_HELP_STRING([--without-pgsql], [Build without postgresql output plugin [default=test]]))
-AS_IF([test "x$with_pgsql" != "xno"], [
- CT_CHECK_POSTGRES_DB()
-])
-AM_CONDITIONAL(HAVE_PGSQL, test "x$PQLIBPATH" != "x")
-if test "x$PQLIBPATH" != "x"; then
- enable_pgsql="yes"
-else
- enable_pgsql="no"
-fi
+CT_CHECK_POSTGRES_DB()
+AM_CONDITIONAL([HAVE_PGSQL], [test "$enable_pgsql" = yes])
AC_ARG_WITH([mysql], AS_HELP_STRING([--without-mysql], [Build without mysql output plugin [default=test]]))
AS_IF([test "x$with_mysql" != "xno"], [
diff --git a/output/pgsql/Makefile.am b/output/pgsql/Makefile.am
index bdaf1d2..6c1d35a 100644
--- a/output/pgsql/Makefile.am
+++ b/output/pgsql/Makefile.am
@@ -1,5 +1,5 @@
-AM_CPPFLAGS = -I$(top_srcdir)/include -I$(PQINCPATH)
+AM_CPPFLAGS = -I$(top_srcdir)/include ${pgsql_CFLAGS}
AM_CFLAGS = ${regular_CFLAGS}
if HAVE_PGSQL
@@ -7,7 +7,7 @@ if HAVE_PGSQL
pkglib_LTLIBRARIES = ulogd_output_PGSQL.la
ulogd_output_PGSQL_la_SOURCES = ulogd_output_PGSQL.c ../../util/db.c
-ulogd_output_PGSQL_la_LIBADD = ${PQLIBS}
+ulogd_output_PGSQL_la_LIBADD = ${pgsql_LIBS}
ulogd_output_PGSQL_la_LDFLAGS = -avoid-version -module
endif
--
2.21.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] build: adjust configure for postgresql 11
2019-03-21 11:54 [PATCH] build: adjust configure for postgresql 11 Jan Engelhardt
2019-03-21 12:25 ` [PATCH] build: adjust configure for postgresql 10/11 Jan Engelhardt
@ 2019-03-22 9:04 ` Arturo Borrero Gonzalez
2019-03-22 12:55 ` Jan Engelhardt
1 sibling, 1 reply; 6+ messages in thread
From: Arturo Borrero Gonzalez @ 2019-03-22 9:04 UTC (permalink / raw)
To: Jan Engelhardt; +Cc: netfilter-devel, eric, Chris Boot, myon
On 3/21/19 12:54 PM, Jan Engelhardt wrote:
> At least in openSUSE, PostgreSQL 11 no longer ships the pg_config
> program. Instead, there is has been a pkg-config file around for a
> while (also 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:
>
> ./configure pgsql_CFLAGS="-I/opt/pgsql/include" \
> pgsql_LIBS="-L/opt/pgsql/lib -lpq"
> ---
> acinclude.m4 | 77 +---------------------------------------
> configure.ac | 9 +++--
> output/pgsql/Makefile.am | 4 +--
> 3 files changed, 7 insertions(+), 83 deletions(-)
>
Debian ships pg_config. In fact, the same package libpq-dev [0] contains both
things:
* /usr/bin/pg_config
* /usr/lib/x86_64-linux-gnu/pkgconfig/libpq.pc
So I think this patch should be fine.
Acked-by: Arturo Borrero Gonzalez <arturo@netfilter.org>
[0] https://packages.debian.org/sid/amd64/libpq-dev/filelist
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] build: adjust configure for postgresql 11
2019-03-22 9:04 ` [PATCH] build: adjust configure for postgresql 11 Arturo Borrero Gonzalez
@ 2019-03-22 12:55 ` Jan Engelhardt
2019-03-22 13:23 ` Christoph Berg
0 siblings, 1 reply; 6+ messages in thread
From: Jan Engelhardt @ 2019-03-22 12:55 UTC (permalink / raw)
To: Arturo Borrero Gonzalez; +Cc: netfilter-devel, eric, Chris Boot, myon
On Friday 2019-03-22 10:04, Arturo Borrero Gonzalez wrote:
>On 3/21/19 12:54 PM, Jan Engelhardt wrote:
>> At least in openSUSE, PostgreSQL 11 no longer ships the pg_config
>> program. Instead, there is has been a pkg-config file around for a
>> while (also in pg10), so make use of that, by default.
>
>Debian ships pg_config. In fact, the same package libpq-dev [0] contains both
>things:
>
>* /usr/bin/pg_config
>* /usr/lib/x86_64-linux-gnu/pkgconfig/libpq.pc
pg_config is regarded for the server part only, says the respective maintainer.
https://bugzilla.opensuse.org/show_bug.cgi?id=1120035#c1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] build: adjust configure for postgresql 11
2019-03-22 12:55 ` Jan Engelhardt
@ 2019-03-22 13:23 ` Christoph Berg
2019-04-08 21:43 ` Pablo Neira Ayuso
0 siblings, 1 reply; 6+ messages in thread
From: Christoph Berg @ 2019-03-22 13:23 UTC (permalink / raw)
To: Jan Engelhardt; +Cc: Arturo Borrero Gonzalez, netfilter-devel, eric, Chris Boot
Re: Jan Engelhardt 2019-03-22 <nycvar.YFH.7.76.1903221354530.7557@n3.vanv.qr>
> >> At least in openSUSE, PostgreSQL 11 no longer ships the pg_config
> >> program. Instead, there is has been a pkg-config file around for a
> >> while (also in pg10), so make use of that, by default.
> >
> >Debian ships pg_config. In fact, the same package libpq-dev [0] contains both
> >things:
> >
> >* /usr/bin/pg_config
> >* /usr/lib/x86_64-linux-gnu/pkgconfig/libpq.pc
>
> pg_config is regarded for the server part only, says the respective maintainer.
> https://bugzilla.opensuse.org/show_bug.cgi?id=1120035#c1
That is wishful thinking. It would be nice if all client-side
applications would use pkg-config to interface to libpq, but state of
things is still that pg_config is used by many (most?) of them. That
choice tries to force everyone to switch. If openSUSE wants to fight
that fight, good luck.
`pg_config --libs` should not be used for linking client-side apps.
Thats an artifact from server-side linking.
Christoph
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] build: adjust configure for postgresql 11
2019-03-22 13:23 ` Christoph Berg
@ 2019-04-08 21:43 ` Pablo Neira Ayuso
0 siblings, 0 replies; 6+ messages in thread
From: Pablo Neira Ayuso @ 2019-04-08 21:43 UTC (permalink / raw)
To: Christoph Berg
Cc: Jan Engelhardt, Arturo Borrero Gonzalez, netfilter-devel, eric,
Chris Boot
Hi Christoph,
On Fri, Mar 22, 2019 at 02:23:59PM +0100, Christoph Berg wrote:
> Re: Jan Engelhardt 2019-03-22 <nycvar.YFH.7.76.1903221354530.7557@n3.vanv.qr>
> > >> At least in openSUSE, PostgreSQL 11 no longer ships the pg_config
> > >> program. Instead, there is has been a pkg-config file around for a
> > >> while (also in pg10), so make use of that, by default.
> > >
> > >Debian ships pg_config. In fact, the same package libpq-dev [0] contains both
> > >things:
> > >
> > >* /usr/bin/pg_config
> > >* /usr/lib/x86_64-linux-gnu/pkgconfig/libpq.pc
> >
> > pg_config is regarded for the server part only, says the respective maintainer.
> > https://bugzilla.opensuse.org/show_bug.cgi?id=1120035#c1
>
> That is wishful thinking. It would be nice if all client-side
> applications would use pkg-config to interface to libpq, but state of
> things is still that pg_config is used by many (most?) of them. That
> choice tries to force everyone to switch. If openSUSE wants to fight
> that fight, good luck.
>
> `pg_config --libs` should not be used for linking client-side apps.
> Thats an artifact from server-side linking.
Any objection then OK with this patch? Not an pg expert here.
Thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-04-08 21:43 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-21 11:54 [PATCH] build: adjust configure for postgresql 11 Jan Engelhardt
2019-03-21 12:25 ` [PATCH] build: adjust configure for postgresql 10/11 Jan Engelhardt
2019-03-22 9:04 ` [PATCH] build: adjust configure for postgresql 11 Arturo Borrero Gonzalez
2019-03-22 12:55 ` Jan Engelhardt
2019-03-22 13:23 ` Christoph Berg
2019-04-08 21:43 ` Pablo Neira Ayuso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).