All of lore.kernel.org
 help / color / mirror / Atom feed
* [ulogd2 PATCH 00/10] Add pkg-config support
@ 2022-01-06 21:09 Jeremy Sowden
  2022-01-06 21:09 ` [ulogd2 PATCH 01/10] build: use `--enable-blah` flags for output plugins Jeremy Sowden
                   ` (9 more replies)
  0 siblings, 10 replies; 15+ messages in thread
From: Jeremy Sowden @ 2022-01-06 21:09 UTC (permalink / raw)
  To: Netfilter Devel

A number of third-party libraries have added pkg-config support over the
years.  This patch-set updates configure to make use it where it is
available.  It also fixes some conflicting option definitions and adds
patches that causes configure to fail if a plugin has been explicitly
requested but the related third-party library is not available.

Patch 1:      switch from `--with-blah` to `--enable-blah` for output
              plugins.
Patches 2-5:  use pkg-config for libdbi, mysql, libpcap and libpq if
              available.
Patches 6-10: abort configure when an output plugin has been explicitly
              enabled, but the related library is not available.

Jeremy Sowden (10):
  build: use `--enable-blah` flags for output plugins
  build: use pkg-config for libdbi
  build: use pkg-config or upstream M4 for mysql
  build: use pkg-config or pcap-config for libpcap
  build: use pkg-config for libpq if available
  build: if `--enable-dbi` is `yes` abort if DBI is not found
  build: if `--enable-mysql` is `yes` abort if MySQL is not found
  build: if `--enable-pcap` is `yes` abort if libpcap is not found
  build: if `--enable-pgsql` is `yes` abort if libpq is not found
  build: if `--enable-sqlite3` is `yes` abort if libsqlite3 is not found

 acinclude.m4             | 351 ---------------------------------------
 configure.ac             | 192 +++++++++++++++++----
 output/dbi/Makefile.am   |   4 +-
 output/pgsql/Makefile.am |   4 +-
 4 files changed, 161 insertions(+), 390 deletions(-)
 delete mode 100644 acinclude.m4

-- 
2.34.1


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [ulogd2 PATCH 01/10] build: use `--enable-blah` flags for output plugins
  2022-01-06 21:09 [ulogd2 PATCH 00/10] Add pkg-config support Jeremy Sowden
@ 2022-01-06 21:09 ` Jeremy Sowden
  2022-01-06 21:09 ` [ulogd2 PATCH 02/10] build: use pkg-config for libdbi Jeremy Sowden
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Jeremy Sowden @ 2022-01-06 21:09 UTC (permalink / raw)
  To: Netfilter Devel

Currently, we use `AC_ARG_WITH` for output plugins.  However, this is
not consistent with the input plugins, which use `AC_ARG_ENABLE`, and in
some cases (dbi, mysql, pgsql) the macro calls in configure.ac conflict
with other calls in acinclude.m4.  Use `AC_ARG_ENABLE` instead and
change the name of the flag for the JSON plugin from `jansson` to
`json`.

Fixes: 51ba7aec8951 ("Fix automagic support of dbi, pcap and sqlite3")
Fixes: c61c05c2d050 ("configure.ac: Add --without-{mysql,pgsql}")
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
---
 configure.ac | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/configure.ac b/configure.ac
index b3e1c8f6b926..b24357dcd4b4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -78,47 +78,47 @@ AS_IF([test "x$enable_nfacct" = "xyes"],
       [enable_nfacct=no])
 AM_CONDITIONAL([BUILD_NFACCT], [test "x$enable_nfacct" = "xyes"])
 
-AC_ARG_WITH([pgsql],
-            [AS_HELP_STRING([--without-pgsql], [Build without postgresql output plugin [default=test]])])
-AS_IF([test "x$with_pgsql" != "xno"],
+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"])
 
-AC_ARG_WITH([mysql],
-            [AS_HELP_STRING([--without-mysql], [Build without mysql output plugin [default=test]])])
-AS_IF([test "x$with_mysql" != "xno"],
+AC_ARG_ENABLE([mysql],
+              [AS_HELP_STRING([--enable-mysql], [Enable MySQL output plugin [default=test]])])
+AS_IF([test "x$enable_mysql" != "xno"],
       [CT_CHECK_MYSQL_DB()])
 AS_IF([test "x$MYSQL_LIB" != "x"], [enable_mysql=yes], [enable_mysql=no])
 AM_CONDITIONAL([HAVE_MYSQL], [test "x$MYSQL_LIB" != "x"])
 
-AC_ARG_WITH([sqlite],
-            [AS_HELP_STRING([--without-sqlite], [Build without SQLITE3 output plugin [default=test]])])
-AS_IF([test "x$with_sqlite" != "xno"],
+AC_ARG_ENABLE([sqlite3],
+              [AS_HELP_STRING([--enable-sqlite3], [Enable SQLITE3 output plugin [default=test]])])
+AS_IF([test "x$enable_sqlite3" != "xno"],
       [PKG_CHECK_MODULES([libsqlite3], [sqlite3], [], [:])])
 AS_IF([test "x$libsqlite3_LIBS" != "x"], [enable_sqlite3=yes], [enable_sqlite3=no])
 AM_CONDITIONAL([HAVE_SQLITE3], [test "x$libsqlite3_LIBS" != "x"])
 
-AC_ARG_WITH([dbi],
-            [AS_HELP_STRING([--without-dbi], [Build without DBI output plugin [default=test]])])
-AS_IF([test "x$with_dbi" != "xno"],
+AC_ARG_ENABLE([dbi],
+              [AS_HELP_STRING([--enable-dbi], [Enable DBI output plugin [default=test]])])
+AS_IF([test "x$enable_dbi" != "xno"],
       [CT_CHECK_DBI()])
 AS_IF([test "x$DBI_LIB" != "x"], [enable_dbi=yes], [enable_dbi=no])
 AM_CONDITIONAL(HAVE_DBI, [test "x$DBI_LIB" != "x"])
 
-AC_ARG_WITH([pcap],
-            [AS_HELP_STRING([--without-pcap], [Build without PCAP output plugin [default=test]])])
-AS_IF([test "x$with_pcap" != "xno"],
+AC_ARG_ENABLE([pcap],
+              [AS_HELP_STRING([--enable-pcap], [Enable PCAP output plugin [default=test]])])
+AS_IF([test "x$enable_pcap" != "xno"],
       [AC_SEARCH_LIBS([pcap_close], [pcap], [libpcap_LIBS="-lpcap"; LIBS=""])
        AC_SUBST([libpcap_LIBS])])
 AS_IF([test "x$libpcap_LIBS" != "x"], [enable_pcap=yes], [enable_pcap=no])
 AM_CONDITIONAL([HAVE_PCAP], [test "x$libpcap_LIBS" != "x"])
 
-AC_ARG_WITH([jansson],
-            [AS_HELP_STRING([--without-jansson], [Build without JSON output plugin [default=test]])])
-AS_IF([test "x$with_jansson" != "xno"],
+AC_ARG_ENABLE([json],
+              [AS_HELP_STRING([--enable-json], [Enable JSON output plugin [default=test]])])
+AS_IF([test "x$enable_json" != "xno"],
       [PKG_CHECK_MODULES([libjansson], [jansson], [], [:])])
-AS_IF([test "x$libjansson_LIBS" != "x"], [enable_jansson=yes], [enable_jansson=no])
+AS_IF([test "x$libjansson_LIBS" != "x"], [enable_json=yes], [enable_json=no])
 AM_CONDITIONAL([HAVE_JANSSON], [test "x$libjansson_LIBS" != "x"])
 
 AC_ARG_WITH([ulogd2libdir],
@@ -182,6 +182,6 @@ Ulogd configuration:
     MySQL plugin:			${enable_mysql}
     SQLITE3 plugin:			${enable_sqlite3}
     DBI plugin:				${enable_dbi}
-    JSON plugin:			${enable_jansson}
+    JSON plugin:			${enable_json}
 "
 echo "You can now run 'make' and 'make install'"
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [ulogd2 PATCH 02/10] build: use pkg-config for libdbi
  2022-01-06 21:09 [ulogd2 PATCH 00/10] Add pkg-config support Jeremy Sowden
  2022-01-06 21:09 ` [ulogd2 PATCH 01/10] build: use `--enable-blah` flags for output plugins Jeremy Sowden
@ 2022-01-06 21:09 ` Jeremy Sowden
  2022-01-06 21:09 ` [ulogd2 PATCH 03/10] build: use pkg-config or upstream M4 for mysql Jeremy Sowden
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Jeremy Sowden @ 2022-01-06 21:09 UTC (permalink / raw)
  To: Netfilter Devel

libdbi introduced pkg-config support in 0.9.0, which was released in
2013.  Use it.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
---
 acinclude.m4           | 84 ------------------------------------------
 configure.ac           |  6 +--
 output/dbi/Makefile.am |  4 +-
 3 files changed, 5 insertions(+), 89 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 8388c452aade..c7a1c67280f7 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -265,87 +265,3 @@ fi
 
 ])
 
-dnl @synopsis CT_CHECK_DBI
-dnl
-dnl This macro tries to find the headers and libraries for libdbi.
-dnl
-dnl If includes are found, the variable DBI_INC will be set. If
-dnl libraries are found, the variable DBI_LIB will be set. if no check
-dnl was successful, the script exits with a error message.
-dnl
-dnl @category InstalledPackages
-dnl @author Pierre Chifflier <chifflier@inl.fr>
-dnl @version 2008-10-30
-dnl @license AllPermissive
-
-AC_DEFUN([CT_CHECK_DBI], [
-
-AC_ARG_WITH(dbi,
-	[  --with-dbi=PREFIX		Prefix of your libdbi installation],
-	[dbi=$withval], [dbi_prefix=])
-AC_ARG_WITH(dbi-inc,
-	[  --with-dbi-inc=PATH		Path to the include directory of dbi],
-	[dbi_inc=$withval], [dbi_inc=/usr/include])
-AC_ARG_WITH(dbi-lib,
-	[  --with-dbi-lib=PATH		Path to the libraries of dbi],
-	[dbi_lib=$withval], [dbi_lib=/usr/lib])
-
-
-AC_SUBST(DBI_INC)
-AC_SUBST(DBI_LIB)
-
-if test "$dbi_prefix" != "no"; then
-
-if test "$dbi_prefix" != ""; then
-   AC_MSG_CHECKING([for libdbi includes in $dbi_prefix/include])
-   if test -f "$dbi_prefix/include/dbi.h" ; then
-      DBI_INC="-I$dbi_prefix/include"
-      AC_MSG_RESULT([yes])
-   elif test -f "$dbi_prefix/include/dbi/dbi.h" ; then
-      DBI_INC="-I$dbi_prefix/include/dbi"
-      AC_MSG_RESULT([yes])
-   else
-      AC_MSG_WARN(dbi.h not found)
-   fi
-   AC_MSG_CHECKING([for libdbi in $dbi_prefix/lib])
-   if test -f "$dbi_prefix/lib/libdbi.so" ; then
-      DBI_LIB="-L$dbi_prefix/lib -ldbi";
-      AC_MSG_RESULT([yes])
-   else
-      AC_MSG_WARN(libdbi.so not found)
-   fi
-else
-  if test "$dbi_inc" != ""; then
-    AC_MSG_CHECKING([for libdbi includes in $dbi_inc])
-    if test -f "$dbi_inc/dbi.h" ; then
-      DBI_INC="-I$dbi_inc"
-      AC_MSG_RESULT([yes])
-    elif test -f "$dbi_inc/dbi/dbi.h" ; then
-      DBI_INC="-I$dbi_inc/dbi"
-      AC_MSG_RESULT([yes])
-    else
-      AC_MSG_WARN(dbi.h not found)
-    fi
-  fi
-  if test "$dbi_lib" != ""; then
-    AC_MSG_CHECKING([for libdbi in $dbi_lib])
-    if test -f "$dbi_lib/libdbi.so" ; then
-      DBI_LIB="-L$dbi_lib -ldbi";
-      AC_MSG_RESULT([yes])
-    else
-      AC_MSG_WARN(libdbi.so not found)
-    fi
-  fi
-fi
-
-if test "$DBI_INC" = "" ; then
-  AC_CHECK_HEADER([dbi.h], [], AC_MSG_WARN(dbi.h not found))
-fi
-if test "$DBI_LIB" = "" ; then
-  AC_CHECK_LIB(dbi, dbi_close, [], AC_MSG_WARN(libdbi.so not found))
-fi
-
-fi
-
-])
-
diff --git a/configure.ac b/configure.ac
index b24357dcd4b4..a3ad198a1d33 100644
--- a/configure.ac
+++ b/configure.ac
@@ -102,9 +102,9 @@ AM_CONDITIONAL([HAVE_SQLITE3], [test "x$libsqlite3_LIBS" != "x"])
 AC_ARG_ENABLE([dbi],
               [AS_HELP_STRING([--enable-dbi], [Enable DBI output plugin [default=test]])])
 AS_IF([test "x$enable_dbi" != "xno"],
-      [CT_CHECK_DBI()])
-AS_IF([test "x$DBI_LIB" != "x"], [enable_dbi=yes], [enable_dbi=no])
-AM_CONDITIONAL(HAVE_DBI, [test "x$DBI_LIB" != "x"])
+      [PKG_CHECK_MODULES([libdbi], [dbi], [], [:])])
+AS_IF([test "x$libdbi_LIBS" != "x"], [enable_dbi=yes], [enable_dbi=no])
+AM_CONDITIONAL([HAVE_DBI], [test "x$libdbi_LIBS" != "x"])
 
 AC_ARG_ENABLE([pcap],
               [AS_HELP_STRING([--enable-pcap], [Enable PCAP output plugin [default=test]])])
diff --git a/output/dbi/Makefile.am b/output/dbi/Makefile.am
index f8b0a9c68c78..9a618b160559 100644
--- a/output/dbi/Makefile.am
+++ b/output/dbi/Makefile.am
@@ -1,9 +1,9 @@
 include $(top_srcdir)/Make_global.am
 
-AM_CPPFLAGS += $(DBI_INC)
+AM_CPPFLAGS += $(libdbi_CFLAGS)
 
 pkglib_LTLIBRARIES = ulogd_output_DBI.la
 
 ulogd_output_DBI_la_SOURCES = ulogd_output_DBI.c ../../util/db.c
-ulogd_output_DBI_la_LIBADD  = ${DBI_LIB}
+ulogd_output_DBI_la_LIBADD  = $(libdbi_LIBS)
 ulogd_output_DBI_la_LDFLAGS = -avoid-version -module
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [ulogd2 PATCH 03/10] build: use pkg-config or upstream M4 for mysql
  2022-01-06 21:09 [ulogd2 PATCH 00/10] Add pkg-config support Jeremy Sowden
  2022-01-06 21:09 ` [ulogd2 PATCH 01/10] build: use `--enable-blah` flags for output plugins Jeremy Sowden
  2022-01-06 21:09 ` [ulogd2 PATCH 02/10] build: use pkg-config for libdbi Jeremy Sowden
@ 2022-01-06 21:09 ` Jeremy Sowden
  2022-01-06 22:15   ` Jan Engelhardt
  2022-01-06 21:09 ` [ulogd2 PATCH 04/10] build: use pkg-config or pcap-config for libpcap Jeremy Sowden
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 15+ messages in thread
From: Jeremy Sowden @ 2022-01-06 21:09 UTC (permalink / raw)
  To: Netfilter Devel

Recent versions of mariadb and mysql have supported pkg-config.  Older
versions provide an m4 file containing macros for use with autoconf.
Use them in preference to rolling our own.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
---
 acinclude.m4 | 93 ----------------------------------------------------
 configure.ac | 53 +++++++++++++++++++++++++++---
 2 files changed, 49 insertions(+), 97 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index c7a1c67280f7..a49ed316e65a 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -93,99 +93,6 @@ fi
 
 ])
 
-dnl @synopsis CT_CHECK_MYSQL_DB
-dnl
-dnl This macro tries to find the headers and librariess for the
-dnl MySQL database to build client applications.
-dnl
-dnl If includes are found, the variable MYSQL_INC will be set. If
-dnl libraries are found, the variable MYSQL_LIB will be set. if no check
-dnl was successful, the script exits with a error message.
-dnl
-dnl @category InstalledPackages
-dnl @author Harald Welte <laforge@gnumonks.org>
-dnl @version 2006-01-07
-dnl @license AllPermissive
-
-AC_DEFUN([CT_CHECK_MYSQL_DB], [
-
-AC_ARG_WITH(mysql,
-	[  --with-mysql=PREFIX		Prefix of your MySQL installation],
-	[my_prefix=$withval], [my_prefix=])
-AC_ARG_WITH(mysql-inc,
-	[  --with-mysql-inc=PATH		Path to the include directory of MySQL],
-	[my_inc=$withval], [my_inc=])
-AC_ARG_WITH(mysql-lib,
-	[  --with-mysql-lib=PATH		Path to the libraries of MySQL],
-	[my_lib=$withval], [my_lib=])
-
-
-AC_SUBST(MYSQL_INC)
-AC_SUBST(MYSQL_LIB)
-
-if test "$my_prefix" != "no"; then
-
-AC_MSG_CHECKING([for MySQL mysql_config program])
-for d in $my_prefix/bin /usr/bin /usr/local/bin /usr/local/mysql/bin /opt/mysql/bin /opt/packages/mysql/bin
-do
-	if test -x $d/mysql_config -a "$cross_compiling" = "no";
-	then
-		AC_MSG_RESULT(found mysql_config in $d)
-		MYSQL_INC=`$d/mysql_config --include`
-		MYSQL_LIB=`$d/mysql_config --libs`
-		break
-	fi
-done
-
-if test "$MYSQL_INC" = ""; then
-   if test "$my_prefix" != ""; then
-      AC_MSG_CHECKING([for MySQL includes in $my_prefix/include])
-      if test -f "$my_prefix/include/mysql.h" ; then
-         MYSQL_INC="-I$my_prefix/include"
-         AC_MSG_RESULT([yes])
-      else
-         AC_MSG_WARN(mysql.h not found)
-      fi
-      AC_MSG_CHECKING([for MySQL libraries in $my_prefix/lib])
-      if test -f "$my_prefix/lib/libmysql.so" ; then
-         MYSQL_LIB="-L$my_prefix/lib -lmysqlclient"
-         AC_MSG_RESULT([yes])
-      else
-         AC_MSG_WARN(libmysqlclient.so not found)
-      fi
-   else
-     if test "$my_inc" != ""; then
-       AC_MSG_CHECKING([for MySQL includes in $my_inc])
-       if test -f "$my_inc/mysql.h" ; then
-         MYSQL_INC="-I$my_inc"
-         AC_MSG_RESULT([yes])
-       else
-         AC_MSG_WARN(mysql.h not found)
-       fi
-     fi
-     if test "$my_lib" != ""; then
-       AC_MSG_CHECKING([for MySQL libraries in $my_lib])
-       if test -f "$my_lib/libmysqlclient.so" ; then
-         MYSQL_LIB="-L$my_lib -lmysqlclient"
-         AC_MSG_RESULT([yes])
-       else
-         AC_MSG_WARN(libmysqlclient.so not found)
-       fi
-     fi
-   fi
-fi
-
-if test "$MYSQL_INC" = "" ; then
-  AC_CHECK_HEADER([mysql.h], [], AC_MSG_WARN(mysql.h not found))
-fi
-if test "$MYSQL_LIB" = "" ; then
-  AC_CHECK_LIB(mysqlclient, mysql_close, [], AC_MSG_WARN(libmysqlclient.so not found))
-fi
-
-fi
-
-])
-
 dnl @synopsis CT_CHECK_PCAP
 dnl
 dnl This macro tries to find the headers and libraries for libpcap.
diff --git a/configure.ac b/configure.ac
index a3ad198a1d33..524fc151e2f3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -87,10 +87,55 @@ AM_CONDITIONAL([HAVE_PGSQL], [test "x$PQLIBPATH" != "x"])
 
 AC_ARG_ENABLE([mysql],
               [AS_HELP_STRING([--enable-mysql], [Enable MySQL output plugin [default=test]])])
-AS_IF([test "x$enable_mysql" != "xno"],
-      [CT_CHECK_MYSQL_DB()])
-AS_IF([test "x$MYSQL_LIB" != "x"], [enable_mysql=yes], [enable_mysql=no])
-AM_CONDITIONAL([HAVE_MYSQL], [test "x$MYSQL_LIB" != "x"])
+AS_IF([test "x$enable_mysql" != "xno"], [
+
+  dnl Recent versions of MySQL and MariaDB have included pkg-config support.
+  dnl Older versions have included an mysql.m4 file which provides macros to
+  dnl find mysql_config and use it to define `CFLAGS` and `LIBS` variables.
+  dnl Therefore, we try pkg-config first and fall back to the M4 macros.
+
+  PKG_CHECK_EXISTS([mysqlclient],
+                   [PKG_CHECK_MODULES([libmysqlclient], [mysqlclient])],
+                   [
+
+    dnl The [MYSQL_CLIENT] macro calls [_MYSQL_CONFIG] to locate mysql_config.
+    dnl However, [MYSQL_CLIENT] will fail with an error if it can't exec it.
+    dnl That would be fine if the user had explicitly requested the mysql output
+    dnl plug-in, but if not, we should like to enable it if it's available and
+    dnl ignore it, otherwise.  Therefore, we call [_MYSQL_CONFIG] ourselves, and
+    dnl only call [MYSQL_CLIENT] if mysql_config is present.
+
+    _MYSQL_CONFIG
+
+    AS_IF([command -v "$mysql_config" >/dev/null], [
+
+      MYSQL_CLIENT([], [client])
+
+      dnl Some distro's don't put mysql_config in the same package as the
+      dnl headers and .so sym-links.  Therefore, it is possible that the former
+      dnl may be available, but the latter may not.  Hence, we check explicitly
+      dnl for mysql.h.
+
+      ulogd_save_CPPFLAGS="$CPPFLAGS"
+      CPPFLAGS="$MYSQL_CLIENT_CFLAGS"
+      AC_CHECK_HEADER([mysql.h], [
+
+        libmysqlclient_CFLAGS="$MYSQL_CLIENT_CFLAGS"
+        libmysqlclient_LIBS="$MYSQL_CLIENT_LIBS"
+
+        AC_SUBST([libmysqlclient_CFLAGS])
+        AC_SUBST([libmysqlclient_LIBS])
+
+      ])
+      CPPFLAGS="$ulogd_save_CPPFLAGS"
+
+    ])
+
+  ])
+
+])
+AS_IF([test "x$libmysqlclient_LIBS" != "x"], [enable_mysql=yes], [enable_mysql=no])
+AM_CONDITIONAL([HAVE_MYSQL], [test "x$libmysqlclient_LIBS" != "x"])
 
 AC_ARG_ENABLE([sqlite3],
               [AS_HELP_STRING([--enable-sqlite3], [Enable SQLITE3 output plugin [default=test]])])
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [ulogd2 PATCH 04/10] build: use pkg-config or pcap-config for libpcap
  2022-01-06 21:09 [ulogd2 PATCH 00/10] Add pkg-config support Jeremy Sowden
                   ` (2 preceding siblings ...)
  2022-01-06 21:09 ` [ulogd2 PATCH 03/10] build: use pkg-config or upstream M4 for mysql Jeremy Sowden
@ 2022-01-06 21:09 ` Jeremy Sowden
  2022-01-06 21:09 ` [ulogd2 PATCH 05/10] build: use pkg-config for libpq if available Jeremy Sowden
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Jeremy Sowden @ 2022-01-06 21:09 UTC (permalink / raw)
  To: Netfilter Devel

Recent versions of libpcap have supported pkg-config.  Older versions
provide an pcap-config script.  Use pkg-config if available, otherwise
fall back to pcap_config.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
---
 acinclude.m4 | 79 ----------------------------------------------------
 configure.ac | 30 ++++++++++++++++++--
 2 files changed, 27 insertions(+), 82 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index a49ed316e65a..6d88c3a53cff 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -93,82 +93,3 @@ fi
 
 ])
 
-dnl @synopsis CT_CHECK_PCAP
-dnl
-dnl This macro tries to find the headers and libraries for libpcap.
-dnl
-dnl If includes are found, the variable PCAP_INC will be set. If
-dnl libraries are found, the variable PCAP_LIB will be set. if no check
-dnl was successful, the script exits with a error message.
-dnl
-dnl @category InstalledPackages
-dnl @author Harald Welte <laforge@gnumonks.org>
-dnl @version 2006-01-07
-dnl @license AllPermissive
-
-AC_DEFUN([CT_CHECK_PCAP], [
-
-AC_ARG_WITH(pcap,
-	[  --with-pcap=PREFIX		Prefix of your libpcap installation],
-	[pcap_prefix=$withval], [pcap_prefix=])
-AC_ARG_WITH(pcap-inc,
-	[  --with-pcap-inc=PATH		Path to the include directory of pcap],
-	[pcap_inc=$withval], [pcap_inc=/usr/include])
-AC_ARG_WITH(pcap-lib,
-	[  --with-pcap-lib=PATH		Path to the libraries of pcap],
-	[pcap_lib=$withval], [pcap_lib=/usr/lib])
-
-
-AC_SUBST(PCAP_INC)
-AC_SUBST(PCAP_LIB)
-AC_SUBST(HAVE_PCAP_LIB)
-
-if test "$pcap_prefix" != "no"; then
-
-if test "$pcap_prefix" != ""; then
-   AC_MSG_CHECKING([for libpcap includes in $pcap_prefix/include])
-   if test -f "$pcap_prefix/include/pcap.h" ; then
-      PCAP_INC="-I$pcap_prefix/include"
-      AC_MSG_RESULT([yes])
-   else
-      AC_MSG_WARN(pcap.h not found)
-   fi
-   AC_MSG_CHECKING([for libpcap in $pcap_prefix/lib])
-   if test -f "$pcap_prefix/lib/libpcap.so" ; then
-      PCAP_LIB="-L$pcap_prefix/lib -lpcap";
-      AC_MSG_RESULT([yes])
-   else
-      AC_MSG_WARN(libpcap.so not found)
-   fi
-else
-  if test "$pcap_inc" != ""; then
-    AC_MSG_CHECKING([for libpcap includes in $pcap_inc])
-    if test -f "$pcap_inc/pcap.h" ; then
-      PCAP_INC="-I$pcap_inc"
-      AC_MSG_RESULT([yes])
-    else
-      AC_MSG_WARN(pcap.h not found)
-    fi
-  fi
-  if test "$pcap_lib" != ""; then
-    AC_MSG_CHECKING([for libpcap in $pcap_lib])
-    if test -f "$pcap_lib/libpcap.so" ; then
-      PCAP_LIB="-L$pcap_lib -lpcap";
-      AC_MSG_RESULT([yes])
-    else
-      AC_MSG_WARN(libpcap.so not found)
-    fi
-  fi
-fi
-
-if test "$PCAP_INC" = "" ; then
-  AC_CHECK_HEADER([pcap.h], [], AC_MSG_WARN(pcap.h not found))
-fi
-if test "$PCAP_LIB" = "" ; then
-  AC_CHECK_LIB(pcap, pcap_close, [HAVE_PCAP_LIB="yes"], AC_MSG_WARN(libpcap.so not found))
-fi
-
-fi
-
-])
-
diff --git a/configure.ac b/configure.ac
index 524fc151e2f3..bbca53e4c394 100644
--- a/configure.ac
+++ b/configure.ac
@@ -153,9 +153,33 @@ AM_CONDITIONAL([HAVE_DBI], [test "x$libdbi_LIBS" != "x"])
 
 AC_ARG_ENABLE([pcap],
               [AS_HELP_STRING([--enable-pcap], [Enable PCAP output plugin [default=test]])])
-AS_IF([test "x$enable_pcap" != "xno"],
-      [AC_SEARCH_LIBS([pcap_close], [pcap], [libpcap_LIBS="-lpcap"; LIBS=""])
-       AC_SUBST([libpcap_LIBS])])
+AS_IF([test "x$enable_pcap" != "xno"], [
+
+  PKG_CHECK_EXISTS([libpcap], [PKG_CHECK_MODULES([libpcap], [libpcap])], [
+
+    AC_ARG_WITH([pcap-config],
+                [AS_HELP_STRING([--with-pcap-config=PATH], [Path to the pcap-config script])],
+                [pcap_config="$withval"], [pcap_config=pcap-config])
+
+    AC_MSG_CHECKING([for pcap-config])
+
+    AS_IF([command -v "$pcap_config" >/dev/null], [
+
+      libpcap_CFLAGS="`$pcap_config --cflags`"
+      libpcap_LIBS="`$pcap_config --libs`"
+
+      AC_SUBST([libpcap_CFLAGS])
+      AC_SUBST([libpcap_LIBS])
+
+      AC_MSG_RESULT([$pcap_config])
+
+    ], [
+      AC_MSG_RESULT([no])
+    ])
+
+  ])
+
+])
 AS_IF([test "x$libpcap_LIBS" != "x"], [enable_pcap=yes], [enable_pcap=no])
 AM_CONDITIONAL([HAVE_PCAP], [test "x$libpcap_LIBS" != "x"])
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [ulogd2 PATCH 05/10] build: use pkg-config for libpq if available
  2022-01-06 21:09 [ulogd2 PATCH 00/10] Add pkg-config support Jeremy Sowden
                   ` (3 preceding siblings ...)
  2022-01-06 21:09 ` [ulogd2 PATCH 04/10] build: use pkg-config or pcap-config for libpcap Jeremy Sowden
@ 2022-01-06 21:09 ` Jeremy Sowden
  2022-01-06 21:09 ` [ulogd2 PATCH 06/10] build: if `--enable-dbi` is `yes` abort if DBI is not found Jeremy Sowden
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Jeremy Sowden @ 2022-01-06 21:09 UTC (permalink / raw)
  To: Netfilter Devel

Recent versions of postgresql have supported pkg-config.  Use pkg-config
if available, otherwise fall back to pg_config.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
---
 acinclude.m4             | 95 ----------------------------------------
 configure.ac             | 33 ++++++++++++--
 output/pgsql/Makefile.am |  4 +-
 3 files changed, 31 insertions(+), 101 deletions(-)
 delete mode 100644 acinclude.m4

diff --git a/acinclude.m4 b/acinclude.m4
deleted file mode 100644
index 6d88c3a53cff..000000000000
--- a/acinclude.m4
+++ /dev/null
@@ -1,95 +0,0 @@
-dnl @synopsis CT_CHECK_POSTGRES_DB
-dnl
-dnl This macro tries to find the headers and libraries for the
-dnl PostgreSQL database to build client applications.
-dnl
-dnl If includes are found, the variable PQINCPATH will be set. If
-dnl libraries are found, the variable PQLIBPATH will be set. if no check
-dnl was successful, the script exits with a error message.
-dnl
-dnl @category InstalledPackages
-dnl @author Christian Toepp <c.toepp@gmail.com>
-dnl @version 2005-12-30
-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
-
-])
-
diff --git a/configure.ac b/configure.ac
index bbca53e4c394..df6fa543e81f 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]])])
diff --git a/output/pgsql/Makefile.am b/output/pgsql/Makefile.am
index 9cdf22d7f765..c458c04900ba 100644
--- a/output/pgsql/Makefile.am
+++ b/output/pgsql/Makefile.am
@@ -1,9 +1,9 @@
 include $(top_srcdir)/Make_global.am
 
-AM_CPPFLAGS += -I$(PQINCPATH)
+AM_CPPFLAGS += -I$(libpq_CFLAGS)
 
 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  = $(libpq_LIBS)
 ulogd_output_PGSQL_la_LDFLAGS = -avoid-version -module
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [ulogd2 PATCH 06/10] build: if `--enable-dbi` is `yes` abort if DBI is not found
  2022-01-06 21:09 [ulogd2 PATCH 00/10] Add pkg-config support Jeremy Sowden
                   ` (4 preceding siblings ...)
  2022-01-06 21:09 ` [ulogd2 PATCH 05/10] build: use pkg-config for libpq if available Jeremy Sowden
@ 2022-01-06 21:09 ` Jeremy Sowden
  2022-01-06 21:09 ` [ulogd2 PATCH 07/10] build: if `--enable-mysql` is `yes` abort if MySQL " Jeremy Sowden
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Jeremy Sowden @ 2022-01-06 21:09 UTC (permalink / raw)
  To: Netfilter Devel

If DBI support has been explicitly requested, abort if it is not
available.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
---
 configure.ac | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index df6fa543e81f..b6b44de888ec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -171,8 +171,13 @@ AM_CONDITIONAL([HAVE_SQLITE3], [test "x$libsqlite3_LIBS" != "x"])
 
 AC_ARG_ENABLE([dbi],
               [AS_HELP_STRING([--enable-dbi], [Enable DBI output plugin [default=test]])])
-AS_IF([test "x$enable_dbi" != "xno"],
-      [PKG_CHECK_MODULES([libdbi], [dbi], [], [:])])
+AS_IF([test "x$enable_dbi" != "xno"], [
+  PKG_CHECK_MODULES([libdbi], [dbi], [], [
+    AS_IF([test "x$enable_dbi" = "xyes"], [
+      AC_MSG_ERROR([$libdbi_PKG_ERRORS])
+    ])
+  ])
+])
 AS_IF([test "x$libdbi_LIBS" != "x"], [enable_dbi=yes], [enable_dbi=no])
 AM_CONDITIONAL([HAVE_DBI], [test "x$libdbi_LIBS" != "x"])
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [ulogd2 PATCH 07/10] build: if `--enable-mysql` is `yes` abort if MySQL is not found
  2022-01-06 21:09 [ulogd2 PATCH 00/10] Add pkg-config support Jeremy Sowden
                   ` (5 preceding siblings ...)
  2022-01-06 21:09 ` [ulogd2 PATCH 06/10] build: if `--enable-dbi` is `yes` abort if DBI is not found Jeremy Sowden
@ 2022-01-06 21:09 ` Jeremy Sowden
  2022-01-06 21:09 ` [ulogd2 PATCH 08/10] build: if `--enable-pcap` is `yes` abort if libpcap " Jeremy Sowden
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Jeremy Sowden @ 2022-01-06 21:09 UTC (permalink / raw)
  To: Netfilter Devel

If MySQL support has been explicitly requested, abort if it is not
available.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
---
 configure.ac | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/configure.ac b/configure.ac
index b6b44de888ec..67f489c22433 100644
--- a/configure.ac
+++ b/configure.ac
@@ -156,6 +156,12 @@ AS_IF([test "x$enable_mysql" != "xno"], [
 
     ])
 
+    AS_IF([test "x$libmysqlclient_LIBS" = "x"], [
+      AS_IF([test "x$enable_mysql" = "xyes"], [
+        AC_MSG_ERROR([libmysqlclient not found])
+      ])
+    ])
+
   ])
 
 ])
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [ulogd2 PATCH 08/10] build: if `--enable-pcap` is `yes` abort if libpcap is not found
  2022-01-06 21:09 [ulogd2 PATCH 00/10] Add pkg-config support Jeremy Sowden
                   ` (6 preceding siblings ...)
  2022-01-06 21:09 ` [ulogd2 PATCH 07/10] build: if `--enable-mysql` is `yes` abort if MySQL " Jeremy Sowden
@ 2022-01-06 21:09 ` Jeremy Sowden
  2022-01-06 21:09 ` [ulogd2 PATCH 09/10] build: if `--enable-pgsql` is `yes` abort if libpq " Jeremy Sowden
  2022-01-06 21:09 ` [ulogd2 PATCH 10/10] build: if `--enable-sqlite3` is `yes` abort if libsqlite3 " Jeremy Sowden
  9 siblings, 0 replies; 15+ messages in thread
From: Jeremy Sowden @ 2022-01-06 21:09 UTC (permalink / raw)
  To: Netfilter Devel

If libpcap support has been explicitly requested, abort if it is not
available.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
---
 configure.ac | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/configure.ac b/configure.ac
index 67f489c22433..4d65d234be69 100644
--- a/configure.ac
+++ b/configure.ac
@@ -213,6 +213,12 @@ AS_IF([test "x$enable_pcap" != "xno"], [
       AC_MSG_RESULT([no])
     ])
 
+    AS_IF([test "x$libpcap_LIBS" = "x"], [
+      AS_IF([test "x$enable_pcap" = "xyes"], [
+        AC_MSG_ERROR([libpcap not found])
+      ])
+    ])
+
   ])
 
 ])
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [ulogd2 PATCH 09/10] build: if `--enable-pgsql` is `yes` abort if libpq is not found
  2022-01-06 21:09 [ulogd2 PATCH 00/10] Add pkg-config support Jeremy Sowden
                   ` (7 preceding siblings ...)
  2022-01-06 21:09 ` [ulogd2 PATCH 08/10] build: if `--enable-pcap` is `yes` abort if libpcap " Jeremy Sowden
@ 2022-01-06 21:09 ` Jeremy Sowden
  2022-01-06 21:09 ` [ulogd2 PATCH 10/10] build: if `--enable-sqlite3` is `yes` abort if libsqlite3 " Jeremy Sowden
  9 siblings, 0 replies; 15+ messages in thread
From: Jeremy Sowden @ 2022-01-06 21:09 UTC (permalink / raw)
  To: Netfilter Devel

If PostgreSQL support has been explicitly requested, abort if it is not
available.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
---
 configure.ac | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/configure.ac b/configure.ac
index 4d65d234be69..fd033164b872 100644
--- a/configure.ac
+++ b/configure.ac
@@ -104,6 +104,12 @@ AS_IF([test "x$enable_pgsql" != "xno"], [
       AC_MSG_RESULT([no])
     ])
 
+    AS_IF([test "x$libpq_LIBS" = "x"], [
+      AS_IF([test "x$enable_pgsql" = "xyes"], [
+        AC_MSG_ERROR([libpq not found])
+      ])
+    ])
+
   ])
 
 ])
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [ulogd2 PATCH 10/10] build: if `--enable-sqlite3` is `yes` abort if libsqlite3 is not found
  2022-01-06 21:09 [ulogd2 PATCH 00/10] Add pkg-config support Jeremy Sowden
                   ` (8 preceding siblings ...)
  2022-01-06 21:09 ` [ulogd2 PATCH 09/10] build: if `--enable-pgsql` is `yes` abort if libpq " Jeremy Sowden
@ 2022-01-06 21:09 ` Jeremy Sowden
  9 siblings, 0 replies; 15+ messages in thread
From: Jeremy Sowden @ 2022-01-06 21:09 UTC (permalink / raw)
  To: Netfilter Devel

If SQLITE3 support has been explicitly requested, abort if it is not
available.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
---
 configure.ac | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index fd033164b872..1469f0f253d7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -176,8 +176,13 @@ AM_CONDITIONAL([HAVE_MYSQL], [test "x$libmysqlclient_LIBS" != "x"])
 
 AC_ARG_ENABLE([sqlite3],
               [AS_HELP_STRING([--enable-sqlite3], [Enable SQLITE3 output plugin [default=test]])])
-AS_IF([test "x$enable_sqlite3" != "xno"],
-      [PKG_CHECK_MODULES([libsqlite3], [sqlite3], [], [:])])
+AS_IF([test "x$enable_sqlite3" != "xno"], [
+  PKG_CHECK_MODULES([libsqlite3], [sqlite3], [], [
+    AS_IF([test "x$enable_sqlite3" = "xyes"], [
+      AC_MSG_ERROR([$libsqlite3_PKG_ERRORS])
+    ])
+  ])
+])
 AS_IF([test "x$libsqlite3_LIBS" != "x"], [enable_sqlite3=yes], [enable_sqlite3=no])
 AM_CONDITIONAL([HAVE_SQLITE3], [test "x$libsqlite3_LIBS" != "x"])
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [ulogd2 PATCH 03/10] build: use pkg-config or upstream M4 for mysql
  2022-01-06 21:09 ` [ulogd2 PATCH 03/10] build: use pkg-config or upstream M4 for mysql Jeremy Sowden
@ 2022-01-06 22:15   ` Jan Engelhardt
  2022-01-07  0:56     ` Duncan Roe
  2022-01-08 17:05     ` Jeremy Sowden
  0 siblings, 2 replies; 15+ messages in thread
From: Jan Engelhardt @ 2022-01-06 22:15 UTC (permalink / raw)
  To: Jeremy Sowden; +Cc: Netfilter Devel


On Thursday 2022-01-06 22:09, Jeremy Sowden wrote:

>Recent versions of mariadb and mysql have supported pkg-config.

(This made me read up on Stackexchange about exact rules for present
perfect, only to find it is not neatly delineated.) IMO better to
just use present. They (still) support pkg-config.

>+  dnl Recent versions of MySQL and MariaDB have included pkg-config support.


>+  dnl Older versions have included an mysql.m4 file which provides macros to

"had included", as I don't see that m4 file anymore on my (mariadb) systems.
(There are a few mysql-related m4 files in autoconf-archive,
but that's not the same package as mysql/mariadb, I suppose.)

>+    dnl The [MYSQL_CLIENT] macro calls [_MYSQL_CONFIG] to locate mysql_config.
>+
>+    _MYSQL_CONFIG

One caveat of m4 macros is that they may be left unexpanded if not found,
and it is up to the tarball producer to ensure the m4 macro is expanded.
Over the years, I built the opinion that this is not always a nice experience
to have.

I would do away with _MYSQL_CONFIG and just attempt to run `mysql_config` out
the blue. sh failing to execute mysql_config, or a compiler failing to find
mysql.h as part of AC_CHECK_HEADER is a nicer experience than _MYSQL_CONFIG
being left accidentally unexpanded.

>+      dnl Some distro's don't put mysql_config in the same package as the

distros


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [ulogd2 PATCH 03/10] build: use pkg-config or upstream M4 for mysql
  2022-01-06 22:15   ` Jan Engelhardt
@ 2022-01-07  0:56     ` Duncan Roe
  2022-01-08 17:05     ` Jeremy Sowden
  1 sibling, 0 replies; 15+ messages in thread
From: Duncan Roe @ 2022-01-07  0:56 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: Jeremy Sowden, Netfilter Development

On Thu, Jan 06, 2022 at 11:15:31PM +0100, Jan Engelhardt wrote:
>
> On Thursday 2022-01-06 22:09, Jeremy Sowden wrote:
>
> >Recent versions of mariadb and mysql have supported pkg-config.
>
> (This made me read up on Stackexchange about exact rules for present
> perfect, only to find it is not neatly delineated.) IMO better to
> just use present. They (still) support pkg-config.
>
+  dnl Recent versions of MySQL and MariaDB include pkg-config support.
>
>
Suggest imperfect past tense, to match "recent versions" suggestion.

+  dnl Older versions included a mysql.m4 file which provided macros to
>
> "had included", as I don't see that m4 file anymore on my (mariadb) systems.
> (There are a few mysql-related m4 files in autoconf-archive,
> but that's not the same package as mysql/mariadb, I suppose.)
>
> >+    dnl The [MYSQL_CLIENT] macro calls [_MYSQL_CONFIG] to locate mysql_config.
> >+
> >+    _MYSQL_CONFIG
>
> One caveat of m4 macros is that they may be left unexpanded if not found,
> and it is up to the tarball producer to ensure the m4 macro is expanded.
> Over the years, I built the opinion that this is not always a nice experience
> to have.
>
> I would do away with _MYSQL_CONFIG and just attempt to run `mysql_config` out
> the blue. sh failing to execute mysql_config, or a compiler failing to find
> mysql.h as part of AC_CHECK_HEADER is a nicer experience than _MYSQL_CONFIG
> being left accidentally unexpanded.
>
> >+      dnl Some distro's don't put mysql_config in the same package as the
>
> distros
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [ulogd2 PATCH 03/10] build: use pkg-config or upstream M4 for mysql
  2022-01-06 22:15   ` Jan Engelhardt
  2022-01-07  0:56     ` Duncan Roe
@ 2022-01-08 17:05     ` Jeremy Sowden
  2022-01-08 20:11       ` Jeremy Sowden
  1 sibling, 1 reply; 15+ messages in thread
From: Jeremy Sowden @ 2022-01-08 17:05 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: Netfilter Devel

[-- Attachment #1: Type: text/plain, Size: 1504 bytes --]

On 2022-01-06, at 23:15:31 +0100, Jan Engelhardt wrote:
> On Thursday 2022-01-06 22:09, Jeremy Sowden wrote:
>
> >Recent versions of mariadb and mysql have supported pkg-config.
>
> (This made me read up on Stackexchange about exact rules for present
> perfect, only to find it is not neatly delineated.) IMO better to
> just use present. They (still) support pkg-config.

Agreed.

> >+  dnl Recent versions of MySQL and MariaDB have included pkg-config support.
> >+  dnl Older versions have included an mysql.m4 file which provides macros to
>
> "had included", as I don't see that m4 file anymore on my (mariadb) systems.
> (There are a few mysql-related m4 files in autoconf-archive,
> but that's not the same package as mysql/mariadb, I suppose.)

It's still present in the libmariadb-dev 10.6 package in Debian
Unstable.

> >+    dnl The [MYSQL_CLIENT] macro calls [_MYSQL_CONFIG] to locate mysql_config.
> >+
> >+    _MYSQL_CONFIG
>
> One caveat of m4 macros is that they may be left unexpanded if not
> found, and it is up to the tarball producer to ensure the m4 macro is
> expanded.  Over the years, I built the opinion that this is not always
> a nice experience to have.
>
> I would do away with _MYSQL_CONFIG and just attempt to run
> `mysql_config` out the blue. sh failing to execute mysql_config, or a
> compiler failing to find mysql.h as part of AC_CHECK_HEADER is a nicer
> experience than _MYSQL_CONFIG being left accidentally unexpanded.

I'll use `m4_ifdef` to add a fall-back.

J.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [ulogd2 PATCH 03/10] build: use pkg-config or upstream M4 for mysql
  2022-01-08 17:05     ` Jeremy Sowden
@ 2022-01-08 20:11       ` Jeremy Sowden
  0 siblings, 0 replies; 15+ messages in thread
From: Jeremy Sowden @ 2022-01-08 20:11 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: Netfilter Devel

[-- Attachment #1: Type: text/plain, Size: 1042 bytes --]

On 2022-01-08, at 17:05:37 +0000, Jeremy Sowden wrote:
> On 2022-01-06, at 23:15:31 +0100, Jan Engelhardt wrote:
> > On Thursday 2022-01-06 22:09, Jeremy Sowden wrote:
> > >+    dnl The [MYSQL_CLIENT] macro calls [_MYSQL_CONFIG] to locate mysql_config.
> > >+
> > >+    _MYSQL_CONFIG
> >
> > One caveat of m4 macros is that they may be left unexpanded if not
> > found, and it is up to the tarball producer to ensure the m4 macro is
> > expanded.  Over the years, I built the opinion that this is not always
> > a nice experience to have.
> >
> > I would do away with _MYSQL_CONFIG and just attempt to run
> > `mysql_config` out the blue. sh failing to execute mysql_config, or a
> > compiler failing to find mysql.h as part of AC_CHECK_HEADER is a nicer
> > experience than _MYSQL_CONFIG being left accidentally unexpanded.
>
> I'll use `m4_ifdef` to add a fall-back.

I took another look at what the macros in mysql.m4 give us, and all we
need is what we implement for libpcap and libpq, so I've updated the
mysql patch to match those.

J.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2022-01-08 20:11 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-06 21:09 [ulogd2 PATCH 00/10] Add pkg-config support Jeremy Sowden
2022-01-06 21:09 ` [ulogd2 PATCH 01/10] build: use `--enable-blah` flags for output plugins Jeremy Sowden
2022-01-06 21:09 ` [ulogd2 PATCH 02/10] build: use pkg-config for libdbi Jeremy Sowden
2022-01-06 21:09 ` [ulogd2 PATCH 03/10] build: use pkg-config or upstream M4 for mysql Jeremy Sowden
2022-01-06 22:15   ` Jan Engelhardt
2022-01-07  0:56     ` Duncan Roe
2022-01-08 17:05     ` Jeremy Sowden
2022-01-08 20:11       ` Jeremy Sowden
2022-01-06 21:09 ` [ulogd2 PATCH 04/10] build: use pkg-config or pcap-config for libpcap Jeremy Sowden
2022-01-06 21:09 ` [ulogd2 PATCH 05/10] build: use pkg-config for libpq if available Jeremy Sowden
2022-01-06 21:09 ` [ulogd2 PATCH 06/10] build: if `--enable-dbi` is `yes` abort if DBI is not found Jeremy Sowden
2022-01-06 21:09 ` [ulogd2 PATCH 07/10] build: if `--enable-mysql` is `yes` abort if MySQL " Jeremy Sowden
2022-01-06 21:09 ` [ulogd2 PATCH 08/10] build: if `--enable-pcap` is `yes` abort if libpcap " Jeremy Sowden
2022-01-06 21:09 ` [ulogd2 PATCH 09/10] build: if `--enable-pgsql` is `yes` abort if libpq " Jeremy Sowden
2022-01-06 21:09 ` [ulogd2 PATCH 10/10] build: if `--enable-sqlite3` is `yes` abort if libsqlite3 " Jeremy Sowden

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.