-AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
-
-PKG_CHECK_MODULES(LIBEVPRIVATE, gtk+-2.0 >= 2.4.0)
-PKG_CHECK_MODULES(RECENT_FILES, gtk+-2.0 >= 2.4.0 libgnomeui-2.0 >= 2.4.0)
-PKG_CHECK_MODULES(SHELL, gtk+-2.0 >= 2.5.0 libgnomeui-2.0 gnome-vfs-2.0 libgnomeprint-2.2 libgnomeprintui-2.2 libglade-2.0)
-PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.6.0)
-PKG_CHECK_MODULES(PS, gtk+-2.0 >= 2.6.0 gnome-vfs-2.0 libgnomeui-2.0)
-
-GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
-AC_SUBST(GLIB_GENMARSHAL)
-
-dnl Compile with disable-deprecated switches
-
-AC_ARG_ENABLE(deprecated,
-AC_HELP_STRING([--disable-deprecated],
- [Don't allow any deprecated GTK+/etc. features.]),
-set_enable_deprecated="$enableval",[
-if test -f $srcdir/autogen.sh; then
- is_cvs_version=true
- set_enable_deprecated=no
-else
- set_enable_deprecated=yes
- fi
-])
-AC_MSG_CHECKING([whether to disable deprecated glib/gtk+/etc. features])
-if test "$set_enable_deprecated" != "yes"; then
- AC_MSG_RESULT(yes)
- EVINCE_DISABLE_DEPRECATED="-DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGNOME_DISABLE_DEPRECATED -DBONOBO_DISABLE_DEPRECATED"
-else
- AC_MSG_RESULT(no)
- EVINCE_DISABLE_DEPRECATED=""
-fi
-AC_SUBST(EVINCE_DISABLE_DEPRECATED)
-
-dnl ================== Xpdf aconf.h.in checks ==================================
-
-AH_TEMPLATE([HAVE_LIBSM], [Define to 1 if you have session management.])
-AH_TEMPLATE([ENABLE_NLS], [Use Native Language Support.])
-AH_TEMPLATE([HAVE_CATGETS], [Use catgets functions.])
-AH_TEMPLATE([HAVE_GETTEXT], [Use gettext functions.])
-
-dnl Optional features.
-AH_TEMPLATE([A4_PAPER],
- [Use A4 paper size instead of Letter for PostScript output.])
-AC_ARG_ENABLE(a4-paper,
- AC_HELP_STRING([--enable-a4-paper],
- [use A4 paper size instead of Letter for
- PostScript output]),
- AC_DEFINE(A4_PAPER))
-
-dnl never define NO_TEXT_SELECT, just remember this Xpdf setting.
-AH_TEMPLATE([NO_TEXT_SELECT], [Do not allow text selection.])
-
-AH_TEMPLATE([OPI_SUPPORT],
- [Include support for OPI comments.])
-AC_ARG_ENABLE(opi,
- AC_HELP_STRING([--enable-opi],
- [include support for OPI comments]),
- AC_DEFINE(OPI_SUPPORT))
-
-dnl enable these unconditionally.
-AC_DEFINE([MULTITHREADED], [1], [Enable multithreading support.])
-AC_DEFINE([TEXTOUT_WORD_LIST], [1], [Enable word list support.])
-
-AH_TEMPLATE([APPDEFDIR],
- [Directory with the Xpdf app-defaults file.])
-AC_ARG_WITH(appdef-dir,
- AC_HELP_STRING([--with-appdef-dir],
- [set app-defaults directory]),
- AC_DEFINE_UNQUOTED(APPDEFDIR, "$with_appdef_dir"))
-
-dnl Path to xpdfrc.
-dnl This ugly kludge to get the sysconfdir path is needed because
-dnl autoconf doesn't actually set the prefix variable until later.
-if test "$sysconfdir" = '${prefix}/etc'; then
- if test "x$prefix" = xNONE; then
- system_xpdfrc="$ac_default_prefix/etc/xpdfrc"
- else
- system_xpdfrc="$prefix/etc/xpdfrc"
- fi
-else
- system_xpdfrc="$sysconfdir/xpdfrc"
-fi
-AC_DEFINE_UNQUOTED(SYSTEM_XPDFRC, "$system_xpdfrc",
- [Full path for the system-wide xpdfrc file.])
-
-dnl Checks for header files.
-AC_HEADER_DIRENT
-
-dnl Switch over to C++. This will make the checks below a little
-dnl bit stricter (requiring function prototypes in include files).
-dnl (99% of xpdf is written in C++.)
-AC_LANG_CPLUSPLUS
-
-dnl Look for header that defines select() and fd_set.
-AC_MSG_CHECKING([select() and fd_set in sys/select.h and sys/bsdtypes.h])
-AC_TRY_COMPILE([#include <stdlib.h>
-#include <stddef.h>
-#include <unistd.h>
-#include <sys/types.h>],
- [fd_set fds;
-select(0, NULL, NULL, NULL, NULL);], xpdf_ok=yes, xpdf_ok=no)
-if test $xpdf_ok = yes; then
- AC_MSG_RESULT([not needed])
+AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
+AM_GLIB_GNU_GETTEXT
+
+m4_pattern_allow([AM_V_GEN])dnl Make autoconf not complain about the rule below
+EV_INTLTOOL_EVINCE_BACKEND_RULE='%.evince-backend: %.evince-backend.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(AM_V_GEN) LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
+AC_SUBST([EV_INTLTOOL_EVINCE_BACKEND_RULE])
+
+GLIB_GSETTINGS
+
+# Check which platform to use
+
+AC_MSG_CHECKING([for which platform to build])
+AC_ARG_WITH([platform],
+ [AS_HELP_STRING([--with-platform=gnome|win32|hildon],
+ [Setting platform (default: gnome)])],
+ [case "$withval" in
+ gnome|win32|hildon) ;;
+ *) AC_MSG_ERROR([invalid argument "$withval" for --with-platform]) ;;
+ esac],
+ [case "$host" in
+ *-*-mingw*|*-*-cygwin*) with_platform="win32" ;;
+ *) with_platform=gnome ;;
+ esac])
+
+AC_MSG_RESULT([$with_platform])
+
+if test "$with_platform" = "win32"; then
+ AC_CHECK_TOOL([WINDRES],[windres])
+ AC_MSG_CHECKING([for native Win32])
+ case "$host" in
+ *-*-mingw*)
+ os_win32=yes
+ ;;
+ *)
+ os_win32=no
+ ;;
+ esac
+ AC_MSG_RESULT([$os_win32])
+fi
+
+AM_CONDITIONAL([PLATFORM_HILDON],[test "$with_platform" = "hildon"])
+AM_CONDITIONAL([PLATFORM_WIN32],[test "$with_platform" = "win32"])
+
+AC_MSG_CHECKING([which gtk+ version to compile against])
+AC_ARG_WITH([gtk],
+ [AS_HELP_STRING([--with-gtk=2.0|3.0],[which gtk+ version to compile against (default: 2.0)])],
+ [case "$with_gtk" in
+ 2.0|3.0) ;;
+ *) AC_MSG_ERROR([invalid gtk version specified]) ;;
+ esac],
+ [with_gtk=2.0])
+AC_MSG_RESULT([$with_gtk])
+
+dnl Specify required versions of dependencies
+CAIRO_REQUIRED=1.9.10
+GLIB_REQUIRED=2.25.11
+KEYRING_REQUIRED=2.22.0
+
+case "$with_gtk" in
+ 2.0) GTK_API_VERSION=2.0
+ GAIL_API_VERSION=
+ GTK_REQUIRED=2.21.5
+ ;;
+ 3.0) GTK_API_VERSION=3.0
+ GAIL_API_VERSION=-3.0
+ GTK_REQUIRED=2.90.5
+ ;;
+esac
+
+AC_SUBST([GLIB_REQUIRED])
+AC_SUBST([GTK_REQUIRED])
+
+GNOME_ICON_THEME_REQUIRED=2.17.1
+LIBXML_REQUIRED=2.5.0
+
+dnl Check dependencies
+
+# LIB_CFLAGS for helpers and generic widgets. (libdocument, cut-and-paste)
+# BACKEND_CFLAGS for backend implementations.
+# FRONTEND_CFLAGS for frontend implementations. (properties, thumbnailer)
+# FRONTEND_LIBS
+# SHELL_CFLAGS for shell implementation.
+# SHELL_LIBS
+
+
+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])
+
+ PKG_CHECK_MODULES([EV_DAEMON], [gio-2.0 >= $GLIB_REQUIRED])
+fi
+
+AM_CONDITIONAL([ENABLE_DBUS], [test "$enable_dbus" = "yes"])
+
+dnl ========= Check for Desktop Schemas
+PKG_CHECK_MODULES([DESKTOP_SCHEMAS], [gsettings-desktop-schemas],
+ has_desktop_schemas=yes, has_desktop_schemas=no)
+if test x$has_desktop_schemas = xyes; then
+ AC_DEFINE([HAVE_DESKTOP_SCHEMAS], [1], [Whether GSettings Desktop Schemas are available])
+fi
+
+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])
+
+ AM_GCONF_SOURCE_2
+
+ AC_PATH_PROG([GCONFTOOL], [gconftool-2], [false])
+ if test "$GCONFTOOL" = "false"; then
+ AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
+ fi