From 9be90a96c537b4a743774b0be9ffc8ca5c6498da Mon Sep 17 00:00:00 2001 From: Matt Jolly Date: Tue, 2 Apr 2024 20:47:38 +1000 Subject: [PATCH] Use AX_COMPARE_VERSION macro for golang version checks The previous approach fragile, required manual updates, and results in unexpected outcomes when the user has updated golang. Reported-by: Denny Rivetti --- a/configure.ac +++ b/configure.ac @@ -80,23 +80,13 @@ AC_ARG_ENABLE(golang, if test ! x"$with_golang" = xno; then AC_CHECK_PROGS(GO, go) - if test -n "$GO" ; then - GOVERSIONOPTION=version - go_version=$($GO $GOVERSIONOPTION | sed -e 's/go version go//' | \ - sed -e 's/ .*$//') - AC_MSG_CHECKING([whether go version is >= 1.14.x ($go_version)]) - case "$go_version" in - 1.14*|1.15*|1.16*|1.17*|1.18*|1.19*|1.20*|1.21*|1.22*|1.23*) - AC_MSG_RESULT([yes - version is: $go_version]) - with_golang="yes" - GO= - ;; - *) - AC_MSG_RESULT([no - version is: $go_version]) - with_golang="no" - problem_golang=": version of go ($go_version) <= 1.14.x" - ;; - esac + if test -n "$GO"; then + GOVERSIONOPTION=version + go_version=$($GO $GOVERSIONOPTION | sed -e 's/go version go//' | sed -e 's/ .*$//') + AX_COMPARE_VERSION([$go_version], [ge], ["1.14.0"], + [with_golang="yes"; GO=], + [with_golang="no"; + AC_MSG_ERROR([Go version ($go_version) is lower than the minimum required version ($REQUIRED_GO_VERSION)])]) fi fi AM_CONDITIONAL([FVWM_BUILD_GOLANG], [test x"$with_golang" = xyes]) @@ -1514,4 +1504,4 @@ Fvwm3 Configuration: Build man pages? $with_mandoc$problem_mandoc Build html man pages? $with_htmldoc$problem_htmldoc -" \ No newline at end of file +"