[gimp] configure.ac, app: require liblcms2 >= 2.7



commit 0ce364ee4dd2200e6607a4575af0cc657600afc9
Author: Michael Natterer <mitch gimp org>
Date:   Thu Sep 15 12:52:20 2016 +0200

    configure.ac, app: require liblcms2 >= 2.7
    
    and add an lcms2 runtime version check to app/sanity.c
    
    Fixes:
    Bug 736701 - LCMS2 rounding errors cause problems with certain GIMP blend modes

 app/Makefile.am |    2 ++
 app/sanity.c    |   53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 configure.ac    |    2 +-
 3 files changed, 56 insertions(+), 1 deletions(-)
---
diff --git a/app/Makefile.am b/app/Makefile.am
index 38bceb9..7f17b16 100644
--- a/app/Makefile.am
+++ b/app/Makefile.am
@@ -118,6 +118,7 @@ AM_CPPFLAGS = \
        $(GTK_CFLAGS)                   \
        $(PANGOCAIRO_CFLAGS)            \
        $(GEGL_CFLAGS)                  \
+       $(LCMS_CFLAGS)                  \
        $(GEXIV2_CFLAGS)                \
        -I$(includedir)                 \
        -I$(builddir)/gui
@@ -163,6 +164,7 @@ gimpconsoleldadd = \
        $(GIO_WINDOWS_LIBS)             \
        $(GEGL_LIBS)                    \
        $(GLIB_LIBS)                    \
+       $(LCMS_LIBS)                    \
        $(GEXIV2_LIBS)                  \
        $(Z_LIBS)                       \
        $(JSON_C_LIBS)                  \
diff --git a/app/sanity.c b/app/sanity.c
index 30709c4..26b31bd 100644
--- a/app/sanity.c
+++ b/app/sanity.c
@@ -22,6 +22,7 @@
 #include <pango/pango.h>
 #include <pango/pangoft2.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
+#include <lcms2.h>
 #include <gexiv2/gexiv2.h>
 #include <gegl.h>
 
@@ -39,6 +40,7 @@ static gchar * sanity_check_pango             (void);
 static gchar * sanity_check_fontconfig        (void);
 static gchar * sanity_check_freetype          (void);
 static gchar * sanity_check_gdk_pixbuf        (void);
+static gchar * sanity_check_lcms              (void);
 static gchar * sanity_check_gexiv2            (void);
 static gchar * sanity_check_babl              (void);
 static gchar * sanity_check_gegl              (void);
@@ -72,6 +74,9 @@ sanity_check (void)
     abort_message = sanity_check_gdk_pixbuf ();
 
   if (! abort_message)
+    abort_message = sanity_check_lcms ();
+
+  if (! abort_message)
     abort_message = sanity_check_gexiv2 ();
 
   if (! abort_message)
@@ -352,6 +357,54 @@ sanity_check_gdk_pixbuf (void)
 }
 
 static gchar *
+sanity_check_lcms (void)
+{
+#define LCMS_REQUIRED_MAJOR 2
+#define LCMS_REQUIRED_MINOR 7
+
+  gint lcms_version = cmsGetEncodedCMMversion ();
+
+  if (LCMS_VERSION > lcms_version)
+    {
+      return g_strdup_printf
+        ("Liblcms2 version mismatch!\n\n"
+         "GIMP was compiled against LittleCMS version %d.%d, but the\n"
+         "LittleCMS version found at runtime is only %d.%d.\n\n"
+         "Somehow you or your software packager managed\n"
+         "to install a LittleCMS that is older than what GIMP was\n"
+         "built against.\n\n"
+         "Please make sure that the installed LittleCMS version\n"
+         "is at least %d.%d and that headers and library match.",
+         LCMS_VERSION / 1000, LCMS_VERSION % 100 / 10,
+         lcms_version / 1000, lcms_version % 100 / 10,
+         LCMS_VERSION / 1000, LCMS_VERSION % 100 / 10);
+    }
+
+  if (lcms_version < (LCMS_REQUIRED_MAJOR * 1000 +
+                      LCMS_REQUIRED_MINOR * 10))
+    {
+      const gint lcms_major_version = lcms_version / 1000;
+      const gint lcms_minor_version = lcms_version % 100 / 10;
+
+      return g_strdup_printf
+        ("Liblcms2 version too old!\n\n"
+         "GIMP requires LittleCMS version %d.%d or later.\n"
+         "Installed LittleCMS version is %d.%d.\n\n"
+         "Somehow you or your software packager managed\n"
+         "to install GIMP with an older LittleCMS version.\n\n"
+         "Please upgrade to LittleCMS version %d.%d or later.",
+         LCMS_REQUIRED_MAJOR, LCMS_REQUIRED_MINOR,
+         lcms_major_version, lcms_minor_version,
+         LCMS_REQUIRED_MAJOR, LCMS_REQUIRED_MINOR);
+    }
+
+#undef LCMS_REQUIRED_MAJOR
+#undef LCMS_REQUIRED_MINOR
+
+  return NULL;
+}
+
+static gchar *
 sanity_check_gexiv2 (void)
 {
 #ifdef GEXIV2_MAJOR_VERSION
diff --git a/configure.ac b/configure.ac
index 93eba6a..f49c762 100644
--- a/configure.ac
+++ b/configure.ac
@@ -68,7 +68,7 @@ m4_define([poppler_data_required_version], [0.4.7])
 m4_define([libgudev_required_version], [167])
 m4_define([gexiv2_required_version], [0.6.1])
 m4_define([libmypaint_required_version], [1.3.0])
-m4_define([lcms_required_version], [2.6])
+m4_define([lcms_required_version], [2.7])
 m4_define([libpng_required_version], [1.2.37])
 m4_define([liblzma_required_version], [5.0.0])
 m4_define([openexr_required_version], [1.6.1])


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]