package/collectd: fix protoc version check

We need to add a patch fixing the protoc version check in collectd's
configure script, prior to bumping protobuf to a newer version.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
James Hilliard 2024-10-30 13:00:20 -06:00 committed by Thomas Petazzoni
parent bca077698f
commit b1ce2522b4

View File

@ -0,0 +1,48 @@
From 77f33d05355b115d3384d94c1c4e36c56ea28b09 Mon Sep 17 00:00:00 2001
From: James Hilliard <james.hilliard1@gmail.com>
Date: Wed, 30 Oct 2024 12:45:51 -0600
Subject: [PATCH] configure.ac: fix protoc version check
The current version check for 3.0.0+ fails to handle cases where
protoc is above version 3.0.0 but does not start with a 3, for
example protoc may have a version of 28.1.
To fix this use AX_COMPARE_VERSION to properly compare the version.
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Upstream: https://github.com/collectd/collectd/pull/4332
---
configure.ac | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/configure.ac b/configure.ac
index 86d2378b..1f7a9cdf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4897,13 +4897,16 @@ AC_PATH_PROG([PROTOC], [protoc])
have_protoc3="no"
if test "x$PROTOC" != "x"; then
AC_MSG_CHECKING([for protoc 3.0.0+])
- if $PROTOC --version | $EGREP libprotoc.3 >/dev/null; then
- protoc3="yes (`$PROTOC --version`)"
- have_protoc3="yes"
- else
- protoc3="no (`$PROTOC --version`)"
- fi
- AC_MSG_RESULT([$protoc3])
+ AC_SUBST([PROTOC_VERSION], [`$PROTOC --version | cut -d ' ' -f 2`])
+ AX_COMPARE_VERSION([$PROTOC_VERSION],[ge],[3],
+ [
+ have_protoc3="yes"
+ AC_MSG_RESULT([yes ($PROTOC_VERSION)])
+ ],
+ [
+ AC_MSG_RESULT([no ($PROTOC_VERSION)])
+ ]
+ )
fi
AM_CONDITIONAL([HAVE_PROTOC3], [test "x$have_protoc3" = "xyes"])
--
2.34.1