 configure.ac                       |    6 ++--
 modules/color-selector-cmyk-lcms.c |   41 +++++++++++++++++++-------
 modules/display-filter-lcms.c      |   55 +++++++++++++++++++++++++++++------
 modules/display-filter-proof.c     |   33 +++++++++++++++++----
 plug-ins/common/lcms.c             |   56 +++++++++++++++++++++++++++++-------
 plug-ins/file-jpeg/jpeg-load.c     |   10 +++---
 6 files changed, 156 insertions(+), 45 deletions(-)

diff --git a/configure.ac b/configure.ac
index 00dd1d7..62099a2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -61,7 +61,7 @@ m4_define([libcurl_required_version], [7.15.1])
 m4_define([dbus_glib_required_version], [0.70])
 m4_define([libgudev_required_version], [167])
 m4_define([exif_required_version], [0.6.15])
-m4_define([lcms_required_version], [1.16])
+m4_define([lcms_required_version], [2.3])
 m4_define([libpng_required_version], [1.2.37])
 
 
@@ -450,7 +450,7 @@ fi
 # Internationalisation
 ######################
 
-IT_PROG_INTLTOOL(0.40.1)
+IT_PROG_INTLTOOL([0.40.1], [no-xml])
 AM_GLIB_GNU_GETTEXT
 
 
@@ -1540,7 +1540,7 @@ AC_ARG_WITH(lcms, [  --without-lcms          build without lcms support])
 have_lcms="no (lcms support disabled)"
 if test "x$with_lcms" != xno; then
   have_lcms=yes
-  PKG_CHECK_MODULES(LCMS, lcms >= lcms_required_version,
+  PKG_CHECK_MODULES(LCMS, lcms2 >= lcms_required_version,
     AC_DEFINE(HAVE_LCMS, 1, [Define to 1 if lcms is available])
     LCMS='lcms$(EXEEXT)',
     have_lcms="no (lcms not found or unusable)")
diff --git a/modules/color-selector-cmyk-lcms.c b/modules/color-selector-cmyk-lcms.c
index 0d5d20f..15322e6 100644
--- a/modules/color-selector-cmyk-lcms.c
+++ b/modules/color-selector-cmyk-lcms.c
@@ -19,7 +19,7 @@
 
 #include <glib.h>  /* lcms.h uses the "inline" keyword */
 
-#include <lcms.h>
+#include <lcms2.h>
 
 #include <gtk/gtk.h>
 
@@ -70,13 +70,13 @@ static void   colorsel_cmyk_init           (ColorselCmyk      *cmyk);
 static void   colorsel_cmyk_dispose        (GObject           *object);
 
 static void   colorsel_cmyk_set_color      (GimpColorSelector *selector,
-                                            const GimpRGB     *rgb,
-                                            const GimpHSV     *hsv);
+    const GimpRGB     *rgb,
+    const GimpHSV     *hsv);
 static void   colorsel_cmyk_set_config     (GimpColorSelector *selector,
-                                            GimpColorConfig   *config);
+    GimpColorConfig   *config);
 
 static void   colorsel_cmyk_adj_update     (GtkAdjustment     *adj,
-                                            ColorselCmyk      *module);
+    ColorselCmyk      *module);
 static void   colorsel_cmyk_config_changed (ColorselCmyk      *module);
 
 
@@ -151,8 +151,6 @@ colorsel_cmyk_class_init (ColorselCmykClass *klass)
   selector_class->stock_id   = GTK_STOCK_PRINT;  /* FIXME */
   selector_class->set_color  = colorsel_cmyk_set_color;
   selector_class->set_config = colorsel_cmyk_set_config;
-
-  cmsErrorAction (LCMS_ERROR_IGNORE);
 }
 
 static void
@@ -391,9 +389,11 @@ colorsel_cmyk_config_changed (ColorselCmyk *module)
 {
   GimpColorSelector *selector = GIMP_COLOR_SELECTOR (module);
   GimpColorConfig   *config   = module->config;
-  DWORD              flags    = 0;
+  cmsUInt32Number    flags    = 0;
+  cmsUInt32Number    descSize =0;
   cmsHPROFILE        rgb_profile;
   cmsHPROFILE        cmyk_profile;
+  gchar             *descData;
   const gchar       *name;
   gchar             *text;
 
@@ -419,13 +419,32 @@ colorsel_cmyk_config_changed (ColorselCmyk *module)
       ! (cmyk_profile = cmsOpenProfileFromFile (config->cmyk_profile, "r")))
     goto out;
 
-  name = cmsTakeProductDesc (cmyk_profile);
+  descSize = cmsGetProfileInfoASCII (cmyk_profile, cmsInfoDescription, "en", "US", NULL, 0);
+  if (descSize > 0)
+    {
+      descData = (gchar*) g_malloc (descSize + sizeof(gchar));
+      descSize = cmsGetProfileInfoASCII (cmyk_profile, cmsInfoDescription, "en", "US", descData, descSize);
+      if (descSize > 0)
+        {
+          name = descData;
+        }
+    }
+
   if (name && ! g_utf8_validate (name, -1, NULL))
     name = _("(invalid UTF-8 string)");
 
   if (! name)
     {
-      name = cmsTakeProductName (cmyk_profile);
+      descSize = cmsGetProfileInfoASCII (cmyk_profile, cmsInfoModel, "en", "US", NULL, 0);
+      if (descSize > 0)
+        {
+          descData = (gchar*) g_malloc (descSize + sizeof(gchar));
+          descSize = cmsGetProfileInfoASCII( cmyk_profile, cmsInfoModel, "en", "US", descData, descSize);
+          if (descSize > 0)
+            {
+              name = descData;
+            }
+        }
       if (name && ! g_utf8_validate (name, -1, NULL))
         name = _("(invalid UTF-8 string)");
     }
@@ -455,7 +474,7 @@ colorsel_cmyk_config_changed (ColorselCmyk *module)
   cmsCloseProfile (rgb_profile);
   cmsCloseProfile (cmyk_profile);
 
- out:
+out:
   if (! module->in_destruction)
     colorsel_cmyk_set_color (selector, &selector->rgb, &selector->hsv);
 }
diff --git a/modules/display-filter-lcms.c b/modules/display-filter-lcms.c
index c99b0f8..67b2ddc 100644
--- a/modules/display-filter-lcms.c
+++ b/modules/display-filter-lcms.c
@@ -25,7 +25,7 @@
 #define LCMS_WIN_TYPES_ALREADY_DEFINED
 #endif
 
-#include <lcms.h>
+#include <lcms2.h>
 
 #include <gtk/gtk.h>
 
@@ -35,6 +35,7 @@
 #include <CoreServices/CoreServices.h>
 #endif
 
+#include "libgimpbase/gimpbase.h"
 #include "libgimpcolor/gimpcolor.h"
 #include "libgimpconfig/gimpconfig.h"
 #include "libgimpmath/gimpmath.h"
@@ -133,8 +134,6 @@ cdisplay_lcms_class_init (CdisplayLcmsClass *klass)
   display_class->configure       = cdisplay_lcms_configure;
   display_class->convert_surface = cdisplay_lcms_convert_surface;
   display_class->changed         = cdisplay_lcms_changed;
-
-  cmsErrorAction (LCMS_ERROR_IGNORE);
 }
 
 static void
@@ -169,15 +168,48 @@ cdisplay_lcms_profile_get_info (cmsHPROFILE   profile,
 {
   if (profile)
     {
-      *name = cmsTakeProductDesc (profile);
+      cmsUInt32Number    descSize =0;
+      gchar             *descData;
+
+      descSize = cmsGetProfileInfoASCII (profile, cmsInfoDescription, "en", "US", NULL, 0);
+      if (descSize > 0)
+        {
+          descData = (gchar*) g_malloc (descSize + sizeof (gchar));
+          descSize = cmsGetProfileInfoASCII (profile, cmsInfoDescription, "en", "US", descData, descSize);
+          if (descSize > 0)
+            {
+              *name = gimp_any_to_utf8 ((gchar*)descData, -1, NULL);
+            }
+        }
 
       if (! *name)
-        *name = cmsTakeProductName (profile);
+        {
+          descSize = cmsGetProfileInfoASCII (profile, cmsInfoModel, "en", "US", NULL, 0);
+          if (descSize > 0)
+            {
+              descData = (gchar*) g_malloc( descSize + sizeof (gchar));
+              descSize = cmsGetProfileInfoASCII(profile, cmsInfoModel, "en", "US", descData, descSize);
+              if (descSize > 0)
+                {
+                  name = descData;
+                }
+            }
+        }
 
       if (*name && ! g_utf8_validate (*name, -1, NULL))
         *name = _("(invalid UTF-8 string)");
 
-      *info = cmsTakeProductInfo (profile);
+      descSize = cmsGetProfileInfoASCII (profile, cmsInfoManufacturer, "en", "US", NULL, 0);
+      if (descSize > 0)
+        {
+          descData = (gchar*) g_malloc (descSize + sizeof (gchar));
+          descSize = cmsGetProfileInfoASCII (profile, cmsInfoManufacturer, "en", "US", descData, descSize);
+          if (descSize > 0)
+            {
+              *info = descData;
+            }
+        }
+
       if (*name && ! g_utf8_validate (*info, -1, NULL))
         *info = NULL;
     }
@@ -313,7 +345,8 @@ cdisplay_lcms_changed (GimpColorDisplay *display)
   cmsHPROFILE      src_profile   = NULL;
   cmsHPROFILE      dest_profile  = NULL;
   cmsHPROFILE      proof_profile = NULL;
-  DWORD            flags         = 0;
+  cmsUInt32Number  flags         = 0;
+  cmsUInt16Number  alarmCodes[cmsMAXCHANNELS] = { 0 };
 
   if (lcms->transform)
     {
@@ -363,7 +396,11 @@ cdisplay_lcms_changed (GimpColorDisplay *display)
 
           gimp_rgb_get_uchar (&config->out_of_gamut_color, &r, &g, &b);
 
-          cmsSetAlarmCodes (r, g, b);
+          alarmCodes[0] = (cmsUInt16Number)r;
+          alarmCodes[1] = (cmsUInt16Number)g;
+          alarmCodes[2] = (cmsUInt16Number)b;
+          
+          cmsSetAlarmCodes (alarmCodes);
         }
 
       lcms->transform = cmsCreateProofingTransform (src_profile, TYPE_ARGB_8,
@@ -398,7 +435,7 @@ cdisplay_lcms_changed (GimpColorDisplay *display)
 static gboolean
 cdisplay_lcms_profile_is_rgb (cmsHPROFILE profile)
 {
-  return (cmsGetColorSpace (profile) == icSigRgbData);
+  return (cmsGetColorSpace (profile) == cmsSigRgbData);
 }
 
 static cmsHPROFILE
diff --git a/modules/display-filter-proof.c b/modules/display-filter-proof.c
index 41967f5..ca568f0 100644
--- a/modules/display-filter-proof.c
+++ b/modules/display-filter-proof.c
@@ -19,7 +19,7 @@
 
 #include <glib.h>  /* lcms.h uses the "inline" keyword */
 
-#include <lcms.h>
+#include <lcms2.h>
 
 #include <gtk/gtk.h>
 
@@ -146,7 +146,6 @@ cdisplay_proof_class_init (CdisplayProofClass *klass)
   display_class->configure       = cdisplay_proof_configure;
   display_class->changed         = cdisplay_proof_changed;
 
-  cmsErrorAction (LCMS_ERROR_IGNORE);
 }
 
 static void
@@ -298,10 +297,32 @@ cdisplay_proof_combo_box_set_active (GimpColorProfileComboBox *combo,
 
   if (profile)
     {
-      label = gimp_any_to_utf8 (cmsTakeProductDesc (profile), -1, NULL);
-      if (! label)
-        label = gimp_any_to_utf8 (cmsTakeProductName (profile), -1, NULL);
+      cmsUInt32Number  descSize =0;
+      gchar           *descData;
 
+      descSize = cmsGetProfileInfoASCII(profile, cmsInfoDescription, "en", "US", NULL, 0);
+      if (descSize > 0)
+        {
+          descData = (gchar*) g_malloc (descSize + sizeof (gchar));
+          descSize = cmsGetProfileInfoASCII (profile, cmsInfoDescription, "en", "US", descData, descSize);
+          if (descSize > 0)
+            {
+              label = gimp_any_to_utf8 (descData, -1, NULL);
+            }
+        }
+      if (! label)
+        {
+          descSize = cmsGetProfileInfoASCII (profile, cmsInfoModel, "en", "US", NULL, 0);
+          if (descSize > 0)
+            {
+              descData = (gchar*) g_malloc (descSize + sizeof (gchar));
+              descSize = cmsGetProfileInfoASCII (profile, cmsInfoModel, "en", "US", descData, descSize);
+              if (descSize > 0)
+                {
+                  label = gimp_any_to_utf8 (descData, -1, NULL);
+                }
+            }
+        }
       cmsCloseProfile (profile);
     }
 
@@ -465,7 +486,7 @@ cdisplay_proof_changed (GimpColorDisplay *display)
 
   if (proofProfile)
     {
-      DWORD flags = cmsFLAGS_SOFTPROOFING;
+      cmsUInt32Number flags = cmsFLAGS_SOFTPROOFING;
 
       if (proof->bpc)
         flags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
diff --git a/plug-ins/common/lcms.c b/plug-ins/common/lcms.c
index d2661d8..b16c18e 100644
--- a/plug-ins/common/lcms.c
+++ b/plug-ins/common/lcms.c
@@ -24,7 +24,7 @@
 
 #include <glib.h>  /* lcms.h uses the "inline" keyword */
 
-#include <lcms.h>
+#include <lcms2.h>
 
 #include <libgimp/gimp.h>
 #include <libgimp/gimpui.h>
@@ -428,7 +428,7 @@ run (const gchar      *name,
         }
     }
 
-  cmsErrorAction (LCMS_ERROR_SHOW);
+//  cmsErrorAction (LCMS_ERROR_SHOW);
 
   switch (proc)
     {
@@ -459,7 +459,7 @@ run (const gchar      *name,
         gchar *desc = NULL;
         gchar *info = NULL;
 
-        cmsErrorAction (LCMS_ERROR_IGNORE);
+//        cmsErrorAction (LCMS_ERROR_IGNORE);
 
         if (proc == PROC_INFO)
           status = lcms_icc_info (config, image, &name, &desc, &info);
@@ -496,25 +496,59 @@ run (const gchar      *name,
 static gchar *
 lcms_icc_profile_get_name (cmsHPROFILE profile)
 {
-  return gimp_any_to_utf8 (cmsTakeProductName (profile), -1, NULL);
+  cmsUInt32Number     descSize = 0;
+  gchar               *descData ="";
+
+  descSize = cmsGetProfileInfoASCII (profile, cmsInfoModel, "en", "US", NULL, 0);
+  if (descSize > 0)
+    {
+      descData = (gchar*) g_malloc (descSize + sizeof (gchar));
+      descSize = cmsGetProfileInfoASCII (profile, cmsInfoModel, "en", "US", descData, descSize);
+}
+
+  return gimp_any_to_utf8 (descData, -1, NULL);
+
+//  return gimp_any_to_utf8 (cmsTakeProductName (profile), -1, NULL);
 }
 
 static gchar *
 lcms_icc_profile_get_desc (cmsHPROFILE profile)
 {
-  return gimp_any_to_utf8 (cmsTakeProductDesc (profile), -1, NULL);
+  cmsUInt32Number     descSize = 0;
+  gchar               *descData = "";
+
+  descSize = cmsGetProfileInfoASCII (profile, cmsInfoDescription, "en", "US", NULL, 0);
+  if (descSize > 0)
+    {
+      descData = (gchar*) g_malloc (descSize + sizeof (gchar));
+      descSize = cmsGetProfileInfoASCII (profile, cmsInfoDescription, "en", "US", descData, descSize);
+}
+
+  return gimp_any_to_utf8 (descData, -1, NULL);
+//  return gimp_any_to_utf8 (cmsTakeProductDesc (profile), -1, NULL);
 }
 
 static gchar *
 lcms_icc_profile_get_info (cmsHPROFILE profile)
 {
-  return gimp_any_to_utf8 (cmsTakeProductInfo (profile), -1, NULL);
+  cmsUInt32Number     descSize = 0;
+  gchar               *descData = "";
+
+  descSize = cmsGetProfileInfoASCII (profile, cmsInfoModel, "en", "US", NULL, 0);
+  if (descSize > 0)
+    {
+      descData = (gchar*) g_malloc (descSize + sizeof (gchar));
+      descSize = cmsGetProfileInfoASCII (profile, cmsInfoModel, "en", "US", descData, descSize);
+}
+
+  return gimp_any_to_utf8 (descData, -1, NULL);
+//  return gimp_any_to_utf8 (cmsTakeProductInfo (profile), -1, NULL);
 }
 
 static gboolean
 lcms_icc_profile_is_rgb (cmsHPROFILE profile)
 {
-  return (cmsGetColorSpace (profile) == icSigRgbData);
+  return (cmsGetColorSpace (profile) == cmsSigRgbData);
 }
 
 static GimpPDBStatusType
@@ -738,8 +772,8 @@ lcms_calculate_checksum (const gchar *data,
       GChecksum *md5 = g_checksum_new (G_CHECKSUM_MD5);
 
       g_checksum_update (md5,
-                         (const guchar *) data + sizeof (icHeader),
-                         len - sizeof (icHeader));
+                         (const guchar *) data + sizeof (cmsICCHeader),
+                         len - sizeof (cmsICCHeader));
 
       len = 16;
       g_checksum_get_digest (md5, digest, &len);
@@ -935,7 +969,7 @@ lcms_image_transform_rgb (gint32                    image,
                           gboolean                  bpc)
 {
   cmsHTRANSFORM  transform   = NULL;
-  DWORD          last_format = 0;
+  cmsUInt32Number  last_format = 0;
   gint          *layers;
   gint           num_layers;
   gint           i;
@@ -945,7 +979,7 @@ lcms_image_transform_rgb (gint32                    image,
   for (i = 0; i < num_layers; i++)
     {
       GimpDrawable *drawable = gimp_drawable_get (layers[i]);
-      DWORD         format;
+      cmsUInt32Number         format;
 
       switch (drawable->bpp)
         {
diff --git a/plug-ins/file-jpeg/jpeg-load.c b/plug-ins/file-jpeg/jpeg-load.c
index 87267fd..5338ac5 100644
--- a/plug-ins/file-jpeg/jpeg-load.c
+++ b/plug-ins/file-jpeg/jpeg-load.c
@@ -31,7 +31,7 @@
 #endif /* HAVE_LIBEXIF */
 
 #ifdef HAVE_LCMS
-#include <lcms.h>
+#include <lcms2.h>
 #endif
 
 #include <libgimp/gimp.h>
@@ -966,7 +966,7 @@ jpeg_load_cmyk_transform (guint8 *profile_data,
   GimpColorConfig *config       = gimp_get_color_configuration ();
   cmsHPROFILE      cmyk_profile = NULL;
   cmsHPROFILE      rgb_profile  = NULL;
-  DWORD            flags        = 0;
+  cmsUInt32Number  flags        = 0;
   cmsHTRANSFORM    transform;
 
   /*  try to load the embedded CMYK profile  */
@@ -976,7 +976,7 @@ jpeg_load_cmyk_transform (guint8 *profile_data,
 
       if (cmyk_profile)
         {
-          if (! cmsGetColorSpace (cmyk_profile) == icSigCmykData)
+          if (! cmsGetColorSpace (cmyk_profile) == cmsSigCmykData)
             {
               cmsCloseProfile (cmyk_profile);
               cmyk_profile = NULL;
@@ -989,7 +989,7 @@ jpeg_load_cmyk_transform (guint8 *profile_data,
     {
       cmyk_profile = cmsOpenProfileFromFile (config->cmyk_profile, "r");
 
-      if (cmyk_profile && ! cmsGetColorSpace (cmyk_profile) == icSigCmykData)
+      if (cmyk_profile && ! cmsGetColorSpace (cmyk_profile) == cmsSigCmykData)
         {
           cmsCloseProfile (cmyk_profile);
           cmyk_profile = NULL;
@@ -1008,7 +1008,7 @@ jpeg_load_cmyk_transform (guint8 *profile_data,
     {
       rgb_profile = cmsOpenProfileFromFile (config->rgb_profile, "r");
 
-      if (rgb_profile && ! cmsGetColorSpace (rgb_profile) == icSigRgbData)
+      if (rgb_profile && ! cmsGetColorSpace (rgb_profile) == cmsSigRgbData)
         {
           cmsCloseProfile (rgb_profile);
           rgb_profile = NULL;
