automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

add action arguments to AM_PROG_VALAC


From: Daiki Ueno
Subject: add action arguments to AM_PROG_VALAC
Date: Tue, 11 Sep 2012 18:34:59 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux)

Hi,

It is good that AM_PROG_VALAC does not abort when valac is not found,
since most upstream tarballs contain generated C files as well.

However, if MINIMUM-VERSION is given and the version comparison fails,
it aborts.  It would be nice if the behavior is controllable.

Here is a patch to add ACTION-IF-FOUND and ACTION-IF-NOT-FOUND to
AM_PROG_VALAC.

>From b764dcfb3992bda8a6223ab8a88113689fca44ea Mon Sep 17 00:00:00 2001
From: Daiki Ueno <address@hidden>
Date: Tue, 11 Sep 2012 17:55:37 +0900
Subject: [PATCH] vala: add action arguments

* m4/vala.m4 (AM_PROG_VALAC): Add optional action arguments to
control the behavior if specified version of valac is not found.
* t/vala4.sh: Add tests for that.
---
 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.7.11.4

Regards,
-- 
Daiki Ueno



reply via email to

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