automake-patches
[Top][All Lists]
Advanced

[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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]