[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/8] vala: add action arguments, for when no proper vala compiler
From: |
Stefano Lattarini |
Subject: |
[PATCH 1/8] vala: add action arguments, for when no proper vala compiler is found |
Date: |
Sat, 27 Oct 2012 09:22:38 +0200 |
From: Daiki Ueno <address@hidden>
* m4/vala.m4 (AM_PROG_VALAC): Add optional action arguments to
control the behavior if specified version of valac is not found.
This emulates the behaviour of AM_PATH_PYTHON.
* t/vala4.sh: Enhance.
Signed-off-by: Stefano Lattarini <address@hidden>
Copyright-paperwork-exempt: yes
---
m4/vala.m4 | 12 ++++++++----
t/vala4.sh | 11 +++++++++++
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/m4/vala.m4 b/m4/vala.m4
index 5dad452..cf88bf8 100644
--- a/m4/vala.m4
+++ b/m4/vala.m4
@@ -10,12 +10,12 @@
# variable VALAC is set. Optionally a minimum release number of the
# compiler can be requested.
#
-# AM_PROG_VALAC([MINIMUM-VERSION])
+# AM_PROG_VALAC([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
# --------------------------------
AC_DEFUN([AM_PROG_VALAC],
[AC_PATH_PROG([VALAC], [valac], [])
AS_IF([test -z "$VALAC"],
- [AC_MSG_WARN([No Vala compiler found. You will not be able to compile
.vala source files.])],
+ [m4_default([$3], [AC_MSG_WARN([No Vala compiler found. You will not be
able to compile .vala source files.])])],
[AS_IF([test -n "$1"],
[AC_MSG_CHECKING([$VALAC is at least version $1])
am__vala_version=`$VALAC --version | sed 's/Vala *//'`
@@ -23,5 +23,9 @@ AC_DEFUN([AM_PROG_VALAC],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
- AC_MSG_ERROR([Vala $1 not found.], [77])])])])
-])
+ VALAC=:])])
+ if test "$VALAC" = :; then
+ m4_default([$3], [AC_MSG_ERROR([Vala $1 not found.], [77])])
+ else
+ m4_default([$2], [:])
+ fi])])
diff --git a/t/vala4.sh b/t/vala4.sh
index a727ec5..60cb79c 100755
--- a/t/vala4.sh
+++ b/t/vala4.sh
@@ -58,4 +58,15 @@ $AUTOCONF --force
# See comments above for why "|| exit 1" is needed.
./configure "VALAC=$cwd/valac" || exit 1
+sed 's/AM_PROG_VALAC.*/AM_PROG_VALAC([9999.9], , [:])/' < configure.ac >t
+mv -f t configure.ac
+$AUTOCONF --force
+./configure "VALAC=$cwd/valac" || exit 1
+
+sed 's/AM_PROG_VALAC.*/AM_PROG_VALAC([1.2.3], [exit 77])/' < configure.ac >t
+mv -f t configure.ac
+$AUTOCONF --force
+st=0; ./configure "VALAC=$cwd/valac" || st=$?
+test $st -eq 77 || exit 1
+
:
--
1.8.0
- [PATCH 0/8] Vala support: some fixlets, improvements and tweaks, Stefano Lattarini, 2012/10/27
- [PATCH 1/8] vala: add action arguments, for when no proper vala compiler is found,
Stefano Lattarini <=
- [PATCH 2/8] vala: style fixes in vala.m4, Stefano Lattarini, 2012/10/27
- [PATCH 3/8] tests: enhance tests on AM_PROG_VALAC, Stefano Lattarini, 2012/10/27
- [PATCH 4/8] docs: document recent changes to AM_PROG_VALAC, Stefano Lattarini, 2012/10/27
- [PATCH 5/8] vala: AM_PROG_VALAC should not produce an error for tool-old valac, Stefano Lattarini, 2012/10/27
- [PATCH 6/8] vala: if no proper compiler found, set $(VALAC) to 'valac', Stefano Lattarini, 2012/10/27
- [PATCH 7/8] news: update w.r.t. recent vala changes, Stefano Lattarini, 2012/10/27
- [PATCH 8/8] vala: improve comments to AM_PROG_VALAC, Stefano Lattarini, 2012/10/27
- Re: [PATCH 0/8] Vala support: some fixlets, improvements and tweaks, Stefano Lattarini, 2012/10/31