Bug 942043 - Straighten up zlib linkage wrt shared js and system zlib. r=gps,r=ted
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 28 Nov 2013 12:49:43 +0900
changeset 158212 a35d2e3a872f6f2962c86420568b1b2dbbdce599
parent 158211 f3226e0a76df9b58579d8fdddb6b2aa3e3d1bc84
child 158213 3fd4b546eed453156a7d87548c9d30f938f46053
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersgps, ted
bugs942043
milestone28.0a1
Bug 942043 - Straighten up zlib linkage wrt shared js and system zlib. r=gps,r=ted
browser/installer/package-manifest.in
config/rules.mk
config/system-headers
configure.in
gfx/angle/moz.build
gfx/graphite2/src/moz.build
gfx/ots/src/moz.build
js/src/config/rules.mk
js/src/config/system-headers
js/src/configure.in
layout/media/moz.build
media/kiss_fft/moz.build
media/libcubeb/src/moz.build
media/libjpeg/moz.build
media/libnestegg/src/moz.build
media/libogg/moz.build
media/libpng/moz.build
media/libsoundtouch/src/moz.build
media/libtheora/lib/moz.build
media/libvorbis/moz.build
media/libvpx/moz.build
media/mtransport/build/moz.build
media/mtransport/standalone/moz.build
media/webrtc/signaling/test/Makefile.in
modules/zlib/src/moz.build
modules/zlib/src/mozzconf.h
mozglue/build/Makefile.in
toolkit/library/Makefile.in
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -47,17 +47,17 @@
 #endif
 #ifdef MOZ_UPDATER
 @BINPATH@/update.locale
 @BINPATH@/updater.ini
 #endif
 
 [xpcom]
 @BINPATH@/dependentlibs.list
-#ifdef XP_WIN32
+#ifdef GKMEDIAS_SHARED_LIBRARY
 @BINPATH@/@DLL_PREFIX@gkmedias@DLL_SUFFIX@
 #endif
 @BINPATH@/@DLL_PREFIX@mozalloc@DLL_SUFFIX@
 #ifdef MOZ_SHARED_MOZGLUE
 @BINPATH@/@DLL_PREFIX@mozglue@DLL_SUFFIX@
 #endif
 #ifndef MOZ_STATIC_JS
 @BINPATH@/@DLL_PREFIX@mozjs@DLL_SUFFIX@
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -112,17 +112,17 @@ ifdef COMPILE_ENVIRONMENT
 
 # Compile the tests to $(DIST)/bin.  Make lots of niceties available by default
 # through TestHarness.h, by modifying the list of includes and the libs against
 # which stuff links.
 CPPSRCS += $(CPP_UNIT_TESTS)
 CPP_UNIT_TEST_BINS := $(CPP_UNIT_TESTS:.cpp=$(BIN_SUFFIX))
 SIMPLE_PROGRAMS += $(CPP_UNIT_TEST_BINS)
 INCLUDES += -I$(DIST)/include/testing
-LIBS += $(XPCOM_GLUE_LDOPTS) $(NSPR_LIBS) $(if $(JS_SHARED_LIBRARY),,$(MOZ_ZLIB_LIBS))
+LIBS += $(XPCOM_GLUE_LDOPTS) $(NSPR_LIBS)
 
 ifndef MOZ_PROFILE_GENERATE
 libs:: $(CPP_UNIT_TEST_BINS) $(call mkdir_deps,$(DIST)/cppunittests)
 	$(NSINSTALL) $(CPP_UNIT_TEST_BINS) $(DIST)/cppunittests
 endif
 
 check::
 	@$(PYTHON) $(topsrcdir)/testing/runcppunittests.py --xre-path=$(DIST)/bin --symbols-path=$(DIST)/crashreporter-symbols $(subst .cpp,$(BIN_SUFFIX),$(CPP_UNIT_TESTS))
--- a/config/system-headers
+++ b/config/system-headers
@@ -1087,17 +1087,17 @@ shareuiinterface.h
 #endif
 #if MOZ_NATIVE_LIBVPX==1
 vpx/vpx_codec.h
 vpx/vpx_decoder.h
 vpx/vpx_encoder.h
 vpx/vp8cx.h
 vpx/vp8dx.h
 #endif
-#ifdef XP_WIN
+#ifdef GKMEDIAS_SHARED_LIBRARY
 vpx/vpx_codec.h
 vpx/vpx_decoder.h
 vpx/vpx_encoder.h
 vpx/vp8cx.h
 vpx/vp8dx.h
 vorbis/codec.h
 theora/theoradec.h
 tremor/ivorbiscodec.h
--- a/configure.in
+++ b/configure.in
@@ -7765,16 +7765,30 @@ else
   MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS"
   AC_DEFINE(MOZ_STATIC_JS)
 fi
 AC_SUBST(JS_SHARED_LIBRARY)
 
 AC_SUBST(LIBXUL_LIBS)
 XPCOM_LIBS="$LIBXUL_LIBS"
 
+if test "$OS_ARCH" = "WINNT"; then
+  GKMEDIAS_SHARED_LIBRARY=1
+fi
+AC_SUBST(GKMEDIAS_SHARED_LIBRARY)
+
+if test -z "$MOZ_NATIVE_ZLIB"; then
+if test -n "$JS_SHARED_LIBRARY" -o "$GKMEDIAS_SHARED_LIBRARY"; then
+  ZLIB_IN_MOZGLUE=1
+  AC_DEFINE(ZLIB_IN_MOZGLUE)
+fi
+fi
+
+AC_SUBST(ZLIB_IN_MOZGLUE)
+
 dnl ========================================================
 dnl =
 dnl = Standalone module options
 dnl =
 dnl ========================================================
 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
 
 dnl Check for GLib.
@@ -9212,31 +9226,32 @@ if test "$MOZ_MEMORY"; then
    ac_configure_args="$ac_configure_args --enable-jemalloc"
 fi
 if test -n "$MOZ_GLUE_LDFLAGS"; then
    export MOZ_GLUE_LDFLAGS
 fi
 if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
    export MOZ_GLUE_PROGRAM_LDFLAGS
 fi
-if test "$MOZ_NATIVE_ZLIB" != 1 -a "$OS_ARCH" = "WINNT"; then
+if test -n "$ZLIB_IN_MOZGLUE"; then
    MOZ_ZLIB_LIBS=
 fi
 export MOZ_NATIVE_ZLIB
 export MOZ_ZLIB_CFLAGS
 export MOZ_ZLIB_LIBS
 export MOZ_APP_NAME
 export DONT_POPULATE_VIRTUALENV=1
 export PYTHON
 export MOZILLA_CENTRAL_PATH=$_topsrcdir
 export STLPORT_CPPFLAGS
 export STLPORT_LDFLAGS
 export STLPORT_LIBS
 export JS_STANDALONE=no
 export MOZ_LINKER
+export ZLIB_IN_MOZGLUE
 
 if ! test -e js; then
     mkdir js
 fi
 
 AC_OUTPUT_SUBDIRS(js/src)
 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
 
--- a/gfx/angle/moz.build
+++ b/gfx/angle/moz.build
@@ -114,12 +114,12 @@ UNIFIED_SOURCES += ['src/compiler/' + sr
     'OutputGLSLBase.cpp',
     'ShaderLang.cpp',
     'TranslatorESSL.cpp',
     'TranslatorGLSL.cpp',
     'VersionGLSL.cpp',
 ]]
 MSVC_ENABLE_PGO = True
 
-if CONFIG['OS_TARGET'] == 'WINNT':
+if CONFIG['GKMEDIAS_SHARED_LIBRARY']:
     NO_VISIBILITY_FLAGS = True
 
 FINAL_LIBRARY = 'gkmedias'
--- a/gfx/graphite2/src/moz.build
+++ b/gfx/graphite2/src/moz.build
@@ -52,12 +52,12 @@ UNIFIED_SOURCES += [
     'Slot.cpp',
     'Sparse.cpp',
     'TtfUtil.cpp',
     'UtfCodec.cpp',
 ]
 
 MSVC_ENABLE_PGO = True
 
-if CONFIG['OS_TARGET'] == 'WINNT':
+if CONFIG['GKMEDIAS_SHARED_LIBRARY']:
     NO_VISIBILITY_FLAGS = True
 
 FINAL_LIBRARY = 'gkmedias'
--- a/gfx/ots/src/moz.build
+++ b/gfx/ots/src/moz.build
@@ -44,12 +44,12 @@ UNIFIED_SOURCES += [
     'prep.cc',
     'svg.cc',
     'vhea.cc',
     'vmtx.cc',
 ]
 
 MSVC_ENABLE_PGO = True
 
-if CONFIG['OS_TARGET'] == 'WINNT':
+if CONFIG['GKMEDIAS_SHARED_LIBRARY']:
     NO_VISIBILITY_FLAGS = True
 
 FINAL_LIBRARY = 'gkmedias'
--- a/js/src/config/rules.mk
+++ b/js/src/config/rules.mk
@@ -112,17 +112,17 @@ ifdef COMPILE_ENVIRONMENT
 
 # Compile the tests to $(DIST)/bin.  Make lots of niceties available by default
 # through TestHarness.h, by modifying the list of includes and the libs against
 # which stuff links.
 CPPSRCS += $(CPP_UNIT_TESTS)
 CPP_UNIT_TEST_BINS := $(CPP_UNIT_TESTS:.cpp=$(BIN_SUFFIX))
 SIMPLE_PROGRAMS += $(CPP_UNIT_TEST_BINS)
 INCLUDES += -I$(DIST)/include/testing
-LIBS += $(XPCOM_GLUE_LDOPTS) $(NSPR_LIBS) $(if $(JS_SHARED_LIBRARY),,$(MOZ_ZLIB_LIBS))
+LIBS += $(XPCOM_GLUE_LDOPTS) $(NSPR_LIBS)
 
 ifndef MOZ_PROFILE_GENERATE
 libs:: $(CPP_UNIT_TEST_BINS) $(call mkdir_deps,$(DIST)/cppunittests)
 	$(NSINSTALL) $(CPP_UNIT_TEST_BINS) $(DIST)/cppunittests
 endif
 
 check::
 	@$(PYTHON) $(topsrcdir)/testing/runcppunittests.py --xre-path=$(DIST)/bin --symbols-path=$(DIST)/crashreporter-symbols $(subst .cpp,$(BIN_SUFFIX),$(CPP_UNIT_TESTS))
--- a/js/src/config/system-headers
+++ b/js/src/config/system-headers
@@ -1087,17 +1087,17 @@ shareuiinterface.h
 #endif
 #if MOZ_NATIVE_LIBVPX==1
 vpx/vpx_codec.h
 vpx/vpx_decoder.h
 vpx/vpx_encoder.h
 vpx/vp8cx.h
 vpx/vp8dx.h
 #endif
-#ifdef XP_WIN
+#ifdef GKMEDIAS_SHARED_LIBRARY
 vpx/vpx_codec.h
 vpx/vpx_decoder.h
 vpx/vpx_encoder.h
 vpx/vp8cx.h
 vpx/vp8dx.h
 vorbis/codec.h
 theora/theoradec.h
 tremor/ivorbiscodec.h
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -2987,16 +2987,20 @@ AC_SUBST(NSPR_PKGCONF_CHECK)
 dnl ========================================================
 dnl system zlib Support
 dnl ========================================================
 dnl Standalone js defaults to system zlib
 ZLIB_DIR=yes
 
 MOZ_ZLIB_CHECK([1.2.3])
 
+if test -n "$ZLIB_IN_MOZGLUE"; then
+    AC_DEFINE(ZLIB_IN_MOZGLUE)
+fi
+
 dnl ========================================================
 dnl system libffi Support
 dnl ========================================================
 MOZ_ARG_ENABLE_BOOL(system-ffi,
 [  --enable-system-ffi       Use system libffi (located with pkgconfig)],
     MOZ_NATIVE_FFI=1 )
 
 if test -n "$MOZ_NATIVE_FFI"; then
--- a/layout/media/moz.build
+++ b/layout/media/moz.build
@@ -1,13 +1,13 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 LIBRARY_NAME = 'gkmedias'
 
-if CONFIG['OS_TARGET'] == 'WINNT':
+if CONFIG['GKMEDIAS_SHARED_LIBRARY']:
     FORCE_SHARED_LIB = True
 
 if CONFIG['MOZ_WEBRTC']:
     DIRS += ['webrtc']
--- a/media/kiss_fft/moz.build
+++ b/media/kiss_fft/moz.build
@@ -9,12 +9,12 @@ EXPORTS.kiss_fft += [
     'kiss_fftr.h',
 ]
 
 SOURCES += [
     'kiss_fft.c',
     'kiss_fftr.c',
 ]
 
-if CONFIG['OS_TARGET'] == 'WINNT':
+if CONFIG['GKMEDIAS_SHARED_LIBRARY']:
     NO_VISIBILITY_FLAGS = True
 
 FINAL_LIBRARY = 'xul'
--- a/media/libcubeb/src/moz.build
+++ b/media/libcubeb/src/moz.build
@@ -42,12 +42,12 @@ if CONFIG['OS_TARGET'] == 'Android':
     ]
     if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
         SOURCES += [
             'cubeb_audiotrack.c',
         ]
 
 MSVC_ENABLE_PGO = True
 
-if CONFIG['OS_TARGET'] == 'WINNT':
+if CONFIG['GKMEDIAS_SHARED_LIBRARY']:
     NO_VISIBILITY_FLAGS = True
 
 FINAL_LIBRARY = 'gkmedias'
--- a/media/libjpeg/moz.build
+++ b/media/libjpeg/moz.build
@@ -141,16 +141,16 @@ elif CONFIG['LIBJPEG_TURBO_X86_ASM']:
     ]
 else: # No SIMD support?
     SOURCES += [
         'jsimd_none.c',
     ]
 
 MSVC_ENABLE_PGO = True
 
-if CONFIG['OS_TARGET'] == 'WINNT':
+if CONFIG['GKMEDIAS_SHARED_LIBRARY']:
     NO_VISIBILITY_FLAGS = True
 
 FINAL_LIBRARY = 'gkmedias'
 
 GENERATED_FILES = [
     'jpeg_nbits_table.h',
 ]
--- a/media/libnestegg/src/moz.build
+++ b/media/libnestegg/src/moz.build
@@ -6,12 +6,12 @@
 
 UNIFIED_SOURCES += [
     'halloc.c',
     'nestegg.c',
 ]
 
 MSVC_ENABLE_PGO = True
 
-if CONFIG['OS_TARGET'] == 'WINNT':
+if CONFIG['GKMEDIAS_SHARED_LIBRARY']:
     NO_VISIBILITY_FLAGS = True
 
 FINAL_LIBRARY = 'gkmedias'
--- a/media/libogg/moz.build
+++ b/media/libogg/moz.build
@@ -12,12 +12,12 @@ EXPORTS.ogg += [
 
 UNIFIED_SOURCES += [
     'src/ogg_bitwise.c',
     'src/ogg_framing.c',
 ]
 
 MSVC_ENABLE_PGO = True
 
-if CONFIG['OS_TARGET'] == 'WINNT':
+if CONFIG['GKMEDIAS_SHARED_LIBRARY']:
     NO_VISIBILITY_FLAGS = True
 
 FINAL_LIBRARY = 'gkmedias'
--- a/media/libpng/moz.build
+++ b/media/libpng/moz.build
@@ -42,12 +42,12 @@ if CONFIG['MOZ_PNG_ARM_NEON']:
     SOURCES += [
         'arm/filter_neon.S'
     ]
 
 LIBRARY_NAME = 'mozpng'
 
 MSVC_ENABLE_PGO = True
 
-if CONFIG['OS_TARGET'] == 'WINNT':
+if CONFIG['GKMEDIAS_SHARED_LIBRARY']:
     NO_VISIBILITY_FLAGS = True
 
 FINAL_LIBRARY = 'gkmedias'
--- a/media/libsoundtouch/src/moz.build
+++ b/media/libsoundtouch/src/moz.build
@@ -27,11 +27,12 @@ if CONFIG['INTEL_ARCHITECTURE']:
             'sse_optimized.cpp',
         ]
     else:
         UNIFIED_SOURCES += [
             'mmx_optimized.cpp',
         ]
 
 MSVC_ENABLE_PGO = True
-NO_VISIBILITY_FLAGS = True
+if CONFIG['GKMEDIAS_SHARED_LIBRARY']:
+    NO_VISIBILITY_FLAGS = True
 
 FINAL_LIBRARY = 'gkmedias'
--- a/media/libtheora/lib/moz.build
+++ b/media/libtheora/lib/moz.build
@@ -52,12 +52,12 @@ if CONFIG['GNU_AS']:
     if 'arm' in CONFIG['OS_TEST']:
         SOURCES += [
             'arm/armcpu.c',
             'arm/armstate.c',
         ]
 
 MSVC_ENABLE_PGO = True
 
-if CONFIG['OS_TARGET'] == 'WINNT':
+if CONFIG['GKMEDIAS_SHARED_LIBRARY']:
     NO_VISIBILITY_FLAGS = True
 
 FINAL_LIBRARY = 'gkmedias'
--- a/media/libvorbis/moz.build
+++ b/media/libvorbis/moz.build
@@ -38,12 +38,12 @@ LOCAL_INCLUDES += ['lib']
 if CONFIG['OS_ARCH'] == 'AIX':
     DEFINES['alloca'] = '__alloca'
 
 if CONFIG['OS_ARCH'] == 'SunOS':
     DEFINES['HAVE_ALLOCA_H'] = True
 
 MSVC_ENABLE_PGO = True
 
-if CONFIG['OS_TARGET'] == 'WINNT':
+if CONFIG['GKMEDIAS_SHARED_LIBRARY']:
     NO_VISIBILITY_FLAGS = True
 
 FINAL_LIBRARY = 'gkmedias'
--- a/media/libvpx/moz.build
+++ b/media/libvpx/moz.build
@@ -85,12 +85,12 @@ SOURCES += [
     'vpx_scale/generic/scalesystemdependent.c',
     'vpx_scale/generic/vpxscale.c',
     'vpx_scale/generic/yv12config.c',
     'vpx_scale/generic/yv12extend.c',
 ]
 
 MSVC_ENABLE_PGO = True
 
-if CONFIG['OS_TARGET'] == 'WINNT':
+if CONFIG['GKMEDIAS_SHARED_LIBRARY']:
     NO_VISIBILITY_FLAGS = True
 
 FINAL_LIBRARY = 'gkmedias'
--- a/media/mtransport/build/moz.build
+++ b/media/mtransport/build/moz.build
@@ -66,12 +66,12 @@ elif CONFIG['OS_TARGET'] == 'Android':
     LOCAL_INCLUDES += [
         '/media/mtransport/third_party/nrappkit/src/port/android/include',
     ]
 elif CONFIG['OS_TARGET'] == 'WINNT':
     LOCAL_INCLUDES += [
         '/media/mtransport/third_party/nrappkit/src/port/win32/include',
     ]
 
-if CONFIG['OS_TARGET'] == 'WINNT':
+if CONFIG['GKMEDIAS_SHARED_LIBRARY']:
     NO_VISIBILITY_FLAGS = True
 
 FINAL_LIBRARY = 'xul'
--- a/media/mtransport/standalone/moz.build
+++ b/media/mtransport/standalone/moz.build
@@ -45,11 +45,8 @@ elif CONFIG['OS_TARGET'] == 'Android':
         '/media/mtransport/third_party/nrappkit/src/port/android/include',
     ]
 elif CONFIG['OS_TARGET'] == 'WINNT':
     LOCAL_INCLUDES += [
         '/media/mtransport/third_party/nrappkit/src/port/win32/include',
     ]
 
 FORCE_STATIC_LIB = True
-
-if CONFIG['OS_TARGET'] == 'WINNT':
-    NO_VISIBILITY_FLAGS = True
--- a/media/webrtc/signaling/test/Makefile.in
+++ b/media/webrtc/signaling/test/Makefile.in
@@ -164,20 +164,15 @@ endif
 ifeq ($(OS_TARGET), Linux)
 LOCAL_INCLUDES +=  -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/linux/include
 endif
 
 ifeq ($(OS_TARGET), Android)
 LOCAL_INCLUDES +=  -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/android/include
 endif
 
-
-ifneq ($(OS_TARGET),WINNT)
-ifneq (gonk,$(MOZ_WIDGET_TOOLKIT))
-ifdef JS_SHARED_LIBRARY
+ifndef ZLIB_IN_MOZGLUE
 LIBS += $(MOZ_ZLIB_LIBS)
 endif
-endif
-endif
 
 include $(topsrcdir)/config/config.mk
 include $(topsrcdir)/media/webrtc/webrtc-config.mk
 include $(topsrcdir)/config/rules.mk
--- a/modules/zlib/src/moz.build
+++ b/modules/zlib/src/moz.build
@@ -24,8 +24,11 @@ SOURCES += [
     'infback.c',
     'inffast.c',
     'inflate.c',
     'inftrees.c',
     'trees.c',
     'uncompr.c',
     'zutil.c',
 ]
+
+if CONFIG['ZLIB_IN_MOZGLUE']:
+    DEFINES['IMPL_MFBT'] = True
--- a/modules/zlib/src/mozzconf.h
+++ b/modules/zlib/src/mozzconf.h
@@ -1,18 +1,20 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef MOZZCONF_H
 #define MOZZCONF_H
 
-#if defined(XP_WIN)
-#define ZLIB_DLL 1
+#include "mozilla/Types.h"
+
+#if defined(ZLIB_IN_MOZGLUE)
+#define ZEXTERN MFBT_API
 #endif
 
 /* Exported Symbols */
 #define zlibVersion MOZ_Z_zlibVersion
 #define deflate MOZ_Z_deflate
 #define deflateEnd MOZ_Z_deflateEnd
 #define inflate MOZ_Z_inflate
 #define inflateEnd MOZ_Z_inflateEnd
--- a/mozglue/build/Makefile.in
+++ b/mozglue/build/Makefile.in
@@ -21,32 +21,39 @@ endif
 endif
 
 endif
  
 MOZ_GLUE_LDFLAGS = # Don't link against ourselves
 
 DEFINES += -DIMPL_MFBT
 
+ifneq (,$(ZLIB_IN_MOZGLUE)$(MOZ_LINKER))
+ifdef MOZ_NATIVE_ZLIB
+EXTRA_DSO_LDOPTS += $(MOZ_ZLIB_LIBS)
+else
+SHARED_LIBRARY_LIBS += $(MOZ_ZLIB_LIBS)
+endif
+endif
+
 ifeq (WINNT,$(OS_TARGET))
 DEFFILE = mozglue.def
 
 mozglue.def: mozglue.def.in
 	$(call py_action,preprocessor,$(if $(MOZ_REPLACE_MALLOC),-DMOZ_REPLACE_MALLOC) $(ACDEFINES) $< -o $@)
 
 GARBAGE += mozglue.def
 
 ifneq (,$(filter -DEFAULTLIB:mozcrt,$(MOZ_GLUE_LDFLAGS)))
 # Don't install the import library if we use mozcrt
 NO_INSTALL_IMPORT_LIBRARY = 1
 endif
 
 
 EXTRA_DSO_LDOPTS += \
-	$(MOZ_ZLIB_LIBS) \
 	version.lib \
 	$(NULL)
 
 STL_FLAGS=
 
 endif
 
 ifeq (Darwin_1,$(OS_TARGET)_$(MOZ_REPLACE_MALLOC))
@@ -71,18 +78,16 @@ ifneq ($(MOZ_REPLACE_MALLOC_LINKAGE),com
 EXTRA_DSO_LDOPTS += -flat_namespace
 endif
 ifeq ($(MOZ_REPLACE_MALLOC_LINKAGE),dummy library)
 EXTRA_DSO_LDOPTS += -Wl,-weak_library,$(DEPTH)/memory/replace/dummy/$(DLL_PREFIX)replace_malloc$(DLL_SUFFIX)
 endif
 endif
 
 ifeq (android, $(MOZ_WIDGET_TOOLKIT))
-# Add Android specific code
-EXTRA_DSO_LDOPTS += $(MOZ_ZLIB_LIBS)
 # To properly wrap jemalloc's pthread_atfork call.
 EXTRA_DSO_LDOPTS += -Wl,--wrap=pthread_atfork
 endif
 
 ifdef MOZ_LINKER
 ifeq (arm, $(TARGET_CPU))
 EXTRA_DSO_LDOPTS += -Wl,-version-script,$(srcdir)/arm-eabi-filter
 endif
--- a/toolkit/library/Makefile.in
+++ b/toolkit/library/Makefile.in
@@ -132,17 +132,17 @@ EXTRA_DSO_LDOPTS += \
 ifdef MOZ_NATIVE_JPEG
 EXTRA_DSO_LDOPTS += $(MOZ_JPEG_LIBS)
 endif
 
 ifdef MOZ_NATIVE_PNG
 EXTRA_DSO_LDOPTS += $(MOZ_PNG_LIBS)
 endif
 
-ifneq (WINNT,$(OS_ARCH))
+ifndef ZLIB_IN_MOZGLUE
 EXTRA_DSO_LDOPTS += $(MOZ_ZLIB_LIBS)
 endif
 
 ifdef MOZ_NATIVE_HUNSPELL
 EXTRA_DSO_LDOPTS += $(MOZ_HUNSPELL_LIBS)
 endif
 
 ifdef MOZ_NATIVE_LIBEVENT