Index: /trunk/psLib/src/jpeg/psImageJpeg.c
===================================================================
--- /trunk/psLib/src/jpeg/psImageJpeg.c	(revision 10993)
+++ /trunk/psLib/src/jpeg/psImageJpeg.c	(revision 10994)
@@ -1,7 +1,9 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <stdio.h>
 #include <strings.h>  // for strcasecmp
 #include <string.h>
-
-#include <jpeglib.h>
 
 #include "psMemory.h"
@@ -11,4 +13,12 @@
 #include "psAssert.h"
 #include "psImageJpeg.h"
+
+#ifdef HAVE_STDLIB_H
+// jpeglib.h includes jconfig.h which is full of autoconf generated HAVE_*
+// defines. This is a hack to work around CPP redefinition errors.  Arrrrrgh!!!
+// -JH
+# undef HAVE_STDLIB_H
+# include <jpeglib.h>
+#endif // ifdef HAVE_STDLIB_H
 
 static void imageJpegColormapFree(psImageJpegColormap *map)
