device: renew dhcp leases on awake for software devices
[NetworkManager.git] / m4 / vapigen.m4
1 dnl vala.m4
2 dnl
3 dnl Copyright 2012 Evan Nemerson
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 # VAPIGEN_CHECK([VERSION], [API_VERSION], [FOUND-INTROSPECTION])
20 # --------------------------------------
21 # Check that vapigen existence and version
22 #
23 # See http://live.gnome.org/Vala/UpstreamGuide for detailed documentation
24 AC_DEFUN([VAPIGEN_CHECK],
25 [
26   AC_BEFORE([GOBJECT_INTROSPECTION_CHECK],[$0])
27   AC_BEFORE([GOBJECT_INTROSPECTION_REQUIRE],[$0])
28
29   AC_ARG_ENABLE([vala],
30     AS_HELP_STRING([--enable-vala[=@<:@no/auto/yes@:>@]],
31       [build Vala bindings [[default=auto]]]),,
32       [enable_vala=auto])
33
34   AS_CASE([$enable_vala], [no], [],
35       [yes], [
36         AS_IF([test "x$3" != "xyes" -a "x$found_introspection" != "xyes"], [
37             AC_MSG_ERROR([Vala bindings require GObject Introspection])
38           ])
39       ], [auto], [
40         AS_IF([test "x$3" != "xyes" -a "x$found_introspection" != "xyes"], [
41             enable_vala=no
42           ])
43       ], [
44         AC_MSG_ERROR([Invalid argument passed to --enable-vala, should be one of @<:@no/auto/yes@:>@])
45       ])
46
47   AS_IF([test "x$2" = "x"], [
48       vapigen_pkg_name=vapigen
49     ], [
50       vapigen_pkg_name=vapigen-$2
51     ])
52   AS_IF([test "x$1" = "x"], [
53       vapigen_pkg="$vapigen_pkg_name"
54     ], [
55       vapigen_pkg="$vapigen_pkg_name >= $1"
56     ])
57
58   PKG_PROG_PKG_CONFIG
59
60   PKG_CHECK_EXISTS([$vapigen_pkg], [
61       AS_IF([test "$enable_vala" = "auto"], [
62           enable_vala=yes
63         ])
64     ], [
65       AS_CASE([$enable_vala], [yes], [
66           AC_MSG_ERROR([$vapigen_pkg not found])
67         ], [auto], [
68           enable_vala=no
69         ])
70     ])
71
72   AS_CASE([$enable_vala],
73     [yes], [
74       VAPIGEN=`$PKG_CONFIG --variable=vapigen vapigen`
75       VAPIGEN_MAKEFILE=`$PKG_CONFIG --variable=datadir vapigen`/vala/Makefile.vapigen
76       AS_IF([test "x$2" = "x"], [
77           VAPIGEN_VAPIDIR=`$PKG_CONFIG --variable=vapidir vapigen`
78         ], [
79           VAPIGEN_VAPIDIR=`$PKG_CONFIG --variable=vapidir_versioned vapigen`
80         ])
81     ])
82
83   AC_SUBST([VAPIGEN])
84   AC_SUBST([VAPIGEN_VAPIDIR])
85   AC_SUBST([VAPIGEN_MAKEFILE])
86
87   AM_CONDITIONAL(ENABLE_VAPIGEN, test "x$enable_vala" = "xyes")
88 ])