--- configure.orig	2013-12-15 11:12:43.000000000 +0100
+++ configure	2013-12-15 11:18:53.000000000 +0100
@@ -620,14 +620,16 @@
 WITH_VALA_FALSE
 WITH_VALA_TRUE
 VAPIGEN
-G_IR_SCANNER_SYMBOL_PREFIX_FALSE
-G_IR_SCANNER_SYMBOL_PREFIX_TRUE
-WITH_GOBJECT_INTROSPECTION_FALSE
-WITH_GOBJECT_INTROSPECTION_TRUE
-G_IR_COMPILER
-G_IR_SCANNER
-GOBJECT_INTROSPECTION_LIBS
-GOBJECT_INTROSPECTION_CFLAGS
+HAVE_INTROSPECTION_FALSE
+HAVE_INTROSPECTION_TRUE
+INTROSPECTION_MAKEFILE
+INTROSPECTION_LIBS
+INTROSPECTION_CFLAGS
+INTROSPECTION_TYPELIBDIR
+INTROSPECTION_GIRDIR
+INTROSPECTION_GENERATE
+INTROSPECTION_COMPILER
+INTROSPECTION_SCANNER
 ENABLE_PLUGIN_FALSE
 ENABLE_PLUGIN_TRUE
 WITH_EXAMPLES_FALSE
@@ -915,9 +917,7 @@
 FIREFOX_PLUGIN_CFLAGS
 FIREFOX_PLUGIN_LIBS
 MOZILLA_PLUGIN_CFLAGS
-MOZILLA_PLUGIN_LIBS
-GOBJECT_INTROSPECTION_CFLAGS
-GOBJECT_INTROSPECTION_LIBS'
+MOZILLA_PLUGIN_LIBS'
 
 
 # Initialize some variables set by options.
@@ -1555,7 +1555,8 @@
   --enable-iso-c          Try to warn if code is not ISO C
   --enable-plugin=no/yes enable browser plugin default=no
   --disable-rebuilds      disable all source autogeneration rules
-  --enable-introspection  enable GObject introspection
+  --enable-introspection=[no/auto/yes]
+                          Enable introspection for this build
   --enable-vala           enable Vala binding generation
 
 Optional Packages:
@@ -1624,11 +1625,6 @@
               C compiler flags for MOZILLA_PLUGIN, overriding pkg-config
   MOZILLA_PLUGIN_LIBS
               linker flags for MOZILLA_PLUGIN, overriding pkg-config
-  GOBJECT_INTROSPECTION_CFLAGS
-              C compiler flags for GOBJECT_INTROSPECTION, overriding
-              pkg-config
-  GOBJECT_INTROSPECTION_LIBS
-              linker flags for GOBJECT_INTROSPECTION, overriding pkg-config
 
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
@@ -15735,286 +15731,98 @@
 fi
 
 
-# Check whether --enable-introspection was given.
-if test "${enable_introspection+set}" = set; then :
-  enableval=$enable_introspection;
-else
-  enable_introspection=check
-fi
-
-
-has_symbol_prefix=no
-if test "x$enable_introspection" != "xno" ; then
-
-pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GOBJECT_INTROSPECTION" >&5
-$as_echo_n "checking for GOBJECT_INTROSPECTION... " >&6; }
-
-if test -n "$GOBJECT_INTROSPECTION_CFLAGS"; then
-    pkg_cv_GOBJECT_INTROSPECTION_CFLAGS="$GOBJECT_INTROSPECTION_CFLAGS"
- elif test -n "$PKG_CONFIG"; then
-    if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gobject-introspection-1.0 >= \$GOBJECT_INTROSPECTION_DESIRED\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_DESIRED") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then
-  pkg_cv_GOBJECT_INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags "gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_DESIRED" 2>/dev/null`
-else
-  pkg_failed=yes
-fi
- else
-    pkg_failed=untried
-fi
-if test -n "$GOBJECT_INTROSPECTION_LIBS"; then
-    pkg_cv_GOBJECT_INTROSPECTION_LIBS="$GOBJECT_INTROSPECTION_LIBS"
- elif test -n "$PKG_CONFIG"; then
-    if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gobject-introspection-1.0 >= \$GOBJECT_INTROSPECTION_DESIRED\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_DESIRED") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then
-  pkg_cv_GOBJECT_INTROSPECTION_LIBS=`$PKG_CONFIG --libs "gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_DESIRED" 2>/dev/null`
-else
-  pkg_failed=yes
-fi
- else
-    pkg_failed=untried
-fi
-
-
 
-if test $pkg_failed = yes; then
-   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
 
-if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
-        _pkg_short_errors_supported=yes
+                # Check whether --enable-introspection was given.
+if test "${enable_introspection+set}" = set; then :
+  enableval=$enable_introspection;
 else
-        _pkg_short_errors_supported=no
+  enable_introspection=auto
 fi
-        if test $_pkg_short_errors_supported = yes; then
-	        GOBJECT_INTROSPECTION_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_DESIRED" 2>&1`
-        else
-	        GOBJECT_INTROSPECTION_PKG_ERRORS=`$PKG_CONFIG --print-errors "gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_DESIRED" 2>&1`
-        fi
-	# Put the nasty error message in config.log where it belongs
-	echo "$GOBJECT_INTROSPECTION_PKG_ERRORS" >&5
-
 
 
-pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GOBJECT_INTROSPECTION" >&5
-$as_echo_n "checking for GOBJECT_INTROSPECTION... " >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gobject-introspection" >&5
+$as_echo_n "checking for gobject-introspection... " >&6; }
 
-if test -n "$GOBJECT_INTROSPECTION_CFLAGS"; then
-    pkg_cv_GOBJECT_INTROSPECTION_CFLAGS="$GOBJECT_INTROSPECTION_CFLAGS"
- elif test -n "$PKG_CONFIG"; then
-    if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gobject-introspection-1.0 >= \$GOBJECT_INTROSPECTION_REQUIRED\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_REQUIRED") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then
-  pkg_cv_GOBJECT_INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags "gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_REQUIRED" 2>/dev/null`
-else
-  pkg_failed=yes
-fi
- else
-    pkg_failed=untried
-fi
-if test -n "$GOBJECT_INTROSPECTION_LIBS"; then
-    pkg_cv_GOBJECT_INTROSPECTION_LIBS="$GOBJECT_INTROSPECTION_LIBS"
- elif test -n "$PKG_CONFIG"; then
-    if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gobject-introspection-1.0 >= \$GOBJECT_INTROSPECTION_REQUIRED\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_REQUIRED") 2>&5
+        case $enable_introspection in #(
+  no) :
+            found_introspection="no (disabled, use --enable-introspection to enable)"
+     ;; #(
+      yes) :
+            if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gobject-introspection-1.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "gobject-introspection-1.0") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_GOBJECT_INTROSPECTION_LIBS=`$PKG_CONFIG --libs "gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_REQUIRED" 2>/dev/null`
-else
-  pkg_failed=yes
-fi
- else
-    pkg_failed=untried
-fi
-
-
-
-if test $pkg_failed = yes; then
-   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
-        _pkg_short_errors_supported=yes
-else
-        _pkg_short_errors_supported=no
-fi
-        if test $_pkg_short_errors_supported = yes; then
-	        GOBJECT_INTROSPECTION_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_REQUIRED" 2>&1`
-        else
-	        GOBJECT_INTROSPECTION_PKG_ERRORS=`$PKG_CONFIG --print-errors "gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_REQUIRED" 2>&1`
-        fi
-	# Put the nasty error message in config.log where it belongs
-	echo "$GOBJECT_INTROSPECTION_PKG_ERRORS" >&5
-
-
-                                 if test "x$enable_introspection" = "xcheck"; then
-			           enable_introspection=no
-                                 else
-                                   as_fn_error $? "gobject-introspection is not available" "$LINENO" 5
-                                 fi
-
-elif test $pkg_failed = untried; then
-     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-                                 if test "x$enable_introspection" = "xcheck"; then
-			           enable_introspection=no
-                                 else
-                                   as_fn_error $? "gobject-introspection is not available" "$LINENO" 5
-                                 fi
-
+  :
 else
-	GOBJECT_INTROSPECTION_CFLAGS=$pkg_cv_GOBJECT_INTROSPECTION_CFLAGS
-	GOBJECT_INTROSPECTION_LIBS=$pkg_cv_GOBJECT_INTROSPECTION_LIBS
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-                                 enable_introspection=yes
-                                 has_symbol_prefix=no
-
+  as_fn_error $? "gobject-introspection-1.0 is not installed" "$LINENO" 5
 fi
-
-elif test $pkg_failed = untried; then
-     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-
-pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GOBJECT_INTROSPECTION" >&5
-$as_echo_n "checking for GOBJECT_INTROSPECTION... " >&6; }
-
-if test -n "$GOBJECT_INTROSPECTION_CFLAGS"; then
-    pkg_cv_GOBJECT_INTROSPECTION_CFLAGS="$GOBJECT_INTROSPECTION_CFLAGS"
- elif test -n "$PKG_CONFIG"; then
-    if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gobject-introspection-1.0 >= \$GOBJECT_INTROSPECTION_REQUIRED\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_REQUIRED") 2>&5
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gobject-introspection-1.0 >= 0.9.4\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "gobject-introspection-1.0 >= 0.9.4") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_GOBJECT_INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags "gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_REQUIRED" 2>/dev/null`
+  found_introspection=yes
 else
-  pkg_failed=yes
-fi
- else
-    pkg_failed=untried
+  as_fn_error $? "You need to have gobject-introspection >= 0.9.4 installed to build gtk-vnc" "$LINENO" 5
 fi
-if test -n "$GOBJECT_INTROSPECTION_LIBS"; then
-    pkg_cv_GOBJECT_INTROSPECTION_LIBS="$GOBJECT_INTROSPECTION_LIBS"
- elif test -n "$PKG_CONFIG"; then
-    if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gobject-introspection-1.0 >= \$GOBJECT_INTROSPECTION_REQUIRED\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_REQUIRED") 2>&5
+     ;; #(
+      auto) :
+            if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gobject-introspection-1.0 >= 0.9.4\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "gobject-introspection-1.0 >= 0.9.4") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_GOBJECT_INTROSPECTION_LIBS=`$PKG_CONFIG --libs "gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_REQUIRED" 2>/dev/null`
+  found_introspection=yes
 else
-  pkg_failed=yes
-fi
- else
-    pkg_failed=untried
+  found_introspection=no
 fi
+		enable_introspection=$found_introspection
+     ;; #(
+  *) :
+                as_fn_error $? "invalid argument passed to --enable-introspection, should be one of [no/auto/yes]" "$LINENO" 5
+     ;;
+esac
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $found_introspection" >&5
+$as_echo "$found_introspection" >&6; }
 
+    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
 
 
-if test $pkg_failed = yes; then
-   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
-        _pkg_short_errors_supported=yes
-else
-        _pkg_short_errors_supported=no
-fi
-        if test $_pkg_short_errors_supported = yes; then
-	        GOBJECT_INTROSPECTION_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_REQUIRED" 2>&1`
-        else
-	        GOBJECT_INTROSPECTION_PKG_ERRORS=`$PKG_CONFIG --print-errors "gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_REQUIRED" 2>&1`
-        fi
-	# Put the nasty error message in config.log where it belongs
-	echo "$GOBJECT_INTROSPECTION_PKG_ERRORS" >&5
-
 
-                                 if test "x$enable_introspection" = "xcheck"; then
-			           enable_introspection=no
-                                 else
-                                   as_fn_error $? "gobject-introspection is not available" "$LINENO" 5
-                                 fi
 
-elif test $pkg_failed = untried; then
-     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
 
-                                 if test "x$enable_introspection" = "xcheck"; then
-			           enable_introspection=no
-                                 else
-                                   as_fn_error $? "gobject-introspection is not available" "$LINENO" 5
-                                 fi
 
-else
-	GOBJECT_INTROSPECTION_CFLAGS=$pkg_cv_GOBJECT_INTROSPECTION_CFLAGS
-	GOBJECT_INTROSPECTION_LIBS=$pkg_cv_GOBJECT_INTROSPECTION_LIBS
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
 
-                                 enable_introspection=yes
-                                 has_symbol_prefix=no
 
-fi
 
+     if test "x$found_introspection" = "xyes"; then
+  HAVE_INTROSPECTION_TRUE=
+  HAVE_INTROSPECTION_FALSE='#'
 else
-	GOBJECT_INTROSPECTION_CFLAGS=$pkg_cv_GOBJECT_INTROSPECTION_CFLAGS
-	GOBJECT_INTROSPECTION_LIBS=$pkg_cv_GOBJECT_INTROSPECTION_LIBS
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-                             enable_introspection=yes
-                             has_symbol_prefix=yes
-
+  HAVE_INTROSPECTION_TRUE='#'
+  HAVE_INTROSPECTION_FALSE=
 fi
 
-        if test "x$enable_introspection" = "xyes" ; then
-
-$as_echo "#define WITH_GOBJECT_INTROSPECTION 1" >>confdefs.h
-
-
-
-          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)
-
-        fi
-fi
- if test "x$enable_introspection" = "xyes"; then
-  WITH_GOBJECT_INTROSPECTION_TRUE=
-  WITH_GOBJECT_INTROSPECTION_FALSE='#'
-else
-  WITH_GOBJECT_INTROSPECTION_TRUE='#'
-  WITH_GOBJECT_INTROSPECTION_FALSE=
-fi
-
- if test "x$has_symbol_prefix" = "xyes"; then
-  G_IR_SCANNER_SYMBOL_PREFIX_TRUE=
-  G_IR_SCANNER_SYMBOL_PREFIX_FALSE='#'
-else
-  G_IR_SCANNER_SYMBOL_PREFIX_TRUE='#'
-  G_IR_SCANNER_SYMBOL_PREFIX_FALSE=
-fi
 
 
 if test "x$with_gtk" = "x3.0"; then
@@ -16030,7 +15838,7 @@
   enable_vala="$default_vala"
 fi
 
-if test "x$enable_introspection" = "xyes" ; then
+if test "x$found_introspection" = "xyes" ; then
         if test "x$enable_vala" != "xno" ; then
                 # Extract the first word of "vapigen", so it can be a program name with args.
 set dummy vapigen; ac_word=$2
@@ -16264,12 +16072,8 @@
   as_fn_error $? "conditional \"ENABLE_PLUGIN\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${WITH_GOBJECT_INTROSPECTION_TRUE}" && test -z "${WITH_GOBJECT_INTROSPECTION_FALSE}"; then
-  as_fn_error $? "conditional \"WITH_GOBJECT_INTROSPECTION\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
-if test -z "${G_IR_SCANNER_SYMBOL_PREFIX_TRUE}" && test -z "${G_IR_SCANNER_SYMBOL_PREFIX_FALSE}"; then
-  as_fn_error $? "conditional \"G_IR_SCANNER_SYMBOL_PREFIX\" was never defined.
+if test -z "${HAVE_INTROSPECTION_TRUE}" && test -z "${HAVE_INTROSPECTION_FALSE}"; then
+  as_fn_error $? "conditional \"HAVE_INTROSPECTION\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${WITH_VALA_TRUE}" && test -z "${WITH_VALA_FALSE}"; then