+BACKEND_LIBTOOL_FLAGS="-module -avoid-version -no-undefined -export-symbols \$(top_srcdir)/backend/backend.symbols"
+AC_SUBST(BACKEND_LIBTOOL_FLAGS)
+
+dnl ===== Check special functions
+evince_save_LIBS=$LIBS
+LIBS="$LIBS $BACKEND_LIBS"
+AC_CHECK_FUNCS(cairo_format_stride_for_width)
+LIBS=$evince_save_LIBS
+
+# ******************
+# GKT+ Unix Printing
+# ******************
+
+AC_MSG_CHECKING([whether gtk+-unix-print support is requested])
+AC_ARG_WITH([gtk-unix-print],
+ [AS_HELP_STRING([--without-gtk-unix-print],[disable the use of gtk-unix-print])],
+ [],[case "$os_win32" in
+ yes) with_gtk_unix_print=no ;;
+ *) with_gtk_unix_print=yes ;;
+ esac])
+AC_MSG_RESULT([$with_gtk_unix_print])
+
+if test "$with_gtk_unix_print" = "yes"; then
+ PKG_CHECK_MODULES(GTKUNIXPRINT, [gtk+-unix-print-2.0 >= $GTK_REQUIRED])
+ AC_DEFINE([GTKUNIXPRINT_ENABLED], [1], [Define if gtk+-unix-print is enabled.])
+fi
+
+# *********************
+# GNOME Keyring support
+# *********************
+
+AC_ARG_WITH(keyring,
+ [AS_HELP_STRING([--without-keyring],[disable the use of gnome-keyring])],
+ [],
+ [case "$with_platform" in
+ gnome) with_keyring=yes ;;
+ hildon|win32) with_keyring=no ;;
+ esac])
+
+AM_CONDITIONAL([WITH_KEYRING],[test "$with_keyring" = "yes"])
+
+if test "$with_keyring" = "yes"; then
+ PKG_CHECK_MODULES(KEYRING, gnome-keyring-1 >= $KEYRING_REQUIRED)
+ AC_DEFINE([WITH_KEYRING],[1],[Define if KEYRING support is enabled])
+fi
+
+GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
+AC_SUBST(GLIB_GENMARSHAL)
+
+dnl ========= Check for DBUS
+AC_ARG_ENABLE(dbus,
+ [AC_HELP_STRING([--enable-dbus], [Compile with support for dbus])],
+ enable_dbus="$enableval",enable_dbus=yes)
+if test "x$enable_dbus" != "xno"; then
+ PKG_CHECK_MODULES([DBUS], [dbus-glib-1 >= $DBUS_GLIB_REQUIRED],
+ [enable_dbus=yes],[enable_dbus=no])
+
+ if test "x$enable_dbus" = "xno"; then
+ AC_MSG_WARN([DBUS support is disabled since dbus $DBUS_GLIB_REQUIRED or higher was not found])
+ fi
+
+ if test "x$enable_dbus" = "xyes" ; then
+ AC_PATH_PROG([DBUS_BINDING_TOOL], [dbus-binding-tool], [no])
+
+ if test x$DBUS_BINDING_TOOL = "xno" ; then
+ AC_MSG_ERROR([dbus-binding-tool executable not found in your path - should be installed with dbus glib bindings])
+ fi
+
+ AC_DEFINE([ENABLE_DBUS],[1],[Define if DBUS support is enabled])
+ fi
+fi
+
+AC_SUBST([DBUS_CFLAGS])
+AC_SUBST([DBUS_LIBS])
+
+AM_CONDITIONAL([ENABLE_DBUS], [test "x$enable_dbus" = "xyes"])
+AM_CONDITIONAL([DBUS_TOOL_NO_PREFIX], [test "x$DBUS_VERSION" = "x33"])
+
+dnl ========= Check for GConf
+
+AC_MSG_CHECKING([whether GConf support is requested])
+AC_ARG_WITH([gconf],
+ [AS_HELP_STRING([--without-gconf],[disable the use of gconf])],
+ [],
+ [case "$os_win32" in
+ yes) with_gconf=no ;;
+ *) with_gconf=yes ;;
+ esac])
+AC_MSG_RESULT([$with_gconf])
+
+AM_CONDITIONAL([WITH_GCONF],[test "$with_gconf" = "yes"])
+
+if test "$with_gconf" = "yes"; then
+ PKG_CHECK_MODULES([GCONF],[gconf-2.0])
+ AC_DEFINE([WITH_GCONF],[1],[Define if GConf support is enabled])
+fi
+
+AM_GCONF_SOURCE_2
+
+AC_PATH_PROG([GCONFTOOL], [gconftool-2], [false])
+if test "$with_gconf" = "yes" -a "$GCONFTOOL" = "false"; then
+ AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
+fi
+
+dnl Debug mode
+
+AC_ARG_ENABLE([debug],
+ AC_HELP_STRING([--enable-debug],
+ [Turn on evince debug mode]),,
+ [enable_debug=no])
+
+if test "x$enable_debug" = "xyes"; then
+ DEBUG_FLAGS="-DEV_ENABLE_DEBUG"
+fi
+
+
+LIBDOCUMENT_CFLAGS="$LIBDOCUMENT_CFLAGS $DEBUG_FLAGS"
+LIBDOCUMENT_LIBS="$LIBDOCUMENT_LIBS"
+AC_SUBST(LIBDOCUMENT_CFLAGS)
+AC_SUBST(LIBDOCUMENT_LIBS)
+
+LIBVIEW_CFLAGS="$LIBVIEW_CFLAGS $DEBUG_FLAGS"
+LIBVIEW_LIBS="$LIBVIEW_LIBS"
+AC_SUBST(LIBVIEW_CFLAGS)
+AC_SUBST(LIBVIEW_LIBS)
+
+BACKEND_CFLAGS="$BACKEND_CFLAGS -DGDK_MULTIHEAD_SAFE -DGTK_MULTIHEAD_SAFE $DEBUG_FLAGS"
+AC_SUBST(BACKEND_CFLAGS)
+AC_SUBST(BACKEND_LIBS)
+
+SHELL_CFLAGS="$SHELL_CORE_CFLAGS $GTKUNIXPRINT_CFLAGS $DBUS_CFLAGS $KEYRING_CFLAGS $GCONF_CFLAGS -DGDK_MULTIHEAD_SAFE -DGTK_MULTIHEAD_SAFE $DEBUG_FLAGS"
+SHELL_LIBS="$SHELL_CORE_LIBS $GTKUNIXPRINT_CFLAGS $DBUS_LIBS $KEYRING_LIBS $GCONF_LIBS -lz"
+AC_SUBST(SHELL_CFLAGS)
+AC_SUBST(SHELL_LIBS)
+
+FRONTEND_CFLAGS="$FRONTEND_CORE_CFLAGS $DEBUG_FLAGS"
+FRONTEND_LIBS="$FRONTEND_CORE_LIBS -lz"
+AC_SUBST(FRONTEND_CFLAGS)
+AC_SUBST(FRONTEND_LIBS)
+
+# Check for Nautilus property page build
+AC_ARG_ENABLE(nautilus,
+ [AS_HELP_STRING([--enable-nautilus],[compile the nautilus plugin])],
+ [],
+ [case "$with_platform" in
+ gnome) enable_nautilus=yes ;;
+ hildon) enable_nautilus=no ;;
+ esac])
+
+if test x$enable_nautilus = "xyes" ; then
+ PKG_CHECK_MODULES(NAUTILUS, gtk+-x11-2.0 $MM gthread-2.0 libnautilus-extension,
+ [HAVE_NAUTILUS=yes], [HAVE_NAUTILUS=no])
+ NAUTILUS_EXTENSION_DIR=`$PKG_CONFIG --variable=extensiondir libnautilus-extension`
+ AC_SUBST(NAUTILUS_EXTENSION_DIR)
+fi
+
+AC_SUBST(NAUTILUS_CFLAGS)
+AC_SUBST(NAUTILUS_LIBS)
+if test x$HAVE_NAUTILUS = "xyes"; then
+ AC_DEFINE(HAVE_NAUTILUS, 1, [defined if you build the nautilus plugin])
+fi
+AM_CONDITIONAL(HAVE_NAUTILUS, test x$HAVE_NAUTILUS = "xyes")
+
+
+dnl Check for thumbnailer build
+AC_ARG_ENABLE(thumbnailer,
+ [AS_HELP_STRING([--disable-thumbnailer],[disable the GNOME thumbnailer])],
+ [],
+ [case "$with_platform" in
+ gnome) enable_thumbnailer=yes ;;
+ hildon) enable_thumbnailer=no ;;
+ esac])
+
+AM_CONDITIONAL(ENABLE_THUMBNAILER, test x$enable_thumbnailer = "xyes")
+
+dnl Check for previewer build
+AC_ARG_ENABLE([previewer],
+ [AS_HELP_STRING([--disable-previewer],[disable the GNOME Document Previewer])],
+ [],
+ [case "$with_platform" in
+ gnome) enable_previewer=yes ;;
+ *) enable_previewer=no ;;
+ esac])
+
+if test "$enable_previewer" = "yes" ; then
+ PKG_CHECK_MODULES(PREVIEWER, gtk+-2.0 >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED,
+ [enable_previewer=yes],[enable_previewer=no])
+ if test x$enable_previewer = "xno" ; then
+ AC_MSG_WARN([Previewer support is disabled since gtk+-unix-print $GTK_REQUIRED or higher was not found])
+ fi
+fi
+AM_CONDITIONAL([ENABLE_PREVIEWER],[test "$enable_previewer" = "yes"])
+PREVIEWER_CFLAGS="$PREVIEWER_CFLAGS $GTKUNIXPRINT_CFLAGS $DEBUG_FLAGS"
+PREVIEWER_LIBS="$PREVIEWER_LIBS $GTKUNIXPRINT_LIBS -lz"
+AC_SUBST(PREVIEWER_CFLAGS)
+AC_SUBST(PREVIEWER_LIBS)
+
+# ***
+# GIR
+# ***
+
+AC_MSG_CHECKING([whether GObject introspection is requested])
+AC_ARG_ENABLE([introspection],
+ AS_HELP_STRING([--enable-introspection],[Enable GObject introspection]),
+ [],[enable_introspection=no])
+AC_MSG_RESULT([$enable_introspection])
+
+G_IR_SCANNER=
+G_IR_COMPILER=
+G_IR_GENERATE=
+GIRDIR=
+GIRTYPELIBDIR=
+
+if test "$enable_introspection" = "yes"; then
+ GOBJECT_INTROSPECTION_REQUIRED=0.6
+ PKG_CHECK_MODULES([GOBJECT_INTROSPECTION],[gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_REQUIRED])
+
+ 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)"
+ GIRTYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"