Setup GObject introspection
authorAlberto Mardegan <mardy@users.sourceforge.net>
Tue, 29 Nov 2011 14:08:37 +0000 (16:08 +0200)
committerAlberto Mardegan <mardy@users.sourceforge.net>
Tue, 29 Nov 2011 14:08:37 +0000 (16:08 +0200)
Makefile.am
configure.ac
libsignon-glib/Makefile.am
libsignon-glib/signon-auth-service.c
libsignon-glib/signon-identity.c
m4/introspection.m4 [new file with mode: 0644]

index c04cad2..a23d56c 100644 (file)
@@ -1,3 +1,7 @@
+ACLOCAL_AMFLAGS = -I m4
+DISTCHECK_CONFIGURE_FLAGS = \
+       --enable-gtk-doc \
+       --enable-introspection
 SUBDIRS = libsignon-glib docs tests
 
 pkgconfigdir = $(libdir)/pkgconfig
@@ -6,4 +10,6 @@ pkgconfig_DATA = libsignon-glib.pc
 libsignondocdir = ${prefix}/doc/reference
 libsignondoc_DATA= README COPYING AUTHORS ChangeLog INSTALL NEWS
 
-EXTRA_DIST = $(libsignondoc_DATA)
+EXTRA_DIST = \
+       $(libsignondoc_DATA) \
+       m4/introspection.m4
index 8d9dbc5..db101c6 100644 (file)
@@ -5,6 +5,10 @@ AC_INIT(libsignon-glib, 1.1)
 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
 AM_CONFIG_HEADER(config.h)
 
+# Gobject Introspection
+AC_CONFIG_MACRO_DIR([m4])
+GOBJECT_INTROSPECTION_CHECK([1.30.0])
+
 PKG_CHECK_MODULES(
        DEPS,
        glib-2.0
index f8e587d..17018bf 100644 (file)
@@ -98,3 +98,38 @@ signon-enum-types.c: Makefile signon-errors.h
 
 EXTRA_DIST = signon-marshal.list \
             stamp-signon-enum-types.h
+
+-include $(INTROSPECTION_MAKEFILE)
+INTROSPECTION_GIRS =
+INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir)
+INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
+
+if HAVE_INTROSPECTION
+introspection_sources = \
+       signon-auth-service.c \
+       signon-auth-service.h \
+       signon-auth-session.c \
+       signon-auth-session.h \
+       signon-enum-types.h \
+       signon-enum-types.c \
+       signon-errors.c \
+       signon-errors.h \
+       signon-identity.c \
+       signon-identity.h
+
+Signon-1.0.gir: libsignon-glib.la
+Signon_1_0_gir_INCLUDES = GObject-2.0
+Signon_1_0_gir_SCANNERFLAGS = --identifier-prefix=Signon --symbol-prefix=signon
+Signon_1_0_gir_CFLAGS = $(DEPS_CFLAGS)
+Signon_1_0_gir_LIBS = libsignon-glib.la
+Signon_1_0_gir_FILES = $(introspection_sources)
+INTROSPECTION_GIRS += Signon-1.0.gir
+
+girdir = $(datadir)/gir-1.0
+gir_DATA = $(INTROSPECTION_GIRS)
+
+typelibdir = $(libdir)/girepository-1.0
+typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
+
+CLEANFILES += $(gir_DATA) $(typelib_DATA)
+endif
index 814428e..cc91189 100644 (file)
@@ -122,7 +122,6 @@ signon_auth_service_class_init (SignonAuthServiceClass *klass)
 
 /**
  * signon_auth_service_new:
- * @type: the name of the service type.
  *
  * Returns: an instance of an #SignonAuthService.
  */
index c38ae66..f352da0 100644 (file)
@@ -568,7 +568,6 @@ signon_identity_new_from_db (guint32 id)
 
 /**
  * signon_identity_new
- * @id: identity ID.
  *
  * Construct an identity object associated with an existing identity record.
  * Returns: an instance of an #SignonIdentity.
@@ -1452,7 +1451,7 @@ identity_void_operation(SignonIdentity *self,
 /**
  * signon_identity_remove:
  * @cb: callback
- * @user_data : user_data.
+ * @user_data: user_data.
  *
  * Removes correspondent credentials record
  */
@@ -1482,7 +1481,7 @@ void signon_identity_remove(SignonIdentity *self,
 /**
  * signon_identity_signout:
  * @cb: callback
- * @user_data : user_data.
+ * @user_data: user_data.
  *
  * Makes SignOut
  */
@@ -1511,7 +1510,7 @@ void signon_identity_signout(SignonIdentity *self,
  * signon_identity_add_reference:
  * @reference: reference to be added
  * @cb: callback
- * @user_data : user_data.
+ * @user_data: user_data.
  *
  * Adds named reference to identity
  */
@@ -1535,7 +1534,7 @@ void signon_identity_add_reference(SignonIdentity *self,
  * signon_identity_remove_reference:
  * @reference: reference to be removed
  * @cb: callback
- * @user_data : user_data.
+ * @user_data: user_data.
  *
  * Removes named reference from identity
  */
@@ -1558,7 +1557,7 @@ void signon_identity_remove_reference(SignonIdentity *self,
 /**
  * signon_identity_info:
  * @cb: callback
- * @user_data : user_data.
+ * @user_data: user_data.
  *
  * Returns info of the associated record in credentials DB (NULL for new identity)
  */
diff --git a/m4/introspection.m4 b/m4/introspection.m4
new file mode 100644 (file)
index 0000000..589721c
--- /dev/null
@@ -0,0 +1,94 @@
+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=
+    if test "x$found_introspection" = "xyes"; 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_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
+       INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0`
+       INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0`
+       INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.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])
+])