automake-patches
[Top][All Lists]
Advanced

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

[PATCH 6/8] vala: if no proper compiler found, set $(VALAC) to 'valac'


From: Stefano Lattarini
Subject: [PATCH 6/8] vala: if no proper compiler found, set $(VALAC) to 'valac'
Date: Sat, 27 Oct 2012 09:22:43 +0200

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 <address@hidden>
---
 doc/automake.texi |  4 ++--
 m4/vala.m4        | 18 ++++++++----------
 t/vala4.sh        |  4 ++--
 3 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/doc/automake.texi b/doc/automake.texi
index ae3fd15..7289d85 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -6900,8 +6900,8 @@ There are a few variables that are used when compiling 
Vala sources:
 
 @vtable @code
 @item VALAC
-Absolute path to the Vala compiler, or @samp{:} if no suitable compiler
-could be found.
+Absolute path to the Vala compiler, or simply @samp{valac} if no
+suitable compiler Vala could be found at configure runtime.
 
 @item VALAFLAGS
 Additional arguments for the Vala compiler.
diff --git a/m4/vala.m4 b/m4/vala.m4
index 0da8d67..7155176 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])
diff --git a/t/vala4.sh b/t/vala4.sh
index 0684d3f..cf3e70e 100755
--- a/t/vala4.sh
+++ b/t/vala4.sh
@@ -26,9 +26,9 @@ END
 
 cat > Makefile.am << 'END'
 has-valac:
-       case '$(VALAC)' in */valac) exit 0;; *) exit 1;; esac
+       case '$(VALAC)' in */bin/valac) exit 0;; *) exit 1;; esac
 no-valac:
-       test x'$(VALAC)' = x':'
+       test x'$(VALAC)' = x'valac'
 END
 
 mkdir bin
-- 
1.8.0




reply via email to

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