[dia] pdf-import: allow to build Dia without poppler-dev



commit 3c14df77a1cd8731a1fd2079c44dd55306f7e4c7
Author: Hans Breuer <hans breuer org>
Date:   Fri Oct 25 23:39:42 2013 +0200

    pdf-import: allow to build Dia without poppler-dev
    
    the recent inclusion into the build broke the case of missing
    missing build dependency

 configure.in             |    1 +
 plug-ins/pdf/Makefile.am |    6 +++++-
 plug-ins/pdf/pdf.c       |   11 +++++++++++
 3 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/configure.in b/configure.in
index d5c9c61..d6b2eb0 100644
--- a/configure.in
+++ b/configure.in
@@ -131,6 +131,7 @@ PKG_CHECK_MODULES(POPPLER,poppler,have_poppler=yes,have_poppler=no)
 if test "$have_poppler" = "yes" ; then
    AC_DEFINE(HAVE_POPPLER,1,[Define if building with POPPLER support])
 fi
+AM_CONDITIONAL(HAVE_POPPLER, test "x$have_poppler" != "xno")
 
 AC_MSG_CHECKING([whether GNOME specific code should be used])
 AC_ARG_ENABLE(gnome,
diff --git a/plug-ins/pdf/Makefile.am b/plug-ins/pdf/Makefile.am
index 163072a..6c8527b 100644
--- a/plug-ins/pdf/Makefile.am
+++ b/plug-ins/pdf/Makefile.am
@@ -1,4 +1,8 @@
-plugin_sources = pdf.c pdf-import.cpp
+plugin_sources = pdf.c
+
+if HAVE_POPPLER
+plugin_sources += pdf-import.cpp
+endif
 
 # Can't do without C++
 if HAVE_CPLUSPLUS
diff --git a/plug-ins/pdf/pdf.c b/plug-ins/pdf/pdf.c
index 9d2111b..fd5b0ec 100644
--- a/plug-ins/pdf/pdf.c
+++ b/plug-ins/pdf/pdf.c
@@ -23,13 +23,24 @@
 #include "filter.h"
 #include "plug-ins.h"
 
+static gboolean
+no_import_pdf(const gchar *filename, DiagramData *dia, DiaContext *ctx, void* user_data)
+{
+  dia_context_add_message (ctx, _("PDF import not available."));
+  return FALSE;
+}
+
 gboolean import_pdf(const gchar *filename, DiagramData *dia, DiaContext *ctx, void* user_data);
 
 static const gchar *pdf_extensions[] = { "pdf", NULL };
 static DiaImportFilter pdf_import_filter = {
     N_("Portable Document File"),
     pdf_extensions,
+#if HAVE_POPPLER
     import_pdf,
+#else
+    no_import_pdf,
+#endif
     NULL, /* user data */
     "pdf"
 };


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]