vala: if no proper compiler found, set $(VALAC) to 'valac'
[platform/upstream/automake.git] / m4 / vala.m4
1 # Autoconf support for the Vala compiler
2
3 # Copyright (C) 2008-2012 Free Software Foundation, Inc.
4 #
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 # Check whether the Vala compiler exists in $PATH. If it is found, the
10 # variable VALAC is set. Optionally a minimum release number of the
11 # compiler can be requested.
12 #
13 # AM_PROG_VALAC([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
14 # --------------------------------------------------------------------------
15 AC_DEFUN([AM_PROG_VALAC],
16   [AC_PATH_PROG([VALAC], [valac], [valac])
17    AS_IF([test "$VALAC" != valac && test -n "$1"],
18       [AC_MSG_CHECKING([whether $VALAC is at least version $1])
19        am__vala_version=`$VALAC --version | sed 's/Vala  *//'`
20        AS_VERSION_COMPARE([$1], ["$am__vala_version"],
21          [AC_MSG_RESULT([yes])],
22          [AC_MSG_RESULT([yes])],
23          [AC_MSG_RESULT([no])
24           VALAC=valac])])
25     if test "$VALAC" = valac; then
26       m4_default([$3],
27         [AC_MSG_WARN([no proper vala compiler found])
28          AC_MSG_WARN([you will not be able to compile vala source files])])
29     else
30       m4_default([$2], [:])
31     fi])