Blame SOURCES/jdk8042159-allow_using_system_installed_lcms2.patch

03c558
diff -ruN jdk8/common/autoconf/libraries.m4 jdk8/common/autoconf/libraries.m4
03c558
--- openjdk/common/autoconf/libraries.m4	2013-11-14 22:04:38.039440136 -0500
03c558
+++ openjdk/common/autoconf/libraries.m4	2013-11-14 22:05:11.474356424 -0500
03c558
@@ -676,6 +676,46 @@
03c558
 
03c558
   ###############################################################################
03c558
   #
03c558
+  # Check for the lcms2 library
03c558
+  #
03c558
+
03c558
+  AC_ARG_WITH(lcms, [AS_HELP_STRING([--with-lcms],
03c558
+  	[use lcms2 from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
03c558
+
03c558
+  AC_CHECK_LIB(lcms2, cmsOpenProfileFromFile,
03c558
+               [ LCMS_FOUND=yes ],
03c558
+               [ LCMS_FOUND=no ])
03c558
+
03c558
+  AC_MSG_CHECKING([for which lcms to use])
03c558
+
03c558
+  DEFAULT_LCMS=bundled
03c558
+
03c558
+  #
03c558
+  # If user didn't specify, use DEFAULT_LCMS
03c558
+  #
03c558
+  if test "x${with_lcms}" = "x"; then
03c558
+      with_lcms=${DEFAULT_LCMS}
03c558
+  fi
03c558
+
03c558
+  if test "x${with_lcms}" = "xbundled"; then
03c558
+      USE_EXTERNAL_LCMS=false
03c558
+      AC_MSG_RESULT([bundled])
03c558
+  elif test "x${with_lcms}" = "xsystem"; then
03c558
+      if test "x${LCMS_FOUND}" = "xyes"; then
03c558
+          USE_EXTERNAL_LCMS=true
03c558
+          AC_MSG_RESULT([system])
03c558
+      else
03c558
+          AC_MSG_RESULT([system not found])
03c558
+          AC_MSG_ERROR([--with-lcms=system specified, but no lcms found!])
03c558
+      fi
03c558
+  else
03c558
+      AC_MSG_ERROR([Invalid value for --with-lcms: ${with_lcms}, use 'system' or 'bundled'])
03c558
+  fi
03c558
+
03c558
+  AC_SUBST(USE_EXTERNAL_LCMS)
03c558
+
03c558
+  ###############################################################################
03c558
+  #
03c558
   # Check for the png library
03c558
   #
03c558
 
03c558
diff -ruN jdk8/jdk/make/lib/Awt2dLibraries.gmk jdk8/jdk/make/lib/Awt2dLibraries.gmk
03c558
--- openjdk/jdk/make/lib/Awt2dLibraries.gmk	2013-11-14 22:04:38.040440133 -0500
03c558
+++ openjdk/jdk/make/lib/Awt2dLibraries.gmk	2013-11-14 22:05:11.475356411 -0500
03c558
@@ -666,18 +666,35 @@
03c558
 
03c558
 ##########################################################################################
03c558
 
03c558
+LIBLCMS_DIR := $(JDK_TOPDIR)/src/share/native/sun/java2d/cmm/lcms
03c558
+
03c558
+ifeq ($(USE_EXTERNAL_LCMS), true)
03c558
+  # If we're using an external library, we'll just need the wrapper part.
03c558
+  # By including it explicitely, all other files will be excluded.
03c558
+  BUILD_LIBLCMS_INCLUDE_FILES := LCMS.c
03c558
+  BUILD_LIBLCMS_HEADERS :=
03c558
+else
03c558
+  BUILD_LIBLCMS_INCLUDE_FILES :=
03c558
+  # If we're using the bundled library, we'll need to include it in the
03c558
+  # include path explicitly. Otherwise the system headers will be used.
03c558
+  BUILD_LIBLCMS_HEADERS := -I$(LIBLCMS_DIR)
03c558
+endif
03c558
+
03c558
 # TODO: Update awt lib path when awt is converted
03c558
 $(eval $(call SetupNativeCompilation,BUILD_LIBLCMS, \
03c558
     LIBRARY := lcms, \
03c558
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
03c558
-    SRC := $(JDK_TOPDIR)/src/share/native/sun/java2d/cmm/lcms, \
03c558
+    SRC := $(LIBLCMS_DIR), \
03c558
+    INCLUDE_FILES := $(BUILD_LIBLCMS_INCLUDE_FILES), \
03c558
     LANG := C, \
03c558
     OPTIMIZATION := HIGHEST, \
03c558
     CFLAGS := $(filter-out -xc99=%none, $(CFLAGS_JDKLIB)) \
03c558
         -DCMS_DONT_USE_FAST_FLOOR \
03c558
         $(SHARED_LIBRARY_FLAGS) \
03c558
         -I$(JDK_TOPDIR)/src/share/native/sun/java2d \
03c558
-        -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug, \
03c558
+        -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
03c558
+        $(BUILD_LIBLCMS_HEADERS) \
03c558
+        $(LCMS_CFLAGS), \
03c558
     CFLAGS_solaris := -xc99=no_lib, \
03c558
     CFLAGS_windows := -DCMS_IS_WINDOWS_, \
03c558
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/liblcms/mapfile-vers, \
03c558
@@ -685,10 +702,10 @@
03c558
         $(call SET_SHARED_LIBRARY_ORIGIN), \
03c558
     LDFLAGS_solaris := /usr/lib$(OPENJDK_TARGET_CPU_ISADIR)/libm.so.2, \
03c558
     LDFLAGS_windows := $(WIN_AWT_LIB) $(WIN_JAVA_LIB), \
03c558
-    LDFLAGS_SUFFIX_solaris := -lawt -ljava -ljvm -lc, \
03c558
-    LDFLAGS_SUFFIX_macosx := $(LIBM) -lawt -ljava -ljvm, \
03c558
-    LDFLAGS_SUFFIX_linux := -lm -lawt -ljava -ljvm, \
03c558
-    LDFLAGS_SUFFIX_aix := -lm -lawt -ljava -ljvm,\
03c558
+    LDFLAGS_SUFFIX_solaris := -lawt -ljava -ljvm -lc $(LCMS_LIBS), \
03c558
+    LDFLAGS_SUFFIX_macosx := $(LIBM) -lawt -ljava -ljvm $(LCMS_LIBS), \
03c558
+    LDFLAGS_SUFFIX_linux := -lm -lawt -ljava -ljvm $(LCMS_LIBS), \
03c558
+    LDFLAGS_SUFFIX_aix := -lm -lawt -ljava -ljvm $(LCMS_LIBS),\
03c558
     VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
03c558
     RC_FLAGS := $(RC_FLAGS) \
03c558
         -D "JDK_FNAME=lcms.dll" \
03c558
diff -r 3d1c3b0b73a3 src/share/native/sun/java2d/cmm/lcms/LCMS.c
03c558
--- openjdk/jdk/src/share/native/sun/java2d/cmm/lcms/LCMS.c	Tue Sep 08 22:31:26 2015 +0300
03c558
+++ openjdk/jdk/src/share/native/sun/java2d/cmm/lcms/LCMS.c	Thu Oct 15 05:29:28 2015 +0100
03c558
@@ -30,7 +30,7 @@
03c558
 #include "jni_util.h"
03c558
 #include "Trace.h"
03c558
 #include "Disposer.h"
03c558
-#include "lcms2.h"
03c558
+#include <lcms2.h>
03c558
 #include "jlong.h"
03c558
 
03c558