diff --git a/configure.in b/configure.in
index 03dde29..eff723d 100644
--- a/configure.in
+++ b/configure.in
@@ -61,6 +61,32 @@ GETTEXT_PACKAGE=AC_PACKAGE_NAME
 AC_SUBST(GETTEXT_PACKAGE)
 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
 
+
+
+# GObject Introspection
+have_introspection=false
+PKG_CHECK_MODULES(INTROSPECTION, gobject-introspection-1.0 >= 0.6.4, have_introspection=true, have_introspection=false)
+AM_CONDITIONAL(HAVE_INTROSPECTION, $have_introspection)
+
+G_IR_SCANNER=
+G_IR_COMPILER=
+G_IR_GENERATE=
+GIRDIR=
+TYPELIBDIR=
+if $have_introspection; then
+   G_IR_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
+   G_IR_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
+   G_IR_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
+   GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0`
+   TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
+fi
+AC_SUBST(G_IR_SCANNER)
+AC_SUBST(G_IR_COMPILER)
+AC_SUBST(G_IR_GENERATE)
+AC_SUBST(GIRDIR)
+AC_SUBST(TYPELIBDIR)
+
+
 dnl Checks for libraries.
 ifelse([
   If we defined the module lists on the M4 level, we could have problems
diff --git a/gsf/Makefile.am b/gsf/Makefile.am
index b09a2fe..00a2a28 100644
--- a/gsf/Makefile.am
+++ b/gsf/Makefile.am
@@ -148,3 +148,38 @@ gsf-1.lib: libgsf-1.la lib.def
 CLEANFILES = gsf-1.exp gsf-1.lib
 endif
 
+
+BUILT_GIRSOURCES = Gsf-1.gir
+
+Gsf-1.gir: $(libgsf_1_include_HEADERS)
+Gsf-1.gir: $(NOINST_H_FILES)
+Gsf-1.gir: $(libgsf_1_la_SOURCES)
+Gsf-1.gir: libgsf-1.la
+Gsf-1.gir: $(G_IR_SCANNER) Makefile
+	$(AM_V_GEN) $(G_IR_SCANNER) -v --namespace Gsf --nsversion=1 \
+	    --add-include-path=$(srcdir) --add-include-path=. \
+	    --include=GObject-2.0 \
+	    --include=Gio-2.0 \
+	    --include=libxml2-2.0 \
+	    --library=libgsf-1.la \
+	    --libtool="$(LIBTOOL)" \
+	    --output $@ \
+	    --pkg libgsf-1 \
+	    -I$(top_srcdir) \
+	    $(libgsf_1_include_HEADERS) $(libgsf_1_la_SOURCES)
+if HAVE_INTROSPECTION
+
+girdir = $(GIRDIR)
+gir_DATA = $(BUILT_GIRSOURCES)
+
+typelibsdir = $(TYPELIBDIR)
+typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
+
+%.typelib: %.gir $(G_IR_COMPILER)
+	$(AM_V_GEN) LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}. $(G_IR_COMPILER) --includedir=$(srcdir) --includedir=. $(G_IR_COMPILER_OPTS) $< -o $(builddir)/$(@F)
+
+endif # HAVE_INTROSPECTION
+
+
+
+
