make/lib/Awt2dLibraries.gmk
changeset 48751 54f355e65415
parent 48731 c832897a3a23
child 48766 2c4d1993b5f9
--- a/make/lib/Awt2dLibraries.gmk	Tue Feb 06 16:04:46 2018 +0000
+++ b/make/lib/Awt2dLibraries.gmk	Tue Feb 06 10:12:05 2018 -0800
@@ -905,9 +905,18 @@
 
   LIBSPLASHSCREEN_LIBS :=
 
-  ifneq ($(USE_EXTERNAL_LIBZ), true)
+  ifeq ($(USE_EXTERNAL_LIBZ), false)
     LIBSPLASHSCREEN_DIRS += $(TOPDIR)/src/java.base/share/native/libzip/zlib
-    LIBSPLASHSCREEN_CFLAGS += $(ZLIB_CPPFLAGS)
+  else
+    ifeq ($(OPENJDK_TARGET_OS), macosx)
+      ifeq ($(USE_EXTERNAL_LIBPNG), false)
+        # When building our own libpng and using an external libz, we need to
+        # inject our own libz.h to tweak the exported ZLIB_VERNUM macro. See
+        # $(TOPDIR)/src/java.desktop/macosx/native/libsplashscreen/libpng/zlib.h
+        # for details.
+        LIBSPLASHSCREEN_CFLAGS += -iquote $(TOPDIR)/src/java.desktop/macosx/native/libsplashscreen/libpng
+      endif
+    endif
   endif
 
   ifeq ($(OPENJDK_TARGET_OS), macosx)
@@ -933,7 +942,7 @@
       EXCLUDES := $(LIBSPLASHSCREEN_EXCLUDES), \
       OPTIMIZATION := LOW, \
       CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) \
-                $(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS) $(PNG_CFLAGS), \
+          $(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS) $(PNG_CFLAGS) $(LIBZ_CFLAGS), \
       DISABLED_WARNINGS_gcc := sign-compare type-limits unused-result maybe-uninitialized shift-negative-value, \
       DISABLED_WARNINGS_clang := incompatible-pointer-types, \
       DISABLED_WARNINGS_solstudio := E_NEWLINE_NOT_LAST E_DECLARATION_IN_CODE \
@@ -942,8 +951,8 @@
       MAPFILE := $(TOPDIR)/make/mapfiles/libsplashscreen/mapfile-vers, \
       LDFLAGS := $(LIBSPLASHSCREEN_LDFLAGS) $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
-      LIBS := $(JDKLIB_LIBS) $(LIBSPLASHSCREEN_LIBS) $(LIBZ) \
-                        $(GIFLIB_LIBS) $(LIBJPEG_LIBS) $(PNG_LIBS), \
+      LIBS := $(JDKLIB_LIBS) $(LIBSPLASHSCREEN_LIBS) $(LIBZ_LIBS) \
+          $(GIFLIB_LIBS) $(LIBJPEG_LIBS) $(PNG_LIBS), \
       LIBS_aix := -liconv, \
       VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
       RC_FLAGS := $(RC_FLAGS) \