3 dnl Copyright 2012 Evan Nemerson
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.
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.
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
19 # VAPIGEN_CHECK([VERSION], [API_VERSION], [FOUND_INTROSPECTION], [DEFAULT])
20 # --------------------------------------
21 # Check vapigen existence and version
23 # See http://live.gnome.org/Vala/UpstreamGuide for detailed documentation
24 AC_DEFUN([VAPIGEN_CHECK],
26 AS_IF([test "x$3" != "xyes"], [
27 m4_provide_if([GOBJECT_INTROSPECTION_CHECK], [], [
28 m4_provide_if([GOBJECT_INTROSPECTION_REQUIRE], [], [
29 AC_MSG_ERROR([[You must call GOBJECT_INTROSPECTION_CHECK or GOBJECT_INTROSPECTION_REQUIRE before using VAPIGEN_CHECK unless using the FOUND_INTROSPECTION argument is "yes"]])
35 [AS_HELP_STRING([--enable-vala[=@<:@no/auto/yes@:>@]],[build Vala bindings @<:@default=]ifelse($4,,auto,$4)[@:>@])],,[
36 AS_IF([test "x$4" = "x"], [
43 AS_CASE([$enable_vala], [no], [enable_vala=no],
45 AS_IF([test "x$3" != "xyes" -a "x$found_introspection" != "xyes"], [
46 AC_MSG_ERROR([Vala bindings require GObject Introspection])
49 AS_IF([test "x$3" != "xyes" -a "x$found_introspection" != "xyes"], [
53 AC_MSG_ERROR([Invalid argument passed to --enable-vala, should be one of @<:@no/auto/yes@:>@])
56 AS_IF([test "x$2" = "x"], [
57 vapigen_pkg_name=vapigen
59 vapigen_pkg_name=vapigen-$2
61 AS_IF([test "x$1" = "x"], [
62 vapigen_pkg="$vapigen_pkg_name"
64 vapigen_pkg="$vapigen_pkg_name >= $1"
69 PKG_CHECK_EXISTS([$vapigen_pkg], [
70 AS_IF([test "$enable_vala" = "auto"], [
74 AS_CASE([$enable_vala], [yes], [
75 AC_MSG_ERROR([$vapigen_pkg not found])
81 AC_MSG_CHECKING([for vapigen])
83 AS_CASE([$enable_vala],
85 VAPIGEN=`$PKG_CONFIG --variable=vapigen $vapigen_pkg_name`
86 VAPIGEN_MAKEFILE=`$PKG_CONFIG --variable=datadir $vapigen_pkg_name`/vala/Makefile.vapigen
87 AS_IF([test "x$2" = "x"], [
88 VAPIGEN_VAPIDIR=`$PKG_CONFIG --variable=vapidir $vapigen_pkg_name`
90 VAPIGEN_VAPIDIR=`$PKG_CONFIG --variable=vapidir_versioned $vapigen_pkg_name`
94 AC_MSG_RESULT([$enable_vala])
97 AC_SUBST([VAPIGEN_VAPIDIR])
98 AC_SUBST([VAPIGEN_MAKEFILE])
100 AM_CONDITIONAL(ENABLE_VAPIGEN, test "x$enable_vala" = "xyes")