]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix to improve dnstap discovery on Fedora.
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Tue, 8 Jul 2025 07:29:27 +0000 (09:29 +0200)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Tue, 8 Jul 2025 07:29:27 +0000 (09:29 +0200)
configure
dnstap/dnstap.m4
doc/Changelog

index af58f5ef6f1d48c585aa67dc6f9d42bd44c5bb42..4c9be7ba7c254cf5fa7df481bbe247f74710b27a 100755 (executable)
--- a/configure
+++ b/configure
@@ -685,6 +685,7 @@ opt_dnstap_socket_path
 ENABLE_DNSTAP
 PROTOBUFC_LIBS
 PROTOBUFC_CFLAGS
+PROTOC_GEN_C
 PROTOC_C
 PROTOC
 UBSYMS
          as_fn_error $? "The protoc or protoc-c program was not found. It is needed for dnstap, use --disable-dnstap, or install protobuf-c to provide protoc or protoc-c" "$LINENO" 5
        fi
 
+       # Check for protoc-gen-c plugin
+       # Extract the first word of "protoc-gen-c", so it can be a program name with args.
+set dummy protoc-gen-c; ac_word=$2
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_path_PROTOC_GEN_C+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  case $PROTOC_GEN_C in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PROTOC_GEN_C="$PROTOC_GEN_C" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
+    ac_cv_path_PROTOC_GEN_C="$as_dir$ac_word$ac_exec_ext"
+    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+PROTOC_GEN_C=$ac_cv_path_PROTOC_GEN_C
+if test -n "$PROTOC_GEN_C"; then
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PROTOC_GEN_C" >&5
+printf "%s\n" "$PROTOC_GEN_C" >&6; }
+else
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+fi
+
+
+       if test -z "$PROTOC_GEN_C"; then
+         as_fn_error $? "The protoc-gen-c plugin was not found. It is needed for dnstap, use --disable-dnstap, or install protobuf-c-compiler to provide protoc-gen-c" "$LINENO" 5
+       fi
+
+       # Test that protoc-gen-c actually works
+       { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if protoc-gen-c plugin works" >&5
+printf %s "checking if protoc-gen-c plugin works... " >&6; }
+       cat > conftest.proto << EOF
+syntax = "proto2";
+message TestMessage {
+  optional string test_field = 1;
+}
+EOF
+       if $PROTOC_C --c_out=. conftest.proto >/dev/null 2>&1; then
+         { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; }
+         rm -f conftest.proto conftest.pb-c.c conftest.pb-c.h
+       else
+         { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+         rm -f conftest.proto conftest.pb-c.c conftest.pb-c.h
+         as_fn_error $? "The protoc-gen-c plugin is not working properly. Please ensure protobuf-c-compiler is properly installed" "$LINENO" 5
+       fi
+
+
 # Check whether --with-protobuf-c was given.
 if test ${with_protobuf_c+y}
 then :
index 166402d8136c24169058d6147d8887639ac3923e..89eda929bfb318e0a90c32838452b0bce3a117ab 100644 (file)
@@ -29,6 +29,30 @@ AC_DEFUN([dt_DNSTAP],
        if test -z "$PROTOC_C"; then
          AC_MSG_ERROR([[The protoc or protoc-c program was not found. It is needed for dnstap, use --disable-dnstap, or install protobuf-c to provide protoc or protoc-c]])
        fi
+
+       # Check for protoc-gen-c plugin
+       AC_PATH_PROG([PROTOC_GEN_C], [protoc-gen-c])
+       if test -z "$PROTOC_GEN_C"; then
+         AC_MSG_ERROR([[The protoc-gen-c plugin was not found. It is needed for dnstap, use --disable-dnstap, or install protobuf-c-compiler to provide protoc-gen-c]])
+       fi
+
+       # Test that protoc-gen-c actually works
+       AC_MSG_CHECKING([if protoc-gen-c plugin works])
+       cat > conftest.proto << EOF
+syntax = "proto2";
+message TestMessage {
+  optional string test_field = 1;
+}
+EOF
+       if $PROTOC_C --c_out=. conftest.proto >/dev/null 2>&1; then
+         AC_MSG_RESULT([yes])
+         rm -f conftest.proto conftest.pb-c.c conftest.pb-c.h
+       else
+         AC_MSG_RESULT([no])
+         rm -f conftest.proto conftest.pb-c.c conftest.pb-c.h
+         AC_MSG_ERROR([[The protoc-gen-c plugin is not working properly. Please ensure protobuf-c-compiler is properly installed]])
+       fi
+
         AC_ARG_WITH([protobuf-c],
             AS_HELP_STRING([--with-protobuf-c=path], [Path where protobuf-c is installed, for dnstap]),
             [
index 79e82e1444f0c9bc768f7b7a98dd4ab83a1acf9e..5729d46068c850b60785b4b34f4d5e6a49da42af 100644 (file)
@@ -1,3 +1,6 @@
+8 July 2025: Wouter
+       - Fix to improve dnstap discovery on Fedora.
+
 3 July 2025: Wouter
        - Fix #1300: Is 'sock-queue-timeout' a linux only feature.
        - For #1300: implement sock-queue-timeout for FreeBSD as well.