Blame SOURCES/jdk8035341-allow_using_system_installed_libpng.patch

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