+
+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=$enableval],
+ [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)"
+fi
+
+AC_SUBST([G_IR_SCANNER])
+AC_SUBST([G_IR_COMPILER])
+AC_SUBST([G_IR_GENERATE])
+AC_SUBST([GIRDIR])
+AC_SUBST([GIRTYPELIBDIR])
+
+AM_CONDITIONAL([ENABLE_INTROSPECTION],[test "$enable_introspection" = "yes"])
+
+dnl ================== portability checks ===========================================
+
+dnl for backtrace()
+AC_CHECK_HEADERS([execinfo.h])
+
+AC_CHECK_DECL([_NL_MEASUREMENT_MEASUREMENT],[
+ AC_DEFINE([HAVE__NL_MEASUREMENT_MEASUREMENT],[1],[Define if _NL_MEASUREMENT_MEASUREMENT is available])
+ ],[],[#include <langinfo.h>])
+
+dnl ================== pdf checks ===================================================
+AC_ARG_ENABLE([pdf],
+ [AS_HELP_STRING([--disable-pdf],
+ [Disable the PDF support])],
+ [enable_pdf=$enableval],
+ [enable_pdf=yes])
+
+if test "x$enable_pdf" = "xyes"; then
+ POPPLER_REQUIRED=0.14.0
+ PKG_CHECK_MODULES(POPPLER, poppler-glib >= $POPPLER_REQUIRED libxml-2.0 >= $LIBXML_REQUIRED,enable_pdf=yes,enable_pdf=no)
+
+ if test "x$enable_pdf" = "xyes"; then
+ evince_save_LIBS=$LIBS
+ LIBS="$LIBS $POPPLER_LIBS"
+ AC_CHECK_FUNCS(poppler_page_get_text_layout)
+ AC_CHECK_FUNCS(poppler_page_get_selected_text)
+ AC_CHECK_FUNCS(poppler_page_add_annot)
+ LIBS=$evince_save_LIBS
+ PKG_CHECK_MODULES(CAIRO_PDF, cairo-pdf, enable_cairo_pdf=yes, enable_cairo_pdf=no)
+ if test x$enable_cairo_pdf = xyes; then
+ AC_DEFINE([HAVE_CAIRO_PDF], [1], [defined if cairo-pdf is available])
+ fi
+
+ PKG_CHECK_MODULES(CAIRO_PS, cairo-ps, enable_cairo_ps=yes, enable_cairo_ps=no)
+ if test x$enable_cairo_ps = xyes; then
+ AC_DEFINE([HAVE_CAIRO_PS], [1], [defined if cairo-ps is available])
+ fi
+ else
+ AC_MSG_ERROR("PDF support is disabled since poppler-glib library version $POPPLER_REQUIRED or newer not found")
+ fi
+fi
+
+AM_CONDITIONAL(ENABLE_PDF, test x$enable_pdf = xyes)
+dnl ================== end of pdf checks ============================================
+
+dnl libspectre (used by ps and dvi backends)
+SPECTRE_REQUIRED=0.2.0
+PKG_CHECK_MODULES(SPECTRE, libspectre >= $SPECTRE_REQUIRED,have_spectre=yes,have_spectre=no)
+AM_CONDITIONAL(HAVE_SPECTRE, test x$have_spectre = xyes)
+if test "x$have_spectre" = "xyes"; then
+ AC_DEFINE([HAVE_SPECTRE], [1], [Have libspectre])
+fi
+
+dnl ================== ps checks ====================================================
+AC_ARG_ENABLE(ps,
+ [AS_HELP_STRING([--disable-ps],
+ [Disable the PostScript backend])],
+ [enable_ps=$enableval],
+ [enable_ps=yes])
+
+if test "x$enable_ps" = "xyes"; then
+ if test "x$have_spectre" = "xyes"; then
+ AC_DEFINE([ENABLE_PS], [1], [Enable support for PostScript files.])
+ else
+ enable_ps="no"
+ AC_MSG_WARN([PS support is disabled since libspectre (version >= $SPECTRE_REQUIRED) is needed])
+ fi
+fi
+AM_CONDITIONAL(ENABLE_PS, test x$enable_ps = xyes)
+dnl ======================== End of ps checks ===================================