Build fixes
cover Build fixes
The first three patches contain changes suggested by autoupdate. Four and five bring the handling of the yacc- and lex-generated sources more in line with the automake doc's. The last one fixes a race in parallel builds.
Jeremy Sowden (6):
build: remove commented-out macros from configure.ac
build: quote AC_INIT arguments
build: replace AM_PROG_LIBTOOL and AC_DISABLE_STATIC with
`LT_INIT`
build: remove yacc-generated header from EXTRA_DIST
build: clean yacc- and lex-generated files with maintainer-clean
build: fix dependency-tracking of yacc-generated header
configure.ac | 30 ++---------------------------- src/Makefile.am | 5 ++--- 2 files changed, 4 insertions(+), 31 deletions(-)
Signature · 1 line
2.33.0
PATCH 1/6 build: remove commented-out macros from configure.ac
This code has been commented out since at least 2007.
--- configure.ac | 25 ------------------------- 1 file changed, 25 deletions(-)
configure.ac +0 -25
@@ -75,37 +75,12 @@ AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$enable_systemd" = "xyes"]) AC_CHECK_HEADERS([linux/capability.h],, [AC_MSG_ERROR([Cannot find linux/capabibility.h])]) -# Checks for libraries. -# FIXME: Replace `main' with a function in `-lc': -dnl AC_CHECK_LIB([c], [main]) -# FIXME: Replace `main' with a function in `-ldl': - AC_CHECK_HEADERS(arpa/inet.h) -dnl check for inet_pton AC_CHECK_FUNCS(inet_pton) -# Checks for header files. -dnl AC_HEADER_STDC -dnl AC_CHECK_HEADERS([netinet/in.h stdlib.h]) - -# Checks for typedefs, structures, and compiler characteristics. -dnl AC_C_CONST -dnl AC_C_INLINE - # Let nfct use dlopen() on helper libraries without resolving all symbols. AX_CHECK_LINK_FLAG([-Wl,-z,lazy], [AC_SUBST([LAZY_LDFLAGS], [-Wl,-z,lazy])]) -# Checks for library functions. -dnl AC_FUNC_MALLOC -dnl AC_FUNC_VPRINTF -dnl AC_CHECK_FUNCS([memset]) - -dnl AC_CONFIG_FILES([Makefile -dnl debug/Makefile -dnl debug/src/Makefile -dnl extensions/Makefile -dnl src/Makefile]) - if test ! -z "$libdir"; then MODULE_DIR="\\\"$libdir/conntrack-tools/\\\"" CFLAGS="$CFLAGS -DCONNTRACKD_LIB_DIR=$MODULE_DIR"
Signature · 1 line
2.33.0
PATCH 2/6 build: quote AC_INIT arguments
In reply to Jeremy Sowden--- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
configure.ac +1 -1
@@ -1,4 +1,4 @@ -AC_INIT(conntrack-tools, 1.4.6, [email protected]) +AC_INIT([conntrack-tools],[1.4.6],[[email protected]]) AC_CONFIG_AUX_DIR([build-aux]) AC_CANONICAL_HOST
Signature · 1 line
2.33.0
PATCH 3/6 build: replace `AM_PROG_LIBTOOL` and `AC_DISABLE_STATIC` with `LT_INIT`
In reply to Jeremy SowdenAM_PROG_LIBTOOL is superseded by LT_INIT, which also accepts options to control the defaults for creating shared or static libraries.
--- configure.ac | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
configure.ac +1 -2
@@ -13,9 +13,8 @@ AC_SEARCH_LIBS([dlopen], [dl], [libdl_LIBS="$LIBS"; LIBS=""]) AC_SUBST([libdl_LIBS]) AC_PROG_CC -AC_DISABLE_STATIC AM_PROG_AR -AM_PROG_LIBTOOL +LT_INIT([disable-static]) AC_PROG_INSTALL AC_PROG_LN_S AM_PROG_LEX
Signature · 1 line
2.33.0
PATCH 4/6 build: remove yacc-generated header from EXTRA_DIST
In reply to Jeremy SowdenAutomake generates yacc and lex output files and includes them in distributions as a matter of course.
--- src/Makefile.am | 2 -- 1 file changed, 2 deletions(-)
src/Makefile.am +0 -2
@@ -77,5 +77,3 @@ conntrackd_LDADD += ${LIBSYSTEMD_LIBS} endif conntrackd_LDFLAGS = -export-dynamic - -EXTRA_DIST = read_config_yy.h
Signature · 1 line
2.33.0
PATCH 5/6 build: clean yacc- and lex-generated files with maintainer-clean
In reply to Jeremy SowdenAutomake expects to distribute yacc- and lex-generated sources, so that the user doesn't need to regenerate them. Therefore, the appropriate target to clean them is maintainer-clean.
--- src/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/Makefile.am +1 -1
@@ -6,7 +6,7 @@ endif AM_YFLAGS = -d -CLEANFILES = read_config_yy.c read_config_lex.c +MAINTAINERCLEANFILES = read_config_yy.c read_config_yy.h read_config_lex.c sbin_PROGRAMS = conntrack conntrackd nfct
Signature · 1 line
2.33.0
PATCH 6/6 build: fix dependency-tracking of yacc-generated header
In reply to Jeremy SowdenList it as a built source in order to force make to create it before compilation. Otherwise, a parallel make can end up attempting to compile the output of lex before yacc has finished generating its own output:
$ make -j17 [...] YACC read_config_yy.c LEX read_config_lex.c CC stack.o CC resync.o CC cthelper.o CC helpers.o CC utils.o CC expect.o CC systemd.o CC nfct.o CC nfct-extensions/helper.o CC nfct-extensions/timeout.o CC read_config_lex.o read_config_lex.l:25:10: fatal error: read_config_yy.h: No such file or directory 25 | #include "read_config_yy.h" | ^~~~~~~~~~~~~~~~~~ compilation terminated. make[2]: *** [Makefile:701: read_config_lex.o] Error 1 make[2]: *** Waiting for unfinished jobs.... updating read_config_yy.h make[2]: Leaving directory '/space/azazel/work/git/netfilter/conntrack-tools/src' make[1]: *** [Makefile:743: all-recursive] Error 1 make[1]: Leaving directory '/space/azazel/work/git/netfilter/conntrack-tools/src' make: *** [Makefile:541: all-recursive] Error 1
--- src/Makefile.am | 1 + 1 file changed, 1 insertion(+)
src/Makefile.am +1 -0
@@ -6,6 +6,7 @@ endif AM_YFLAGS = -d +BUILT_SOURCES = read_config_yy.h MAINTAINERCLEANFILES = read_config_yy.c read_config_yy.h read_config_lex.c sbin_PROGRAMS = conntrack conntrackd nfct
Signature · 1 line
2.33.0
Re: [conntrack-tools 6/6] build: fix dependency-tracking of yacc-generated header
Quoted 11 lines · Jeremy Sowden
List it as a built source in order to force make to create it before compilation. Otherwise, a parallel make can end up attempting to compile the output of lex before yacc has finished generating its own output:
src/Makefile.am +0
-0@@ -6,6 +6,7 @@ endif
AM_YFLAGS= -d
Quoted 2 lines
+BUILT_SOURCES =
read_config_yy.h
MAINTAINERCLEANFILES =read_config_yy.cread_config_yy.hread_config_lex.c
I have a strong reason to believe that you could just write
read_config_yy.h: read_config_yy.y
(detail https://lists.gnu.org/archive/html/automake/2021-09/msg00011.html )
Re: [conntrack-tools 6/6] build: fix dependency-tracking of yacc-generated header
Quoted 12 lines · Jan Engelhardt
Quoted 11 lines · Jeremy Sowden
List it as a built source in order to force make to create it before compilation. Otherwise, a parallel make can end up attempting to compile the output of lex before yacc has finished generating its own output:
src/Makefile.am +0
-0@@ -6,6 +6,7 @@ endif AM_YFLAGS = -d
Quoted 8 lines
src/Makefile.am endif · line 10
Quoted 2 lines
src/Makefile.am +1
-0+BUILT_SOURCES = read_config_yy.h MAINTAINERCLEANFILES = read_config_yy.c read_config_yy.h read_config_lex.cI have a strong reason to believe that you could just write
read_config_yy.h: read_config_yy.y(detail https://lists.gnu.org/archive/html/automake/2021-09/msg00011.html )
Automake complains:
src/Makefile.am:65: warning: user target 'read_config_yy.h' defined here ...
automake: ... overrides Automake target 'read_config_yy.h' defined here
From the documentation (https://www.gnu.org/software/automake/manual/automake.html#Extending):
Note that Automake does not make any distinction between rules with commands and rules that only specify dependencies. So it is not possible to append new dependencies to an automake-defined target without redefining the entire rule.
In this case, adding the rule you suggest to Makefile.am suppresses the rule that automake would normally generate:
read_config_yy.h: read_config_yy.c
@if test ! -f $@; then rm -f read_config_yy.c; else :; fi
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) read_config_yy.c; else :; fiJ.
Pablo Neira Ayuso
maintainerQuoted 4 lines · Jeremy Sowden
The first three patches contain changes suggested by autoupdate. Four and five bring the handling of the yacc- and lex-generated sources more in line with the automake doc's. The last one fixes a race in parallel builds.
Series applied, thanks.