Blame SOURCES/system-libpng.patch

045ef6
diff -ruN jdk8/common/autoconf/libraries.m4 jdk8/common/autoconf/libraries.m4
045ef6
--- jdk8/common/autoconf/libraries.m4	2013-11-14 20:08:01.845065585 -0500
045ef6
+++ jdk8/common/autoconf/libraries.m4	2013-11-14 20:10:56.186553066 -0500
045ef6
@@ -676,6 +676,47 @@
045ef6
 
045ef6
   ###############################################################################
045ef6
   #
045ef6
+  # Check for the png library
045ef6
+  #
045ef6
+
045ef6
+  AC_ARG_WITH(libpng, [AS_HELP_STRING([--with-libpng],
045ef6
+     [use libpng from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
045ef6
+
045ef6
+  AC_CHECK_LIB(png, png_sig_cmp,
045ef6
+               [ LIBPNG_FOUND=yes ],
045ef6
+               [ LIBPNG_FOUND=no ])
045ef6
+
045ef6
+  AC_MSG_CHECKING([for which libpng to use])
045ef6
+
045ef6
+  # default is bundled
045ef6
+  DEFAULT_LIBPNG=bundled
045ef6
+
045ef6
+  #
045ef6
+  # if user didn't specify, use DEFAULT_LIBPNG
045ef6
+  #
045ef6
+  if test "x${with_libpng}" = "x"; then
045ef6
+      with_libpng=${DEFAULT_libpng}
045ef6
+  fi
045ef6
+
045ef6
+
045ef6
+  if test "x${with_libpng}" = "xbundled"; then
045ef6
+      USE_EXTERNAL_LIBPNG=false
045ef6
+      AC_MSG_RESULT([bundled])
045ef6
+  elif test "x${with_libpng}" = "xsystem"; then
045ef6
+      if test "x${LIBPNG_FOUND}" = "xyes"; then
045ef6
+          USE_EXTERNAL_LIBPNG=true
045ef6
+          AC_MSG_RESULT([system])
045ef6
+      else
045ef6
+          AC_MSG_RESULT([system not found])
045ef6
+          AC_MSG_ERROR([--with-libpng=system specified, but no libpng found!])
045ef6
+      fi
045ef6
+  else
045ef6
+      AC_MSG_ERROR([Invalid value of --with-libpng: ${with_libpng}, use 'system' or 'bundled'])
045ef6
+  fi
045ef6
+  AC_SUBST(USE_EXTERNAL_LIBPNG)
045ef6
+
045ef6
+  ###############################################################################
045ef6
+  #
045ef6
   # Check for the zlib library
045ef6
   #
045ef6
 
045ef6
diff -ruN jdk8/common/autoconf/spec.gmk.in jdk8/common/autoconf/spec.gmk.in
045ef6
--- jdk8/common/autoconf/spec.gmk.in	2013-10-31 19:24:33.000000000 -0400
045ef6
+++ jdk8/common/autoconf/spec.gmk.in	2013-11-14 21:10:56.365976518 -0500
045ef6
@@ -548,6 +548,7 @@
045ef6
 ENABLE_JFR=@ENABLE_JFR@
045ef6
 ENABLE_INTREE_EC=@ENABLE_INTREE_EC@
045ef6
 USE_EXTERNAL_LIBJPEG:=@USE_EXTERNAL_LIBJPEG@
045ef6
+USE_EXTERNAL_LIBPNG:=@USE_EXTERNAL_LIBPNG@
045ef6
 USE_EXTERNAL_LIBGIF:=@USE_EXTERNAL_LIBGIF@
045ef6
 USE_EXTERNAL_LIBZ:=@USE_EXTERNAL_LIBZ@
045ef6
 LIBZIP_CAN_USE_MMAP:=@LIBZIP_CAN_USE_MMAP@
045ef6
diff -ruN jdk8/jdk/make/lib/Awt2dLibraries.gmk jdk8/jdk/make/lib/Awt2dLibraries.gmk
045ef6
--- jdk8/jdk/make/lib/Awt2dLibraries.gmk	2013-11-14 20:08:01.845065585 -0500
045ef6
+++ jdk8/jdk/make/lib/Awt2dLibraries.gmk	2013-11-14 20:14:10.791982343 -0500
045ef6
@@ -1183,7 +1183,6 @@
045ef6
 
045ef6
 ifndef BUILD_HEADLESS_ONLY
045ef6
   LIBSPLASHSCREEN_DIRS := \
045ef6
-    $(JDK_TOPDIR)/src/share/native/sun/awt/libpng \
045ef6
     $(JDK_TOPDIR)/src/share/native/sun/awt/splashscreen
045ef6
 
045ef6
   ifeq ($(USE_EXTERNAL_LIBGIF), true)
045ef6
@@ -1200,6 +1199,13 @@
045ef6
     LIBJPEG_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/awt/jpeg
045ef6
   endif
045ef6
 
045ef6
+  ifeq ($(USE_EXTERNAL_LIBPNG), true)
045ef6
+    LIBPNG_LDFLAGS := -lpng
045ef6
+  else
045ef6
+    LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/share/native/sun/awt/image/libpng
045ef6
+    LIBPNG_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/awt/libpng
045ef6
+  endif
045ef6
+
045ef6
   ifneq ($(OPENJDK_TARGET_OS), macosx)
045ef6
     LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt/splashscreen
045ef6
   else
045ef6
@@ -1263,12 +1269,12 @@
045ef6
       LANG := C, \
045ef6
       OPTIMIZATION := LOW, \
045ef6
       CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) \
045ef6
-          $(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS), \
045ef6
+          $(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS) $(LIBPNG_CFLAGS), \
045ef6
       MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libsplashscreen/mapfile-vers, \
045ef6
       LDFLAGS := $(LDFLAGS_JDKLIB) \
045ef6
           $(call SET_SHARED_LIBRARY_ORIGIN), \
045ef6
       LDFLAGS_SUFFIX := $(LIBSPLASHSCREEN_LDFLAGS_SUFFIX) \
045ef6
-          $(LIBZ) $(GIFLIB_LDFLAGS) $(LIBJPEG_LDFLAGS), \
045ef6
+          $(LIBZ) $(GIFLIB_LDFLAGS) $(LIBJPEG_LDFLAGS) $(LIBPNG_LDFLAGS), \
045ef6
       LDFLAGS_SUFFIX_solaris := -lc, \
045ef6
       VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
045ef6
       RC_FLAGS := $(RC_FLAGS) \
045ef6
diff -ruN jdk8/jdk/src/share/native/sun/awt/splashscreen/splashscreen_png.c jdk8/jdk/src/share/native/sun/awt/splashscreen/splashscreen_png.c
045ef6
--- jdk8/jdk/src/share/native/sun/awt/splashscreen/splashscreen_png.c	2013-10-31 19:44:18.000000000 -0400
045ef6
+++ jdk8/jdk/src/share/native/sun/awt/splashscreen/splashscreen_png.c	2013-11-14 20:14:41.363892797 -0500
045ef6
@@ -25,8 +25,7 @@
045ef6
 
045ef6
 #include "splashscreen_impl.h"
045ef6
 
045ef6
-#include "../libpng/png.h"
045ef6
-
045ef6
+#include <png.h>
045ef6
 #include <setjmp.h>
045ef6
 
045ef6
 #define SIG_BYTES 8