Skip to content

Instantly share code, notes, and snippets.

@livibetter
Created August 15, 2011 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save livibetter/1145946 to your computer and use it in GitHub Desktop.
Save livibetter/1145946 to your computer and use it in GitHub Desktop.
unsubmitted (prob not finished, either) patch for Inkscape about poppler library
=== modified file 'configure.ac'
--- configure.ac 2011-08-05 16:47:02 +0000
+++ configure.ac 2011-08-10 12:47:21 +0000
@@ -521,101 +521,96 @@
dnl Libpoppler checking
dnl ******************************
+AC_ARG_ENABLE(poppler,
+ AC_HELP_STRING([--enable-poppler], [enable libpoppler for loading PDF file]),
+ [enable_poppler=$enableval], [enable_poppler=yes])
AC_ARG_ENABLE(poppler-cairo,
AC_HELP_STRING([--enable-poppler-cairo], [Enable libpoppler-cairo for rendering PDF preview]),
[enable_poppler_cairo=$enableval], [enable_poppler_cairo=yes])
-POPPLER_CFLAGS=""
-PKG_CHECK_MODULES(POPPLER, poppler >= 0.5.9, poppler=yes, poppler=no)
-
-if test "x$poppler" = "xyes"; then
- dnl Working libpoppler
- dnl Have to test libpoppler-glib presence
- PKG_CHECK_MODULES(POPPLER_GLIB, poppler-glib >= 0.5.9, poppler_glib=yes, poppler_glib=no)
- if test "x$poppler_glib" = "xyes"; then
- dnl Working libpoppler-glib found
- dnl Check whether the Cairo SVG backend is available
- PKG_CHECK_MODULES(CAIRO_SVG, cairo-svg, cairo_svg=yes, cairo_svg=no)
- if test "x$cairo_svg" = "xyes"; then
- POPPLER_LIBS="$POPPLER_LIBS $POPPLER_GLIB_LIBS "
- fi
- fi
- if test "x$enable_poppler_cairo" = "xyes"; then
- dnl Have to test libpoppler-cairo presence for PDF preview
- dnl AC_CHECK_HEADER(Magick++.h, magick_ok=yes, magick_ok=no)
- PKG_CHECK_MODULES(POPPLER_CAIRO, poppler-cairo >= 0.5.9, poppler_cairo=yes, poppler_cairo=no)
- if test "x$poppler_glib" = "xyes" -a "x$poppler_cairo" = "xyes" -a \
- "x$cairo_svg" = "xno"
- then
- POPPLER_LIBS="$POPPLER_LIBS $POPPLER_CAIRO_LIBS "
- fi
- fi
-fi
-
-if test "x$poppler" = "xyes"; then
- LIBS="$LIBS $POPPLER_LIBS"
- AC_DEFINE(HAVE_POPPLER, 1, [Use libpoppler for direct PDF import])
-fi
-if test "x$poppler_cairo" = "xyes" -a "x$poppler_glib" = "xyes"; then
- AC_DEFINE(HAVE_POPPLER_CAIRO, 1, [Use libpoppler-cairo for rendering PDF preview])
-fi
-if test "x$poppler_glib" = "xyes" -a "x$cairo_svg" = "xyes"; then
- AC_DEFINE(HAVE_POPPLER_GLIB, 1, [Use libpoppler-glib and Cairo-SVG for PDF import])
-fi
-AC_SUBST(POPPLER_CFLAGS)
-AC_SUBST(POPPLER_LIBS)
-
-PKG_CHECK_MODULES(POPPLER_GFXFONT, poppler >= 0.8.3, popplernew=yes, popplernew=no)
-if test "x$popplernew" = "xyes"; then
- AC_DEFINE(POPPLER_NEW_GFXFONT, 1, [Use GfxFont from Poppler >= 0.8.3])
-fi
-
-ink_svd_CPPFLAGS=$CPPFLAGS
-ink_svd_LIBS=$LIBS
-CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
-LIBS="$LIBS $POPPLER_LIBS"
-
-AC_MSG_CHECKING(for new color space API in Poppler)
-popplercolor="no"
-AC_COMPILE_IFELSE([
-#include <GfxState.h>
-
-int main() {
- typedef GfxColorSpace *(*parse_p)(Object *, Gfx *);
- parse_p p;
- p = &GfxColorSpace::parse;
- return 0;
-}
-], [popplercolor=yes])
-if test "x$popplercolor" = "xyes"; then
- AC_DEFINE(POPPLER_NEW_COLOR_SPACE_API, 1, [Use color space API from Poppler >= 0.12.2])
- AC_MSG_RESULT(yes)
-else
- AC_MSG_RESULT(no)
-fi
-
-# Poppler's b604a008 commit changes this
-AC_MSG_CHECKING([whether Poppler's GfxPatch no longer uses GfxColor])
-popplergfxcolor="no"
-AC_COMPILE_IFELSE([
-#include <GfxState.h>
-
-int main() {
- GfxPatch::ColorValue color = {c: {0}};
- GfxPatch patch;
- patch.color[[0]][[0]] = color;
- return 0;
-}
-], [popplergfxcolor=yes])
-if test "x$popplergfxcolor" = "xyes"; then
- AC_DEFINE(POPPLER_NEW_GFXPATCH, 1, [GfxPatch no longer uses GfxColor in >= 0.15.1])
- AC_MSG_RESULT(yes)
-else
- AC_MSG_RESULT(no)
-fi
-
-CPPFLAGS=$ink_svd_CPPFLAGS
-LIBS=$ink_svd_LIBS
+if test "x$enable_poppler" = "xyes"; then
+ PKG_CHECK_MODULES(POPPLER, poppler >= 0.5.9, poppler=yes, poppler=no)
+ if test "x$poppler" = "xyes"; then
+ AC_DEFINE(HAVE_POPPLER, 1, [Use libpoppler for direct PDF import])
+ PKG_CHECK_MODULES(POPPLER_GLIB, poppler-glib >= 0.5.9, poppler_glib=yes, poppler_glib=no)
+ if test "x$poppler_glib" = "xyes"; then
+ PKG_CHECK_MODULES(CAIRO_SVG, cairo-svg, cairo_svg=yes, cairo_svg=no)
+ if test "x$cairo_svg" = "xyes"; then
+ POPPLER_LIBS="$POPPLER_LIBS $POPPLER_GLIB_LIBS "
+ LIBS="$LIBS $POPPLER_LIBS"
+ fi
+ if test "x$enable_poppler_cairo" = "xyes"; then
+ PKG_CHECK_MODULES(POPPLER_CAIRO, poppler-cairo >= 0.5.9, poppler_cairo=yes, poppler_cairo=no)
+ if test "x$poppler_cairo" = "xyes" -a "x$cairo_svg" = "xyes"; then
+ AC_DEFINE(HAVE_POPPLER_CAIRO, 1, [Use libpoppler-cairo for rendering PDF preview])
+ else
+ enable_poppler_cairo="no"
+ fi
+ fi
+ fi
+
+ AC_SUBST(POPPLER_CFLAGS)
+ AC_SUBST(POPPLER_LIBS)
+
+ PKG_CHECK_MODULES(POPPLER_GFXFONT, poppler >= 0.8.3, popplernew=yes, popplernew=no)
+ if test "x$popplernew" = "xyes"; then
+ AC_DEFINE(POPPLER_NEW_GFXFONT, 1, [Use GfxFont from Poppler >= 0.8.3])
+ fi
+
+ ink_svd_CPPFLAGS=$CPPFLAGS
+ ink_svd_LIBS=$LIBS
+ CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
+ LIBS="$LIBS $POPPLER_LIBS"
+
+ AC_MSG_CHECKING(for new color space API in Poppler)
+ popplercolor="no"
+ AC_COMPILE_IFELSE([
+ #include <GfxState.h>
+
+ int main() {
+ typedef GfxColorSpace *(*parse_p)(Object *, Gfx *);
+ parse_p p;
+ p = &GfxColorSpace::parse;
+ return 0;
+ }
+ ], [popplercolor=yes])
+ if test "x$popplercolor" = "xyes"; then
+ AC_DEFINE(POPPLER_NEW_COLOR_SPACE_API, 1, [Use color space API from Poppler >= 0.12.2])
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ fi
+
+ # Poppler's b604a008 commit changes this
+ AC_MSG_CHECKING([whether Poppler's GfxPatch no longer uses GfxColor])
+ popplergfxcolor="no"
+ AC_COMPILE_IFELSE([
+ #include <GfxState.h>
+
+ int main() {
+ GfxPatch::ColorValue color = {c: {0}};
+ GfxPatch patch;
+ patch.color[[0]][[0]] = color;
+ return 0;
+ }
+ ], [popplergfxcolor=yes])
+ if test "x$popplergfxcolor" = "xyes"; then
+ AC_DEFINE(POPPLER_NEW_GFXPATCH, 1, [GfxPatch no longer uses GfxColor in >= 0.15.1])
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ fi
+
+ CPPFLAGS=$ink_svd_CPPFLAGS
+ LIBS=$ink_svd_LIBS
+ else
+ enable_poppler="no"
+ enable_poppler_cairo="no"
+ fi
+else
+ enable_poppler_cairo="no"
+fi
+
dnl ******************************
dnl Check for libwpg for extension
@@ -1032,6 +1027,7 @@
Internal Perl: ${with_perl}
Enable LittleCms: ${enable_lcms}
Enable DBUS: ${with_dbus}
+ Enable Poppler: ${enable_poppler}
Enable Poppler-Cairo: ${enable_poppler_cairo}
ImageMagick Magick++: ${magick_ok}
Libwpg: ${with_libwpg}
=== modified file 'src/extension/init.cpp'
--- src/extension/init.cpp 2011-04-15 07:17:08 +0000
+++ src/extension/init.cpp 2011-08-10 08:30:08 +0000
@@ -37,7 +37,7 @@
#ifdef HAVE_POPPLER
# include "internal/pdfinput/pdf-input.h"
#endif
-#ifdef HAVE_POPPLER_GLIB
+#ifdef HAVE_POPPLER_CAIRO
# include "internal/pdf-input-cairo.h"
#endif
#include "internal/pov-out.h"
@@ -164,10 +164,8 @@
#ifdef HAVE_POPPLER
Internal::PdfInput::init();
#endif
-#ifdef HAVE_POPPLER_GLIB
- if (1) {
+#ifdef HAVE_POPPLER_CAIRO
Internal::PdfInputCairo::init();
- }
#endif
#ifdef WIN32
Internal::PrintEmfWin32::init();
=== modified file 'src/extension/internal/pdf-input-cairo.cpp'
--- src/extension/internal/pdf-input-cairo.cpp 2011-04-16 22:56:19 +0000
+++ src/extension/internal/pdf-input-cairo.cpp 2011-08-10 06:34:34 +0000
@@ -15,7 +15,6 @@
# include <config.h>
#endif
-#ifdef HAVE_POPPLER_GLIB
#ifdef HAVE_POPPLER_CAIRO
#include "pdf-input-cairo.h"
@@ -666,7 +665,6 @@
} } } /* namespace Inkscape, Extension, Implementation */
#endif /* HAVE_POPPLER_CAIRO */
-#endif /* HAVE_POPPLER_GLIB */
/*
Local Variables:
=== modified file 'src/extension/internal/pdf-input-cairo.h'
--- src/extension/internal/pdf-input-cairo.h 2011-04-16 22:56:19 +0000
+++ src/extension/internal/pdf-input-cairo.h 2011-08-10 06:34:42 +0000
@@ -30,7 +30,6 @@
#include <glibmm/i18n.h>
#include <gdk/gdk.h>
-#ifdef HAVE_POPPLER_GLIB
#ifdef HAVE_POPPLER_CAIRO
#include <poppler/glib/poppler.h>
@@ -123,7 +122,6 @@
} } } /* namespace Inkscape, Extension, Implementation */
#endif /* HAVE_POPPLER_CAIRO */
-#endif /* HAVE_POPPLER_GLIB */
#endif /* __EXTENSION_INTERNAL_PDFINPUTCAIRO_H__ */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment