From: Andreas Rottmann <a.rottmann@gmx.at>
Subject: [PATCH] Bug 576595 - Please add gobject-introspection support

- Detect gobject-introspection (g-i) in configure, using the macro
  from introspection.m4 as installed by g-i; this adds g-i as a
  autogen.sh-time dependency, and as an *optional* build dependency

- Integrate the generation of .gir and .typelib files into the build
  build process

- Add the annotations from gir-repository to the source code

---
 Makefile.am                    |    1 +
 configure.in                   |    7 +++-
 libsoup/Makefile.am            |   35 +++++++++++++++-
 libsoup/soup-auth.c            |    2 +-
 libsoup/soup-cookie.c          |   16 ++++----
 libsoup/soup-date.c            |    2 +-
 libsoup/soup-form.c            |   10 +++--
 libsoup/soup-headers.c         |   33 +++++++++------
 libsoup/soup-message-body.c    |    2 +-
 libsoup/soup-message-headers.c |   11 +++--
 libsoup/soup-message.c         |    5 +-
 libsoup/soup-server.c          |   28 +++++++++----
 libsoup/soup-session.c         |    2 +-
 libsoup/soup-socket.c          |    4 +-
 libsoup/soup-xmlrpc.c          |    8 ++--
 m4/introspection.m4            |   88 ++++++++++++++++++++++++++++++++++++++++
 16 files changed, 203 insertions(+), 51 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 6c7dc3c..686e2e6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,6 @@
 ## Process this file with automake to produce Makefile.in
 AUTOMAKE_OPTIONS = 1.6
+ACLOCAL_AMFLAGS = -I m4
 
 SUBDIRS = libsoup tests docs
 
diff --git a/configure.in b/configure.in
index 8f506c3..0e321ad 100644
--- a/configure.in
+++ b/configure.in
@@ -5,7 +5,8 @@ dnl *******************************************
 AC_PREREQ(2.53)
 AC_INIT(libsoup, 2.26.1)
 AC_CONFIG_SRCDIR(libsoup-2.4.pc.in)
-AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
+AC_CONFIG_MACRO_DIR([m4])
+AM_INIT_AUTOMAKE([-Wno-portability])
 
 AM_CONFIG_HEADER(config.h)
 AM_MAINTAINER_MODE
@@ -227,6 +228,10 @@ dnl *** gtk-doc ***
 dnl ***************
 GTK_DOC_CHECK([1.0])
 
+dnl *****************************
+dnl *** gobject-introspection ***
+dnl *****************************
+GOBJECT_INTROSPECTION_CHECK([0.6.3])
 
 dnl *************************************
 dnl *** Warnings to show if using GCC ***
diff --git a/libsoup/Makefile.am b/libsoup/Makefile.am
index dc9ff55..0db4a9d 100644
--- a/libsoup/Makefile.am
+++ b/libsoup/Makefile.am
@@ -187,7 +187,40 @@ libsoup_gnome_2_4_la_SOURCES =		\
 
 endif
 
+if HAVE_INTROSPECTION
+BUILT_GIRSOURCES =
+
+# Core library
+gi_soup_files = $(filter-out soup.h, $(soup_headers)) \
+		$(libsoup_2_4_la_SOURCES)
+Soup-2.4.gir: $(INTROSPECTION_SCANNER) $(gi_soup_files)
+	$(INTROSPECTION_SCANNER) -v --namespace Soup --nsversion=2.4 \
+	    $(INCLUDES) \
+            --include=Gio-2.0 \
+            --library=soup-2.4 \
+	    --libtool="$(LIBTOOL)" \
+            --output $@ \
+	    $(gi_soup_files) 
+BUILT_GIRSOURCES += Soup-2.4.gir
+
+# TODO: GNOME integration library
+
+# INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to install
+# thing - we need to install inside our prefix.
+girdir = $(datadir)/gir-1.0
+gir_DATA = $(BUILT_GIRSOURCES)
+
+typelibsdir = $(libdir)/girepository-1.0/
+typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
+
+%.typelib: %.gir $(INTROSPECTION_COMPILER)
+	$(DEBUG) $(INTROSPECTION_COMPILER) --includedir=$(srcdir) --includedir=. $(INTROSPECTION_COMPILER_OPTS) $< -o $(builddir)/$(@F)
+
+CLEANFILES += $(BUILT_GIRSOURCES) $(typelibs_DATA)
+
+endif
+
 EXTRA_DIST=				\
 	soup-marshal.list		\
 	soup-enum-types.h.tmpl		\
-	soup-enum-types.c.tmpl
\ No newline at end of file
+	soup-enum-types.c.tmpl
diff --git a/libsoup/soup-auth.c b/libsoup/soup-auth.c
index d77fd82..ac778b9 100644
--- a/libsoup/soup-auth.c
+++ b/libsoup/soup-auth.c
@@ -478,7 +478,7 @@ soup_auth_get_authorization (SoupAuth *auth, SoupMessage *msg)
  * of @auth's protection space, unless otherwise discovered not to
  * be.)
  *
- * Return value: the list of paths, which must be freed with
+ * Return value: (element-type utf8): the list of paths, which must be freed with
  * soup_auth_free_protection_space().
  **/
 GSList *
diff --git a/libsoup/soup-cookie.c b/libsoup/soup-cookie.c
index 5e18bd0..3317ecf 100644
--- a/libsoup/soup-cookie.c
+++ b/libsoup/soup-cookie.c
@@ -782,8 +782,8 @@ soup_cookie_free (SoupCookie *cookie)
  * #SoupCookie<!-- -->s. Cookies that do not specify "path" or
  * "domain" attributes will have their values defaulted from @msg.
  *
- * Return value: a #GSList of #SoupCookie<!-- -->s, which can be freed
- * with soup_cookies_free().
+ * Return value: (element-type SoupCookie): a #GSList of
+ * #SoupCookie<!-- -->s, which can be freed with soup_cookies_free().
  *
  * Since: 2.24
  **/
@@ -828,8 +828,8 @@ soup_cookies_from_response (SoupMessage *msg)
  * pass a cookie returned from this method directly to
  * soup_cookies_to_response().)
  *
- * Return value: a #GSList of #SoupCookie<!-- -->s, which can be freed
- * with soup_cookies_free().
+ * Return value: (element-type SoupCookie): a #GSList of
+ * #SoupCookie<!-- -->s, which can be freed with soup_cookies_free().
  *
  * Since: 2.24
  **/
@@ -860,7 +860,7 @@ soup_cookies_from_request (SoupMessage *msg)
 
 /**
  * soup_cookies_to_response:
- * @cookies: a #GSList of #SoupCookie
+ * @cookies: (element-type SoupCookie): a #GSList of #SoupCookie
  * @msg: a #SoupMessage
  *
  * Appends a "Set-Cookie" response header to @msg for each cookie in
@@ -887,7 +887,7 @@ soup_cookies_to_response (GSList *cookies, SoupMessage *msg)
 
 /**
  * soup_cookies_to_request:
- * @cookies: a #GSList of #SoupCookie
+ * @cookies: (element-type SoupCookie): a #GSList of #SoupCookie
  * @msg: a #SoupMessage
  *
  * Adds the name and value of each cookie in @cookies to @msg's
@@ -916,7 +916,7 @@ soup_cookies_to_request (GSList *cookies, SoupMessage *msg)
 
 /**
  * soup_cookies_free:
- * @cookies: a #GSList of #SoupCookie
+ * @cookies: (element-type SoupCookie): a #GSList of #SoupCookie
  *
  * Frees @cookies.
  *
@@ -934,7 +934,7 @@ soup_cookies_free (GSList *cookies)
 
 /**
  * soup_cookies_to_cookie_header:
- * @cookies: a #GSList of #SoupCookie
+ * @cookies: (element-type SoupCookie): a #GSList of #SoupCookie
  *
  * Serializes a #GSList of #SoupCookie into a string suitable for
  * setting as the value of the "Cookie" header.
diff --git a/libsoup/soup-date.c b/libsoup/soup-date.c
index 13364ba..737b8f3 100644
--- a/libsoup/soup-date.c
+++ b/libsoup/soup-date.c
@@ -722,7 +722,7 @@ soup_date_to_time_t (SoupDate *date)
 /**
  * soup_date_to_timeval:
  * @date: a #SoupDate
- * @time: a #GTimeVal structure in which to store the converted time.
+ * @time: (out): a #GTimeVal structure in which to store the converted time.
  *
  * Converts @date to a #GTimeVal.
  *
diff --git a/libsoup/soup-form.c b/libsoup/soup-form.c
index a2103f7..9c18d77 100644
--- a/libsoup/soup-form.c
+++ b/libsoup/soup-form.c
@@ -78,8 +78,9 @@ form_decode (char *part)
  * Decodes @form, which is an urlencoded dataset as defined in the
  * HTML 4.01 spec.
  *
- * Return value: a hash table containing the name/value pairs from
- * @encoded_form, which you can free with g_hash_table_destroy().
+ * Return value: (element-type utf8 utf8): a hash table containing the
+ * name/value pairs from @encoded_form, which you can free with
+ * g_hash_table_destroy().
  **/
 GHashTable *
 soup_form_decode (const char *encoded_form)
@@ -269,7 +270,8 @@ soup_form_encode (const char *first_field, ...)
 
 /**
  * soup_form_encode_hash:
- * @form_data_set: a hash table containing name/value pairs (as strings)
+ * @form_data_set: (element-type utf8 utf8): a hash table containing
+ * name/value pairs (as strings)
  *
  * Encodes @form_data_set into a value of type
  * "application/x-www-form-urlencoded", as defined in the HTML 4.01
@@ -415,7 +417,7 @@ soup_form_request_new (const char *method, const char *uri,
  * soup_form_request_new_from_hash:
  * @method: the HTTP method, either "GET" or "POST"
  * @uri: the URI to send the form data to
- * @form_data_set: the data to send to @uri
+ * @form_data_set: (element-type utf8 utf8): the data to send to @uri
  *
  * Creates a new %SoupMessage and sets it up to send @form_data_set to
  * @uri via @method, as with soup_form_request_new().
diff --git a/libsoup/soup-headers.c b/libsoup/soup-headers.c
index f815db3..9f0cc2c 100644
--- a/libsoup/soup-headers.c
+++ b/libsoup/soup-headers.c
@@ -155,9 +155,12 @@ soup_headers_clean_for_10 (SoupMessageHeaders *hdrs)
  * @str: the header string (including the trailing blank line)
  * @len: length of @str up to (but not including) the terminating blank line.
  * @req_headers: #SoupMessageHeaders to store the header values in
- * @req_method: if non-%NULL, will be filled in with the request method
- * @req_path: if non-%NULL, will be filled in with the request path
- * @ver: if non-%NULL, will be filled in with the HTTP version
+ * @req_method: (out) (allow-none): if non-%NULL, will be filled in with the
+ * request method
+ * @req_path: (out) (allow-none): if non-%NULL, will be filled in with the
+ * request path
+ * @ver: (out) (allow-none): if non-%NULL, will be filled in with the HTTP
+ * version
  *
  * Parses the headers of an HTTP request in @str and stores the
  * results in @req_method, @req_path, @ver, and @req_headers.
@@ -259,10 +262,12 @@ soup_headers_parse_request (const char          *str,
 /**
  * soup_headers_parse_status_line:
  * @status_line: an HTTP Status-Line
- * @ver: if non-%NULL, will be filled in with the HTTP version
- * @status_code: if non-%NULL, will be filled in with the status code
- * @reason_phrase: if non-%NULL, will be filled in with the reason
- * phrase
+ * @ver: (out) (allow-none): if non-%NULL, will be filled in with the HTTP
+ * version
+ * @status_code: (out) (allow-none): if non-%NULL, will be filled in with
+ * the status code
+ * @reason_phrase: (out) (allow-none): if non-%NULL, will be filled in with
+ * the reason phrase
  *
  * Parses the HTTP Status-Line string in @status_line into @ver,
  * @status_code, and @reason_phrase. @status_line must be terminated by
@@ -331,10 +336,12 @@ soup_headers_parse_status_line (const char       *status_line,
  * @str: the header string (including the trailing blank line)
  * @len: length of @str up to (but not including) the terminating blank line.
  * @headers: #SoupMessageheaders to store the header values in
- * @ver: if non-%NULL, will be filled in with the HTTP version
- * @status_code: if non-%NULL, will be filled in with the status code
- * @reason_phrase: if non-%NULL, will be filled in with the reason
- * phrase
+ * @ver: (out) (allow-none): if non-%NULL, will be filled in with the HTTP
+ * version
+ * @status_code: (out) (allow-none): if non-%NULL, will be filled in with
+ * the status code
+ * @reason_phrase: (out) (allow-none): if non-%NULL, will be filled in with
+ * the reason phrase
  *
  * Parses the headers of an HTTP response in @str and stores the
  * results in @ver, @status_code, @reason_phrase, and @headers.
@@ -484,8 +491,8 @@ sort_by_qval (const void *a, const void *b)
 /**
  * soup_header_parse_quality_list:
  * @header: a header value
- * @unacceptable: on return, will contain a list of unacceptable
- * values
+ * @unacceptable: (out) (allow-none): on return, will contain a list of
+ * unacceptable values
  *
  * Parses a header whose content is a list of items with optional
  * "qvalue"s (eg, Accept, Accept-Charset, Accept-Encoding,
diff --git a/libsoup/soup-message-body.c b/libsoup/soup-message-body.c
index f3e75f7..d1d88aa 100644
--- a/libsoup/soup-message-body.c
+++ b/libsoup/soup-message-body.c
@@ -407,7 +407,7 @@ append_buffer (SoupMessageBody *body, SoupBuffer *buffer)
  * soup_message_body_append:
  * @body: a #SoupMessageBody
  * @use: how to use @data
- * @data: data to append
+ * @data: (array length=length) (element-type uint8): data to append
  * @length: length of @data
  *
  * Appends @length bytes from @data to @body according to @use.
diff --git a/libsoup/soup-message-headers.c b/libsoup/soup-message-headers.c
index f0abb78..5d74377 100644
--- a/libsoup/soup-message-headers.c
+++ b/libsoup/soup-message-headers.c
@@ -391,7 +391,8 @@ typedef struct {
 
 /**
  * soup_message_headers_iter_init:
- * @iter: a pointer to a %SoupMessageHeadersIter structure
+ * @iter: (out) (transfer none): a pointer to a %SoupMessageHeadersIter
+ * structure
  * @hdrs: a %SoupMessageHeaders
  *
  * Initializes @iter for iterating @hdrs.
@@ -408,9 +409,11 @@ soup_message_headers_iter_init (SoupMessageHeadersIter *iter,
 
 /**
  * soup_message_headers_iter_next:
- * @iter: a %SoupMessageHeadersIter
- * @name: pointer to a variable to return the header name in
- * @value: pointer to a variable to return the header value in
+ * @iter: (inout) (transfer none): a %SoupMessageHeadersIter
+ * @name: (out) (transfer none): pointer to a variable to return
+ * the header name in
+ * @value: (out) (transfer none): pointer to a variable to return
+ * the header value in
  *
  * Yields the next name/value pair in the %SoupMessageHeaders being
  * iterated by @iter. If @iter has already yielded the last header,
diff --git a/libsoup/soup-message.c b/libsoup/soup-message.c
index 68a21c1..a5fc707 100644
--- a/libsoup/soup-message.c
+++ b/libsoup/soup-message.c
@@ -694,9 +694,10 @@ soup_message_set_request (SoupMessage    *msg,
 /**
  * soup_message_set_response:
  * @msg: the message
- * @content_type: MIME Content-Type of the body
+ * @content_type: (allow-none): MIME Content-Type of the body
  * @resp_use: a #SoupMemoryUse describing how to handle @resp_body
- * @resp_body: a data buffer containing the body of the message response.
+ * @resp_body: (array length=resp_length) (element-type uint8): a data buffer
+ * containing the body of the message response.
  * @resp_length: the byte length of @resp_body.
  * 
  * Convenience function to set the response body of a #SoupMessage. If
diff --git a/libsoup/soup-server.c b/libsoup/soup-server.c
index e34fffb..e7ac152 100644
--- a/libsoup/soup-server.c
+++ b/libsoup/soup-server.c
@@ -576,6 +576,17 @@ get_property (GObject *object, guint prop_id,
 }
 
 /**
+ * SoupServerCallback:
+ * @server:
+ * @msg:
+ * @path:
+ * @query: (element-type utf8 utf8) (allow-none):
+ * @client:
+ * @user_data:
+ *
+ */
+
+/**
  * soup_server_new:
  * @optname1: name of first property to set
  * @...: value of @optname1, followed by additional property/value pairs
@@ -647,7 +658,7 @@ soup_server_is_https (SoupServer *server)
  * read-only; writing to it or modifiying it may cause @server to
  * malfunction.
  *
- * Return value: the listening socket.
+ * Return value: (transfer none): the listening socket.
  **/
 SoupSocket *
 soup_server_get_listener (SoupServer *server)
@@ -987,7 +998,7 @@ soup_server_quit (SoupServer *server)
  * context, so you will need to ref it yourself if you want it to
  * outlive its server.
  *
- * Return value: @server's #GMainContext, which may be %NULL
+ * Return value: (transfer none): @server's #GMainContext, which may be %NULL
  **/
 GMainContext *
 soup_server_get_async_context (SoupServer *server)
@@ -1044,7 +1055,8 @@ soup_client_context_get_type (void)
  * not get fooled when the allocator reuses the memory address of a
  * previously-destroyed socket to represent a new socket.
  *
- * Return value: the #SoupSocket that @client is associated with.
+ * Return value: (transfer none): the #SoupSocket that @client is
+ * associated with.
  **/
 SoupSocket *
 soup_client_context_get_socket (SoupClientContext *client)
@@ -1061,8 +1073,8 @@ soup_client_context_get_socket (SoupClientContext *client)
  * Retrieves the #SoupAddress associated with the remote end
  * of a connection.
  *
- * Return value: the #SoupAddress associated with the remote end of a
- * connection.
+ * Return value: (transfer none): the #SoupAddress associated with the
+ * remote end of a connection.
  **/
 SoupAddress *
 soup_client_context_get_address (SoupClientContext *client)
@@ -1101,8 +1113,8 @@ soup_client_context_get_host (SoupClientContext *client)
  * authenticated, and if so returns the #SoupAuthDomain that
  * authenticated it.
  *
- * Return value: a #SoupAuthDomain, or %NULL if the request was not
- * authenticated.
+ * Return value: (transfer none) (allow-none): a #SoupAuthDomain, or
+ * %NULL if the request was not authenticated.
  **/
 SoupAuthDomain *
 soup_client_context_get_auth_domain (SoupClientContext *client)
@@ -1191,7 +1203,7 @@ soup_client_context_get_auth_user (SoupClientContext *client)
 /**
  * soup_server_add_handler:
  * @server: a #SoupServer
- * @path: the toplevel path for the handler
+ * @path: (allow-none): the toplevel path for the handler
  * @callback: callback to invoke for requests under @path
  * @user_data: data for @callback
  * @destroy: destroy notifier to free @user_data
diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c
index cbaa42d..ff4886a 100644
--- a/libsoup/soup-session.c
+++ b/libsoup/soup-session.c
@@ -1256,7 +1256,7 @@ queue_message (SoupSession *session, SoupMessage *msg,
 /**
  * soup_session_queue_message:
  * @session: a #SoupSession
- * @msg: the message to queue
+ * @msg: (transfer full): the message to queue
  * @callback: a #SoupSessionCallback which will be called after the
  * message completes or when an unrecoverable error occurs.
  * @user_data: a pointer passed to @callback.
diff --git a/libsoup/soup-socket.c b/libsoup/soup-socket.c
index d3f77f9..32c90f0 100644
--- a/libsoup/soup-socket.c
+++ b/libsoup/soup-socket.c
@@ -1055,7 +1055,7 @@ soup_socket_is_connected (SoupSocket *sock)
  *
  * Returns the #SoupAddress corresponding to the local end of @sock.
  *
- * Return value: the #SoupAddress
+ * Return value: (transfer none): the #SoupAddress
  **/
 SoupAddress *
 soup_socket_get_local_address (SoupSocket *sock)
@@ -1085,7 +1085,7 @@ soup_socket_get_local_address (SoupSocket *sock)
  *
  * Returns the #SoupAddress corresponding to the remote end of @sock.
  *
- * Return value: the #SoupAddress
+ * Return value: (transfer none): the #SoupAddress
  **/
 SoupAddress *
 soup_socket_get_remote_address (SoupSocket *sock)
diff --git a/libsoup/soup-xmlrpc.c b/libsoup/soup-xmlrpc.c
index 63277b8..a3bd34d 100644
--- a/libsoup/soup-xmlrpc.c
+++ b/libsoup/soup-xmlrpc.c
@@ -545,8 +545,8 @@ parse_value (xmlNode *xmlvalue, GValue *value)
  * soup_xmlrpc_parse_method_call:
  * @method_call: the XML-RPC methodCall string
  * @length: the length of @method_call, or -1 if it is NUL-terminated
- * @method_name: on return, the methodName from @method_call
- * @params: on return, the parameters from @method_call
+ * @method_name: (out): on return, the methodName from @method_call
+ * @params: (out): on return, the parameters from @method_call
  *
  * Parses @method_call to get the name and parameters, and returns the
  * parameter values in a #GValueArray; see also
@@ -612,7 +612,7 @@ fail:
  * soup_xmlrpc_extract_method_call:
  * @method_call: the XML-RPC methodCall string
  * @length: the length of @method_call, or -1 if it is NUL-terminated
- * @method_name: on return, the methodName from @method_call
+ * @method_name: (out): on return, the methodName from @method_call
  * @...: return types and locations for parameters
  *
  * Parses @method_call to get the name and parameters, and puts
@@ -652,7 +652,7 @@ soup_xmlrpc_extract_method_call (const char *method_call, int length,
  * soup_xmlrpc_parse_method_response:
  * @method_response: the XML-RPC methodResponse string
  * @length: the length of @method_response, or -1 if it is NUL-terminated
- * @value: on return, the return value from @method_call
+ * @value: (out): on return, the return value from @method_call
  * @error: error return value
  *
  * Parses @method_response and returns the return value in @value. If
diff --git a/m4/introspection.m4 b/m4/introspection.m4
new file mode 100644
index 0000000..f9ce49c
--- /dev/null
+++ b/m4/introspection.m4
@@ -0,0 +1,88 @@
+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)"
+    fi
+    AC_SUBST(INTROSPECTION_SCANNER)
+    AC_SUBST(INTROSPECTION_COMPILER)
+    AC_SUBST(INTROSPECTION_GENERATE)
+    AC_SUBST(INTROSPECTION_GIRDIR)
+    AC_SUBST(INTROSPECTION_TYPELIBDIR)
+
+    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])
+])
-- 
tg: (13ab5e6..) t/g-i (depends on: master)
