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
])
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 :
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
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"
+ ])
])
])