All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-4.14] tools: check go compiler version if present
@ 2020-06-12 14:31 Nick Rosbrook
  2020-06-12 16:40 ` Ian Jackson
  2020-06-15 11:42 ` George Dunlap
  0 siblings, 2 replies; 9+ messages in thread
From: Nick Rosbrook @ 2020-06-12 14:31 UTC (permalink / raw)
  To: xen-devel; +Cc: Nick Rosbrook, Ian Jackson, george.dunlap, Wei Liu, paul

Currently, no minimum go compiler version is required by the configure
scripts. However, the go bindings actually will not build with some
older versions of go. Add a check for a minimum go version of 1.11.1 in
accordance with tools/golang/xenlight/go.mod.

Signed-off-by: Nick Rosbrook <rosbrookn@ainfosec.com>
---
 m4/golang.m4       |  4 ++++
 tools/configure    | 49 ++++++++++++++++++++++++++++++++++++++++++++++
 tools/configure.ac |  7 +++++++
 3 files changed, 60 insertions(+)

diff --git a/m4/golang.m4 b/m4/golang.m4
index 0b4bd54ce0..9cfd7e00a5 100644
--- a/m4/golang.m4
+++ b/m4/golang.m4
@@ -1,4 +1,8 @@
 AC_DEFUN([AC_PROG_GO], [
     dnl Check for the go compiler
     AC_CHECK_TOOL([GO],[go],[no])
+
+    if test "$GO" != "no"; then
+        GOVERSION=`$GO version | cut -d " " -f 3 | sed "s/go//"`
+    fi
 ])
diff --git a/tools/configure b/tools/configure
index b3668ec98d..f3f19c1a90 100755
--- a/tools/configure
+++ b/tools/configure
@@ -6845,6 +6845,10 @@ else
 fi
 
 
+    if test "$GO" != "no"; then
+        GOVERSION=`$GO version | cut -d " " -f 3 | sed "s/go//"`
+    fi
+
     if test "x$GO" = "xno"; then :
 
         if test "x$enable_golang" =  "xyes"; then :
@@ -6854,6 +6858,51 @@ fi
 fi
         golang="n"
 
+else
+
+
+
+
+  # Used to indicate true or false condition
+  ax_compare_version=false
+
+  # Convert the two version strings to be compared into a format that
+  # allows a simple string comparison.  The end result is that a version
+  # string of the form 1.12.5-r617 will be converted to the form
+  # 0001001200050617.  In other words, each number is zero padded to four
+  # digits, and non digits are removed.
+
+  ax_compare_version_A=`echo "$GOVERSION" | sed -e 's/\([0-9]*\)/Z\1Z/g' \
+                     -e 's/Z\([0-9]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \
+                     -e 's/[^0-9]//g'`
+
+
+  ax_compare_version_B=`echo "1.11.1" | sed -e 's/\([0-9]*\)/Z\1Z/g' \
+                     -e 's/Z\([0-9]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \
+                     -e 's/[^0-9]//g'`
+
+
+    ax_compare_version=`echo "x$ax_compare_version_A
+x$ax_compare_version_B" | sed 's/^ *//' | sort -r | sed "s/x${ax_compare_version_A}/false/;s/x${ax_compare_version_B}/true/;1q"`
+
+
+
+    if test "$ax_compare_version" = "true" ; then
+
+            if test "x$enable_golang" = "xyes"; then :
+
+                as_fn_error $? "\"Your version of go: $GOVERSION is not supported\"" "$LINENO" 5
+
+fi
+            golang="n"
+
+      fi
+
+
 fi
 
 fi
diff --git a/tools/configure.ac b/tools/configure.ac
index a9af0a21c6..9d126b7a14 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -338,6 +338,13 @@ AS_IF([test "x$golang" = "xy"], [
             AC_MSG_ERROR([Go tools enabled, but missing go compiler])
         ])
         golang="n"
+    ], [
+        AX_COMPARE_VERSION([$GOVERSION], [lt], [1.11.1], [
+            AS_IF([test "x$enable_golang" = "xyes"], [
+                AC_MSG_ERROR(["Your version of go: $GOVERSION is not supported"])
+            ])
+            golang="n"
+        ])
     ])
 ])
 
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-06-15 14:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-12 14:31 [PATCH for-4.14] tools: check go compiler version if present Nick Rosbrook
2020-06-12 16:40 ` Ian Jackson
2020-06-12 21:50   ` Nick Rosbrook
2020-06-15 13:48     ` Ian Jackson
2020-06-15 14:32       ` Nick Rosbrook
2020-06-15 14:42         ` Ian Jackson
2020-06-15 14:46           ` Paul Durrant
2020-06-15 14:50             ` Ian Jackson
2020-06-15 11:42 ` George Dunlap

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.