+PKG_CHECK_MODULES(LIBDOCUMENT, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED)
+PKG_CHECK_MODULES(LIBVIEW, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED gail$GAIL_API_VERSION >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED)
+PKG_CHECK_MODULES(BACKEND, cairo >= $CAIRO_REQUIRED gtk+-$GTK_API_VERSION >= $GTK_REQUIRED)
+PKG_CHECK_MODULES(FRONTEND_CORE, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED)
+
+SHELL_PLATFORM_PKGS=
+case "$with_platform" in
+ hildon) AC_DEFINE([PLATFORM_HILDON],[1],[Define if building for the hildon platform])
+ SHELL_PLATFORM_PKGS="hildon-1 hildon-fm-2 libosso"
+ ;;
+ gnome)
+ # Evince has a rather soft run-time dependency on hicolor-icon-theme.
+ # If the hicolor theme is not available, Evince fails to display some
+ # icons. Because we cannot check for it at run-time, we instead
+ # would like to require the icon theme at compile-time. But, because
+ # the hicolor-icon-theme does not have a pkgconfig file, on gnome we
+ # require the gnome icon theme instead.
+ SHELL_PLATFORM_PKGS="gnome-icon-theme >= $GNOME_ICON_THEME_REQUIRED"
+ # The totem-screensaver and egg_smclient code use x11 directly.
+ SHELL_PLATFORM_PKGS="$SHELL_PLATFORM_PKGS x11"
+ ;;
+ *)
+ # On all other platforms we issue a warning about the runtime
+ # dependency.
+ AC_MSG_WARN([Evince has a soft run-time dependency on hicolor-icon-theme. You are advised to have this theme installed when running Evince.]);
+ SHELL_PLATFORM_PKGS=""
+ ;;
+esac
+
+PKG_CHECK_MODULES([SHELL_CORE],[libxml-2.0 >= $LIBXML_REQUIRED gtk+-$GTK_API_VERSION >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED gthread-2.0 $SHELL_PLATFORM_PKGS])
+
+# *********
+# SM client
+# *********
+
+GDK_TARGET="$($PKG_CONFIG --variable target gdk-$GTK_API_VERSION)"
+
+AC_MSG_CHECKING([which smclient backend to use])
+AC_ARG_WITH([smclient],
+ [AS_HELP_STRING([--with-smclient-backend=no|xsmp|win32|quartz],
+ [Setting smclient backend (default:auto)])],
+ [],
+ [case "$GDK_TARGET" in
+ x11) case "$with_platform" in
+ gnome) with_smclient=xsmp ;;
+ *) with_smclient=no ;;
+ esac ;;
+ win32|quartz) with_smclient=$GDK_TARGET ;;
+ *) with_smclient=no ;;
+ esac])
+
+AC_MSG_RESULT([$with_smclient])
+
+if test "$with_smclient" != "no"; then
+ AC_DEFINE([WITH_SMCLIENT],[1],[Define if smclient is enabled])
+
+ case "$with_smclient" in
+ xsmp) SMCLIENT_PKGS="sm >= 1.0.0" ;;
+ *) SMCLIENT_PKGS="" ;;
+ esac
+
+ PKG_CHECK_MODULES([SMCLIENT],[gtk+-$GTK_API_VERSION gthread-2.0 $SMCLIENT_PKGS])
+ AC_SUBST([SMCLIENT_CFLAGS])
+ AC_SUBST([SMCLIENT_LIBS])
+fi
+
+AM_CONDITIONAL([WITH_SMCLIENT],[test "$with_smclient" != "no"])
+AM_CONDITIONAL([WITH_SMCLIENT_XSMP],[test "$with_smclient" = "xsmp"])
+AM_CONDITIONAL([WITH_SMCLIENT_WIN32],[test "$with_smclient" = "win32"])
+AM_CONDITIONAL([WITH_SMCLIENT_QUARTZ],[test "$with_smclient" = "quartz"])
+
+# ***
+
+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-$GTK_API_VERSION >= $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
+
+# ****
+# DBUS
+# ****
+
+AC_ARG_ENABLE([dbus],
+ [AS_HELP_STRING([--disable-dbus], [Disable support for dbus])],
+ [],
+ [case "$with_platform" in
+ gnome) enable_dbus=yes ;;
+ hildon) enable_dbus=no ;;
+ esac])
+
+if test "$enable_dbus" = "yes"; then
+ AC_DEFINE([ENABLE_DBUS],[1],[Define if DBUS support is enabled])