diff -up libglpng-1.45.orig/include/GL/glpng.h~ libglpng-1.45.orig/include/GL/glpng.h
--- libglpng-1.45.orig/include/GL/glpng.h~	2011-12-06 22:14:59.000000000 +0100
+++ libglpng-1.45.orig/include/GL/glpng.h	2011-12-06 22:15:48.900673919 +0100
@@ -57,7 +57,7 @@ extern "C" {
 #define PNG_SIMPLEMIPMAP PNG_SIMPLEMIPMAPS
 
 /* Transparency parameters */
-#define PNG_CALLBACK  -3 /* Call the callback function to generate alpha   */
+#define PNG_CALLBACK_FUNC -3 /* Call the callback function to generate alpha   */
 #define PNG_ALPHA     -2 /* Use alpha channel in PNG file, if there is one */
 #define PNG_SOLID     -1 /* No transparency                                */
 #define PNG_STENCIL    0 /* Sets alpha to 0 for r=g=b=0, 1 otherwise       */
diff -up libglpng-1.45.orig/src/glpng.c~ libglpng-1.45.orig/src/glpng.c
--- libglpng-1.45.orig/src/glpng.c~	2011-12-06 19:38:53.000000000 +0100
+++ libglpng-1.45.orig/src/glpng.c	2011-12-06 22:13:34.501354149 +0100
@@ -282,7 +282,11 @@ int APIENTRY pngLoadRawF(FILE *fp, pngRa
 	if (!endinfo) return 0;
 
 	// DH: added following lines
+#if PNG_LIBPNG_VER >= 10400
+	if (setjmp(png_jmpbuf(png)))
+#else
 	if (setjmp(png->jmpbuf))
+#endif
 	{
 error:
 		png_destroy_read_struct(&png, &info, &endinfo);
@@ -402,7 +406,11 @@ int APIENTRY pngLoadF(FILE *fp, int mipm
 	if (!endinfo) return 0;
 
 	// DH: added following lines
+#if PNG_LIBPNG_VER >= 10400
+	if (setjmp(png_jmpbuf(png)))
+#else
 	if (setjmp(png->jmpbuf))
+#endif
 	{
 error:
 		png_destroy_read_struct(&png, &info, &endinfo);
@@ -603,7 +611,7 @@ error:
 			#define ALPHA *q
 
 			switch (trans) {
-				case PNG_CALLBACK:
+				case PNG_CALLBACK_FUNC:
 					FORSTART
 						ALPHA = AlphaCallback((unsigned char) r, (unsigned char) g, (unsigned char) b);
 					FOREND