From df202a3e6412b530a052e0a1f6de6307faae19a0 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Tue, 11 Sep 2012 17:55:37 +0900 Subject: [PATCH] vala: add action arguments, for when no proper vala compiler is found * 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 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 + : -- 2.7.4