am-ft: make the environment available earlier
[platform/upstream/automake.git] / m4 / vala.m4
1 # Autoconf support for the Vala compiler
2
3 # Copyright (C) 2008-2013 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 pointing to its absolute path.  Otherwise, it is
11 # simply set to 'valac'.
12 # Optionally a minimum release number of the compiler can be requested.
13 # If the ACTION-IF-FOUND parameter is given, it will be run if a proper
14 # Vala compiler is found.
15 # Similarly, if the ACTION-IF-FOUND is given, it will be run if no proper
16 # Vala compiler is found.  It defaults to simply print a warning about the
17 # situation, but otherwise proceeding with the configuration.
18 #
19 # AM_PROG_VALAC([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
20 # --------------------------------------------------------------------------
21 AC_DEFUN([AM_PROG_VALAC],
22   [AC_PATH_PROG([VALAC], [valac], [valac])
23    AS_IF([test "$VALAC" != valac && test -n "$1"],
24       [AC_MSG_CHECKING([whether $VALAC is at least version $1])
25        am__vala_version=`$VALAC --version | sed 's/Vala  *//'`
26        AS_VERSION_COMPARE([$1], ["$am__vala_version"],
27          [AC_MSG_RESULT([yes])],
28          [AC_MSG_RESULT([yes])],
29          [AC_MSG_RESULT([no])
30           VALAC=valac])])
31     if test "$VALAC" = valac; then
32       m4_default([$3],
33         [AC_MSG_WARN([no proper vala compiler found])
34          AC_MSG_WARN([you will not be able to compile vala source files])])
35     else
36       m4_default([$2], [:])
37     fi])