-diff -durN -x '*.orig' jdk8u-jdk8u66-b02.orig/common/autoconf/generated-configure.sh jdk8u-jdk8u66-b02/common/autoconf/generated-configure.sh
---- jdk8u-jdk8u66-b02.orig/common/autoconf/generated-configure.sh 2015-07-17 09:35:23.000000000 +0200
-+++ jdk8u-jdk8u66-b02/common/autoconf/generated-configure.sh 2015-09-18 13:13:58.000000000 +0200
-@@ -1065,6 +1065,7 @@
- with_alsa
- with_alsa_include
- with_alsa_lib
-+with_libjpeg
- with_giflib
- with_zlib
- with_stdc__lib
-@@ -1838,6 +1839,8 @@
- headers under PATH/include)
- --with-alsa-include specify directory for the alsa include files
- --with-alsa-lib specify directory for the alsa library
-+ --with-libjpeg use libjpeg from build system or OpenJDK source
-+ (system, bundled) [bundled]
- --with-giflib use giflib from build system or OpenJDK source
- (system, bundled) [bundled]
- --with-zlib use zlib from build system or OpenJDK source
-@@ -8092,6 +8095,11 @@
- HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}minimal1 "
- fi
-
-+ if test "x$JVM_VARIANT_CLIENT" = xtrue; then
-+ if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
-+ as_fn_error $? "You cannot build a client JVM for a 64-bit machine." "$LINENO" 5
-+ fi
-+ fi
- if test "x$JVM_VARIANT_KERNEL" = xtrue; then
- HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}kernel "
- fi
-@@ -34837,10 +34845,43 @@
- # Check for the jpeg library
- #
-
-- USE_EXTERNAL_LIBJPEG=true
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -ljpeg" >&5
--$as_echo_n "checking for main in -ljpeg... " >&6; }
--if ${ac_cv_lib_jpeg_main+:} false; then :
-+
-+# Check whether --with-libjpeg was given.
-+if test "${with_libjpeg+set}" = set; then :
-+ withval=$with_libjpeg;
-+fi
-+
-+
-+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for which libjpeg to use" >&5
-+$as_echo_n "checking for which libjpeg to use... " >&6; }
-+
-+ # default is bundled
-+ DEFAULT_LIBJPEG=bundled
-+
-+ #
-+ # if user didn't specify, use DEFAULT_LIBJPEG
-+ #
-+ if test "x${with_libjpeg}" = "x"; then
-+ with_libjpeg=${DEFAULT_LIBJPEG}
-+ fi
-+
-+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_libjpeg}" >&5
-+$as_echo "${with_libjpeg}" >&6; }
-+
-+ if test "x${with_libjpeg}" = "xbundled"; then
-+ USE_EXTERNAL_LIBJPEG=false
-+ elif test "x${with_libjpeg}" = "xsystem"; then
-+ ac_fn_cxx_check_header_mongrel "$LINENO" "jpeglib.h" "ac_cv_header_jpeglib_h" "$ac_includes_default"
-+if test "x$ac_cv_header_jpeglib_h" = xyes; then :
-+
-+else
-+ as_fn_error $? "--with-libjpeg=system specified, but jpeglib.h not found!" "$LINENO" 5
-+fi
-+
-+
-+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jpeg_CreateDecompress in -ljpeg" >&5
-+$as_echo_n "checking for jpeg_CreateDecompress in -ljpeg... " >&6; }
-+if ${ac_cv_lib_jpeg_jpeg_CreateDecompress+:} false; then :
- $as_echo_n "(cached) " >&6
- else
- ac_check_lib_save_LIBS=$LIBS
-@@ -34848,27 +34889,33 @@
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
- /* end confdefs.h. */
-
--
-+/* Override any GCC internal prototype to avoid an error.
-+ Use char because int might match the return type of a GCC
-+ builtin and then its argument prototype would still apply. */
-+#ifdef __cplusplus
-+extern "C"
-+#endif
-+char jpeg_CreateDecompress ();
- int
- main ()
- {
--return main ();
-+return jpeg_CreateDecompress ();
- ;
- return 0;
- }
- _ACEOF
- if ac_fn_cxx_try_link "$LINENO"; then :
-- ac_cv_lib_jpeg_main=yes
-+ ac_cv_lib_jpeg_jpeg_CreateDecompress=yes
- else
-- ac_cv_lib_jpeg_main=no
-+ ac_cv_lib_jpeg_jpeg_CreateDecompress=no
- fi
- rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
- LIBS=$ac_check_lib_save_LIBS
- fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jpeg_main" >&5
--$as_echo "$ac_cv_lib_jpeg_main" >&6; }
--if test "x$ac_cv_lib_jpeg_main" = xyes; then :
-+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jpeg_jpeg_CreateDecompress" >&5
-+$as_echo "$ac_cv_lib_jpeg_jpeg_CreateDecompress" >&6; }
-+if test "x$ac_cv_lib_jpeg_jpeg_CreateDecompress" = xyes; then :
- cat >>confdefs.h <<_ACEOF
- #define HAVE_LIBJPEG 1
- _ACEOF
-@@ -34876,13 +34923,16 @@
- LIBS="-ljpeg $LIBS"
-
- else
-- USE_EXTERNAL_LIBJPEG=false
-- { $as_echo "$as_me:${as_lineno-$LINENO}: Will use jpeg decoder bundled with the OpenJDK source" >&5
--$as_echo "$as_me: Will use jpeg decoder bundled with the OpenJDK source" >&6;}
--
-+ as_fn_error $? "--with-libjpeg=system specified, but no libjpeg found" "$LINENO" 5
- fi
-
-
-+ USE_EXTERNAL_LIBJPEG=true
-+ else
-+ as_fn_error $? "Invalid use of --with-libjpeg: ${with_libjpeg}, use 'system' or 'bundled'" "$LINENO" 5
-+ fi
-+
-+
-
- ###############################################################################
- #
-diff -durN -x '*.orig' jdk8u-jdk8u66-b02.orig/common/autoconf/libraries.m4 jdk8u-jdk8u66-b02/common/autoconf/libraries.m4
---- jdk8u-jdk8u66-b02.orig/common/autoconf/libraries.m4 2015-07-17 09:35:23.000000000 +0200
-+++ jdk8u-jdk8u66-b02/common/autoconf/libraries.m4 2015-09-18 13:13:58.000000000 +0200
-@@ -595,11 +595,36 @@
+# DP: S8043805: Allow using a system-installed libjpeg
+# DP: http://hg.openjdk.java.net/jdk9/client/rev/bfd9a3e1aeb5
+# DP: http://hg.openjdk.java.net/jdk9/client/jdk/rev/320743f0b4fc
+
+--- a/common/autoconf/libraries.m4
++++ b/common/autoconf/libraries.m4
+@@ -774,11 +774,36 @@ AC_DEFUN_ONCE([LIB_SETUP_MISC_LIBS],
# Check for the jpeg library
#
AC_SUBST(USE_EXTERNAL_LIBJPEG)
###############################################################################
-diff -durN -x '*.orig' jdk8u-jdk8u66-b02.orig/jdk/make/lib/Awt2dLibraries.gmk jdk8u-jdk8u66-b02/jdk/make/lib/Awt2dLibraries.gmk
---- jdk8u-jdk8u66-b02.orig/jdk/make/lib/Awt2dLibraries.gmk 2015-07-23 16:17:35.000000000 +0200
-+++ jdk8u-jdk8u66-b02/jdk/make/lib/Awt2dLibraries.gmk 2015-09-18 13:13:58.000000000 +0200
-@@ -702,21 +702,24 @@
+--- a/jdk/make/lib/Awt2dLibraries.gmk
++++ b/jdk/make/lib/Awt2dLibraries.gmk
+@@ -702,21 +702,24 @@ $(BUILD_LIBLCMS): $(BUILD_LIBAWT)
##########################################################################################
# Suppress gcc warnings like "variable might be clobbered by 'longjmp'
# or 'vfork'": this warning indicates that some variable is placed to
# a register by optimized compiler and it's value might be lost on longjmp().
-@@ -728,37 +731,50 @@
+@@ -728,37 +731,50 @@ endif
# $(shell $(EXPR) $(CC_MAJORVER) \> 4 \| \
# \( $(CC_MAJORVER) = 4 \& $(CC_MINORVER) \>= 3 \) )
# ifeq ($(CC_43_OR_NEWER), 1)
- $(BUILD_LIBJPEG_CLOSED_INCLUDES) \
- -I$(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg, \
- MAPFILE := $(BUILD_LIBJPEG_MAPFILE), \
+- LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(BUILD_LIBJAVAJPEG_CLOSED_INCLUDES) \
+ $(BUILD_LIBJAVAJPEG_HEADERS), \
+ MAPFILE := $(BUILD_LIBJAVAJPEG_MAPFILE), \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
++ LDFLAGS := $(LDFLAGS_JDKLIB) $(LIBJPEG_LIBS) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_windows := $(WIN_JAVA_LIB) jvm.lib, \
-- LDFLAGS_SUFFIX := $(LDFLAGS_JDKLIB_SUFFIX), \
-+ LDFLAGS_SUFFIX := $(LIBJPEG_LIBS) $(LDFLAGS_JDKLIB_SUFFIX), \
+ LDFLAGS_SUFFIX := $(LDFLAGS_JDKLIB_SUFFIX), \
VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=jpeg.dll" \
##########################################################################################
-@@ -1198,6 +1214,13 @@
+@@ -1149,6 +1165,13 @@ ifndef BUILD_HEADLESS_ONLY
GIFLIB_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/awt/giflib
endif
ifneq ($(OPENJDK_TARGET_OS), macosx)
LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt/splashscreen
else
-@@ -1258,11 +1281,13 @@
+@@ -1205,11 +1228,13 @@ ifndef BUILD_HEADLESS_ONLY
EXCLUDE_FILES := imageioJPEG.c jpegdecoder.c pngtest.c, \
LANG := C, \
OPTIMIZATION := LOW, \
LDFLAGS_SUFFIX_solaris := -lc, \
VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
RC_FLAGS := $(RC_FLAGS) \
-diff -durN -x '*.orig' jdk8u-jdk8u66-b02.orig/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java jdk8u-jdk8u66-b02/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
---- jdk8u-jdk8u66-b02.orig/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java 2015-07-23 16:17:35.000000000 +0200
-+++ jdk8u-jdk8u66-b02/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java 2015-09-18 13:13:58.000000000 +0200
-@@ -89,7 +89,7 @@
+--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
++++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
+@@ -89,7 +89,7 @@ public class JPEGImageReader extends Ima
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Void>() {
public Void run() {
return null;
}
});
-diff -durN -x '*.orig' jdk8u-jdk8u66-b02.orig/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java jdk8u-jdk8u66-b02/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java
---- jdk8u-jdk8u66-b02.orig/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java 2015-07-23 16:17:35.000000000 +0200
-+++ jdk8u-jdk8u66-b02/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java 2015-09-18 13:13:58.000000000 +0200
-@@ -177,7 +177,7 @@
+--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java
++++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java
+@@ -177,7 +177,7 @@ public class JPEGImageWriter extends Ima
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Void>() {
public Void run() {
return null;
}
});
-diff -durN -x '*.orig' jdk8u-jdk8u66-b02.orig/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java jdk8u-jdk8u66-b02/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java
---- jdk8u-jdk8u66-b02.orig/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java 2015-07-23 16:17:35.000000000 +0200
-+++ jdk8u-jdk8u66-b02/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java 2015-09-18 13:13:58.000000000 +0200
-@@ -56,7 +56,7 @@
+--- a/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java
++++ b/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java
+@@ -56,7 +56,7 @@ public class JPEGImageDecoder extends Im
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Void>() {
public Void run() {
return null;
}
});
-diff -durN -x '*.orig' jdk8u-jdk8u66-b02.orig/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c jdk8u-jdk8u66-b02/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
---- jdk8u-jdk8u66-b02.orig/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c 2015-07-23 16:17:35.000000000 +0200
-+++ jdk8u-jdk8u66-b02/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c 2015-09-18 13:13:58.000000000 +0200
+--- a/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
++++ b/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
@@ -51,7 +51,7 @@
/* headers from the JPEG library */