]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix #1006: Can't find protobuf-c package since #999.
authorYorgos Thessalonikefs <yorgos@nlnetlabs.nl>
Wed, 7 Feb 2024 09:38:52 +0000 (10:38 +0100)
committerYorgos Thessalonikefs <yorgos@nlnetlabs.nl>
Wed, 7 Feb 2024 09:38:52 +0000 (10:38 +0100)
configure.ac
dnstap/dnstap.m4
doc/Changelog

index d4a13e6d62231b926d53aac7607826e3e527f03f..4edab4f4a8a7ff1934798537a9fdd5653e68633f 100644 (file)
@@ -407,7 +407,7 @@ AC_CHECK_TOOL(STRIP, strip)
 ACX_LIBTOOL_C_ONLY
 
 # pkg-config is only needed for these options, do not require it otherwise
-if test "$enable_systemd" = "yes" -o "$with_pyunbound" = "yes" -o "$with_pythonmod" = "yes"; then
+if test "$enable_systemd" = "yes" -o "$enable_dnstap" = "yes" -o "$with_pyunbound" = "yes" -o "$with_pythonmod" = "yes"; then
 PKG_PROG_PKG_CONFIG
 fi
 
index a9202c1155a777e2c68cf4769afe04761c283915..a6b707004a241775d018154ac0453812901f179f 100644 (file)
@@ -5,54 +5,76 @@
 # Check for required dnstap libraries and add dnstap configure args.
 AC_DEFUN([dt_DNSTAP],
 [
-  AC_ARG_ENABLE([dnstap],
-    AS_HELP_STRING([--enable-dnstap],
-                   [Enable dnstap support (requires protobuf-c)]),
-    [opt_dnstap=$enableval], [opt_dnstap=no])
+    AC_ARG_ENABLE([dnstap],
+        AS_HELP_STRING([--enable-dnstap],
+            [Enable dnstap support (requires protobuf-c)]),
+        [opt_dnstap=$enableval],
+        [opt_dnstap=no])
 
-  AC_ARG_WITH([dnstap-socket-path],
-    AS_HELP_STRING([--with-dnstap-socket-path=pathname],
-                   [set default dnstap socket path]),
-    [opt_dnstap_socket_path=$withval], [opt_dnstap_socket_path="$1"])
+    AC_ARG_WITH([dnstap-socket-path],
+        AS_HELP_STRING([--with-dnstap-socket-path=pathname],
+            [set default dnstap socket path]),
+        [opt_dnstap_socket_path=$withval],
+        [opt_dnstap_socket_path="$1"])
 
-  if test "x$opt_dnstap" != "xno"; then
-    AC_PATH_PROG([PROTOC_C], [protoc-c])
-    if test -z "$PROTOC_C"; then
-      AC_MSG_ERROR([The protoc-c program was not found. Please install protobuf-c!])
-    fi
-    AC_ARG_WITH([protobuf-c], AS_HELP_STRING([--with-protobuf-c=path],
-       [Path where protobuf-c is installed, for dnstap]), [
-         # workaround for protobuf-c includes at old dir before protobuf-c-1.0.0
-         if test -f $withval/include/google/protobuf-c/protobuf-c.h; then
-           CFLAGS="$CFLAGS -I$withval/include/google"
-         else
-           CFLAGS="$CFLAGS -I$withval/include"
-         fi
-         LDFLAGS="$LDFLAGS -L$withval/lib"
-       ], [
-      ifdef([PKG_CHECK_MODULES], [
-        PKG_CHECK_MODULES([PROTOBUFC], [libprotobuf-c], [
-          CFLAGS="$CFLAGS $PROTOBUFC_CFLAGS"
-          LIBS="$LIBS $PROTOBUFC_LIBS"
-        ], [
-          AC_MSG_ERROR([The protobuf-c package was not found with pkg-config. Please install protobuf-c!])
-        ])
-      ], [
-        # 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
+    if test "x$opt_dnstap" == "xno"; then
+        AC_PATH_PROG([PROTOC_C], [protoc-c])
+        if test -z "$PROTOC_C"; then
+          AC_MSG_ERROR([The protoc-c program was not found. Please install protobuf-c!])
         fi
-      ])
-    ])
-    AC_SEARCH_LIBS([protobuf_c_message_pack], [protobuf-c], [],
-      AC_MSG_ERROR([The protobuf-c library was not found. Please install the development libraries for protobuf-c!]))
-    $2
-  else
-    $3
-  fi
+        AC_ARG_WITH([protobuf-c],
+            AS_HELP_STRING([--with-protobuf-c=path], [Path where protobuf-c is installed, for dnstap]),
+            [
+                # workaround for protobuf-c includes at old dir before protobuf-c-1.0.0
+                if test -f $withval/include/google/protobuf-c/protobuf-c.h; then
+                    CFLAGS="$CFLAGS -I$withval/include/google"
+                else
+                    CFLAGS="$CFLAGS -I$withval/include"
+                fi
+                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"
+                                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
+                                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
+                        fi
+                    ]
+                )
+            ]
+        )
+        AC_SEARCH_LIBS([protobuf_c_message_pack], [protobuf-c], [],
+            AC_MSG_ERROR([The protobuf-c library was not found. Please install the development libraries for protobuf-c!]))
+        $2
+    else
+        $3
+    fi
 ])
index 7593054dc9d7c9f279c5dbaf4f28296622640e2f..2a8a598aa3fa917615ec8033bbcbecf504700188 100644 (file)
@@ -1,3 +1,6 @@
+7 February 2024: Yorgos
+       - Fix #1006: Can't find protobuf-c package since #999.
+
 30 January 2024: Wouter
        - Merge #999: Search for protobuf-c with pkg-config.