From df202a3e6412b530a052e0a1f6de6307faae19a0 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Tue, 11 Sep 2012 17:55:37 +0900 Subject: 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 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'm4/vala.m4') diff --git a/m4/vala.m4 b/m4/vala.m4 index 5dad452bf..cf88bf866 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])]) -- cgit v1.2.1 From df6303ec01ceffb74eaf1f201c6d575efa99bff6 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Fri, 26 Oct 2012 15:18:44 +0200 Subject: vala: style fixes in vala.m4 * m4/vala.m4 (AM_PROG_VALAC): Here. Signed-off-by: Stefano Lattarini --- m4/vala.m4 | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'm4/vala.m4') diff --git a/m4/vala.m4 b/m4/vala.m4 index cf88bf866..0674c8eb2 100644 --- a/m4/vala.m4 +++ b/m4/vala.m4 @@ -11,21 +11,23 @@ # compiler can be requested. # # 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"], - [m4_default([$3], [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]) + AC_MSG_WARN([you will not be able to compile vala source files])])], [AS_IF([test -n "$1"], - [AC_MSG_CHECKING([$VALAC is at least version $1]) + [AC_MSG_CHECKING([whether $VALAC is at least version $1]) am__vala_version=`$VALAC --version | sed 's/Vala *//'` AS_VERSION_COMPARE([$1], ["$am__vala_version"], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]) VALAC=:])]) - if test "$VALAC" = :; then - m4_default([$3], [AC_MSG_ERROR([Vala $1 not found.], [77])]) + if test x"$VALAC" = x":"; then + m4_default([$3], [AC_MSG_ERROR([no proper vala compiler found], [77])]) else m4_default([$2], [:]) fi])]) -- cgit v1.2.1 From 9fe696bc9d6654a972d99f524c14a22fdc429e79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Wilmet?= Date: Fri, 26 Oct 2012 17:08:09 +0200 Subject: vala: AM_PROG_VALAC should not produce an error for tool-old valac This change fixes automake bug#12688. In the AM_PROG_VALAC macro, when the optional parameter specifying the minimum release number is not provided, and/or if the Vala compiler is not found, then there is a _warning_ message. On the other hand, when the version number is specified and if the Vala compiler is too old, there is an _error_ message. This error message is problematic, because for a tarball, the Vala compiler is not required: the generated C code is included in the tarball. So if a user wants to compile the software, he shouldn't need the valac program with the right version. * m4/vala.m4 (AM_PROG_VALAC): Modify to use AC_MSG_WARN instead of AC_MSG_ERROR. * t/vala4.sh: Adjust and enhance. * doc/automake.texi (Vala Support): Likewise. * THANKS: Update. Co-authored-by: Matthieu Baerts Co-authored-by: Stefano Lattarini Copyright-paperwork-exempt: yes Signed-off-by: Stefano Lattarini --- m4/vala.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'm4/vala.m4') diff --git a/m4/vala.m4 b/m4/vala.m4 index 0674c8eb2..0da8d67ac 100644 --- a/m4/vala.m4 +++ b/m4/vala.m4 @@ -27,7 +27,7 @@ AC_DEFUN([AM_PROG_VALAC], [AC_MSG_RESULT([no]) VALAC=:])]) if test x"$VALAC" = x":"; then - m4_default([$3], [AC_MSG_ERROR([no proper vala compiler found], [77])]) + m4_default([$3], [AC_MSG_WARN([no proper vala compiler found])]) else m4_default([$2], [:]) fi])]) -- cgit v1.2.1 From 1b187099d61143733e35ff58bfc6a0cedd2e2322 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Fri, 26 Oct 2012 18:01:17 +0200 Subject: vala: if no proper compiler found, set $(VALAC) to 'valac' This is better than setting it to ':' (as is currently done), because a triggered makefile rule invoking a vala compilation will then clearly fail with an informative error message like "valac: command not found", rather than silently, with the error possibly going unnoticed, or triggering harder-to-diagnose fallout failures in later steps. For a precedent of a similar behaviour, see the AC_PROG_YACC macro. * m4/valac.m4: Implement the new semantic. * doc/automake.texi (Vala Support): Document it. * t/vala4.sh: Adjust. Signed-off-by: Stefano Lattarini --- m4/vala.m4 | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'm4/vala.m4') diff --git a/m4/vala.m4 b/m4/vala.m4 index 0da8d67ac..715517617 100644 --- a/m4/vala.m4 +++ b/m4/vala.m4 @@ -13,21 +13,19 @@ # 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"], - [m4_default([$3], - [AC_MSG_WARN([no vala compiler found]) - AC_MSG_WARN([you will not be able to compile vala source files])])], - [AS_IF([test -n "$1"], + [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 *//'` AS_VERSION_COMPARE([$1], ["$am__vala_version"], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]) - VALAC=:])]) - if test x"$VALAC" = x":"; then - m4_default([$3], [AC_MSG_WARN([no proper vala compiler found])]) + 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])]) else m4_default([$2], [:]) - fi])]) + fi]) -- cgit v1.2.1 From 3f20803ca180b8d2994f9dce3665ea87fe43c67c Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Fri, 26 Oct 2012 20:22:40 +0200 Subject: vala: improve comments to AM_PROG_VALAC * m4/vala.m4 (AM_PROG_VALAC): Here. Signed-off-by: Stefano Lattarini --- m4/vala.m4 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'm4/vala.m4') diff --git a/m4/vala.m4 b/m4/vala.m4 index 715517617..2355c85d2 100644 --- a/m4/vala.m4 +++ b/m4/vala.m4 @@ -6,9 +6,15 @@ # 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. Optionally a minimum release number of the -# compiler can be requested. +# 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. # # AM_PROG_VALAC([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # -------------------------------------------------------------------------- -- cgit v1.2.1