Here is the patch with the EXTRA_DIST moved. Note that the .deps file
is useless without the .vapi file (that's why it was inside the if
ENABLE_VAPIGEN )
Regards,
Corentin
---
.gitignore | 1 +
configure.ac | 4 ++
gobject/Makefile.am | 17 +++++
gobject/libguestfs-gobject-1.0.deps | 2 +
m4/vapigen.m4 | 101 ++++++++++++++++++++++++++++
5 files changed, 125 insertions(+)
create mode 100644 gobject/libguestfs-gobject-1.0.deps
create mode 100644 m4/vapigen.m4
diff --git a/.gitignore b/.gitignore
index 637bf7765..29d3e3aae 100644
--- a/.gitignore
+++ b/.gitignore
@@ -339,6 +339,7 @@ Makefile.in
/gobject/Guestfs-1.0.gir
/gobject/Guestfs-1.0.typelib
/gobject/guestfs-gobject.3
+/gobject/libguestfs-gobject-1.0.vapi
/gobject/stamp-guestfs-gobject.pod
/golang/bindtests.go
/golang/examples/guestfs-golang.3
diff --git a/configure.ac b/configure.ac
index e18e099b9..dfc7a1af3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -161,6 +161,8 @@ HEADING([Checking for Go])
m4_include([m4/guestfs-golang.m4])
HEADING([Checking for GObject Introspection])
m4_include([m4/guestfs-gobject.m4])
+HEADING([Checking for Vala])
+VAPIGEN_CHECK
dnl virt-v2v, virt-p2v.
HEADING([Checking the virt-v2v and virt-p2v dependencies])
@@ -421,6 +423,8 @@ AS_ECHO_N(["gobject bindings ....................
"])
if test "x$HAVE_GOBJECT_TRUE" = "x"; then echo "yes"; else
echo "no";
fi
AS_ECHO_N(["gobject introspection ............... "])
if test "x$HAVE_INTROSPECTION_TRUE" = "x"; then echo "yes";
else echo
"no"; fi
+AS_ECHO_N(["Vala bindings ....................... "])
+if test "x$ENABLE_VAPIGEN" = "x"; then echo "yes"; else
echo "no"; fi
AS_ECHO_N(["bash completion ..................... "])
if test "x$HAVE_BASH_COMPLETION_TRUE" = "x"; then echo
"yes"; else
echo "no"; fi
echo
diff --git a/gobject/Makefile.am b/gobject/Makefile.am
index ddedd5b51..c32cc8ec6 100644
--- a/gobject/Makefile.am
+++ b/gobject/Makefile.am
@@ -105,6 +105,23 @@ $(TESTS): $(typelib_DATA)
CLEANFILES += $(gir_DATA) $(typelib_DATA)
+if ENABLE_VAPIGEN
+-include $(VAPIGEN_MAKEFILE)
+
+libguestfs-gobject-1.0.vapi: Guestfs-1.0.gir libguestfs-gobject-
1.0.deps
+
+VAPIGEN_VAPIS = libguestfs-gobject-1.0.vapi
+
+libguestfs_gobject_1_0_vapi_DEPS = gobject-2.0 gio-2.0
+libguestfs_gobject_1_0_vapi_METADATADIRS = $(srcdir)
+libguestfs_gobject_1_0_vapi_FILES = Guestfs-1.0.gir
+
+vapidir = $(datadir)/vala/vapi
+vapi_DATA = $(VAPIGEN_VAPIS) $(VAPIGEN_VAPIS:.vapi=.deps)
+endif
+
+EXTRA_DIST += libguestfs-gobject-1.0.deps
+
endif HAVE_INTROSPECTION
# Documentation.
diff --git a/gobject/libguestfs-gobject-1.0.deps b/gobject/libguestfs-
gobject-1.0.deps
new file mode 100644
index 000000000..d4db05933
--- /dev/null
+++ b/gobject/libguestfs-gobject-1.0.deps
@@ -0,0 +1,2 @@
+gobject-2.0
+gio-2.0
diff --git a/m4/vapigen.m4 b/m4/vapigen.m4
new file mode 100644
index 000000000..2c435e74b
--- /dev/null
+++ b/m4/vapigen.m4
@@ -0,0 +1,101 @@
+dnl vapigen.m4
+dnl
+dnl Copyright 2012 Evan Nemerson
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License, or (at your option) any later version.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free
Software
+dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
+
+# VAPIGEN_CHECK([VERSION], [API_VERSION], [FOUND_INTROSPECTION],
[DEFAULT])
+# --------------------------------------
+# Check vapigen existence and version
+#
+# See
http://live.gnome.org/Vala/UpstreamGuide for detailed
documentation
+AC_DEFUN([VAPIGEN_CHECK],
+[
+ AS_IF([test "x$3" != "xyes"], [
+ m4_provide_if([GOBJECT_INTROSPECTION_CHECK], [], [
+ m4_provide_if([GOBJECT_INTROSPECTION_REQUIRE], [], [
+ 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"]])
+ ])
+ ])
+ ])
+
+ AC_ARG_ENABLE([vala],
+ [AS_HELP_STRING([--enable-vala[=@<:@no/auto/yes@:>@]],[build Vala
bindings @<:@default=]ifelse($4,,auto,$4)[@:>@])],,[
+ AS_IF([test "x$4" = "x"], [
+ enable_vala=auto
+ ], [
+ enable_vala=$4
+ ])
+ ])
+
+ AS_CASE([$enable_vala], [no], [enable_vala=no],
+ [yes], [
+ AS_IF([test "x$3" != "xyes" -a
"x$found_introspection" !=
"xyes"], [
+ AC_MSG_ERROR([Vala bindings require GObject
Introspection])
+ ])
+ ], [auto], [
+ AS_IF([test "x$3" != "xyes" -a
"x$found_introspection" !=
"xyes"], [
+ enable_vala=no
+ ])
+ ], [
+ AC_MSG_ERROR([Invalid argument passed to --enable-vala, should
be one of @<:@no/auto/yes@:>@])
+ ])
+
+ AS_IF([test "x$2" = "x"], [
+ vapigen_pkg_name=vapigen
+ ], [
+ vapigen_pkg_name=vapigen-$2
+ ])
+ AS_IF([test "x$1" = "x"], [
+ vapigen_pkg="$vapigen_pkg_name"
+ ], [
+ vapigen_pkg="$vapigen_pkg_name >= $1"
+ ])
+
+ PKG_PROG_PKG_CONFIG
+
+ PKG_CHECK_EXISTS([$vapigen_pkg], [
+ AS_IF([test "$enable_vala" = "auto"], [
+ enable_vala=yes
+ ])
+ ], [
+ AS_CASE([$enable_vala], [yes], [
+ AC_MSG_ERROR([$vapigen_pkg not found])
+ ], [auto], [
+ enable_vala=no
+ ])
+ ])
+
+ AC_MSG_CHECKING([for vapigen])
+
+ AS_CASE([$enable_vala],
+ [yes], [
+ VAPIGEN=`$PKG_CONFIG --variable=vapigen $vapigen_pkg_name`
+ VAPIGEN_MAKEFILE=`$PKG_CONFIG --variable=datadir
$vapigen_pkg_name`/vala/Makefile.vapigen
+ AS_IF([test "x$2" = "x"], [
+ VAPIGEN_VAPIDIR=`$PKG_CONFIG --variable=vapidir
$vapigen_pkg_name`
+ ], [
+ VAPIGEN_VAPIDIR=`$PKG_CONFIG --variable=vapidir_versioned
$vapigen_pkg_name`
+ ])
+ ])
+
+ AC_MSG_RESULT([$enable_vala])
+
+ AC_SUBST([VAPIGEN])
+ AC_SUBST([VAPIGEN_VAPIDIR])
+ AC_SUBST([VAPIGEN_MAKEFILE])
+
+ AM_CONDITIONAL(ENABLE_VAPIGEN, test "x$enable_vala" = "xyes")
+])