From b67fbb69e75d80e24ec46a5ab9ab9cefb748f122 Mon Sep 17 00:00:00 2001 From: Yorgos Thessalonikefs Date: Fri, 21 Jun 2024 14:34:12 +0200 Subject: [PATCH] - Fix pkg-config availability check in dnstap/dnstap.m4 and systemd.m4. - autoconf. --- configure | 67 +++++++++++++++++++++++++++++------------------- dnstap/dnstap.m4 | 59 ++++++++++++++++++++---------------------- doc/Changelog | 4 +++ systemd.m4 | 8 +++--- 4 files changed, 76 insertions(+), 62 deletions(-) diff --git a/configure b/configure index 195172c16..f343fac9f 100755 --- a/configure +++ b/configure @@ -1596,7 +1596,8 @@ Optional Features: --disable-libtool-lock avoid locking (might break parallel builds) --disable-rpath disable hardcoded rpath (default=enabled) --disable-largefile omit support for large files - --enable-systemd compile with systemd support + --enable-systemd compile with systemd support (requires libsystemd, + pkg-config) --enable-alloc-checks enable to memory allocation statistics, for debug purposes --enable-alloc-lite enable for lightweight alloc assertions, for debug @@ -17624,7 +17625,7 @@ have_systemd=no if test "x$enable_systemd" != xno then : - + if test -n "$PKG_CONFIG"; then have_systemd=no pkg_failed=no @@ -17831,7 +17832,9 @@ printf "%s\n" "#define HAVE_SYSTEMD 1" >>confdefs.h *) : ;; esac - + else + as_fn_error $? "systemd enabled but need pkg-config to configure for it" "$LINENO" 5 + fi fi if test "x$have_systemd" = xyes; then @@ -23802,7 +23805,7 @@ then : else $as_nop - + if test -n "$PKG_CONFIG"; then pkg_failed=no { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for PROTOBUFC" >&5 @@ -23863,36 +23866,36 @@ fi echo "$PROTOBUFC_PKG_ERRORS" >&5 - # pkg-config failed; try falling back to known values - # workaround for protobuf-c includes at old dir before protobuf-c-1.0.0 - if test -f /usr/include/google/protobuf-c/protobuf-c.h; then - CFLAGS="$CFLAGS -I/usr/include/google" + # pkg-config failed; try falling back to known values + # workaround for protobuf-c includes at old dir before protobuf-c-1.0.0 + if test -f /usr/include/google/protobuf-c/protobuf-c.h; then + CFLAGS="$CFLAGS -I/usr/include/google" + else + if test -f /usr/local/include/google/protobuf-c/protobuf-c.h; then + CFLAGS="$CFLAGS -I/usr/local/include/google" + LDFLAGS="$LDFLAGS -L/usr/local/lib" else - if test -f /usr/local/include/google/protobuf-c/protobuf-c.h; then - CFLAGS="$CFLAGS -I/usr/local/include/google" - LDFLAGS="$LDFLAGS -L/usr/local/lib" - else - as_fn_error $? "The protobuf-c package was not found with pkg-config. Please install protobuf-c!" "$LINENO" 5 - fi + as_fn_error $? "The protobuf-c package was not found with pkg-config. Please install protobuf-c!" "$LINENO" 5 fi + fi elif test $pkg_failed = untried; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } - # pkg-config failed; try falling back to known values - # workaround for protobuf-c includes at old dir before protobuf-c-1.0.0 - if test -f /usr/include/google/protobuf-c/protobuf-c.h; then - CFLAGS="$CFLAGS -I/usr/include/google" + # pkg-config failed; try falling back to known values + # workaround for protobuf-c includes at old dir before protobuf-c-1.0.0 + if test -f /usr/include/google/protobuf-c/protobuf-c.h; then + CFLAGS="$CFLAGS -I/usr/include/google" + else + if test -f /usr/local/include/google/protobuf-c/protobuf-c.h; then + CFLAGS="$CFLAGS -I/usr/local/include/google" + LDFLAGS="$LDFLAGS -L/usr/local/lib" else - if test -f /usr/local/include/google/protobuf-c/protobuf-c.h; then - CFLAGS="$CFLAGS -I/usr/local/include/google" - LDFLAGS="$LDFLAGS -L/usr/local/lib" - else - as_fn_error $? "The protobuf-c package was not found with pkg-config. Please install protobuf-c!" "$LINENO" 5 - fi + as_fn_error $? "The protobuf-c package was not found with pkg-config. Please install protobuf-c!" "$LINENO" 5 fi + fi else @@ -23901,11 +23904,21 @@ else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - CFLAGS="$CFLAGS $PROTOBUFC_CFLAGS" - LIBS="$LIBS $PROTOBUFC_LIBS" + CFLAGS="$CFLAGS $PROTOBUFC_CFLAGS" + LIBS="$LIBS $PROTOBUFC_LIBS" fi - + else + # workaround for protobuf-c includes at old dir before protobuf-c-1.0.0 + if test -f /usr/include/google/protobuf-c/protobuf-c.h; then + CFLAGS="$CFLAGS -I/usr/include/google" + else + if test -f /usr/local/include/google/protobuf-c/protobuf-c.h; then + CFLAGS="$CFLAGS -I/usr/local/include/google" + LDFLAGS="$LDFLAGS -L/usr/local/lib" + fi + fi + fi fi diff --git a/dnstap/dnstap.m4 b/dnstap/dnstap.m4 index 80b7bc92c..78d0dd68b 100644 --- a/dnstap/dnstap.m4 +++ b/dnstap/dnstap.m4 @@ -34,41 +34,38 @@ AC_DEFUN([dt_DNSTAP], LDFLAGS="$LDFLAGS -L$withval/lib" ], [ - ifdef([PKG_CHECK_MODULES], - [ - PKG_CHECK_MODULES([PROTOBUFC], [libprotobuf-c], - [ - CFLAGS="$CFLAGS $PROTOBUFC_CFLAGS" - LIBS="$LIBS $PROTOBUFC_LIBS" - ], - [ - # pkg-config failed; try falling back to known values - # workaround for protobuf-c includes at old dir before protobuf-c-1.0.0 - if test -f /usr/include/google/protobuf-c/protobuf-c.h; then - CFLAGS="$CFLAGS -I/usr/include/google" + if test -n "$PKG_CONFIG"; then + PKG_CHECK_MODULES([PROTOBUFC], [libprotobuf-c], + [ + CFLAGS="$CFLAGS $PROTOBUFC_CFLAGS" + LIBS="$LIBS $PROTOBUFC_LIBS" + ], + [ + # pkg-config failed; try falling back to known values + # workaround for protobuf-c includes at old dir before protobuf-c-1.0.0 + if test -f /usr/include/google/protobuf-c/protobuf-c.h; then + CFLAGS="$CFLAGS -I/usr/include/google" + else + if test -f /usr/local/include/google/protobuf-c/protobuf-c.h; then + CFLAGS="$CFLAGS -I/usr/local/include/google" + LDFLAGS="$LDFLAGS -L/usr/local/lib" else - if test -f /usr/local/include/google/protobuf-c/protobuf-c.h; then - CFLAGS="$CFLAGS -I/usr/local/include/google" - LDFLAGS="$LDFLAGS -L/usr/local/lib" - else - AC_MSG_ERROR([The protobuf-c package was not found with pkg-config. Please install protobuf-c!]) - fi + AC_MSG_ERROR([The protobuf-c package was not found with pkg-config. Please install protobuf-c!]) fi - ] - ) - ], - [ - # workaround for protobuf-c includes at old dir before protobuf-c-1.0.0 - if test -f /usr/include/google/protobuf-c/protobuf-c.h; then - CFLAGS="$CFLAGS -I/usr/include/google" - else - if test -f /usr/local/include/google/protobuf-c/protobuf-c.h; then - CFLAGS="$CFLAGS -I/usr/local/include/google" - LDFLAGS="$LDFLAGS -L/usr/local/lib" fi + ] + ) + else + # workaround for protobuf-c includes at old dir before protobuf-c-1.0.0 + if test -f /usr/include/google/protobuf-c/protobuf-c.h; then + CFLAGS="$CFLAGS -I/usr/include/google" + else + if test -f /usr/local/include/google/protobuf-c/protobuf-c.h; then + CFLAGS="$CFLAGS -I/usr/local/include/google" + LDFLAGS="$LDFLAGS -L/usr/local/lib" fi - ] - ) + fi + fi ] ) AC_SEARCH_LIBS([protobuf_c_message_pack], [protobuf-c], [], diff --git a/doc/Changelog b/doc/Changelog index 60fdf5bc5..41fa34523 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,7 @@ +21 June 2024: Yorgos + - Fix pkg-config availability check in dnstap/dnstap.m4 and + systemd.m4. + 19 June 2024: Yorgos - Fix #1092: Ubuntu 22.04 Jammy fails to compile unbound 1.20.0; by adding helpful text for the Python interpreter version and allowing diff --git a/systemd.m4 b/systemd.m4 index f93fe0659..154f4ffab 100644 --- a/systemd.m4 +++ b/systemd.m4 @@ -2,11 +2,11 @@ # Copyright 2015, Sami Kerola, CloudFlare. # BSD licensed. AC_ARG_ENABLE([systemd], - [AS_HELP_STRING([--enable-systemd], [compile with systemd support])], + [AS_HELP_STRING([--enable-systemd], [compile with systemd support (requires libsystemd, pkg-config)])], [], [enable_systemd=no]) have_systemd=no AS_IF([test "x$enable_systemd" != xno], [ - ifdef([PKG_CHECK_MODULES], [ + if test -n "$PKG_CONFIG"; then dnl systemd v209 or newer have_systemd=no PKG_CHECK_MODULES([SYSTEMD], [libsystemd], [have_systemd=yes], []) @@ -26,8 +26,8 @@ AS_IF([test "x$enable_systemd" != xno], [ LIBS="$LIBS $SYSTEMD_LIBS" ] ) - ], [ + else AC_MSG_ERROR([systemd enabled but need pkg-config to configure for it]) - ]) + fi ]) AM_CONDITIONAL([USE_SYSTEMD], [test "x$have_systemd" = xyes])