Updated Galician translations
[profile/ivi/rygel.git] / m4 / vala.m4
1 dnl vala.m4
2 dnl
3 dnl Copyright 2010 Marc-Andre Lureau
4 dnl
5 dnl This library is free software; you can redistribute it and/or
6 dnl modify it under the terms of the GNU Lesser General Public
7 dnl License as published by the Free Software Foundation; either
8 dnl version 2.1 of the License, or (at your option) any later version.
9 dnl
10 dnl This library is distributed in the hope that it will be useful,
11 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 dnl Lesser General Public License for more details.
14 dnl
15 dnl You should have received a copy of the GNU Lesser General Public
16 dnl License along with this library; if not, write to the Free Software
17 dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
18
19 # _VALA_CHECK_COMPILE_WITH_ARGS(ARGS, [ACTION-IF-TRUE],
20 #   [ACTION-IF-FALSE])
21 # --------------------------------------
22 # Check that Vala compile with ARGS.
23 #
24 AC_DEFUN([_VALA_CHECK_COMPILE_WITH_ARGS],
25 [AC_REQUIRE([AM_PROG_VALAC])[]dnl
26
27   cat <<_ACEOF >conftest.vala
28 void main(){}
29 _ACEOF
30
31   AS_IF([vala_error=`$VALAC $1 -C -q -o conftest$ac_exeext conftest.vala 2>&1`],
32         [$2], [$3])
33 ])
34
35 ])# _VALA_CHECK_COMPILE_WITH_ARGS
36
37 # VALA_CHECK_PACKAGES(PKGS, [ACTION-IF-FOUND],
38 #   [ACTION-IF-NOT-FOUND])
39 # --------------------------------------
40 # Check that PKGS Vala bindings are installed and usable.
41 #
42 AC_DEFUN([VALA_CHECK_PACKAGES],
43 [
44   unset vala_pkgs
45   unset vala_bindings
46   ac_save_ifs="$IFS"; unset IFS
47   for vala_pkg in $(echo "$1"); do
48       vala_pkgs="${vala_pkgs:+$vala_pkgs }--pkg $vala_pkg"
49       vala_bindings="${vala_bindings:+$vala_bindings }$vala_pkg"
50   done
51   IFS="$ac_save_ifs"
52   AC_MSG_CHECKING([for $vala_bindings vala bindings])
53   _VALA_CHECK_COMPILE_WITH_ARGS([$vala_pkgs],
54     [vala_pkg_exists=yes],
55     [vala_pkg_exists=no])
56
57 AS_IF([test x${vala_pkg_exists} = xno],[
58   ifelse([$3], , [AC_MSG_ERROR([]dnl
59 [Package requirements were not met: $1
60
61 $vala_error
62
63 Consider adjusting the XDG_DATA_DIRS environment variable if you
64 installed bindings in a non-standard prefix.
65 ])],
66   [AC_MSG_RESULT([no])
67 $3])],[
68   AC_MSG_RESULT([yes])
69   ifelse([$2], , :, [$2])[]dnl
70 ])
71
72 ])# VALA_CHECK_PACKAGES