From bf0229caad23a4c33e84ce0c8092953dcbbbe7d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Mon, 29 Jun 2020 10:23:23 +0200 Subject: [PATCH 1/2] Fix restoring CFLAGS and LIBS in AX_LIB_LMDB() The AX_LIB_LMDB() macro attempts to test the potential LMDB installation path provided to it by temporarily updating CFLAGS and LIBS, calling AC_SEARCH_LIBS(), and then restoring CFLAGS and LIBS to their original values. However, including certain statements (e.g. "break") in the arguments provided to the AX_LIB_LMDB() macro may cause an early exit from it, in which case CFLAGS and LIBS will be left polluted. Fix by resetting CFLAGS and LIBS to their original values before executing the commands provided as AX_LIB_LMDB() arguments. --- m4/ax_lib_lmdb.m4 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/m4/ax_lib_lmdb.m4 b/m4/ax_lib_lmdb.m4 index 0895a9d269..2d011dc7cd 100644 --- a/m4/ax_lib_lmdb.m4 +++ b/m4/ax_lib_lmdb.m4 @@ -37,22 +37,21 @@ AC_DEFUN([AX_LIB_LMDB], [AC_MSG_RESULT([yes]) LMDB_CFLAGS="-I$1/include" LMDB_LIBS="-L$1/lib" - saved_CFLAGS="$CFLAGS" - saved_LIBS="$LIBS" + AX_SAVE_FLAGS([lmdb]) CFLAGS="$CFLAGS $LMDB_CFLAGS" LIBS="$LIBS $LMDB_LIBS" AC_SEARCH_LIBS([mdb_env_create], [lmdb], [LMDB_LIBS="$LMDB_LIBS $ac_cv_search_mdb_env_create" AC_SUBST([LMDB_CFLAGS]) AC_SUBST([LMDB_LDFLAGS]) + AX_RESTORE_FLAGS([lmdb]) $2 ], [AC_MSG_RESULT([no]) LMDB_CFLAGS="" LMDB_LIBS="" + AX_RESTORE_FLAGS([lmdb]) $3 ]) - CFLAGS="$saved_CFLAGS" - LIBS="$saved_LIBS" ], [AC_MSG_RESULT([no])])]) From 0975eeedd787f3171cca2f38c766364ca1ebb0a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Mon, 29 Jun 2020 10:23:23 +0200 Subject: [PATCH 2/2] Fix libdns CFLAGS Since lib/dns/include/dns/view.h unconditionally defines dnstap-related fields in struct dns_view (and includes ), care must be taken to ensure that any source file which includes gets built with a set of CFLAGS which allows to be properly processed (particularly its and conditional dependencies which are only included for dnstap-enabled builds). Ensure that by making LIBDNS_CFLAGS include DNSTAP_CFLAGS when building with dnstap support. The same reasoning applies for LMDB_CFLAGS. --- Makefile.top | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Makefile.top b/Makefile.top index b7d711c77c..140ab4406e 100644 --- a/Makefile.top +++ b/Makefile.top @@ -42,6 +42,16 @@ LIBDNS_CFLAGS = \ LIBDNS_LIBS = \ $(top_builddir)/lib/dns/libdns.la +if HAVE_DNSTAP +LIBDNS_CFLAGS += \ + $(DNSTAP_CFLAGS) +endif HAVE_DNSTAP + +if HAVE_LMDB +LIBDNS_CFLAGS += \ + $(LMDB_CFLAGS) +endif HAVE_LMDB + LIBNS_CFLAGS = \ -I$(top_srcdir)/lib/ns/include