diff -Nurd -x'*~' eog-2.28.2.orig/bindings/python/Makefile.am eog-2.28.2/bindings/python/Makefile.am
--- eog-2.28.2.orig/bindings/python/Makefile.am	2009-11-10 13:10:59.000000000 -0500
+++ eog-2.28.2/bindings/python/Makefile.am	2010-03-02 00:48:40.000000000 -0500
@@ -13,7 +13,7 @@
 	$(PYTHON_EXTRA_LIBS)	\
 	$(PYGTK_LIBS)
 
-eog_la_CFLAGS = 					\
+eog_la_CPPFLAGS = 					\
 	-I$(top_srcdir)					\
 	-I$(top_builddir)				\
 	-I$(top_srcdir)/src				\
diff -Nurd -x'*~' eog-2.28.2.orig/configure.ac eog-2.28.2/configure.ac
--- eog-2.28.2.orig/configure.ac	2009-12-16 15:53:29.000000000 -0500
+++ eog-2.28.2/configure.ac	2013-09-10 23:33:13.000000000 -0400
@@ -96,6 +96,7 @@
 EOG_MODULES="gtk+-2.0 >= $GTK_REQUIRED \
              glib-2.0 >= $GLIB_REQUIRED \
              gio-2.0 >= $GLIB_REQUIRED \
+             gthread-2.0 >= $GLIB_REQUIRED \
              gnome-desktop-2.0 >= $GNOME_DESKTOP_REQUIRED \
              gdk-pixbuf-2.0 >= $GDKPIXBUF_REQUIRED \
              gconf-2.0 >= $GCONF_REQUIRED \
@@ -146,13 +147,14 @@
 AC_ARG_WITH([cms], AC_HELP_STRING([--without-cms], [disable colour management support]))
 have_lcms=no
 if test x$with_cms != xno; then
-    PKG_CHECK_MODULES(LCMS, lcms, have_lcms=yes, have_lcms=no)
+    PKG_CHECK_MODULES(LCMS, lcms2, have_lcms=yes, have_lcms=no)
 fi
 if test "x$have_lcms" = "xyes"; then
   AC_DEFINE(HAVE_LCMS, 1, [Little CMS Support.])
-  EOG_MODULES="$EOG_MODULES lcms"
+  EOG_MODULES="$EOG_MODULES lcms2"
 fi
 
+AM_CONDITIONAL([HAVE_LCMS], [test "x$have_lcms" = "xyes"])
 
 # *********************
 # Exempi (optional)
@@ -261,9 +263,33 @@
 # ****************
 
 PKG_CHECK_MODULES(EOG, $EOG_MODULES)
+EOG_LIBS="$EOG_LIBS $INTLLIBS"
 AC_SUBST(EOG_CFLAGS)
 AC_SUBST(EOG_LIBS)
 
+# *******************************************************
+# libX11 (required for TotemScrSaver and Color Profiling)
+# *******************************************************
+
+# Check GDK rendering target
+gdk_target=`$PKG_CONFIG --variable=target gdk-2.0`
+
+if test "x$have_lcms" = "xyes" || test "$gdk_target" = "x11"; then
+	PKG_CHECK_MODULES(X11, [x11], have_x11=yes, have_x11=no)
+
+	if test "x$have_x11" != "xyes"; then
+		# Fallback for X11 releases without .pc-files
+		AC_PATH_XTRA
+		if test x$no_x = xyes ; then
+			AC_MSG_ERROR([X development libraries (libX11) not found])
+		else
+			X11_LIBS="$X_PRE_LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
+			AC_SUBST(X11_LIBS) 
+			have_x11=yes
+		fi
+	fi
+fi
+
 # *****
 # GConf
 # *****
diff -Nurd -x'*~' eog-2.28.2.orig/cut-n-paste/totem-screensaver/Makefile.am eog-2.28.2/cut-n-paste/totem-screensaver/Makefile.am
--- eog-2.28.2.orig/cut-n-paste/totem-screensaver/Makefile.am	2009-08-11 06:49:55.000000000 -0400
+++ eog-2.28.2/cut-n-paste/totem-screensaver/Makefile.am	2010-03-02 00:57:29.000000000 -0500
@@ -4,9 +4,12 @@
 	totem-scrsaver.h \
 	totem-scrsaver.c
 
-libtotemscrsaver_la_CFLAGS = \
+libtotemscrsaver_la_LIBADD = $(X11_LIBS)
+
+libtotemscrsaver_la_CPPFLAGS = \
 	-I$(top_srcdir)/src	\
 	$(EOG_CFLAGS)		\
+	$(X11_CFLAGS)		\
 	$(WARN_CFLAGS)
 
 -include $(top_srcdir)/git.mk
diff -Nurd -x'*~' eog-2.28.2.orig/src/Makefile.am eog-2.28.2/src/Makefile.am
--- eog-2.28.2.orig/src/Makefile.am	2009-12-16 15:53:29.000000000 -0500
+++ eog-2.28.2/src/Makefile.am	2010-03-02 01:20:12.000000000 -0500
@@ -142,7 +142,7 @@
 	eog-exif-details.c
 endif HAVE_EXEMPI
 
-libeog_la_CFLAGS =						\
+libeog_la_CPPFLAGS =						\
 	-I$(top_srcdir)/jpegutils				\
 	-I$(top_srcdir)/cut-n-paste/toolbar-editor		\
 	-I$(top_srcdir)/cut-n-paste/totem-screensaver		\
@@ -158,8 +158,16 @@
 libeog_la_LIBADD = \
 	$(EOG_LIBS)
 
+if HAVE_LCMS
+libeog_la_CPPFLAGS += 	\
+	$(X11_CFLAGS)
+
+libeog_la_LIBADD += \
+	$(X11_LIBS)
+endif
+
 if ENABLE_PYTHON
-libeog_la_CFLAGS += 			\
+libeog_la_CPPFLAGS += 			\
 	$(NO_STRICT_ALIASING_CFLAGS)	\
 	$(PYGTK_CFLAGS)			\
 	$(PYTHON_CFLAGS)		\
@@ -173,7 +181,7 @@
 
 eog_SOURCES = main.c
 
-eog_CFLAGS = 							\
+eog_CPPFLAGS = 							\
 	-I$(top_srcdir)/cut-n-paste/toolbar-editor		\
 	-I$(top_srcdir)/cut-n-paste/totem-screensaver		\
 	$(EOG_CFLAGS)						\
@@ -183,7 +191,6 @@
 eog_LDADD = 				\
 	libeog.la			\
 	$(EOG_LIBS)			\
-	$(X_LIBS)			\
 	$(LIBJPEG)			\
 	$(toolbar_LIB)			\
 	$(screensaver_LIB)		\
diff -Nurd -x'*~' eog-2.28.2.orig/src/eog-image.c eog-2.28.2/src/eog-image.c
--- eog-2.28.2.orig/src/eog-image.c	2009-12-16 15:53:29.000000000 -0500
+++ eog-2.28.2/src/eog-image.c	2013-09-10 23:33:13.000000000 -0400
@@ -58,7 +58,7 @@
 #endif
 
 #ifdef HAVE_LCMS
-#include <lcms.h>
+#include <lcms2.h>
 #ifndef EXIF_TAG_GAMMA
 #define EXIF_TAG_GAMMA 0xa500
 #endif
@@ -629,8 +629,8 @@
 	if (screen == NULL || priv->profile == NULL) return;
 
 	/* TODO: support other colorspaces than RGB */
-	if (cmsGetColorSpace (priv->profile) != icSigRgbData ||
-	    cmsGetColorSpace (screen) != icSigRgbData) {
+	if (cmsGetColorSpace (priv->profile) != cmsSigRgbData ||
+	    cmsGetColorSpace (screen) != cmsSigRgbData) {
 		eog_debug_message (DEBUG_LCMS, "One or both ICC profiles not in RGB colorspace; not correcting");
 		return;
 	}
diff -Nurd -x'*~' eog-2.28.2.orig/src/eog-image.h eog-2.28.2/src/eog-image.h
--- eog-2.28.2.orig/src/eog-image.h	2009-12-16 15:53:29.000000000 -0500
+++ eog-2.28.2/src/eog-image.h	2013-09-10 23:33:13.000000000 -0400
@@ -37,7 +37,7 @@
 #endif
 
 #ifdef HAVE_LCMS
-#include <lcms.h>
+#include <lcms2.h>
 #endif
 
 #ifdef HAVE_EXEMPI
diff -Nurd -x'*~' eog-2.28.2.orig/src/eog-metadata-reader-jpg.c eog-2.28.2/src/eog-metadata-reader-jpg.c
--- eog-2.28.2.orig/src/eog-metadata-reader-jpg.c	2009-08-11 06:49:55.000000000 -0400
+++ eog-2.28.2/src/eog-metadata-reader-jpg.c	2013-09-10 23:33:13.000000000 -0400
@@ -513,8 +513,6 @@
 	priv = emr->priv;
 
 	if (priv->icc_chunk) {
-		cmsErrorAction (LCMS_ERROR_SHOW);
-
 		profile = cmsOpenProfileFromMem(priv->icc_chunk + 14, priv->icc_len - 14);
 
 		if (profile) {
@@ -562,7 +560,7 @@
 		  	{
 			cmsCIExyY whitepoint;
 			cmsCIExyYTRIPLE primaries;
-			LPGAMMATABLE gamma[3];
+			cmsToneCurve *gamma[3];
 			double gammaValue;
 			ExifRational r;
 
@@ -619,11 +617,11 @@
 				gammaValue = 2.2;
 			}
 
-			gamma[0] = gamma[1] = gamma[2] = cmsBuildGamma (256, gammaValue);
+			gamma[0] = gamma[1] = gamma[2] = cmsBuildGamma (NULL, gammaValue);
 
 			profile = cmsCreateRGBProfile (&whitepoint, &primaries, gamma);
 
-			cmsFreeGamma(gamma[0]);
+			cmsFreeToneCurve(gamma[0]);
 
 			eog_debug_message (DEBUG_LCMS, "JPEG is calibrated");
 
diff -Nurd -x'*~' eog-2.28.2.orig/src/eog-metadata-reader-png.c eog-2.28.2/src/eog-metadata-reader-png.c
--- eog-2.28.2.orig/src/eog-metadata-reader-png.c	2009-12-16 15:53:29.000000000 -0500
+++ eog-2.28.2/src/eog-metadata-reader-png.c	2013-09-10 23:33:13.000000000 -0400
@@ -569,8 +569,6 @@
 			return NULL;
 		}
 
-		cmsErrorAction (LCMS_ERROR_SHOW);
-
 		profile = cmsOpenProfileFromMem(outbuf, zstr.total_out);
 		inflateEnd (&zstr);
 		g_free (outbuf);
@@ -589,7 +587,7 @@
 	if (!profile && priv->cHRM_chunk) {
 		cmsCIExyY whitepoint;
 		cmsCIExyYTRIPLE primaries;
-		LPGAMMATABLE gamma[3];
+		cmsToneCurve *gamma[3];
 		double gammaValue = 2.2; // 2.2 should be a sane default gamma
 
 		/* This uglyness extracts the chromacity and whitepoint values
@@ -617,11 +615,11 @@
 		if (priv->gAMA_chunk)
 			gammaValue = (double) 1.0/EXTRACT_DOUBLE_UINT_BLOCK_OFFSET (priv->gAMA_chunk, 0, 100000);
 
-		gamma[0] = gamma[1] = gamma[2] = cmsBuildGamma (256, gammaValue);
+		gamma[0] = gamma[1] = gamma[2] = cmsBuildGamma (NULL, gammaValue);
 
 		profile = cmsCreateRGBProfile (&whitepoint, &primaries, gamma);
 
-		cmsFreeGamma(gamma[0]);
+		cmsFreeToneCurve(gamma[0]);
 	}
 
 	return profile;
diff -Nurd -x'*~' eog-2.28.2.orig/src/eog-metadata-reader.h eog-2.28.2/src/eog-metadata-reader.h
--- eog-2.28.2.orig/src/eog-metadata-reader.h	2009-08-11 06:49:55.000000000 -0400
+++ eog-2.28.2/src/eog-metadata-reader.h	2013-09-10 23:33:13.000000000 -0400
@@ -30,7 +30,7 @@
 #include <exempi/xmp.h>
 #endif
 #if HAVE_LCMS
-#include <lcms.h>
+#include <lcms2.h>
 #endif
 
 G_BEGIN_DECLS
diff -Nurd -x'*~' eog-2.28.2.orig/src/eog-scroll-view.c eog-2.28.2/src/eog-scroll-view.c
--- eog-2.28.2.orig/src/eog-scroll-view.c	2009-12-16 15:53:29.000000000 -0500
+++ eog-2.28.2/src/eog-scroll-view.c	2013-09-10 23:55:41.000000000 -0400
@@ -2,6 +2,7 @@
 #include <config.h>
 #endif
 
+#include <stdlib.h>
 #include <math.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
 #include <gdk/gdkkeysyms.h>
diff -Nurd -x'*~' eog-2.28.2.orig/src/eog-window.c eog-2.28.2/src/eog-window.c
--- eog-2.28.2.orig/src/eog-window.c	2009-12-16 15:53:29.000000000 -0500
+++ eog-2.28.2/src/eog-window.c	2013-09-10 23:33:13.000000000 -0400
@@ -71,7 +71,7 @@
 #ifdef GDK_WINDOWING_X11
 #include <gdk/gdkx.h>
 #endif
-#include <lcms.h>
+#include <lcms2.h>
 #endif
 
 #define EOG_WINDOW_GET_PRIVATE(object) \
@@ -638,7 +638,6 @@
 	int result;
 	cmsHPROFILE *profile;
 	char *atom_name;
-	int lcms_error_action;
 
 	dpy = GDK_DISPLAY_XDISPLAY (gdk_screen_get_display (screen));
 
@@ -685,17 +684,8 @@
 				return NULL;
 		}
 
-		/* Make lcms errors non-fatal here, as it is possible
-		 * to load invalid profiles with XICC.
-		 * We don't want lcms to abort EOG in that case.
-		 */
-		lcms_error_action = cmsErrorAction (LCMS_ERROR_IGNORE);
-
 		profile = cmsOpenProfileFromMem (str, length);
 
-		// Restore the previous error setting
-		cmsErrorAction (lcms_error_action);
-
 		if (G_UNLIKELY (profile == NULL)) {
 			eog_debug_message (DEBUG_LCMS,
 					   "Invalid display profile, "
