Blame SOURCES/jdk8042159-allow_using_system_installed_lcms2.patch

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