-dnl Check select argument type: on HP-UX before version 10, select
-dnl takes (int *) instead of (fd_set *).
-AC_CACHE_CHECK([whether select takes fd_set arguments],
-xpdf_cv_func_select_arg,
-[AC_TRY_COMPILE([#include <sys/types.h>
-#include <sys/time.h>
-#include <unistd.h>
-#ifdef HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif],
-[fd_set fds;
-select(1, &fds, &fds, &fds, 0);],
-xpdf_cv_func_select_arg=yes, xpdf_cv_func_select_arg=no)])
-if test "$xpdf_cv_func_select_arg" != yes; then
- AC_DEFINE(SELECT_TAKES_INT, 1, [select() takes int, not fd_set arguments.])
+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,
+ [AC_HELP_STRING([--enable-pdf], [Compile with pdf support])],enable_pdf="$enableval",enable_pdf=yes)
+
+if test "x$enable_pdf" = "xyes"; then
+ POPPLER_REQUIRED=0.6
+ PKG_CHECK_MODULES(POPPLER, poppler-glib >= $POPPLER_REQUIRED,enable_pdf=yes,enable_pdf=no)
+
+ if test "x$enable_pdf" = "xyes"; then
+ AC_DEFINE([ENABLE_PDF], [1], [Enable pdf support.])
+ SHELL_LIBS="$SHELL_LIBS $POPPLER_LIBS"
+ SHELL_CFLAGS="$SHELL_CFLAGS $POPPLER_CFLAGS"
+
+ evince_save_LIBS=$LIBS
+ LIBS="$LIBS $POPPLER_LIBS"
+ AC_CHECK_FUNCS(poppler_page_render)
+ AC_CHECK_FUNCS(poppler_page_render_for_printing)
+ AC_CHECK_FUNCS(poppler_page_get_image)
+ 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_WARN("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 ============================================
+SPECTRE_REQUIRED=0.2.0
+
+dnl libspectre (used by ps and dvi backends)
+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 libpectre])