Skip to contentSkip to conversation

Build Improvements

PATCH Superseded Jeremy Sowden 2 participants 19 messages Nov 14, 2021

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover Build Improvements

Some tidying and autotools updates and fixes.

Changes since v2:

* more detailed commit-messages for most patches;
* a number of the patches have been broken up or restructured

    for easier review;

* patch 14, which removes a number of AC_SUBST calls, is new.

Changes since v1:

* ignore .dirstamp anywhere;
* fix --disable-static;
* drop AC_PREREQ bump.

Jeremy Sowden (16):
gitignore: add Emacs artefacts
gitignore: ignore .dirstamp
build: remove unused Makefile fragment
build: remove empty filter sub-directory
build: move CPP -D flag.
build: add Make_global.am for common flags
build: use dist_man_MANS to declare man-pages
build: skip sub-directories containing disabled plugins
build: group *_la_* variables with their libraries
build: delete commented-out code
build: use correct automake variable for library dependencies
build: update obsolete autoconf macros
build: remove commented-out code
build: remove unnecessary AC_SUBST calls
build: quote autoconf macro arguments
build: use AS_IF consistently in configure.ac

 .gitignore                     |   5 +-
 Make_global.am                 |   2 +
 Makefile.am                    |  11 +-
 Rules.make.in                  |  43 ------
 acinclude.m4                   |  13 --
 configure.ac                   | 241 ++++++++++++++-------------------
 filter/Makefile.am             |   7 +-
 filter/packet2flow/Makefile.am |   0
 filter/raw2packet/Makefile.am  |   4 +-
 include/libipulog/Makefile.am  |   1 -
 include/ulogd/Makefile.am      |   1 -
 input/Makefile.am              |   9 +-
 input/flow/Makefile.am         |  14 +-
 input/packet/Makefile.am       |  23 ++--
 input/sum/Makefile.am          |   9 +-
 libipulog/Makefile.am          |   4 +-
 output/Makefile.am             |  35 ++++-
 output/dbi/Makefile.am         |   8 +-
 output/ipfix/Makefile.am       |   3 +-
 output/mysql/Makefile.am       |   7 +-
 output/pcap/Makefile.am        |   8 +-
 output/pgsql/Makefile.am       |   8 +-
 output/sqlite3/Makefile.am     |   7 +-
 src/Makefile.am                |   8 +-
 24 files changed, 194 insertions(+), 277 deletions(-)
 create mode 100644 Make_global.am
 delete mode 100644 Rules.make.in
 delete mode 100644 filter/packet2flow/Makefile.am
Signature · 1 line
2.33.0
#1 lore raw

PATCH v3 1/16 gitignore: add Emacs artefacts

---
 .gitignore | 3 +++
 1 file changed, 3 insertions(+)
.gitignore +3 -0
index 0ff56cfe0423..3f218218dfc9 100644
@@ -1,3 +1,6 @@
+*~
+.\#*
+\#*\#
 # global
 *.la
 *.lo
Signature · 1 line
2.33.0
#2 lore raw

PATCH v3 2/16 gitignore: ignore .dirstamp

In reply to Jeremy Sowden

It's created by automake while making sure that build directories (utils/ and utils/.deps/, in this case) exist if the subdir-objects option is enabled.

---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)
.gitignore +1 -0
index 3f218218dfc9..3eb592245c0d 100644
@@ -6,6 +6,7 @@
 *.lo
 *.o
 .deps/
+.dirstamp
 .libs/
 Makefile
 Makefile.in
Signature · 1 line
2.33.0
#3 lore raw

PATCH v3 3/16 build: remove unused Makefile fragment

In reply to Jeremy Sowden

Rules.make.in contains a number of variables defined by configure. It is left-over from the pre-Automake build-system, in which it used to fill a similar role to Make_global.am. It is no longer used anywhere. Remove it.

---
 .gitignore    |  1 -
 Rules.make.in | 43 -------------------------------------------
 configure.ac  |  2 +-
 3 files changed, 1 insertion(+), 45 deletions(-)
 delete mode 100644 Rules.make.in
.gitignore +0 -1
index 3eb592245c0d..5c06684db5fb 100644
@@ -12,7 +12,6 @@ Makefile
 Makefile.in
 
 # this dir
-/Rules.make
 /ulogd.conf
 
 # build system
Rules.make.in deleted +0 -43

43 lines not on this page · raw message

configure.ac +1 -1
index 48b4995f148c..e341ad12a159 100644
@@ -180,7 +180,7 @@ AC_CONFIG_FILES(include/Makefile include/ulogd/Makefile include/libipulog/Makefi
 	  filter/Makefile filter/raw2packet/Makefile filter/packet2flow/Makefile \
 	  output/Makefile output/pcap/Makefile output/mysql/Makefile output/pgsql/Makefile output/sqlite3/Makefile \
 	  output/dbi/Makefile output/ipfix/Makefile \
-	  src/Makefile Makefile Rules.make)
+	  src/Makefile Makefile)
 AC_OUTPUT
 
 define([EXPAND_VARIABLE],
Signature · 1 line
2.33.0
#4 lore raw

PATCH v3 4/16 build: remove empty filter sub-directory

In reply to Jeremy Sowden

The only file in filter/packet2flow is an empty Makefile.am. Remove it.

---
 configure.ac                   | 2 +-
 filter/Makefile.am             | 2 +-
 filter/packet2flow/Makefile.am | 0
 3 files changed, 2 insertions(+), 2 deletions(-)
 delete mode 100644 filter/packet2flow/Makefile.am
configure.ac +1 -1
index e341ad12a159..4e502171292e 100644
@@ -177,7 +177,7 @@ AC_CONFIG_FILES(include/Makefile include/ulogd/Makefile include/libipulog/Makefi
 	  include/linux/netfilter_ipv4/Makefile libipulog/Makefile \
 	  input/Makefile input/packet/Makefile input/flow/Makefile \
 	  input/sum/Makefile \
-	  filter/Makefile filter/raw2packet/Makefile filter/packet2flow/Makefile \
+	  filter/Makefile filter/raw2packet/Makefile \
 	  output/Makefile output/pcap/Makefile output/mysql/Makefile output/pgsql/Makefile output/sqlite3/Makefile \
 	  output/dbi/Makefile output/ipfix/Makefile \
 	  src/Makefile Makefile)
filter/Makefile.am +1 -1
index 875850b8ae90..c2755ecb7c49 100644
@@ -1,4 +1,4 @@
-SUBDIRS = raw2packet packet2flow
+SUBDIRS = raw2packet
 
 AM_CPPFLAGS = -I$(top_srcdir)/include ${LIBNFNETLINK_CFLAGS}
 AM_CFLAGS = ${regular_CFLAGS}
filter/packet2flow/Makefile.am deleted +0 -0
deleted file mode 100644
index e69de29bb2d1..000000000000
Signature · 1 line
2.33.0
#5 lore raw

PATCH v3 5/16 build: move CPP `-D` flag.

In reply to Jeremy Sowden

The ULOGD2_LIBDIR macro is only used in one place, so move the flag defining it out of the common regular_CFLAGS variable to the AM_CPPFLAGS variable in the Makefile where it is needed.

---
 configure.ac    | 2 +-
 src/Makefile.am | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)
configure.ac +1 -1
index 4e502171292e..1d795bad325d 100644
@@ -157,7 +157,7 @@ AC_ARG_WITH([ulogd2libdir],
         [ulogd2libdir="${libdir}/ulogd"])
 AC_SUBST([ulogd2libdir])
 
-regular_CFLAGS="-Wall -Wextra -Wno-unused-parameter -DULOGD2_LIBDIR=\\\"\${ulogd2libdir}\\\"";
+regular_CFLAGS="-Wall -Wextra -Wno-unused-parameter";
 AC_SUBST([regular_CFLAGS])
 
 dnl AC_SUBST(DATABASE_DIR)
src/Makefile.am +3 -2
index 998e776a8079..e1d45aee4b6c 100644
@@ -1,7 +1,8 @@
 
 AM_CPPFLAGS = -I$(top_srcdir)/include \
-	      -DULOGD_CONFIGFILE="\"$(sysconfdir)/ulogd.conf\"" \
-	      -DULOGD_LOGFILE_DEFAULT="\"$(localstatedir)/log/ulogd.log\""
+	      -DULOGD_CONFIGFILE='"$(sysconfdir)/ulogd.conf"' \
+	      -DULOGD_LOGFILE_DEFAULT='"$(localstatedir)/log/ulogd.log"' \
+	      -DULOGD2_LIBDIR='"$(ulogd2libdir)"'
 AM_CFLAGS = ${regular_CFLAGS}
 
 sbin_PROGRAMS = ulogd
Signature · 1 line
2.33.0
#6 lore raw

PATCH v3 6/16 build: add Make_global.am for common flags

In reply to Jeremy Sowden

Move ${regular_CFLAGS} from configure.ac to Make_global.am, renaming it to AM_CFLAGS. Add AM_CPPFGLAGS to include $(top_srcdir)/include. Include the new file in the Makefiles that require it.

---
 Make_global.am                | 2 ++
 Makefile.am                   | 1 -
 configure.ac                  | 3 ---
 filter/Makefile.am            | 5 +++--
 filter/raw2packet/Makefile.am | 4 +---
 input/flow/Makefile.am        | 4 ++--
 input/packet/Makefile.am      | 4 ++--
 input/sum/Makefile.am         | 6 ++++--
 libipulog/Makefile.am         | 4 +---
 output/Makefile.am            | 8 +++++---
 output/dbi/Makefile.am        | 4 ++--
 output/ipfix/Makefile.am      | 3 +--
 output/mysql/Makefile.am      | 5 +++--
 output/pcap/Makefile.am       | 4 +---
 output/pgsql/Makefile.am      | 4 ++--
 output/sqlite3/Makefile.am    | 5 +++--
 src/Makefile.am               | 9 ++++-----
 17 files changed, 36 insertions(+), 39 deletions(-)
 create mode 100644 Make_global.am
Make_global.am new file +2 -0
new file mode 100644
index 000000000000..4ce896d06d70
@@ -0,0 +1,2 @@
+AM_CPPFLAGS = -I$(top_srcdir)/include
+AM_CFLAGS   = -Wall -Wextra -Wno-unused-parameter
Makefile.am +0 -1
index 5600f8c6f552..0e5721472cb2 100644
@@ -5,7 +5,6 @@ man_MANS = ulogd.8
 
 EXTRA_DIST = $(man_MANS) ulogd.conf.in doc
 
-AM_CPPFLAGS = -I$(top_srcdir)/include
 SUBDIRS = include libipulog src input filter output
 
 noinst_DATA = ulogd.conf
configure.ac +0 -3
index 1d795bad325d..f7d6b50c47f5 100644
@@ -157,9 +157,6 @@ AC_ARG_WITH([ulogd2libdir],
         [ulogd2libdir="${libdir}/ulogd"])
 AC_SUBST([ulogd2libdir])
 
-regular_CFLAGS="-Wall -Wextra -Wno-unused-parameter";
-AC_SUBST([regular_CFLAGS])
-
 dnl AC_SUBST(DATABASE_DIR)
 dnl AC_SUBST(DATABASE_LIB)
 dnl AC_SUBST(DATABASE_LIB_DIR)
filter/Makefile.am +3 -2
index c2755ecb7c49..f1d2c81f48d4 100644
@@ -1,7 +1,8 @@
 SUBDIRS = raw2packet
 
-AM_CPPFLAGS = -I$(top_srcdir)/include ${LIBNFNETLINK_CFLAGS}
-AM_CFLAGS = ${regular_CFLAGS}
+include $(top_srcdir)/Make_global.am
+
+AM_CPPFLAGS += ${LIBNFNETLINK_CFLAGS}
 
 pkglib_LTLIBRARIES = ulogd_filter_IFINDEX.la ulogd_filter_PWSNIFF.la \
 			 ulogd_filter_PRINTPKT.la ulogd_filter_PRINTFLOW.la \
filter/raw2packet/Makefile.am +1 -3
index 7498f9aa3c55..90768ef6ca0e 100644
@@ -1,6 +1,4 @@
-
-AM_CPPFLAGS = -I$(top_srcdir)/include
-AM_CFLAGS = ${regular_CFLAGS}
+include $(top_srcdir)/Make_global.am
 
 pkglib_LTLIBRARIES = ulogd_raw2packet_BASE.la
 
input/flow/Makefile.am +2 -2
index 0e07a7dc1ccc..004e532981a4 100644
@@ -1,6 +1,6 @@
+include $(top_srcdir)/Make_global.am
 
-AM_CPPFLAGS = -I$(top_srcdir)/include ${LIBNETFILTER_CONNTRACK_CFLAGS}
-AM_CFLAGS = ${regular_CFLAGS}
+AM_CPPFLAGS += ${LIBNETFILTER_CONNTRACK_CFLAGS}
 
 if BUILD_NFCT
 pkglib_LTLIBRARIES = ulogd_inpflow_NFCT.la # ulogd_inpflow_IPFIX.la
input/packet/Makefile.am +2 -2
index 1c3151d52f13..daf374a65917 100644
@@ -1,6 +1,6 @@
+include $(top_srcdir)/Make_global.am
 
-AM_CPPFLAGS = -I$(top_srcdir)/include ${LIBNETFILTER_LOG_CFLAGS}
-AM_CFLAGS = ${regular_CFLAGS}
+AM_CPPFLAGS += ${LIBNETFILTER_LOG_CFLAGS}
 
 pkglib_LTLIBRARIES = ulogd_inppkt_UNIXSOCK.la
 
input/sum/Makefile.am +4 -2
index b6ddb4d29b93..e0c42f7de376 100644
@@ -1,5 +1,7 @@
-AM_CPPFLAGS = -I$(top_srcdir)/include $(LIBNETFILTER_ACCT_CFLAGS) $(LIBMNL_CFLAGS)
-AM_CFLAGS = ${regular_CFLAGS}
+include $(top_srcdir)/Make_global.am
+
+AM_CPPFLAGS += $(LIBNETFILTER_ACCT_CFLAGS) $(LIBMNL_CFLAGS)
+
 if BUILD_NFACCT
 pkglib_LTLIBRARIES = ulogd_inpflow_NFACCT.la
 ulogd_inpflow_NFACCT_la_SOURCES = ulogd_inpflow_NFACCT.c
libipulog/Makefile.am +1 -3
index 111cd4889ed6..708975a5fb99 100644
@@ -1,6 +1,4 @@
-
-AM_CPPFLAGS = -I$(top_srcdir)/include
-AM_CFLAGS = ${regular_CFLAGS}
+include $(top_srcdir)/Make_global.am
 
 noinst_LTLIBRARIES = libipulog.la
 
output/Makefile.am +5 -3
index 7ba821764afe..879c317d03ff 100644
@@ -1,6 +1,8 @@
-AM_CPPFLAGS = -I$(top_srcdir)/include ${LIBNETFILTER_ACCT_CFLAGS} \
-              ${LIBNETFILTER_CONNTRACK_CFLAGS} ${LIBNETFILTER_LOG_CFLAGS}
-AM_CFLAGS = ${regular_CFLAGS}
+include $(top_srcdir)/Make_global.am
+
+AM_CPPFLAGS += ${LIBNETFILTER_ACCT_CFLAGS} \
+	       ${LIBNETFILTER_CONNTRACK_CFLAGS} \
+	       ${LIBNETFILTER_LOG_CFLAGS}
 
 SUBDIRS= pcap mysql pgsql sqlite3 dbi ipfix
 
output/dbi/Makefile.am +2 -2
index f413cab4a340..38db0a26fd84 100644
@@ -1,6 +1,6 @@
+include $(top_srcdir)/Make_global.am
 
-AM_CPPFLAGS = -I$(top_srcdir)/include $(DBI_INC)
-AM_CFLAGS = ${regular_CFLAGS}
+AM_CPPFLAGS += $(DBI_INC)
 
 if HAVE_DBI
 
output/ipfix/Makefile.am +1 -2
index cacda265c1f5..7354f6be6d51 100644
@@ -1,5 +1,4 @@
-AM_CPPFLAGS = -I$(top_srcdir)/include
-AM_CFLAGS = $(regular_CFLAGS)
+include $(top_srcdir)/Make_global.am
 
 pkglib_LTLIBRARIES = ulogd_output_IPFIX.la
 
output/mysql/Makefile.am +3 -2
index c24208c3e302..3839a135c926 100644
@@ -1,5 +1,6 @@
-AM_CPPFLAGS = -I$(top_srcdir)/include $(MYSQL_INC)
-AM_CFLAGS = ${regular_CFLAGS}
+include $(top_srcdir)/Make_global.am
+
+AM_CPPFLAGS += $(MYSQL_INC)
 
 if HAVE_MYSQL
 
output/pcap/Makefile.am +1 -3
index c1723a642a63..a022bf0cc15c 100644
@@ -1,6 +1,4 @@
-
-AM_CPPFLAGS = -I$(top_srcdir)/include
-AM_CFLAGS = ${regular_CFLAGS}
+include $(top_srcdir)/Make_global.am
 
 if HAVE_PCAP
 
output/pgsql/Makefile.am +2 -2
index bdaf1d249dce..fbc0d04c9f11 100644
@@ -1,6 +1,6 @@
+include $(top_srcdir)/Make_global.am
 
-AM_CPPFLAGS = -I$(top_srcdir)/include -I$(PQINCPATH)
-AM_CFLAGS = ${regular_CFLAGS}
+AM_CPPFLAGS += -I$(PQINCPATH)
 
 if HAVE_PGSQL
 
output/sqlite3/Makefile.am +3 -2
index 62af267c4108..e00e1d6cf11c 100644
@@ -1,5 +1,6 @@
-AM_CPPFLAGS = -I$(top_srcdir)/include ${libsqlite3_CFLAGS}
-AM_CFLAGS = ${regular_CFLAGS}
+include $(top_srcdir)/Make_global.am
+
+AM_CPPFLAGS += ${libsqlite3_CFLAGS}
 
 if HAVE_SQLITE3
 
src/Makefile.am +4 -5
index e1d45aee4b6c..7a12a72da9a3 100644
@@ -1,9 +1,8 @@
+include $(top_srcdir)/Make_global.am
 
-AM_CPPFLAGS = -I$(top_srcdir)/include \
-	      -DULOGD_CONFIGFILE='"$(sysconfdir)/ulogd.conf"' \
-	      -DULOGD_LOGFILE_DEFAULT='"$(localstatedir)/log/ulogd.log"' \
-	      -DULOGD2_LIBDIR='"$(ulogd2libdir)"'
-AM_CFLAGS = ${regular_CFLAGS}
+AM_CPPFLAGS += -DULOGD_CONFIGFILE='"$(sysconfdir)/ulogd.conf"' \
+	       -DULOGD_LOGFILE_DEFAULT='"$(localstatedir)/log/ulogd.log"' \
+	       -DULOGD2_LIBDIR='"$(ulogd2libdir)"'
 
 sbin_PROGRAMS = ulogd
 
Signature · 1 line
2.33.0
#7 lore raw

PATCH v3 7/16 build: use `dist_man_MANS` to declare man-pages

In reply to Jeremy Sowden

By using dist_man_MANS, instead of man_MANS, we no longer need to include the man-pages in EXTRA_DIST.

---
 Makefile.am | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile.am +2 -2
index 0e5721472cb2..7ea5db55a2cc 100644
@@ -1,9 +1,9 @@
 
 ACLOCAL_AMFLAGS  = -I m4
 
-man_MANS = ulogd.8
+dist_man_MANS = ulogd.8
 
-EXTRA_DIST = $(man_MANS) ulogd.conf.in doc
+EXTRA_DIST = ulogd.conf.in doc
 
 SUBDIRS = include libipulog src input filter output
 
Signature · 1 line
2.33.0
#8 lore raw

PATCH v3 8/16 build: skip sub-directories containing disabled plugins

In reply to Jeremy Sowden

Currently, make enters all sub-directories containing source-code, even if they only contain optional targets which are not configured to be built. Instead, change the Makefiles so that the sub-directories are optional, rather than the targets.

Group sub-directory definitions consistently at the top of the Makefiles that contain them.

Trim a few leading and trailing blank lines.

---
 Makefile.am                   |  6 ++----
 include/libipulog/Makefile.am |  1 -
 include/ulogd/Makefile.am     |  1 -
 input/Makefile.am             |  9 ++++++++-
 input/flow/Makefile.am        |  2 --
 input/sum/Makefile.am         |  3 +--
 output/Makefile.am            | 29 +++++++++++++++++++++++++++--
 output/dbi/Makefile.am        |  4 ----
 output/mysql/Makefile.am      |  4 ----
 output/pcap/Makefile.am       |  4 ----
 output/pgsql/Makefile.am      |  4 ----
 output/sqlite3/Makefile.am    |  4 ----
 12 files changed, 38 insertions(+), 33 deletions(-)
Makefile.am +2 -4
index 7ea5db55a2cc..bf390a4faad7 100644
@@ -1,12 +1,11 @@
+SUBDIRS = include libipulog src input filter output
 
-ACLOCAL_AMFLAGS  = -I m4
+ACLOCAL_AMFLAGS = -I m4
 
 dist_man_MANS = ulogd.8
 
 EXTRA_DIST = ulogd.conf.in doc
 
-SUBDIRS = include libipulog src input filter output
-
 noinst_DATA = ulogd.conf
 
 edit = sed \
@@ -17,4 +16,3 @@ ulogd.conf: Makefile $(srcdir)/ulogd.conf.in
 
 dist-hook:
 	rm -f ulogd.conf
-
include/libipulog/Makefile.am +0 -1
index a98f941a781d..80d16b1b22a0 100644
@@ -1,2 +1 @@
-
 noinst_HEADERS = libipulog.h
include/ulogd/Makefile.am +0 -1
index 5e6aa75606f9..e4b41c4f3d19 100644
@@ -1,2 +1 @@
-
 noinst_HEADERS = conffile.h db.h ipfix_protocol.h linuxlist.h ulogd.h printpkt.h printflow.h common.h linux_rbtree.h timer.h slist.h hash.h jhash.h addr.h
input/Makefile.am +8 -1
index 5ffef1b4e711..668fc2b1444a 100644
@@ -1,2 +1,9 @@
+if BUILD_NFCT
+    OPT_SUBDIR_FLOW = flow
+endif
 
-SUBDIRS = packet flow sum
+if BUILD_NFACCT
+    OPT_SUBDIR_SUM = sum
+endif
+
+SUBDIRS = packet $(OPT_SUBDIR_FLOW) $(OPT_SUBDIR_SUM)
input/flow/Makefile.am +0 -2
index 004e532981a4..2171a0cd80c8 100644
@@ -2,12 +2,10 @@ include $(top_srcdir)/Make_global.am
 
 AM_CPPFLAGS += ${LIBNETFILTER_CONNTRACK_CFLAGS}
 
-if BUILD_NFCT
 pkglib_LTLIBRARIES = ulogd_inpflow_NFCT.la # ulogd_inpflow_IPFIX.la
 
 ulogd_inpflow_NFCT_la_SOURCES = ulogd_inpflow_NFCT.c
 ulogd_inpflow_NFCT_la_LDFLAGS = -avoid-version -module $(LIBNETFILTER_CONNTRACK_LIBS)
-endif
 
 #ulogd_inpflow_IPFIX_la_SOURCES = ulogd_inpflow_IPFIX.c
 #ulogd_inpflow_IPFIX_la_LDFLAGS = -avoid-version -module
input/sum/Makefile.am +1 -2
index e0c42f7de376..b24af7b5606c 100644
@@ -2,9 +2,8 @@ include $(top_srcdir)/Make_global.am
 
 AM_CPPFLAGS += $(LIBNETFILTER_ACCT_CFLAGS) $(LIBMNL_CFLAGS)
 
-if BUILD_NFACCT
 pkglib_LTLIBRARIES = ulogd_inpflow_NFACCT.la
+
 ulogd_inpflow_NFACCT_la_SOURCES = ulogd_inpflow_NFACCT.c
 ulogd_inpflow_NFACCT_la_LDFLAGS = -avoid-version -module
 ulogd_inpflow_NFACCT_la_LIBADD  = $(LIBMNL_LIBS) $(LIBNETFILTER_ACCT_LIBS)
-endif
output/Makefile.am +27 -2
index 879c317d03ff..cdb49df157e5 100644
@@ -1,11 +1,36 @@
+if HAVE_PCAP
+  OPT_SUBDIR_PCAP = pcap
+endif
+
+if HAVE_MYSQL
+  OPT_SUBDIR_MYSQL = mysql
+endif
+
+if HAVE_PGSQL
+  OPT_SUBDIR_PGSQL = pgsql
+endif
+
+if HAVE_SQLITE3
+  OPT_SUBDIR_SQLITE3 = sqlite3
+endif
+
+if HAVE_DBI
+  OPT_SUBDIR_DBI = dbi
+endif
+
+SUBDIRS = $(OPT_SUBDIR_PCAP) \
+	  $(OPT_SUBDIR_MYSQL) \
+	  $(OPT_SUBDIR_PGSQL) \
+	  $(OPT_SUBDIR_SQLITE3) \
+	  $(OPT_SUBDIR_DBI) \
+	  ipfix
+
 include $(top_srcdir)/Make_global.am
 
 AM_CPPFLAGS += ${LIBNETFILTER_ACCT_CFLAGS} \
 	       ${LIBNETFILTER_CONNTRACK_CFLAGS} \
 	       ${LIBNETFILTER_LOG_CFLAGS}
 
-SUBDIRS= pcap mysql pgsql sqlite3 dbi ipfix
-
 pkglib_LTLIBRARIES = ulogd_output_LOGEMU.la ulogd_output_SYSLOG.la \
 			 ulogd_output_OPRINT.la ulogd_output_GPRINT.la \
 			 ulogd_output_NACCT.la ulogd_output_XML.la \
output/dbi/Makefile.am +0 -4
index 38db0a26fd84..f8b0a9c68c78 100644
@@ -2,12 +2,8 @@ include $(top_srcdir)/Make_global.am
 
 AM_CPPFLAGS += $(DBI_INC)
 
-if HAVE_DBI
-
 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_LDFLAGS = -avoid-version -module
-
-endif
output/mysql/Makefile.am +0 -4
index 3839a135c926..54abb9654eb7 100644
@@ -2,12 +2,8 @@ include $(top_srcdir)/Make_global.am
 
 AM_CPPFLAGS += $(MYSQL_INC)
 
-if HAVE_MYSQL
-
 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_LDFLAGS = -avoid-version -module
-
-endif
output/pcap/Makefile.am +0 -4
index a022bf0cc15c..9b4b3dde3a9c 100644
@@ -1,11 +1,7 @@
 include $(top_srcdir)/Make_global.am
 
-if HAVE_PCAP
-
 pkglib_LTLIBRARIES = ulogd_output_PCAP.la
 
 ulogd_output_PCAP_la_SOURCES = ulogd_output_PCAP.c
 ulogd_output_PCAP_la_LIBADD  = ${libpcap_LIBS}
 ulogd_output_PCAP_la_LDFLAGS = -avoid-version -module
-
-endif
output/pgsql/Makefile.am +0 -4
index fbc0d04c9f11..9cdf22d7f765 100644
@@ -2,12 +2,8 @@ include $(top_srcdir)/Make_global.am
 
 AM_CPPFLAGS += -I$(PQINCPATH)
 
-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_LDFLAGS = -avoid-version -module
-
-endif
output/sqlite3/Makefile.am +0 -4
index e00e1d6cf11c..72fd1a6a8db4 100644
@@ -2,12 +2,8 @@ include $(top_srcdir)/Make_global.am
 
 AM_CPPFLAGS += ${libsqlite3_CFLAGS}
 
-if HAVE_SQLITE3
-
 pkglib_LTLIBRARIES = ulogd_output_SQLITE3.la
 
 ulogd_output_SQLITE3_la_SOURCES = ulogd_output_SQLITE3.c ../../util/db.c
 ulogd_output_SQLITE3_la_LIBADD  = ${libsqlite3_LIBS}
 ulogd_output_SQLITE3_la_LDFLAGS = -avoid-version -module
-
-endif
Signature · 1 line
2.33.0
#9 lore raw

PATCH v3 9/16 build: group `*_la_*` variables with their libraries

In reply to Jeremy Sowden

Move the _SOURCES, _LIBADD and _LDFLAGS variables for each input-packet library alongside the matching .la definition. In particular, move the NFLOG and ULOG variables inside the conditionals controlling whether the libraries get built.

---
 input/packet/Makefile.am | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
input/packet/Makefile.am +8 -8
index daf374a65917..5c95e0576e00 100644
@@ -4,20 +4,20 @@ AM_CPPFLAGS += ${LIBNETFILTER_LOG_CFLAGS}
 
 pkglib_LTLIBRARIES = ulogd_inppkt_UNIXSOCK.la
 
+ulogd_inppkt_UNIXSOCK_la_SOURCES = ulogd_inppkt_UNIXSOCK.c
+ulogd_inppkt_UNIXSOCK_la_LDFLAGS = -avoid-version -module
+
 if BUILD_ULOG
 pkglib_LTLIBRARIES += ulogd_inppkt_ULOG.la
+
+ulogd_inppkt_ULOG_la_SOURCES = ulogd_inppkt_ULOG.c
+ulogd_inppkt_ULOG_la_LDFLAGS = -avoid-version -module
+ulogd_inppkt_ULOG_la_LIBADD = ../../libipulog/libipulog.la
 endif
 
 if BUILD_NFLOG
 pkglib_LTLIBRARIES += ulogd_inppkt_NFLOG.la
-endif
 
 ulogd_inppkt_NFLOG_la_SOURCES = ulogd_inppkt_NFLOG.c
 ulogd_inppkt_NFLOG_la_LDFLAGS = -avoid-version -module $(LIBNETFILTER_LOG_LIBS)
-
-ulogd_inppkt_ULOG_la_SOURCES = ulogd_inppkt_ULOG.c
-ulogd_inppkt_ULOG_la_LDFLAGS = -avoid-version -module
-ulogd_inppkt_ULOG_la_LIBADD = ../../libipulog/libipulog.la
-
-ulogd_inppkt_UNIXSOCK_la_SOURCES = ulogd_inppkt_UNIXSOCK.c
-ulogd_inppkt_UNIXSOCK_la_LDFLAGS = -avoid-version -module
+endif
Signature · 1 line
2.33.0
#10 lore raw

PATCH v3 10/16 build: delete commented-out code

In reply to Jeremy Sowden

There are a few of commented-out variable definitions left over from the introduction of Automake. Remove them.

---
 input/flow/Makefile.am | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
input/flow/Makefile.am +1 -4
index 2171a0cd80c8..fc95bdb85af8 100644
@@ -2,10 +2,7 @@ include $(top_srcdir)/Make_global.am
 
 AM_CPPFLAGS += ${LIBNETFILTER_CONNTRACK_CFLAGS}
 
-pkglib_LTLIBRARIES = ulogd_inpflow_NFCT.la # ulogd_inpflow_IPFIX.la
+pkglib_LTLIBRARIES = ulogd_inpflow_NFCT.la
 
 ulogd_inpflow_NFCT_la_SOURCES = ulogd_inpflow_NFCT.c
 ulogd_inpflow_NFCT_la_LDFLAGS = -avoid-version -module $(LIBNETFILTER_CONNTRACK_LIBS)
-
-#ulogd_inpflow_IPFIX_la_SOURCES = ulogd_inpflow_IPFIX.c
-#ulogd_inpflow_IPFIX_la_LDFLAGS = -avoid-version -module
Signature · 1 line
2.33.0
#11 lore raw

PATCH v3 11/16 build: use correct automake variable for library dependencies

In reply to Jeremy Sowden

A couple of library dependencies are specified in _LDFLAGS variables. They are supposed to be specified in _LIBADD variables. Move them.

---
 input/flow/Makefile.am   | 3 ++-
 input/packet/Makefile.am | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
input/flow/Makefile.am +2 -1
index fc95bdb85af8..a556b4e4cb90 100644
@@ -5,4 +5,5 @@ AM_CPPFLAGS += ${LIBNETFILTER_CONNTRACK_CFLAGS}
 pkglib_LTLIBRARIES = ulogd_inpflow_NFCT.la
 
 ulogd_inpflow_NFCT_la_SOURCES = ulogd_inpflow_NFCT.c
-ulogd_inpflow_NFCT_la_LDFLAGS = -avoid-version -module $(LIBNETFILTER_CONNTRACK_LIBS)
+ulogd_inpflow_NFCT_la_LDFLAGS = -avoid-version -module
+ulogd_inpflow_NFCT_la_LIBADD  = $(LIBNETFILTER_CONNTRACK_LIBS)
input/packet/Makefile.am +2 -1
index 5c95e0576e00..3aa01112084e 100644
@@ -19,5 +19,6 @@ if BUILD_NFLOG
 pkglib_LTLIBRARIES += ulogd_inppkt_NFLOG.la
 
 ulogd_inppkt_NFLOG_la_SOURCES = ulogd_inppkt_NFLOG.c
-ulogd_inppkt_NFLOG_la_LDFLAGS = -avoid-version -module $(LIBNETFILTER_LOG_LIBS)
+ulogd_inppkt_NFLOG_la_LDFLAGS = -avoid-version -module
+ulogd_inppkt_NFLOG_la_LIBADD  = $(LIBNETFILTER_LOG_LIBS)
 endif
Signature · 1 line
2.33.0
#12 lore raw

PATCH v3 12/16 build: update obsolete autoconf macros

In reply to Jeremy Sowden

AC_CONFIG_HEADER has been superseded by AC_CONFIG_HEADERS.

AC_PROG_LIBTOOL has been superseded by LT_INIT.

AC_DISABLE_STATIC can be replaced by an argument to LT_INIT.

AC_HEADER_STDC is obsolete.

---
 configure.ac | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
configure.ac +2 -4
index f7d6b50c47f5..b88c7a6d7708 100644
@@ -3,7 +3,7 @@ AC_INIT([ulogd], [2.0.7])
 AC_PREREQ([2.50])
 AC_CONFIG_AUX_DIR([build-aux])
 AM_INIT_AUTOMAKE([-Wall foreign tar-pax no-dist-gzip dist-bzip2 1.10b subdir-objects])
-AC_CONFIG_HEADER([config.h])
+AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_MACRO_DIR([m4])
 
 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
@@ -14,8 +14,7 @@ dnl Checks for programs.
 AC_PROG_MAKE_SET
 AC_PROG_CC
 AC_PROG_INSTALL
-AC_DISABLE_STATIC
-AC_PROG_LIBTOOL
+LT_INIT([disable-static])
 
 dnl Checks for libraries.
 AC_SEARCH_LIBS([dlopen], [dl], [libdl_LIBS="$LIBS"; LIBS=""])
@@ -23,7 +22,6 @@ AC_SUBST([libdl_LIBS])
 
 dnl Checks for header files.
 AC_HEADER_DIRENT
-AC_HEADER_STDC
 AC_CHECK_HEADERS(fcntl.h unistd.h)
 
 dnl Checks for typedefs, structures, and compiler characteristics.
Signature · 1 line
2.33.0
#13 lore raw

PATCH v3 13/16 build: remove commented-out code

In reply to Jeremy Sowden

There are a couple of blocks of macros in configure.ac which were commented out in 2006. Remove them.

---
 configure.ac | 12 ------------
 1 file changed, 12 deletions(-)
configure.ac +0 -12
index b88c7a6d7708..268cd10de2da 100644
@@ -155,18 +155,6 @@ AC_ARG_WITH([ulogd2libdir],
         [ulogd2libdir="${libdir}/ulogd"])
 AC_SUBST([ulogd2libdir])
 
-dnl AC_SUBST(DATABASE_DIR)
-dnl AC_SUBST(DATABASE_LIB)
-dnl AC_SUBST(DATABASE_LIB_DIR)
-dnl AC_SUBST(DB_DEF)
-dnl AC_SUBST(EXTRA_MYSQL_DEF)
-dnl AC_SUBST(EXTRA_PGSQL_DEF)
-
-dnl AC_SUBST(DATABASE_DRIVERS)
-
-dnl AM_CONDITIONAL(HAVE_MYSQL, test x$mysqldir != x)
-dnl AM_CONDITIONAL(HAVE_PGSQL, test x$pgsqldir != x)
-
 AC_CONFIG_FILES(include/Makefile include/ulogd/Makefile include/libipulog/Makefile \
 	  include/linux/Makefile include/linux/netfilter/Makefile \
 	  include/linux/netfilter_ipv4/Makefile libipulog/Makefile \
Signature · 1 line
2.33.0
#14 lore raw

PATCH v3 14/16 build: remove unnecessary `AC_SUBST` calls

In reply to Jeremy Sowden

We don't use the variables being passed to AC_SUBST in these calls as output variables, so remove them.

---
 acinclude.m4 | 13 -------------
 configure.ac |  4 ----
 2 files changed, 17 deletions(-)
acinclude.m4 +0 -13
index 8388c452aade..16434f4fdf0d 100644
@@ -25,9 +25,6 @@ AC_ARG_WITH(pgsql-lib,
 	[pg_lib=$withval], [pg_lib=])
 
 
-AC_SUBST(PQINCPATH)
-AC_SUBST(PQLIBPATH)
-AC_SUBST(PQLIBS)
 PQLIBS=-lpq
 
 if test "$pg_prefix" != "no"; then
@@ -120,9 +117,6 @@ AC_ARG_WITH(mysql-lib,
 	[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])
@@ -212,10 +206,6 @@ AC_ARG_WITH(pcap-lib,
 	[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
@@ -291,9 +281,6 @@ AC_ARG_WITH(dbi-lib,
 	[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
configure.ac +0 -4
index 268cd10de2da..154650000fb1 100644
@@ -18,7 +18,6 @@ LT_INIT([disable-static])
 
 dnl Checks for libraries.
 AC_SEARCH_LIBS([dlopen], [dl], [libdl_LIBS="$LIBS"; LIBS=""])
-AC_SUBST([libdl_LIBS])
 
 dnl Checks for header files.
 AC_HEADER_DIRENT
@@ -35,7 +34,6 @@ AC_FUNC_VPRINTF
 AC_CHECK_FUNCS(socket strerror)
 
 AC_SEARCH_LIBS([pthread_create], [pthread], [libpthread_LIBS="$LIBS"; LIBS=""])
-AC_SUBST([libpthread_LIBS])
 
 AC_ARG_ENABLE(ulog,
        AS_HELP_STRING([--enable-ulog], [Enable ulog module [default=yes]]),[enable_ulog=$enableval],[enable_ulog=yes])
@@ -128,7 +126,6 @@ fi
 AC_ARG_WITH([pcap], AS_HELP_STRING([--without-pcap], [Build without PCAP output plugin [default=test]]))
 AS_IF([test "x$with_pcap" != "xno"], [
     AC_SEARCH_LIBS([pcap_close], [pcap], [libpcap_LIBS="-lpcap"; LIBS=""])
-    AC_SUBST([libpcap_LIBS])
 ])
 AM_CONDITIONAL([HAVE_PCAP], [test -n "$libpcap_LIBS"])
 if test "x$libpcap_LIBS" != "x"; then
@@ -153,7 +150,6 @@ AC_ARG_WITH([ulogd2libdir],
         [Default directory to load ulogd2 plugin from [[LIBDIR/ulogd]]]),
         [ulogd2libdir="$withval"],
         [ulogd2libdir="${libdir}/ulogd"])
-AC_SUBST([ulogd2libdir])
 
 AC_CONFIG_FILES(include/Makefile include/ulogd/Makefile include/libipulog/Makefile \
 	  include/linux/Makefile include/linux/netfilter/Makefile \
Signature · 1 line
2.33.0
#15 lore raw

Re: [ulogd2 PATCH v3 14/16] build: remove unnecessary `AC_SUBST` calls

acinclude.m4 AC_ARG_WITH(pgsql-lib, · line 30

Quoted 6 lines · Jeremy Sowden

We don't use the variables being passed to AC_SUBST in these calls as output variables, so remove them.

acinclude.m4 +0 -3
-AC_SUBST(PQINCPATH)
-AC_SUBST(PQLIBPATH)
-AC_SUBST(PQLIBS)

Eh, but why? These are all still used.

output/pgsql/Makefile.am:AM_CPPFLAGS = -I$(top_srcdir)/include -I$(PQINCPATH)

Review

Quoted 3 lines
(quoted diff) +0 -3
-AC_SUBST(MYSQL_INC)
-AC_SUBST([libdl_LIBS])
-AC_SUBST([libpthread_LIBS])

src/Makefile.am:ulogd_LDADD = ${libdl_LIBS} ${libpthread_LIBS}

#16 lore raw

Re: [ulogd2 PATCH v3 14/16] build: remove unnecessary `AC_SUBST` calls

Quoted 10 lines · Jan Engelhardt
Quoted 1 line · Jeremy Sowden

We don't use the variables being passed to AC_SUBST in these calls

as

acinclude.m4 AC_ARG_WITH(pgsql-lib, · line 30

Quoted 5 lines

output variables, so remove them.

acinclude.m4 +0 -3
-AC_SUBST(PQINCPATH)
-AC_SUBST(PQLIBPATH)
-AC_SUBST(PQLIBS)

Eh, but why? These are all still used.

You're quite right. Fit of idiocy on my part.

J.

#17 lore raw

PATCH v3 15/16 build: quote autoconf macro arguments

In reply to Jeremy Sowden

Arguments are supposed to be quoted in square brackets. Fix several that weren't.

Sort and reformat the AC_OUTPUT_FILES argument list while we're at it.

---
 configure.ac | 94 ++++++++++++++++++++++++++++++++++------------------
 1 file changed, 61 insertions(+), 33 deletions(-)
configure.ac +61 -33
index 154650000fb1..1e321e6ff0a5 100644
@@ -21,7 +21,7 @@ AC_SEARCH_LIBS([dlopen], [dl], [libdl_LIBS="$LIBS"; LIBS=""])
 
 dnl Checks for header files.
 AC_HEADER_DIRENT
-AC_CHECK_HEADERS(fcntl.h unistd.h)
+AC_CHECK_HEADERS([fcntl.h unistd.h])
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
@@ -31,12 +31,14 @@ AC_SYS_LARGEFILE
 
 dnl Checks for library functions.
 AC_FUNC_VPRINTF
-AC_CHECK_FUNCS(socket strerror)
+AC_CHECK_FUNCS([socket strerror])
 
 AC_SEARCH_LIBS([pthread_create], [pthread], [libpthread_LIBS="$LIBS"; LIBS=""])
 
-AC_ARG_ENABLE(ulog,
-       AS_HELP_STRING([--enable-ulog], [Enable ulog module [default=yes]]),[enable_ulog=$enableval],[enable_ulog=yes])
+AC_ARG_ENABLE([ulog],
+              [AS_HELP_STRING([--enable-ulog], [Enable ulog module [default=yes]])],
+              [enable_ulog=$enableval],
+              [enable_ulog=yes])
 AM_CONDITIONAL([BUILD_ULOG], [test "x$enable_ulog" = "xyes"])
 if [! test "x$enable_ulog" = "xyes"]; then
 	enable_ulog="no"
@@ -44,8 +46,11 @@ fi
 
 dnl Check for the right nfnetlink version
 PKG_CHECK_MODULES([LIBNFNETLINK], [libnfnetlink >= 1.0.1])
-AC_ARG_ENABLE(nflog,
-       AS_HELP_STRING([--enable-nflog], [Enable nflog module [default=yes]]),[enable_nflog=$enableval],[enable_nflog=yes])
+
+AC_ARG_ENABLE([nflog],
+              [AS_HELP_STRING([--enable-nflog], [Enable nflog module [default=yes]])],
+              [enable_nflog=$enableval],
+              [enable_nflog=yes])
 AS_IF([test "x$enable_nflog" = "xyes"], [
     PKG_CHECK_MODULES([LIBNETFILTER_LOG], [libnetfilter_log >= 1.0.0])
     AC_DEFINE([BUILD_NFLOG], [1], [Building nflog module])
@@ -55,8 +60,10 @@ if [! test "x$enable_nflog" = "xyes"]; then
 	enable_nflog="no"
 fi
 
-AC_ARG_ENABLE(nfct,
-       AS_HELP_STRING([--enable-nfct], [Enable nfct module [default=yes]]),[enable_nfct=$enableval],[enable_nfct=yes])
+AC_ARG_ENABLE([nfct],
+              [AS_HELP_STRING([--enable-nfct], [Enable nfct module [default=yes]])],
+              [enable_nfct=$enableval],
+              [enable_nfct=yes])
 AS_IF([test "x$enable_nfct" = "xyes"], [
     PKG_CHECK_MODULES([LIBNETFILTER_CONNTRACK], [libnetfilter_conntrack >= 1.0.2])
     AC_DEFINE([BUILD_NFCT], [1], [Building nfct module])
@@ -66,8 +73,10 @@ if [! test "x$enable_nfct" = "xyes"]; then
 	enable_nfct="no"
 fi
 
-AC_ARG_ENABLE(nfacct,
-       AS_HELP_STRING([--enable-nfacct], [Enable nfacct module [default=yes]]),[enable_nfacct=$enableval],[enable_nfacct=yes])
+AC_ARG_ENABLE([nfacct],
+              [AS_HELP_STRING([--enable-nfacct], [Enable nfacct module [default=yes]])],
+              [enable_nfacct=$enableval],
+              [enable_nfacct=yes])
 AS_IF([test "x$enable_nfacct" = "xyes"], [
     PKG_CHECK_MODULES([LIBMNL], [libmnl >= 1.0.3])
     PKG_CHECK_MODULES([LIBNETFILTER_ACCT], [libnetfilter_acct >= 1.0.1])
@@ -78,22 +87,24 @@ 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]]))
+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")
+AM_CONDITIONAL([HAVE_PGSQL], [test "x$PQLIBPATH" != "x"])
 if test "x$PQLIBPATH" != "x"; then
 	enable_pgsql="yes"
 else
 	enable_pgsql="no"
 fi
 
-AC_ARG_WITH([mysql], AS_HELP_STRING([--without-mysql], [Build without mysql output plugin [default=test]]))
+AC_ARG_WITH([mysql],
+            [AS_HELP_STRING([--without-mysql], [Build without mysql output plugin [default=test]])])
 AS_IF([test "x$with_mysql" != "xno"], [
 	CT_CHECK_MYSQL_DB()
 ])
-AM_CONDITIONAL(HAVE_MYSQL, test "x$MYSQL_LIB" != "x")
+AM_CONDITIONAL([HAVE_MYSQL], [test "x$MYSQL_LIB" != "x"])
 if test "x$MYSQL_LIB" != "x"; then
 	enable_mysql="yes"
 else
@@ -101,7 +112,8 @@ else
 fi
 
 
-AC_ARG_WITH([sqlite], AS_HELP_STRING([--without-sqlite], [Build without SQLITE3 output plugin [default=test]]))
+AC_ARG_WITH([sqlite],
+            [AS_HELP_STRING([--without-sqlite], [Build without SQLITE3 output plugin [default=test]])])
 AS_IF([test "x$with_sqlite" != "xno"], [
     PKG_CHECK_MODULES([libsqlite3], [sqlite3], [], [:])
 ])
@@ -112,18 +124,20 @@ else
 	enable_sqlite3="no"
 fi
 
-AC_ARG_WITH([dbi], AS_HELP_STRING([--without-dbi], [Build without DBI output plugin [default=test]]))
+AC_ARG_WITH([dbi],
+            [AS_HELP_STRING([--without-dbi], [Build without DBI output plugin [default=test]])])
 AS_IF([test "x$with_dbi" != "xno"], [
     CT_CHECK_DBI()
 ])
-AM_CONDITIONAL(HAVE_DBI, test "x$DBI_LIB" != "x")
+AM_CONDITIONAL([HAVE_DBI], [test "x$DBI_LIB" != "x"])
 if test "x$DBI_LIB" != "x"; then
 	enable_dbi="yes"
 else
 	enable_dbi="no"
 fi
 
-AC_ARG_WITH([pcap], AS_HELP_STRING([--without-pcap], [Build without PCAP output plugin [default=test]]))
+AC_ARG_WITH([pcap],
+            [AS_HELP_STRING([--without-pcap], [Build without PCAP output plugin [default=test]])])
 AS_IF([test "x$with_pcap" != "xno"], [
     AC_SEARCH_LIBS([pcap_close], [pcap], [libpcap_LIBS="-lpcap"; LIBS=""])
 ])
@@ -134,7 +148,8 @@ else
 	enable_pcap="no"
 fi
 
-AC_ARG_WITH([jansson], AS_HELP_STRING([--without-jansson], [Build without JSON output plugin [default=test]]))
+AC_ARG_WITH([jansson],
+            [AS_HELP_STRING([--without-jansson], [Build without JSON output plugin [default=test]])])
 AS_IF([test "x$with_jansson" != "xno"], [
     PKG_CHECK_MODULES([libjansson], [jansson], [], [:])
 ])
@@ -146,20 +161,33 @@ else
 fi
 
 AC_ARG_WITH([ulogd2libdir],
-	AS_HELP_STRING([--with-ulogd2libdir=PATH],
-        [Default directory to load ulogd2 plugin from [[LIBDIR/ulogd]]]),
-        [ulogd2libdir="$withval"],
-        [ulogd2libdir="${libdir}/ulogd"])
-
-AC_CONFIG_FILES(include/Makefile include/ulogd/Makefile include/libipulog/Makefile \
-	  include/linux/Makefile include/linux/netfilter/Makefile \
-	  include/linux/netfilter_ipv4/Makefile libipulog/Makefile \
-	  input/Makefile input/packet/Makefile input/flow/Makefile \
-	  input/sum/Makefile \
-	  filter/Makefile filter/raw2packet/Makefile \
-	  output/Makefile output/pcap/Makefile output/mysql/Makefile output/pgsql/Makefile output/sqlite3/Makefile \
-	  output/dbi/Makefile output/ipfix/Makefile \
-	  src/Makefile Makefile)
+            [AS_HELP_STRING([--with-ulogd2libdir=PATH], [Default directory to load ulogd2 plugin from [[LIBDIR/ulogd]]])],
+            [ulogd2libdir="$withval"],
+            [ulogd2libdir="${libdir}/ulogd"])
+
+AC_CONFIG_FILES([Makefile
+		 filter/Makefile
+		 filter/raw2packet/Makefile
+		 include/Makefile
+		 include/libipulog/Makefile
+		 include/linux/Makefile
+		 include/linux/netfilter/Makefile
+		 include/linux/netfilter_ipv4/Makefile
+		 include/ulogd/Makefile
+		 input/Makefile
+		 input/flow/Makefile
+		 input/packet/Makefile
+		 input/sum/Makefile
+		 libipulog/Makefile
+		 output/Makefile
+		 output/dbi/Makefile
+		 output/ipfix/Makefile
+		 output/mysql/Makefile
+		 output/pcap/Makefile
+		 output/pgsql/Makefile
+		 output/sqlite3/Makefile
+		 src/Makefile])
+
 AC_OUTPUT
 
 define([EXPAND_VARIABLE],
Signature · 1 line
2.33.0
#18 lore raw

PATCH v3 16/16 build: use `AS_IF` consistently in configure.ac

In reply to Jeremy Sowden

configure.ac contains a mix of AS_IF and if conditionals. Prefer the portable M4sh AS_IF macro. In some cases, where there are both AS_IF and if conditionals evaluating the same predicates, the latter are merged into the former.

Replace three instance of test -n "$var" with the usual, more portable, autoconf idiom: test "x$var" != "x".

---
 configure.ac | 114 ++++++++++++++++-----------------------------------
 1 file changed, 36 insertions(+), 78 deletions(-)
configure.ac +36 -78
index 1e321e6ff0a5..af7447eae8ac 100644
@@ -39,10 +39,8 @@ AC_ARG_ENABLE([ulog],
               [AS_HELP_STRING([--enable-ulog], [Enable ulog module [default=yes]])],
               [enable_ulog=$enableval],
               [enable_ulog=yes])
+AS_IF([test "x$enable_ulog" != "xyes"], [enable_ulog=no])
 AM_CONDITIONAL([BUILD_ULOG], [test "x$enable_ulog" = "xyes"])
-if [! test "x$enable_ulog" = "xyes"]; then
-	enable_ulog="no"
-fi
 
 dnl Check for the right nfnetlink version
 PKG_CHECK_MODULES([LIBNFNETLINK], [libnfnetlink >= 1.0.1])
@@ -51,114 +49,74 @@ AC_ARG_ENABLE([nflog],
               [AS_HELP_STRING([--enable-nflog], [Enable nflog module [default=yes]])],
               [enable_nflog=$enableval],
               [enable_nflog=yes])
-AS_IF([test "x$enable_nflog" = "xyes"], [
-    PKG_CHECK_MODULES([LIBNETFILTER_LOG], [libnetfilter_log >= 1.0.0])
-    AC_DEFINE([BUILD_NFLOG], [1], [Building nflog module])
-])
+AS_IF([test "x$enable_nflog" = "xyes"],
+      [PKG_CHECK_MODULES([LIBNETFILTER_LOG], [libnetfilter_log >= 1.0.0])
+       AC_DEFINE([BUILD_NFLOG], [1], [Building nflog module])],
+      [enable_nflog=no])
 AM_CONDITIONAL([BUILD_NFLOG], [test "x$enable_nflog" = "xyes"])
-if [! test "x$enable_nflog" = "xyes"]; then
-	enable_nflog="no"
-fi
 
 AC_ARG_ENABLE([nfct],
               [AS_HELP_STRING([--enable-nfct], [Enable nfct module [default=yes]])],
               [enable_nfct=$enableval],
               [enable_nfct=yes])
-AS_IF([test "x$enable_nfct" = "xyes"], [
-    PKG_CHECK_MODULES([LIBNETFILTER_CONNTRACK], [libnetfilter_conntrack >= 1.0.2])
-    AC_DEFINE([BUILD_NFCT], [1], [Building nfct module])
-])
+AS_IF([test "x$enable_nfct" = "xyes"],
+      [PKG_CHECK_MODULES([LIBNETFILTER_CONNTRACK], [libnetfilter_conntrack >= 1.0.2])
+       AC_DEFINE([BUILD_NFCT], [1], [Building nfct module])],
+      [enable_nfct=no])
 AM_CONDITIONAL([BUILD_NFCT], [test "x$enable_nfct" = "xyes"])
-if [! test "x$enable_nfct" = "xyes"]; then
-	enable_nfct="no"
-fi
 
 AC_ARG_ENABLE([nfacct],
               [AS_HELP_STRING([--enable-nfacct], [Enable nfacct module [default=yes]])],
               [enable_nfacct=$enableval],
               [enable_nfacct=yes])
-AS_IF([test "x$enable_nfacct" = "xyes"], [
-    PKG_CHECK_MODULES([LIBMNL], [libmnl >= 1.0.3])
-    PKG_CHECK_MODULES([LIBNETFILTER_ACCT], [libnetfilter_acct >= 1.0.1])
-    AC_DEFINE([BUILD_NFACCT], [1], [Building nfacct module])
-])
+AS_IF([test "x$enable_nfacct" = "xyes"],
+      [PKG_CHECK_MODULES([LIBMNL], [libmnl >= 1.0.3])
+       PKG_CHECK_MODULES([LIBNETFILTER_ACCT], [libnetfilter_acct >= 1.0.1])
+       AC_DEFINE([BUILD_NFACCT], [1], [Building nfacct module])],
+      [enable_nfacct=no])
 AM_CONDITIONAL([BUILD_NFACCT], [test "x$enable_nfacct" = "xyes"])
-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()
-])
+AS_IF([test "x$with_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"])
-if test "x$PQLIBPATH" != "x"; then
-	enable_pgsql="yes"
-else
-	enable_pgsql="no"
-fi
 
 AC_ARG_WITH([mysql],
             [AS_HELP_STRING([--without-mysql], [Build without mysql output plugin [default=test]])])
-AS_IF([test "x$with_mysql" != "xno"], [
-	CT_CHECK_MYSQL_DB()
-])
+AS_IF([test "x$with_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"])
-if test "x$MYSQL_LIB" != "x"; then
-	enable_mysql="yes"
-else
-	enable_mysql="no"
-fi
-
 
 AC_ARG_WITH([sqlite],
             [AS_HELP_STRING([--without-sqlite], [Build without SQLITE3 output plugin [default=test]])])
-AS_IF([test "x$with_sqlite" != "xno"], [
-    PKG_CHECK_MODULES([libsqlite3], [sqlite3], [], [:])
-])
-AM_CONDITIONAL([HAVE_SQLITE3], [test -n "$libsqlite3_LIBS"])
-if test "x$libsqlite3_LIBS" != "x"; then
-	enable_sqlite3="yes"
-else
-	enable_sqlite3="no"
-fi
+AS_IF([test "x$with_sqlite" != "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"], [
-    CT_CHECK_DBI()
-])
-AM_CONDITIONAL([HAVE_DBI], [test "x$DBI_LIB" != "x"])
-if test "x$DBI_LIB" != "x"; then
-	enable_dbi="yes"
-else
-	enable_dbi="no"
-fi
+AS_IF([test "x$with_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_SEARCH_LIBS([pcap_close], [pcap], [libpcap_LIBS="-lpcap"; LIBS=""])
-])
-AM_CONDITIONAL([HAVE_PCAP], [test -n "$libpcap_LIBS"])
-if test "x$libpcap_LIBS" != "x"; then
-	enable_pcap="yes"
-else
-	enable_pcap="no"
-fi
+AS_IF([test "x$with_pcap" != "xno"],
+      [AC_SEARCH_LIBS([pcap_close], [pcap], [libpcap_LIBS="-lpcap"; 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"], [
-    PKG_CHECK_MODULES([libjansson], [jansson], [], [:])
-])
-AM_CONDITIONAL([HAVE_JANSSON], [test -n "$libjansson_LIBS"])
-if test "x$libjansson_LIBS" != "x"; then
-	enable_jansson="yes"
-else
-	enable_jansson="no"
-fi
+AS_IF([test "x$with_jansson" != "xno"],
+      [PKG_CHECK_MODULES([libjansson], [jansson], [], [:])])
+AS_IF([test "x$libjansson_LIBS" != "x"], [enable_jansson=yes], [enable_jansson=no])
+AM_CONDITIONAL([HAVE_JANSSON], [test "x$libjansson_LIBS" != "x"])
 
 AC_ARG_WITH([ulogd2libdir],
             [AS_HELP_STRING([--with-ulogd2libdir=PATH], [Default directory to load ulogd2 plugin from [[LIBDIR/ulogd]]])],
Signature · 1 line
2.33.0