Patch from Étoilé:
  - Add support Poppler 0.6

--- popplerkit.orig/bindings/poppler_page.cc
+++ popplerkit/bindings/poppler_page.cc
@@ -33,7 +33,8 @@
       return NULL;
    }
    
-   if ((pageIndex <= 0) || (pageIndex > PDF_DOC(poppler_document)->getNumPages()))
+   if ((pageIndex <= 0) || 
+       ((int)pageIndex > PDF_DOC(poppler_document)->getNumPages()))
    {
       return NULL;
    }
@@ -69,8 +70,7 @@
 
 #ifdef POPPLER_0_4
    return PAGE(poppler_page)->getWidth();
-#endif
-#ifdef POPPLER_0_5
+#else
    return PAGE(poppler_page)->getMediaWidth();
 #endif
 
@@ -85,9 +85,7 @@
    
 #ifdef POPPLER_0_4
    return PAGE(poppler_page)->getHeight();
-#endif
-#ifdef POPPLER_0_5
+#else
    return PAGE(poppler_page)->getMediaHeight();
 #endif
-
 }
--- popplerkit.orig/bindings/poppler.cc
+++ popplerkit/bindings/poppler.cc
@@ -110,7 +110,7 @@
       }
       
       // tell fontconfig about application fonts
-      for (int i = 0; i < nappFonts; i++)
+      for (unsigned int i = 0; i < nappFonts; i++)
       {
          if (FcConfigAppFontAddFile(FcConfigGetCurrent(), appFonts[i]))
          {
@@ -118,12 +118,16 @@
          }
          else
          {
-            fprintf(stderr, "failed to register application font %s\n");
+            fprintf(stderr, "failed to register application font %s\n", appFonts[i]);
          }
          fflush(stderr);
       }
 
+#ifdef POPPLER_0_6
+      globalParams = new GlobalParams();
+#else
       globalParams = new GlobalParams(NULL);
+#endif
 #ifdef POPPLER_0_4
       globalParams->setupBaseFontsFc(NULL);
 #endif
--- popplerkit.orig/bindings/poppler_splash_renderer.cc
+++ popplerkit/bindings/poppler_splash_renderer.cc
@@ -38,8 +38,7 @@
 #ifdef POPPLER_0_4
       white.rgb8 = splashMakeRGB8(bg_red, bg_green, bg_blue);
       void* splashDevice = new SplashOutputDev(splashModeRGB8, gFalse, white);
-#endif
-#ifdef POPPLER_0_5
+#else // 0.5, 0.6
       white[0] = bg_red;
       white[1] = bg_green;
       white[2] = bg_blue;
@@ -86,13 +85,17 @@
    SYNCHRONIZED(PAGE(poppler_page)->displaySlice(SPLASH_DEV(output_dev),
                                                  (double)hDPI, (double)vDPI,
                                                  rotate,
-#ifdef POPPLER_0_5
+#ifndef POPPLER_0_4 // 0.5, 0.6
 						 gTrue, // useMediaBox
 #endif
                                                  gTrue, // Crop
                                                  (int)sliceX, (int)sliceY,
                                                  (int)sliceW, (int)sliceH,
+#ifdef POPPLER_0_6
+												 gFalse, // printing
+#else
                                                  NULL, // Links
+#endif
                                                  PDF_DOC(poppler_document)->getCatalog()));
 
    return 1;
@@ -123,16 +126,14 @@
 
 #ifdef POPPLER_0_4
    SplashRGB8*     rgb8;
-#endif
-#ifdef POPPLER_0_5
+#else // 0.5, 0.6
    SplashColorPtr  color;
 #endif
    unsigned char*  dataPtr;
 
 #ifdef POPPLER_0_4
    rgb8 = SPLASH_BITMAP(bitmap)->getDataPtr().rgb8;
-#endif
-#ifdef POPPLER_0_5
+#else // 0.5, 0.6
    color = SPLASH_BITMAP(bitmap)->getDataPtr();
 #endif
 
@@ -146,8 +147,7 @@
          *dataPtr++ = splashRGB8G(*rgb8);
          *dataPtr++ = splashRGB8B(*rgb8);
          ++rgb8;
-#endif
-#ifdef POPPLER_0_5
+#else // 0.5, 0.6
 	 *dataPtr++ = splashRGB8R(color);
 	 *dataPtr++ = splashRGB8G(color);
 	 *dataPtr++ = splashRGB8B(color);
--- popplerkit.orig/bindings/GNUmakefile
+++ popplerkit/bindings/GNUmakefile
@@ -52,4 +52,8 @@
    bindings_CFLAGS += -DPOPPLER_0_5
 endif
 
+ifeq ($(POPPLER_0_6), YES)
+   bindings_CFLAGS += -DPOPPLER_0_6
+endif
+
 include $(GNUSTEP_MAKEFILES)/subproject.make
--- popplerkit.orig/bindings/poppler_text.cc
+++ popplerkit/bindings/poppler_text.cc
@@ -51,10 +51,16 @@
 
    SYNCHRONIZED(PAGE(poppler_page)->display(TEXT_DEV(text_device), 
 			   hDPI, vDPI, rotate, 
-#ifdef POPPLER_0_5
+#ifndef POPPLER_0_4
 			   gTrue, // useMediaBox
 #endif
-			   crop, NULL, PDF_DOC(poppler_document)->getCatalog()));
+			   crop, 
+#ifdef POPPLER_0_6
+				gFalse, // printing
+#else
+				NULL, // links
+#endif
+				PDF_DOC(poppler_document)->getCatalog()));
    return 1;
 }
 
@@ -70,7 +76,7 @@
       int result = TEXT_DEV(text_device)->findText(text_utf32, text_len,
                                                    start_at_top, stop_at_bottom,
                                                    start_at_last, stop_at_last,
-#ifdef POPPLER_0_5
+#ifndef POPPLER_0_4 // 0.5, 0.6
 						   gTrue, gFalse,
 #endif
                                                    x_min, y_min, x_max, y_max);
--- popplerkit.orig/config.sh
+++ popplerkit/config.sh
@@ -59,6 +59,13 @@
   POPPLER_VERSION="POPPLER_0_5"
 fi
 
+${PKG_CONFIG} --atleast-version=0.5.9 poppler
+if [ $? -eq 0 ]; then
+  POPPLER_VERSION="POPPLER_0_6"
+fi
+
+echo $POPPLER_VERSION
+
 # include freetype, just to be sure
 ${PKG_CONFIG} --exists freetype2
 if [ $? -eq 0 ]; then
