[gxml] Improbed Autotools, GObject Introspection support.



commit bdf265f8641bab11ef1c913a809074524e9c8931
Author: Daniel Espinosa Ortiz <despinosa git gnome org>
Date:   Thu Nov 17 13:21:51 2011 -0600

    Improbed Autotools, GObject Introspection support.
    
    * Remains an issue on typelib generation, may be due to nested namespaces

 configure.ac           |   21 ++++++++-
 gxml/Makefile.am       |   31 +++++++++++++-
 gxml/libgxml-1.0.pc.in |    2 +-
 m4/introspection.m4    |  103 ++++++++++++++++++++++++++++++++++++++++++++++++
 po/POTFILES            |    1 +
 5 files changed, 152 insertions(+), 6 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 5544066..3784a8c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,7 @@
 dnl Process this file with autoconf to produce a configure script.
-dnl Created by Anjuta application wizard.
+
+AC_CONFIG_MACRO_DIR([m4])
+m4_include(m4/introspection.m4)
 
 AC_INIT(gxml, 1.0)
 
@@ -13,7 +15,6 @@ AC_PROG_CC
 
 
 
-
 dnl ***************************************************************************
 dnl Internationalization
 dnl ***************************************************************************
@@ -50,7 +51,7 @@ VALA_VAPIDIR=`pkg-config $VALA_MODULES --variable=vapidir`
 AC_SUBST(VALA_VAPIDIR)
 
 dnl Check for libgee
-GEE_REQUIRED="0.6.2"
+GEE_REQUIRED="0.6.1"
 
 PKG_CHECK_MODULES(GEE, gee-1.0 >= $GEE_REQUIRED)
 AC_SUBST(GEE_CFLAGS)
@@ -69,9 +70,23 @@ PKG_CHECK_MODULES(GIO, $GIO_MODULES)
 AC_SUBST(GIO_CFLAGS)
 AC_SUBST(GIO_LIBS)
 
+dnl Check for GObject Introspection
+GOBJECT_INTROSPECTION_CHECK([0.6.7])
+
+AC_ARG_ENABLE([gi-system-install],
+    AS_HELP_STRING([--enable-gi-system-install], [Install GObject Introspection files along with system installed files [default=yes]]),
+    [enable_gi_system_install=$enableval],[enable_gi_system_install=yes])
+AM_CONDITIONAL(ENABLE_GI_SYSTEM_INSTALL, [test x"$enable_gi_system_install" = "xyes"])
 
 AC_OUTPUT([
 Makefile
 gxml/libgxml-1.0.pc
 gxml/Makefile
 po/Makefile.in])
+
+dnl Print configuration summary
+echo ""
+echo " Configuration summary for GXml"
+echo "   Installation prefix = $prefix"
+echo "   Enable GObject Introspection System Install: `if test x$enable_gi_system_install != xno; then echo yes; else echo no; fi`"
+echo ""
diff --git a/gxml/Makefile.am b/gxml/Makefile.am
index 8108666..0351adb 100644
--- a/gxml/Makefile.am
+++ b/gxml/Makefile.am
@@ -61,11 +61,11 @@ libgxml_la_SOURCES = \
 	$(libgxml_la_VALASOURCES:.vala=.c) \
 	$(NULL)	
 
-gxml-1.0.vapi gxml.vala.stamp: $(libgxml_la_VALASOURCES)
+gxml-1.0.vapi gxml.vala.stamp GXml-1.0.gir: $(libgxml_la_VALASOURCES)
 	$(VALA_COMPILER) $(VALAFLAGS) -C -H gxml.h --gir=GXml-1.0.gir --vapidir=$(top_srcdir)/vapi --library gxml-1.0 $^
 	@touch $@
 
-CLEANFILES+= gxml-1.0.vapi GXml-1.0.gir
+
 
 libgxml_la_LDFLAGS = 
 
@@ -85,6 +85,33 @@ include_HEADERS = \
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libgxml-1.0.pc
 
+gxmlincludedir=$(includedir)/libgxml-1.0/libgxml
+gxmlinclude_HEADERS= libgxml.h
+
+# GObject Introspection
+
+if ENABLE_GI_SYSTEM_INSTALL
+girdir = $(INTROSPECTION_GIRDIR)
+typelibsdir = $(INTROSPECTION_TYPELIBDIR)
+else
+girdir = $(datadir)/gir-1.0
+typelibsdir = $(libdir)/girepository-1.0
+endif
+
+# GIR files are generated automatically by Valac then is not necessary to scan source code to generate it
+INTROSPECTION_GIRS =
+INTROSPECTION_GIRS += GXml-1.0.gir
+INTROSPECTION_COMPILER_ARGS = 
+
+GXml-1.0.typelib: $(INTROSPECTION_GIRS)
+	$(INTROSPECTION_COMPILER) $(INTROSPECTION_COMPILER_ARGS) --includedir=. $< -o $@
+
+gir_DATA = $(INTROSPECTION_GIRS)
+typelibs_DATA = GXml-1.0.typelib
+
+
+CLEANFILES += $(INTROSPECTION_GIRS) $(typelibs_DATA) gxml-1.0.vapi
+
 EXTRA_DIST = \
 	libgxml-1.0.pc.in \
 	$(libgxml_la_VALASOURCES) \
diff --git a/gxml/libgxml-1.0.pc.in b/gxml/libgxml-1.0.pc.in
index 4a4a372..bc7d787 100644
--- a/gxml/libgxml-1.0.pc.in
+++ b/gxml/libgxml-1.0.pc.in
@@ -6,7 +6,7 @@ datadir= datadir@
 includedir= includedir@/libgxml-1.0
 
 Name: libgxml
-Description: Sample library created by Anjuta project wizard.
+Description: GObject API for XML manipulation library
 Version: @VERSION@
 Requires: 
 Libs: -L${libdir} -lgxml
diff --git a/m4/introspection.m4 b/m4/introspection.m4
new file mode 100644
index 0000000..f11f5f4
--- /dev/null
+++ b/m4/introspection.m4
@@ -0,0 +1,103 @@
+dnl -*- mode: autoconf -*-
+dnl Copyright 2009 Johan Dahlin
+dnl
+dnl This file is free software; the author(s) gives unlimited
+dnl permission to copy and/or distribute it, with or without
+dnl modifications, as long as this notice is preserved.
+dnl
+
+# serial 1
+
+m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL],
+[
+    AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
+    AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
+    AC_BEFORE([LT_INIT],[$0])dnl setup libtool first
+
+    dnl enable/disable introspection
+    m4_if([$2], [require],
+    [dnl
+        enable_introspection=yes
+    ],[dnl
+        AC_ARG_ENABLE(introspection,
+                  AS_HELP_STRING([--enable-introspection[=@<:@no/auto/yes@:>@]],
+                                 [Enable introspection for this build]),, 
+                                 [enable_introspection=auto])
+    ])dnl
+
+    AC_MSG_CHECKING([for gobject-introspection])
+
+    dnl presence/version checking
+    AS_CASE([$enable_introspection],
+    [no], [dnl
+        found_introspection="no (disabled, use --enable-introspection to enable)"
+    ],dnl
+    [yes],[dnl
+        PKG_CHECK_EXISTS([gobject-introspection-1.0],,
+                         AC_MSG_ERROR([gobject-introspection-1.0 is not installed]))
+        PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1],
+                         found_introspection=yes,
+                         AC_MSG_ERROR([You need to have gobject-introspection >= $1 installed to build AC_PACKAGE_NAME]))
+    ],dnl
+    [auto],[dnl
+        PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], found_introspection=yes, found_introspection=no)
+    ],dnl
+    [dnl	
+        AC_MSG_ERROR([invalid argument passed to --enable-introspection, should be one of @<:@no/auto/yes@:>@])
+    ])dnl
+
+    AC_MSG_RESULT([$found_introspection])
+
+    INTROSPECTION_SCANNER=
+    INTROSPECTION_COMPILER=
+    INTROSPECTION_GENERATE=
+    INTROSPECTION_GIRDIR=
+    INTROSPECTION_TYPELIBDIR=
+    introspection_makefile=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection
+    if test "x$found_introspection" = "xyes"; then
+        AC_MSG_CHECKING([if gobject-introspection is correctly installed])
+        if test -f $introspection_makefile; then
+            INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
+            INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
+            INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
+            INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0`
+            INTROSPECTION_GIRDIR=${INTROSPECTION_GIRDIR/$datadir/\$(datadir)}
+            INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
+            INTROSPECTION_TYPELIBDIR=${INTROSPECTION_TYPELIBDIR/$libdir/\$(libdir)}
+            INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0`
+            INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0`
+            INTROSPECTION_MAKEFILE=$introspection_makefile
+        else
+           found_introspection=no
+        fi
+        AC_MSG_RESULT([$found_introspection])
+    fi
+    AC_SUBST(INTROSPECTION_SCANNER)
+    AC_SUBST(INTROSPECTION_COMPILER)
+    AC_SUBST(INTROSPECTION_GENERATE)
+    AC_SUBST(INTROSPECTION_GIRDIR)
+    AC_SUBST(INTROSPECTION_TYPELIBDIR)
+    AC_SUBST(INTROSPECTION_CFLAGS)
+    AC_SUBST(INTROSPECTION_LIBS)
+    AC_SUBST(INTROSPECTION_MAKEFILE)
+
+    AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes")
+])
+
+
+dnl Usage:
+dnl   GOBJECT_INTROSPECTION_CHECK([minimum-g-i-version])
+
+AC_DEFUN([GOBJECT_INTROSPECTION_CHECK],
+[
+  _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1])
+])
+
+dnl Usage:
+dnl   GOBJECT_INTROSPECTION_REQUIRE([minimum-g-i-version])
+
+
+AC_DEFUN([GOBJECT_INTROSPECTION_REQUIRE],
+[
+  _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1], [require])
+])
diff --git a/po/POTFILES b/po/POTFILES
new file mode 100644
index 0000000..456c6b4
--- /dev/null
+++ b/po/POTFILES
@@ -0,0 +1 @@
+	../src/lib.c



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