* [ulogd2 PATCH v2 01/10] build: use `--enable-XXX` options for output plugins
2022-01-09 11:57 [ulogd2 PATCH 00/10] Add pkg-config support Jeremy Sowden
@ 2022-01-09 11:57 ` Jeremy Sowden
2022-01-09 11:57 ` [ulogd2 PATCH v2 02/10] build: use pkg-config for libdbi Jeremy Sowden
` (9 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Jeremy Sowden @ 2022-01-09 11:57 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 others in acinclude.m4. Use `AC_ARG_ENABLE` instead and change the
name of the option 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] 14+ messages in thread
* [ulogd2 PATCH v2 02/10] build: use pkg-config for libdbi
2022-01-09 11:57 [ulogd2 PATCH 00/10] Add pkg-config support Jeremy Sowden
2022-01-09 11:57 ` [ulogd2 PATCH v2 01/10] build: use `--enable-XXX` options for output plugins Jeremy Sowden
@ 2022-01-09 11:57 ` Jeremy Sowden
2022-01-09 11:57 ` [ulogd2 PATCH v2 03/10] build: use pkg-config or mysql_config for libmysqlclient Jeremy Sowden
` (8 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Jeremy Sowden @ 2022-01-09 11:57 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] 14+ messages in thread
* [ulogd2 PATCH v2 03/10] build: use pkg-config or mysql_config for libmysqlclient
2022-01-09 11:57 [ulogd2 PATCH 00/10] Add pkg-config support Jeremy Sowden
2022-01-09 11:57 ` [ulogd2 PATCH v2 01/10] build: use `--enable-XXX` options for output plugins Jeremy Sowden
2022-01-09 11:57 ` [ulogd2 PATCH v2 02/10] build: use pkg-config for libdbi Jeremy Sowden
@ 2022-01-09 11:57 ` Jeremy Sowden
2022-01-09 11:57 ` [ulogd2 PATCH v2 04/10] build: use pkg-config or pcap-config for libpcap Jeremy Sowden
` (7 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Jeremy Sowden @ 2022-01-09 11:57 UTC (permalink / raw)
To: Netfilter Devel
Recent versions of mariadb and mysql support pkg-config. Older versions
provide a mysql_config script. Use pkg-config if available, otherwise
fall back to mysql_config.
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
---
acinclude.m4 | 93 ----------------------------------------
configure.ac | 53 +++++++++++++++++++++--
output/mysql/Makefile.am | 4 +-
3 files changed, 51 insertions(+), 99 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..bcdd2f8ed99f 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"], [
+
+ PKG_CHECK_EXISTS([mysqlclient],
+ [PKG_CHECK_MODULES([libmysqlclient], [mysqlclient])],
+ [
+
+ AC_ARG_WITH([mysql-config],
+ [AS_HELP_STRING([--with-mysql-config=PATH], [Path to the mysql_config script])],
+ [mysql_config="$withval"], [mysql_config=mysql_config])
+
+ AC_MSG_CHECKING([for mysql_config])
+
+ AS_IF([command -v "$mysql_config" >/dev/null], [
+
+ MYSQL_CLIENT_CFLAGS=`$mysql_config --cflags`
+ MYSQL_CLIENT_LIBS=`$mysql_config --libs`
+
+ AC_SUBST([MYSQL_CLIENT_CFLAGS])
+ AC_SUBST([MYSQL_CLIENT_LIBS])
+
+ AC_MSG_RESULT([$mysql_config])
+
+ 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"
+
+ ], [
+ AC_MSG_RESULT([no])
+ ])
+
+ ])
+
+])
+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]])])
diff --git a/output/mysql/Makefile.am b/output/mysql/Makefile.am
index 54abb9654eb7..69d983982cc9 100644
--- a/output/mysql/Makefile.am
+++ b/output/mysql/Makefile.am
@@ -1,9 +1,9 @@
include $(top_srcdir)/Make_global.am
-AM_CPPFLAGS += $(MYSQL_INC)
+AM_CPPFLAGS += $(libmysqlclient_CFLAGS)
pkglib_LTLIBRARIES = ulogd_output_MYSQL.la
ulogd_output_MYSQL_la_SOURCES = ulogd_output_MYSQL.c ../../util/db.c
-ulogd_output_MYSQL_la_LIBADD = ${MYSQL_LIB}
+ulogd_output_MYSQL_la_LIBADD = $(libmysqlclient_LIBS)
ulogd_output_MYSQL_la_LDFLAGS = -avoid-version -module
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [ulogd2 PATCH v2 04/10] build: use pkg-config or pcap-config for libpcap
2022-01-09 11:57 [ulogd2 PATCH 00/10] Add pkg-config support Jeremy Sowden
` (2 preceding siblings ...)
2022-01-09 11:57 ` [ulogd2 PATCH v2 03/10] build: use pkg-config or mysql_config for libmysqlclient Jeremy Sowden
@ 2022-01-09 11:57 ` Jeremy Sowden
2022-01-09 11:57 ` [ulogd2 PATCH v2 05/10] build: use pkg-config or pg_config for libpq Jeremy Sowden
` (6 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Jeremy Sowden @ 2022-01-09 11:57 UTC (permalink / raw)
To: Netfilter Devel
Recent versions of libpcap support pkg-config. Older versions provide a
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 ++++++++++++++--
output/pcap/Makefile.am | 2 ++
3 files changed, 29 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 bcdd2f8ed99f..6909ea4858bb 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"])
diff --git a/output/pcap/Makefile.am b/output/pcap/Makefile.am
index 9b4b3dde3a9c..b5064eac9fd3 100644
--- a/output/pcap/Makefile.am
+++ b/output/pcap/Makefile.am
@@ -1,5 +1,7 @@
include $(top_srcdir)/Make_global.am
+AM_CPPFLAGS += $(libpcap_CFLAGS)
+
pkglib_LTLIBRARIES = ulogd_output_PCAP.la
ulogd_output_PCAP_la_SOURCES = ulogd_output_PCAP.c
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [ulogd2 PATCH v2 05/10] build: use pkg-config or pg_config for libpq
2022-01-09 11:57 [ulogd2 PATCH 00/10] Add pkg-config support Jeremy Sowden
` (3 preceding siblings ...)
2022-01-09 11:57 ` [ulogd2 PATCH v2 04/10] build: use pkg-config or pcap-config for libpcap Jeremy Sowden
@ 2022-01-09 11:57 ` Jeremy Sowden
2022-01-09 11:57 ` [ulogd2 PATCH v2 06/10] build: if `--enable-dbi` is `yes`, abort if libdbi is not found Jeremy Sowden
` (5 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Jeremy Sowden @ 2022-01-09 11:57 UTC (permalink / raw)
To: Netfilter Devel
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>
---
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 6909ea4858bb..75764db8aec9 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..c78a773d6f9f 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 += $(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] 14+ messages in thread
* [ulogd2 PATCH v2 06/10] build: if `--enable-dbi` is `yes`, abort if libdbi is not found
2022-01-09 11:57 [ulogd2 PATCH 00/10] Add pkg-config support Jeremy Sowden
` (4 preceding siblings ...)
2022-01-09 11:57 ` [ulogd2 PATCH v2 05/10] build: use pkg-config or pg_config for libpq Jeremy Sowden
@ 2022-01-09 11:57 ` Jeremy Sowden
2022-01-09 11:57 ` [ulogd2 PATCH v2 07/10] build: if `--enable-mysql` is `yes`, abort if libmysqlclient " Jeremy Sowden
` (4 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Jeremy Sowden @ 2022-01-09 11:57 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 75764db8aec9..bd1059a9633b 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] 14+ messages in thread
* [ulogd2 PATCH v2 07/10] build: if `--enable-mysql` is `yes`, abort if libmysqlclient is not found
2022-01-09 11:57 [ulogd2 PATCH 00/10] Add pkg-config support Jeremy Sowden
` (5 preceding siblings ...)
2022-01-09 11:57 ` [ulogd2 PATCH v2 06/10] build: if `--enable-dbi` is `yes`, abort if libdbi is not found Jeremy Sowden
@ 2022-01-09 11:57 ` Jeremy Sowden
2022-01-09 11:57 ` [ulogd2 PATCH v2 08/10] build: if `--enable-pcap` is `yes`, abort if libpcap " Jeremy Sowden
` (3 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Jeremy Sowden @ 2022-01-09 11:57 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 bd1059a9633b..620cb34c8537 100644
--- a/configure.ac
+++ b/configure.ac
@@ -156,6 +156,12 @@ AS_IF([test "x$enable_mysql" != "xno"], [
AC_MSG_RESULT([no])
])
+ 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] 14+ messages in thread
* [ulogd2 PATCH v2 08/10] build: if `--enable-pcap` is `yes`, abort if libpcap is not found
2022-01-09 11:57 [ulogd2 PATCH 00/10] Add pkg-config support Jeremy Sowden
` (6 preceding siblings ...)
2022-01-09 11:57 ` [ulogd2 PATCH v2 07/10] build: if `--enable-mysql` is `yes`, abort if libmysqlclient " Jeremy Sowden
@ 2022-01-09 11:57 ` Jeremy Sowden
2022-01-09 11:57 ` [ulogd2 PATCH v2 09/10] build: if `--enable-pgsql` is `yes`, abort if libpq " Jeremy Sowden
` (2 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Jeremy Sowden @ 2022-01-09 11:57 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 620cb34c8537..41eeb52b9121 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] 14+ messages in thread
* [ulogd2 PATCH v2 09/10] build: if `--enable-pgsql` is `yes`, abort if libpq is not found
2022-01-09 11:57 [ulogd2 PATCH 00/10] Add pkg-config support Jeremy Sowden
` (7 preceding siblings ...)
2022-01-09 11:57 ` [ulogd2 PATCH v2 08/10] build: if `--enable-pcap` is `yes`, abort if libpcap " Jeremy Sowden
@ 2022-01-09 11:57 ` Jeremy Sowden
2022-01-09 11:57 ` [ulogd2 PATCH v2 10/10] build: if `--enable-sqlite3` is `yes`, abort if libsqlite3 " Jeremy Sowden
2022-01-10 21:25 ` [ulogd2 PATCH 00/10] Add pkg-config support Pablo Neira Ayuso
10 siblings, 0 replies; 14+ messages in thread
From: Jeremy Sowden @ 2022-01-09 11:57 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 41eeb52b9121..62c43d630b29 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] 14+ messages in thread
* [ulogd2 PATCH v2 10/10] build: if `--enable-sqlite3` is `yes`, abort if libsqlite3 is not found
2022-01-09 11:57 [ulogd2 PATCH 00/10] Add pkg-config support Jeremy Sowden
` (8 preceding siblings ...)
2022-01-09 11:57 ` [ulogd2 PATCH v2 09/10] build: if `--enable-pgsql` is `yes`, abort if libpq " Jeremy Sowden
@ 2022-01-09 11:57 ` Jeremy Sowden
2022-01-10 21:25 ` [ulogd2 PATCH 00/10] Add pkg-config support Pablo Neira Ayuso
10 siblings, 0 replies; 14+ messages in thread
From: Jeremy Sowden @ 2022-01-09 11:57 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 62c43d630b29..5e90bb6365e9 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] 14+ messages in thread
* Re: [ulogd2 PATCH 00/10] Add pkg-config support
2022-01-09 11:57 [ulogd2 PATCH 00/10] Add pkg-config support Jeremy Sowden
` (9 preceding siblings ...)
2022-01-09 11:57 ` [ulogd2 PATCH v2 10/10] build: if `--enable-sqlite3` is `yes`, abort if libsqlite3 " Jeremy Sowden
@ 2022-01-10 21:25 ` Pablo Neira Ayuso
2022-01-11 12:44 ` Jeremy Sowden
10 siblings, 1 reply; 14+ messages in thread
From: Pablo Neira Ayuso @ 2022-01-10 21:25 UTC (permalink / raw)
To: Jeremy Sowden; +Cc: Netfilter Devel
On Sun, Jan 09, 2022 at 11:57:43AM +0000, Jeremy Sowden wrote:
> A number of third-party libraries have added pkg-config support over the
> years. This patch-set updates configure to make use of it where it is
> available. It also fixes some conflicting option definitions and adds
> checks that cause configure to fail if a plugin has been explicitly
> requested, but the related third-party library is not available.
>
> Patch 1: switch from `--with-XXX` to `--enable-XXX` for output
> plugins.
> Patches 2-5: use pkg-config for libdbi, libmysqlclient, 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.
>
> Changes since v1
>
> * Better commit messages.
> * Simpler mysql patch: remove the upstream m4 macro calls, and look
> for `mysql_config` the same way we do `pg_config` and `pcap-config`.
> * `AM_CPPFLAGS` fixes for mysql, pcap, and postgresql.
> * `LIBADD` fix for mysql.
>
> Jeremy Sowden (10):
> build: use `--enable-XXX` options for output plugins
I hesitate about this change from --with-XYZ to --enable-XYZ, it will
force package maintainers to update their scripts.
Althought I agree after reading the documentation that --enable-XYZ
might make more sense since the input plugins rely on netfilter
libraries which are supposed to be "external software".
> build: use pkg-config for libdbi
> build: use pkg-config or mysql_config for libmysqlclient
> build: use pkg-config or pcap-config for libpcap
> build: use pkg-config or pg_config for libpq
> build: if `--enable-dbi` is `yes`, abort if libdbi is not found
> build: if `--enable-mysql` is `yes`, abort if libmysqlclient 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/mysql/Makefile.am | 4 +-
> output/pcap/Makefile.am | 2 +
> output/pgsql/Makefile.am | 4 +-
> 6 files changed, 165 insertions(+), 392 deletions(-)
> delete mode 100644 acinclude.m4
>
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [ulogd2 PATCH 00/10] Add pkg-config support
2022-01-10 21:25 ` [ulogd2 PATCH 00/10] Add pkg-config support Pablo Neira Ayuso
@ 2022-01-11 12:44 ` Jeremy Sowden
2022-01-11 21:18 ` Pablo Neira Ayuso
0 siblings, 1 reply; 14+ messages in thread
From: Jeremy Sowden @ 2022-01-11 12:44 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: Netfilter Devel
[-- Attachment #1: Type: text/plain, Size: 2782 bytes --]
On 2022-01-10, at 22:25:56 +0100, Pablo Neira Ayuso wrote:
> On Sun, Jan 09, 2022 at 11:57:43AM +0000, Jeremy Sowden wrote:
> > A number of third-party libraries have added pkg-config support over
> > the years. This patch-set updates configure to make use of it where
> > it is available. It also fixes some conflicting option definitions
> > and adds checks that cause configure to fail if a plugin has been
> > explicitly requested, but the related third-party library is not
> > available.
> >
> > Patch 1: switch from `--with-XXX` to `--enable-XXX` for output
> > plugins.
> > Patches 2-5: use pkg-config for libdbi, libmysqlclient, 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.
> >
> > Changes since v1
> >
> > * Better commit messages.
> > * Simpler mysql patch: remove the upstream m4 macro calls, and
> > look for `mysql_config` the same way we do `pg_config` and
> > `pcap-config`. * `AM_CPPFLAGS` fixes for mysql, pcap, and
> > postgresql.
> > * `LIBADD` fix for mysql.
> >
> > Jeremy Sowden (10):
> > build: use `--enable-XXX` options for output plugins
>
> I hesitate about this change from --with-XYZ to --enable-XYZ, it will
> force package maintainers to update their scripts.
True. However, it is a one-off change, and ulogd2 doesn't change often
-- the last release was in 2018 -- so I would argue that the maintenance
burden isn't very great.
> Althought I agree after reading the documentation that --enable-XYZ
> might make more sense since the input plugins rely on netfilter
> libraries which are supposed to be "external software".
>
> > build: use pkg-config for libdbi
> > build: use pkg-config or mysql_config for libmysqlclient
> > build: use pkg-config or pcap-config for libpcap
> > build: use pkg-config or pg_config for libpq
> > build: if `--enable-dbi` is `yes`, abort if libdbi is not found
> > build: if `--enable-mysql` is `yes`, abort if libmysqlclient 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/mysql/Makefile.am | 4 +-
> > output/pcap/Makefile.am | 2 +
> > output/pgsql/Makefile.am | 4 +-
> > 6 files changed, 165 insertions(+), 392 deletions(-)
> > delete mode 100644 acinclude.m4
> >
> > --
> > 2.34.1
> >
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [ulogd2 PATCH 00/10] Add pkg-config support
2022-01-11 12:44 ` Jeremy Sowden
@ 2022-01-11 21:18 ` Pablo Neira Ayuso
0 siblings, 0 replies; 14+ messages in thread
From: Pablo Neira Ayuso @ 2022-01-11 21:18 UTC (permalink / raw)
To: Jeremy Sowden; +Cc: Netfilter Devel
On Tue, Jan 11, 2022 at 12:44:30PM +0000, Jeremy Sowden wrote:
> On 2022-01-10, at 22:25:56 +0100, Pablo Neira Ayuso wrote:
> > On Sun, Jan 09, 2022 at 11:57:43AM +0000, Jeremy Sowden wrote:
> > > A number of third-party libraries have added pkg-config support over
> > > the years. This patch-set updates configure to make use of it where
> > > it is available. It also fixes some conflicting option definitions
> > > and adds checks that cause configure to fail if a plugin has been
> > > explicitly requested, but the related third-party library is not
> > > available.
> > >
> > > Patch 1: switch from `--with-XXX` to `--enable-XXX` for output
> > > plugins.
> > > Patches 2-5: use pkg-config for libdbi, libmysqlclient, 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.
> > >
> > > Changes since v1
> > >
> > > * Better commit messages.
> > > * Simpler mysql patch: remove the upstream m4 macro calls, and
> > > look for `mysql_config` the same way we do `pg_config` and
> > > `pcap-config`. * `AM_CPPFLAGS` fixes for mysql, pcap, and
> > > postgresql.
> > > * `LIBADD` fix for mysql.
> > >
> > > Jeremy Sowden (10):
> > > build: use `--enable-XXX` options for output plugins
> >
> > I hesitate about this change from --with-XYZ to --enable-XYZ, it will
> > force package maintainers to update their scripts.
>
> True. However, it is a one-off change, and ulogd2 doesn't change often
> -- the last release was in 2018 -- so I would argue that the maintenance
> burden isn't very great.
Right. The input plugins also are enabled by default if the netfilter
library dependencies are present.
Applied, thanks for explaining.
^ permalink raw reply [flat|nested] 14+ messages in thread