From f09959b414ef0f5112f7c6277a23606e432e2389 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Mon, 18 Dec 2006 17:01:34 +0000 Subject: Make cairo-pdf depedency optional. 2006-12-18 Carlos Garcia Campos * configure.ac: * pdf/ev-poppler.cc: (pdf_print_context_free), (pdf_document_file_exporter_begin), (pdf_document_file_exporter_do_page): Make cairo-pdf depedency optional. --- diff --git a/ChangeLog b/ChangeLog index 18d2b55..331749f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2006-12-18 Carlos Garcia Campos + * configure.ac: + * pdf/ev-poppler.cc: (pdf_print_context_free), + (pdf_document_file_exporter_begin), + (pdf_document_file_exporter_do_page): + + Make cairo-pdf depedency optional. + +2006-12-18 Carlos Garcia Campos + * shell/ev-print-job.c: (idle_print_handler), (ev_print_job_print): Use ev_file_exporter instead of ev_ps_exporter in ev-print-job. diff --git a/configure.ac b/configure.ac index 2e431cf..8d17081 100644 --- a/configure.ac +++ b/configure.ac @@ -206,6 +206,11 @@ if test "x$enable_pdf" = "xyes"; then LIBS="$LIBS $FRONTEND_LIBS" AC_CHECK_FUNCS(poppler_page_render) 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 else AC_MSG_WARN("PDF support is disabled since poppler-glib library version $POPPLER_REQUIRED or newer not found") fi diff --git a/pdf/ev-poppler.cc b/pdf/ev-poppler.cc index d4372ad..2e0e46a 100644 --- a/pdf/ev-poppler.cc +++ b/pdf/ev-poppler.cc @@ -25,7 +25,9 @@ #include #include #include +#ifdef HAVE_CAIRO_PDF #include +#endif #include #include "ev-poppler.h" @@ -51,7 +53,9 @@ typedef struct { typedef struct { EvFileExporterFormat format; PopplerPSFile *ps_file; +#ifdef HAVE_CAIRO_PDF cairo_t *pdf_cairo; +#endif } PdfPrintContext; struct _PdfDocumentClass @@ -1425,11 +1429,13 @@ pdf_document_find_iface_init (EvDocumentFindIface *iface) static const gboolean supported_formats[] = { TRUE, /* EV_FILE_FORMAT_PS */ +#ifdef HAVE_CAIRO_PDF #ifdef HAVE_POPPLER_PAGE_RENDER TRUE, /* EV_FILE_FORMAT_PDF */ #else FALSE, /* EV_FILE_FORMAT_PDF */ #endif +#endif }; static void @@ -1442,12 +1448,12 @@ pdf_print_context_free (PdfPrintContext *ctx) poppler_ps_file_free (ctx->ps_file); ctx->ps_file = NULL; } - +#ifdef HAVE_CAIRO_PDF if (ctx->pdf_cairo) { cairo_destroy (ctx->pdf_cairo); ctx->pdf_cairo = NULL; } - +#endif g_free (ctx); } @@ -1487,11 +1493,13 @@ pdf_document_file_exporter_begin (EvFileExporter *exporter, break; case EV_FILE_FORMAT_PDF: { +#ifdef HAVE_CAIRO_PDF cairo_surface_t *surface; surface = cairo_pdf_surface_create (filename, width, height); ctx->pdf_cairo = cairo_create (surface); cairo_surface_destroy (surface); +#endif } break; default: @@ -1518,7 +1526,9 @@ pdf_document_file_exporter_do_page (EvFileExporter *exporter, EvRenderContext *r #ifdef HAVE_POPPLER_PAGE_RENDER poppler_page_render (poppler_page, ctx->pdf_cairo); #endif +#ifdef HAVE_CAIRO_PDF cairo_show_page (ctx->pdf_cairo); +#endif break; default: g_assert_not_reached (); -- cgit v0.9.1