Initial support for the vala programming language.
[platform/upstream/automake.git] / m4 / vala.m4
1 # Autoconf support for the Vala compiler
2
3 # Copyright (C) 2007 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 # serial 2
10
11 # Check whether the Vala compiler exists in `PATH'. If it is found the
12 # variable VALAC is set. Optionally a minimum release number of the compiler
13 # can be requested.
14 #
15 # Author: Mathias Hasselmann <mathias.hasselmann@gmx.de>
16 #
17 # AC_PROG_VALAC([MINIMUM-VERSION])
18 # --------------------------------------------------------------------------
19 AC_DEFUN([AC_PROG_VALAC],[
20   AC_PATH_PROG([VALAC], [valac], [])
21   AC_SUBST(VALAC)
22
23   if test -z "${VALAC}"; then
24     AC_MSG_WARN([No Vala compiler found. You will not be able to recompile .vala source files.])
25   elif test -n "$1"; then
26     AC_REQUIRE([AC_PROG_AWK])
27     AC_MSG_CHECKING([valac is at least version $1])
28
29     if "${VALAC}" --version | "${AWK}" -v r='$1' 'function vn(s) { if (3 == split(s,v,".")) return (v[1]*1000+v[2])*1000+v[3]; else exit 2; } /^Vala / { exit vn(r) > vn($[2]) }'; then
30       AC_MSG_RESULT([yes])
31     else
32       AC_MSG_RESULT([no])
33       AC_MSG_ERROR([Vala $1 not found.])
34     fi
35   fi
36 ])