--- pdftex-orig/pdftex-1.40.0-beta-20060125/src/texk/web2c/pdftexdir/pdftoepdf.cc	2006-01-15 20:09:32.000000000 +0100
+++ pdftex-1.40.0-beta-20060125/src/texk/web2c/pdftexdir/pdftoepdf.cc	2006-02-02 17:15:06.372784840 +0100
@@ -27,6 +27,34 @@
 #include <string.h>
 #include <ctype.h>
 #include <aconf.h>
+
+#ifdef POPPLER
+// linking with libpoppler
+
+#include <dirent.h>
+#include <poppler/poppler-config.h>
+#include <poppler/goo/GooString.h>
+#include <poppler/goo/gmem.h>
+#include <poppler/goo/gfile.h>
+#include "poppler/Object.h"
+#include "poppler/Stream.h"
+#include "poppler/Array.h"
+#include "poppler/Dict.h"
+#include "poppler/XRef.h"
+#include "poppler/Link.h"
+#include "poppler/Catalog.h"
+#include "poppler/Page.h"
+#include "poppler/GfxFont.h"
+#include "poppler/PDFDoc.h"
+#include "poppler/GlobalParams.h"
+#include "poppler/Error.h"
+
+#define GOOSTRING GooString
+#define PDF_EMPTY_ARG NULL
+
+#else
+  // linking with xpdf code copy in our source tree
+
 #include <GString.h>
 #include <gmem.h>
 #include <gfile.h>
@@ -44,6 +72,11 @@
 #include "GlobalParams.h"
 #include "Error.h"
 
+#define GOOSTRING GString
+#define PDF_EMPTY_ARG 
+
+#endif
+
 #include "epdf.h"
 
 static const char perforce_id[] = 
@@ -166,7 +199,7 @@
 #ifdef DEBUG
     fprintf(stderr, "\npdfTeX Debug: Creating %s (%d)\n", p->file_name, p->occurences);
 #endif
-    GString *docName = new GString(p->file_name);
+    GOOSTRING *docName = new GOOSTRING(p->file_name);
     p->doc = new PDFDoc(docName);  // takes ownership of docName
     if (!p->doc->isOk() || !p->doc->okToPrint()) {
         pdftex_fail("xpdf: reading PDF image failed");
@@ -515,7 +548,7 @@
     int  i, l, c;
     Ref ref;
     char *p;
-    GString *s;
+    GOOSTRING *s;
     if (obj->isBool()) {
         pdf_printf("%s", obj->getBool() ? "true" : "false");
     }
@@ -686,7 +719,7 @@
     float pdf_version_found, pdf_version_wanted;
     // initialize
     if (!isInit) {
-        globalParams = new GlobalParams();
+        globalParams = new GlobalParams(PDF_EMPTY_ARG);
         globalParams->setErrQuiet(gFalse);
         isInit = gTrue;
     }
@@ -711,7 +744,7 @@
     epdf_num_pages = pdf_doc->doc->getCatalog()->getNumPages();
     if (page_name) {
         // get page by name
-        GString name(page_name);
+        GOOSTRING name(page_name);
         LinkDest *link = pdf_doc->doc->findDest(&name);
         if (link == 0 || !link->isOk())
             pdftex_fail("pdf inclusion: invalid destination <%s>",
--- pdftex-orig/pdftex-1.40.0-beta-20060125/src/texk/web2c/pdftexdir/pdftosrc.cc	2004-03-12 14:47:57.000000000 +0100
+++ pdftex-1.40.0-beta-20060125/src/texk/web2c/pdftexdir/pdftosrc.cc	2006-02-02 14:44:50.000000000 +0100
@@ -26,28 +26,61 @@
 #include <string.h>
 #include <ctype.h>
 #include <aconf.h>
+
+#ifdef POPPLER
+
+#include <dirent.h>
+#include <poppler/poppler-config.h>
+#include <poppler/goo/GooString.h>
+#include <poppler/goo/gmem.h>
+#include <poppler/goo/gfile.h>
+#include "poppler/Object.h"
+#include "poppler/Stream.h"
+#include "poppler/Array.h"
+#include "poppler/Dict.h"
+#include "poppler/XRef.h"
+#include "poppler/Link.h"
+#include "poppler/Catalog.h"
+#include "poppler/Page.h"
+#include "poppler/GfxFont.h"
+#include "poppler/PDFDoc.h"
+#include "poppler/GlobalParams.h"
+#include "poppler/Error.h"
+
+#define GOOSTRING GooString
+#define PDF_EMPTY_ARG NULL
+
+#else
+
 #include <GString.h>
 #include <gmem.h>
 #include <gfile.h>
+#include <config.h>
 #include "Object.h"
 #include "Stream.h"
 #include "Array.h"
 #include "Dict.h"
 #include "XRef.h"
 #include "Catalog.h"
+#include "Link.h"
 #include "Page.h"
 #include "GfxFont.h"
 #include "PDFDoc.h"
 #include "GlobalParams.h"
 #include "Error.h"
 
+#define GOOSTRING GString
+#define PDF_EMPTY_ARG 
+
+#endif
+
 static XRef *xref = 0;
 
 int main(int argc, char *argv[])
 {
     char *p, buf[1024];
     PDFDoc *doc;
-    GString *fileName;
+    GOOSTRING *fileName;
     Stream *s;
     Object srcStream, srcName, catalogDict;
     FILE *outfile;
@@ -59,8 +92,8 @@
         fprintf(stderr, "Usage: pdftosrc <PDF-file> [<stream-object-number>]\n");
         exit(1);
     }
-    fileName = new GString(argv[1]);
-    globalParams = new GlobalParams();
+    fileName = new GOOSTRING(argv[1]);
+    globalParams = new GlobalParams(PDF_EMPTY_ARG);
     doc = new PDFDoc(fileName);
     if (!doc->isOk()) {
         fprintf(stderr, "Invalid PDF file\n");
