summaryrefslogtreecommitdiff
blob: 835568e2d60335246d30e69752b4559ab855afe9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
From d4414feefd95adf9c91d7eaf1e94380296c35f7a Mon Sep 17 00:00:00 2001
From: Peter Newman <peternewman@users.noreply.github.com>
Date: Fri, 7 Jul 2023 15:57:35 +0100
Subject: [PATCH 1/2] Fix protoc version checking, since v20.x (cherry picked
 from commit 2e55aa88756718d8ab4a4c8fde97d620542c2c98)

--- a/config/ola.m4
+++ b/config/ola.m4
@@ -44,7 +44,14 @@ if test -z "$PROTOC" ; then
   AC_MSG_ERROR([cannot find 'protoc' program]);
 elif test -n "$1" ; then
   AC_MSG_CHECKING([protoc version])
-  [protoc_version=`$PROTOC --version 2>&1 | grep 'libprotoc' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`]
+  # Since v20.x we only get effectively the minor and patch versions out of protoc.
+  # Treat them as major and minor and everything should keep working indefinitely.
+  # See https://protobuf.dev/support/version-support/
+  # So we've got either of these:
+  # libprotoc 2.4.1
+  # libprotoc 23.3
+  # The first sed ensures all versions have major, minor, patch, by adding a .0 on the end of ones missing it
+  [protoc_version=`$PROTOC --version 2>&1 | grep 'libprotoc' | sed 's/\([^\.0-9][0-9][0-9]*\.[0-9][0-9]*\)$/\1\.0/g' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`]
   [required=$1]
   [required_major=`echo $required | sed 's/[^0-9].*//'`]
   [required_minor=`echo $required | sed 's/[0-9][0-9]*\.\([0-9][0-9]*\)\.[0-9][0-9]*/\1/'`]

From 546d9ee8d970c4e5b33d9d28b4acf6eb34f27a5d Mon Sep 17 00:00:00 2001
From: Peter Newman <peternewman@users.noreply.github.com>
Date: Fri, 7 Jul 2023 16:14:21 +0100
Subject: [PATCH 2/2] Protoc check - correctly match multi-digit major versions
 (cherry picked from commit 69a2946622cdfce54cb6ed7f2210df2be0ec5576)

--- a/config/ola.m4
+++ b/config/ola.m4
@@ -51,7 +51,7 @@ elif test -n "$1" ; then
   # libprotoc 2.4.1
   # libprotoc 23.3
   # The first sed ensures all versions have major, minor, patch, by adding a .0 on the end of ones missing it
-  [protoc_version=`$PROTOC --version 2>&1 | grep 'libprotoc' | sed 's/\([^\.0-9][0-9][0-9]*\.[0-9][0-9]*\)$/\1\.0/g' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`]
+  [protoc_version=`$PROTOC --version 2>&1 | grep 'libprotoc' | sed 's/\([^\.0-9][0-9][0-9]*\.[0-9][0-9]*\)$/\1\.0/g' | sed 's/[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`]
   [required=$1]
   [required_major=`echo $required | sed 's/[^0-9].*//'`]
   [required_minor=`echo $required | sed 's/[0-9][0-9]*\.\([0-9][0-9]*\)\.[0-9][0-9]*/\1/'`]