[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH glib] Switch over to using standard gobject introspection macros



Remove hand crafted configure.ac and Makefile.am rules in
favour of the standard macros.

Signed-off-by: Daniel P. Berrange <berrange redhat com>
---
 configure.ac                | 25 +---------------
 libvirt-gconfig/Makefile.am | 71 ++++++++++++++++++++-------------------------
 libvirt-glib/Makefile.am    | 51 ++++++++++++++------------------
 libvirt-gobject/Makefile.am | 71 ++++++++++++++++++---------------------------
 4 files changed, 83 insertions(+), 135 deletions(-)

diff --git a/configure.ac b/configure.ac
index 9b5d09c..8b0b63b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -232,30 +232,7 @@ AC_SUBST([PYTHON_VERSION])
 AC_SUBST([PYTHON_INCLUDES])
 AC_SUBST([PYTHON_SITE_PACKAGES])
 
-AC_ARG_ENABLE([introspection],
-        AS_HELP_STRING([--enable-introspection], [enable GObject introspection]),
-        [], [enable_introspection=check])
-
-if test "x$enable_introspection" != "xno" ; then
-        PKG_CHECK_MODULES([GOBJECT_INTROSPECTION],
-                          [gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_REQUIRED],
-                          [enable_introspection=yes],
-                          [
-                             if test "x$enable_introspection" = "xcheck"; then
-                               enable_introspection=no
-                             else
-                               AC_MSG_ERROR([gobject-introspection is not available])
-                             fi
-                          ])
-        if test "x$enable_introspection" = "xyes" ; then
-          AC_DEFINE([WITH_GOBJECT_INTROSPECTION], [1], [enable GObject introspection support])
-          AC_SUBST(GOBJECT_INTROSPECTION_CFLAGS)
-          AC_SUBST(GOBJECT_INTROSPECTION_LIBS)
-          AC_SUBST([G_IR_SCANNER], [$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0)])
-          AC_SUBST([G_IR_COMPILER], [$($PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0)])
-        fi
-fi
-AM_CONDITIONAL([WITH_GOBJECT_INTROSPECTION], [test "x$enable_introspection" = "xyes"])
+GOBJECT_INTROSPECTION_CHECK([$GOBJECT_INTROSPECTION_REQUIRED])
 
 AC_ARG_ENABLE([vala],
               AS_HELP_STRING([--enable-vala], [enable Vala binding generation]),
diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index 0793da1..03e4036 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -168,6 +168,10 @@ GCONFIG_SOURCE_FILES = \
 			libvirt-gconfig-storage-vol-target.c \
 			libvirt-gconfig-xml-doc.c
 
+GCONFIG_GENERATED_FILES = \
+			libvirt-gconfig-enum-types.c \
+			libvirt-gconfig-enum-types.h
+
 libvirt_gconfig_1_0_ladir = $(includedir)/libvirt-gconfig-1.0/libvirt-gconfig
 libvirt_gconfig_1_0_la_HEADERS = \
 			$(GCONFIG_HEADER_FILES)
@@ -177,7 +181,7 @@ libvirt_gconfig_1_0_la_SOURCES = \
 			$(libvirt_gconfig_1_0_la_HEADERS) \
 			$(GCONFIG_SOURCE_FILES)
 nodist_libvirt_gconfig_1_0_la_SOURCES = \
-			$(builddir)/libvirt-gconfig-enum-types.c
+			$(GCONFIG_GENERATED_FILES)
 libvirt_gconfig_1_0_la_CFLAGS = \
 			-DG_LOG_DOMAIN="\"Libvirt.GConfig\"" \
 			-DDATADIR="\"$(datadir)\"" \
@@ -199,9 +203,7 @@ libvirt_gconfig_1_0_la_LDFLAGS = \
 			-Wl,--version-script=$(srcdir)/libvirt-gconfig.sym \
 			-version-info $(LIBVIRT_GLIB_VERSION_INFO)
 
-BUILT_SOURCES = \
-		libvirt-gconfig-enum-types.c \
-		libvirt-gconfig-enum-types.h
+BUILT_SOURCES = $(GCONFIG_GENERATED_FILES)
 
 CLEANFILES = $(BUILT_SOURCES)
 
@@ -213,44 +215,33 @@ libvirt-gconfig-enum-types.c: $(GCONFIG_HEADER_FILES) libvirt-gconfig-enum-types
 	$(AM_V_GEN) ( $(GLIB_MKENUMS) --template $(srcdir)/libvirt-gconfig-enum-types.c.template $(GCONFIG_HEADER_FILES:%=$(srcdir)/%) ) | \
 	    sed -e "s/G_TYPE_VIR_CONFIG/GVIR_CONFIG_TYPE/" -e "s/g_vir/gvir/" > libvirt-gconfig-enum-types.c
 
-if WITH_GOBJECT_INTROSPECTION
-
-LibvirtGConfig-1.0.gir: libvirt-gconfig-1.0.la $(G_IR_SCANNER) Makefile.am
-	$(AM_V_GEN)$(G_IR_SCANNER) \
-                --quiet \
-                --warn-all \
-                --namespace LibvirtGConfig \
-                --nsversion 1.0 \
-                --include GObject-2.0 \
-                --identifier-prefix=GVirConfig \
-                --symbol-prefix=gvir_config \
-                --library=$(builddir)/libvirt-gconfig-1.0.la \
-                --output $@ \
-                -I$(top_builddir) \
-                -I$(top_srcdir) \
-                --verbose \
-                --c-include="libvirt-gconfig/libvirt-gconfig.h" \
-                --pkg=libxml-2.0 \
-                --pkg-export=libvirt-gconfig-1.0 \
-                $(srcdir)/libvirt-gconfig.h \
-                $(GCONFIG_SOURCE_FILES:%=$(srcdir)/%) \
-                $(GCONFIG_HEADER_FILES:%=$(srcdir)/%) \
-                $(builddir)/libvirt-gconfig-enum-types.c \
-                $(builddir)/libvirt-gconfig-enum-types.h
-
+-include $(INTROSPECTION_MAKEFILE)
+INTROSPECTION_GIRS =
+
+if HAVE_INTROSPECTION
+LibvirtGConfig-1.0.gir: libvirt-gconfig-1.0.la
+LibvirtGConfig_1_0_gir_INCLUDES = GObject-2.0
+LibvirtGConfig_1_0_gir_PACKAGES = gobject-2.0
+LibvirtGConfig_1_0_gir_EXPORT_PACKAGES = libvirt-gconfig-1.0
+LibvirtGConfig_1_0_gir_LIBS = libvirt-gconfig-1.0.la
+LibvirtGConfig_1_0_gir_FILES = \
+	$(GCONFIG_SOURCE_FILES) \
+	$(GCONFIG_HEADER_FILES) \
+	$(GCONFIG_GENERATED_FILES) \
+	$(NULL)
+LibvirtGConfig_1_0_gir_CFLAGS = $(libvirt_gconfig_1_0_la_CFLAGS)
+LibvirtGConfig_1_0_gir_SCANNERFLAGS = \
+	--identifier-prefix=GVirConfig \
+	--symbol-prefix=gvir_config \
+	--c-include="libvirt-gconfig/libvirt-gconfig.h" \
+	$(NULL)
+INTROSPECTION_GIRS += LibvirtGConfig-1.0.gir
 
 girdir = $(datadir)/gir-1.0
 gir_DATA = LibvirtGConfig-1.0.gir
 
-typelibsdir = $(libdir)/girepository-1.0
-typelibs_DATA = LibvirtGConfig-1.0.typelib
-
-%.typelib: %.gir
-	$(AM_V_GEN)$(G_IR_COMPILER) \
-                --includedir=$(builddir) \
-                --includedir=$(girdir) \
-                -o $@ $<
-
-CLEANFILES += $(gir_DATA) $(typelibs_DATA)
+typelibdir = $(libdir)/girepository-1.0
+typelib_DATA = LibvirtGConfig-1.0.typelib
 
-endif # WITH_GOBJECT_INTROSPECTION
+CLEANFILES += $(gir_DATA) $(typelib_DATA)
+endif # HAVE_INTROSPECTION
diff --git a/libvirt-glib/Makefile.am b/libvirt-glib/Makefile.am
index 1370ebc..36404f1 100644
--- a/libvirt-glib/Makefile.am
+++ b/libvirt-glib/Makefile.am
@@ -37,38 +37,31 @@ libvirt_glib_1_0_la_LDFLAGS = \
 			-Wl,--version-script=$(srcdir)/libvirt-glib.sym \
 			-version-info $(LIBVIRT_GLIB_VERSION_INFO)
 
-if WITH_GOBJECT_INTROSPECTION
 
-LibvirtGLib-1.0.gir: libvirt-glib-1.0.la $(G_IR_SCANNER) Makefile.am
-	$(AM_V_GEN)$(G_IR_SCANNER) \
-                --quiet \
-                --warn-all \
-                --namespace LibvirtGLib \
-                --nsversion 1.0 \
-                --include GLib-2.0 \
-                --identifier-prefix=GVir \
-                --symbol-prefix=gvir \
-                --library=$(builddir)/libvirt-glib-1.0.la \
-                --output $@ \
-                -I$(top_srcdir) \
-                --verbose \
-                --pkg=gthread-2.0 \
-                --c-include="libvirt-glib/libvirt-glib.h" \
-                --pkg-export=libvirt-glib-1.0 \
-                $(libvirt_glib_1_0_la_SOURCES:%=$(srcdir)/%)
+-include $(INTROSPECTION_MAKEFILE)
+INTROSPECTION_GIRS =
+CLEANFILES=
+
+if HAVE_INTROSPECTION
+LibvirtGLib-1.0.gir: libvirt-glib-1.0.la
+LibvirtGLib_1_0_gir_INCLUDES = GLib-2.0
+LibvirtGLib_1_0_gir_PACKAGES = glib-2.0
+LibvirtGLib_1_0_gir_EXPORT_PACKAGES = libvirt-glib-1.0
+LibvirtGLib_1_0_gir_LIBS = libvirt-glib-1.0.la
+LibvirtGLib_1_0_gir_FILES = $(libvirt_glib_1_0_la_SOURCES)
+LibvirtGLib_1_0_gir_CFLAGS = $(libvirt_glib_1_0_la_CFLAGS)
+LibvirtGLib_1_0_gir_SCANNERFLAGS = \
+	--identifier-prefix=GVir \
+	--symbol-prefix=gvir \
+	--c-include="libvirt-glib/libvirt-glib.h" \
+	$(NULL)
+INTROSPECTION_GIRS += LibvirtGLib-1.0.gir
 
 girdir = $(datadir)/gir-1.0
 gir_DATA = LibvirtGLib-1.0.gir
 
-typelibsdir = $(libdir)/girepository-1.0
-typelibs_DATA = LibvirtGLib-1.0.typelib
-
-%.typelib: %.gir
-	$(AM_V_GEN)$(G_IR_COMPILER) \
-                --includedir=$(builddir) \
-                --includedir=$(girdir) \
-                -o $@ $<
-
-CLEANFILES = $(gir_DATA) $(typelibs_DATA)
+typelibdir = $(libdir)/girepository-1.0
+typelib_DATA = LibvirtGLib-1.0.typelib
 
-endif # WITH_GOBJECT_INTROSPECTION
+CLEANFILES += $(gir_DATA) $(typelib_DATA)
+endif # HAVE_INTROSPECTION
diff --git a/libvirt-gobject/Makefile.am b/libvirt-gobject/Makefile.am
index 3284b2c..9c05cb5 100644
--- a/libvirt-gobject/Makefile.am
+++ b/libvirt-gobject/Makefile.am
@@ -119,50 +119,37 @@ BUILT_SOURCES = $(GOBJECT_GENERATED_FILES)
 
 CLEANFILES = $(BUILT_SOURCES)
 
-if WITH_GOBJECT_INTROSPECTION
-
-LibvirtGObject-1.0.gir: libvirt-gobject-1.0.la $(G_IR_SCANNER) Makefile.am
-	$(AM_V_GEN)$(G_IR_SCANNER) \
-                --quiet \
-                --warn-all \
-                --namespace LibvirtGObject \
-                --nsversion 1.0 \
-                --include GObject-2.0 \
-                --include Gio-2.0 \
-                --include-uninstalled $(top_builddir)/libvirt-glib/LibvirtGLib-1.0.gir \
-                --include-uninstalled $(top_builddir)/libvirt-gconfig/LibvirtGConfig-1.0.gir \
-                --identifier-prefix=GVir \
-                --symbol-prefix=gvir \
-                --library=$(top_builddir)/libvirt-glib/libvirt-glib-1.0.la \
-                --library=$(top_builddir)/libvirt-gconfig/libvirt-gconfig-1.0.la \
-                --library=$(builddir)/libvirt-gobject-1.0.la \
-                --output $@ \
-                -I$(top_builddir) \
-                -I$(top_srcdir) \
-                --verbose \
-                --c-include="libvirt-gobject/libvirt-gobject.h" \
-                --pkg=gthread-2.0 \
-                --pkg=libxml-2.0 \
-                --pkg-export=libvirt-gobject-1.0 \
-                $(srcdir)/libvirt-gobject.h \
-                $(GOBJECT_SOURCE_FILES:%=$(srcdir)/%) \
-                $(GOBJECT_HEADER_FILES:%=$(srcdir)/%) \
-                $(GOBJECT_GENERATED_FILES:%=$(builddir)/%)
+-include $(INTROSPECTION_MAKEFILE)
+INTROSPECTION_GIRS =
+
+if HAVE_INTROSPECTION
+LibvirtGObject-1.0.gir: libvirt-gobject-1.0.la
+LibvirtGObject_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0
+LibvirtGObject_1_0_gir_PACKAGES = gobject-2.0
+LibvirtGObject_1_0_gir_EXPORT_PACKAGES = libvirt-gobject-1.0
+LibvirtGObject_1_0_gir_LIBS = \
+	$(top_builddir)/libvirt-glib/libvirt-glib-1.0.la \
+	$(top_builddir)/libvirt-gconfig/libvirt-gconfig-1.0.la \
+	libvirt-gobject-1.0.la
+LibvirtGObject_1_0_gir_FILES = \
+	$(GOBJECT_SOURCE_FILES) \
+	$(GOBJECT_HEADER_FILES) \
+	$(GOBJECT_GENERATED_FILES) \
+	$(NULL)
+LibvirtGObject_1_0_gir_CFLAGS = $(libvirt_gobject_1_0_la_CFLAGS)
+LibvirtGObject_1_0_gir_SCANNERFLAGS = \
+	--identifier-prefix=GVir --symbol-prefix=gvir \
+	--c-include="libvirt-gobject/libvirt-gobject.h" \
+	--include-uninstalled $(top_builddir)/libvirt-glib/LibvirtGLib-1.0.gir \
+	--include-uninstalled $(top_builddir)/libvirt-gconfig/LibvirtGConfig-1.0.gir \
+	$(NULL)
+INTROSPECTION_GIRS += LibvirtGObject-1.0.gir
 
 girdir = $(datadir)/gir-1.0
 gir_DATA = LibvirtGObject-1.0.gir
 
-typelibsdir = $(libdir)/girepository-1.0
-typelibs_DATA = LibvirtGObject-1.0.typelib
-
-%.typelib: %.gir
-	$(AM_V_GEN)$(G_IR_COMPILER) \
-                --includedir=$(top_builddir)/libvirt-glib \
-                --includedir=$(top_builddir)/libvirt-gconfig \
-                --includedir=$(builddir) \
-                --includedir=$(girdir) \
-                -o $@ $<
-
-CLEANFILES += $(gir_DATA) $(typelibs_DATA)
+typelibdir = $(libdir)/girepository-1.0
+typelib_DATA = LibvirtGObject-1.0.typelib
 
-endif # WITH_GOBJECT_INTROSPECTION
+CLEANFILES += $(gir_DATA) $(typelib_DATA)
+endif # HAVE_INTROSPECTION
-- 
1.8.4.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]