summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReuben Thomas <rrt@sc3d.org>2020-10-21 23:31:46 +0100
committerKarl Berry <karl@freefriends.org>2020-10-23 14:19:12 -0700
commitf832992db3490fecd8059b69ce302813bc539f52 (patch)
treeccba84dffa334878aae5627b0ccbdfb307b56dd4
parent9f83372ba3406587100b043f6d6f266eaaeada4f (diff)
downloadautomake-f832992db3490fecd8059b69ce302813bc539f52.tar.gz
Improve Vala compiler detection: use API version, not compiler version
* m4/vala.m4: check `valac --api-version', not `valac --version'. * doc/automake.texi: update documentation.
-rw-r--r--doc/automake.texi15
-rw-r--r--m4/vala.m428
-rw-r--r--t/vala-configure.sh10
3 files changed, 32 insertions, 21 deletions
diff --git a/doc/automake.texi b/doc/automake.texi
index 91e1d679a..dbeaf01f5 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -6969,12 +6969,15 @@ number.
Search for a Vala compiler in @env{PATH}. If it is found, the variable
@code{VALAC} is set to point to it (see below for more details). This
macro takes three optional arguments. The first argument, if present,
-is the minimum version of the Vala compiler required to compile this
-package. If a compiler is found and satisfies @var{minimum-version},
-then @var{action-if-found} is run (this defaults to do nothing).
-Otherwise, @var{action-if-not-found} is run. If @var{action-if-not-found}
-is not specified, the default value is to print a warning in case no
-compiler is found, or if a too-old version of the compiler is found.
+is the minimum version of the Vala API required to compile this package.
+For Vala releases, this is the same as the major and minor release
+number; e.g., when @code{valac --version} reports @code{0.48.7},
+@code{valac --api-version} reports @code{0.48}. If a compiler is found
+and satisfies @var{minimum-version}, then @var{action-if-found} is run
+(this defaults to do nothing). Otherwise, @var{action-if-not-found} is
+run. If @var{action-if-not-found} is not specified, the default value
+is to print a warning in case no compiler is found, or if a too-old
+version of the compiler is found.
@end defmac
There are a few variables that are used when compiling Vala sources:
diff --git a/m4/vala.m4 b/m4/vala.m4
index 759061dc0..509904b11 100644
--- a/m4/vala.m4
+++ b/m4/vala.m4
@@ -6,23 +6,25 @@
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# Check whether the Vala compiler exists in $PATH. If it is found, the
-# variable VALAC is set pointing to its absolute path. Otherwise, it is
-# simply set to 'valac'.
-# Optionally a minimum release number of the compiler can be requested.
-# If the ACTION-IF-FOUND parameter is given, it will be run if a proper
-# Vala compiler is found.
-# Similarly, if the ACTION-IF-FOUND is given, it will be run if no proper
-# Vala compiler is found. It defaults to simply print a warning about the
-# situation, but otherwise proceeding with the configuration.
+# Search for a Vala compiler in PATH. If it is found, the variable VALAC is
+# set to point to it. Otherwise, it is simply set to 'valac'. This macro
+# takes three optional arguments. The first argument, if present, is the
+# minimum version of the Vala API required to compile this package. For Vala
+# releases, this is the same as the major and minor release number; e.g., when
+# `valac --version' reports 0.48.7, `valac --api-version' reports 0.48. If a
+# compiler is found and satisfies MINIMUM-VERSION, then ACTION-IF-FOUND is run
+# (this defaults to do nothing). Otherwise, ACTION-IF-NOT-FOUND is run. If
+# ACTION-IF-NOT-FOUND is not specified, the default value is to print a
+# warning in case no compiler is found, or if a too-old version of the
+# compiler is found.
#
# AM_PROG_VALAC([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
# --------------------------------------------------------------------------
AC_DEFUN([AM_PROG_VALAC],
[AC_PATH_PROG([VALAC], [valac], [valac])
AS_IF([test "$VALAC" != valac && test -n "$1"],
- [AC_MSG_CHECKING([whether $VALAC is at least version $1])
- am__vala_version=`$VALAC --version | sed 's/Vala *//'`
+ [AC_MSG_CHECKING([whether $VALAC supports at least API version $1])
+ am__vala_version=`$VALAC --api-version`
AS_VERSION_COMPARE([$1], ["$am__vala_version"],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([yes])],
@@ -30,8 +32,8 @@ AC_DEFUN([AM_PROG_VALAC],
VALAC=valac])])
if test "$VALAC" = valac; then
m4_default([$3],
- [AC_MSG_WARN([no proper vala compiler found])
- AC_MSG_WARN([you will not be able to compile vala source files])])
+ [AC_MSG_WARN([Vala compiler not found or too old])
+ AC_MSG_WARN([you will not be able to compile Vala source files])])
else
m4_default([$2], [:])
fi])
diff --git a/t/vala-configure.sh b/t/vala-configure.sh
index 11bccd5f3..ea46acc84 100644
--- a/t/vala-configure.sh
+++ b/t/vala-configure.sh
@@ -37,6 +37,9 @@ cat > bin/valac << 'END'
if test "x$1" = x--version; then
echo "${vala_version-1.2.3}"
fi
+if test "x$1" = x--api-version; then
+ echo "${vala_version-1.2.3}"
+fi
exit 0
END
chmod +x bin/valac
@@ -46,6 +49,9 @@ cat > bin/valac.old << 'END'
if test "x$1" = x--version; then
echo 0.1
fi
+if test "x$1" = x--api-version; then
+ echo 0.1
+fi
exit 0
END
chmod +x bin/valac.old
@@ -74,13 +80,13 @@ $MAKE has-valac
st=0; vala_version=0.1.2 ./configure 2>stderr || st=$?
cat stderr >&2
test $st -eq 0
-grep '^configure: WARNING: no proper vala compiler found' stderr
+grep '^configure: WARNING: Vala compiler not found or too old' stderr
$MAKE no-valac
st=0; ./configure VALAC="$(pwd)/bin/valac.old" 2>stderr || st=$?
cat stderr >&2
test $st -eq 0 || exit 1
-grep '^configure: WARNING: no proper vala compiler found' stderr
+grep '^configure: WARNING: Vala compiler not found or too old' stderr
$MAKE no-valac
sed 's/^\(AM_PROG_VALAC\).*/\1([1], [: > ok], [: > ko])/' <configure.ac >t