Bug 942043 - Straighten up zlib linkage wrt shared js and system zlib. r=gps,r=ted
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 22 Nov 2013 23:03:21 +0900
changeset 172638 a6c1abbdf6f91ee53485cd0d0e4f6eabb17285da
parent 172637 8c339e9c197b277f71e63657e74e33122729798b
child 172639 4c360770998dcb6400862f667945eb49eb46eff9
push id3224
push userlsblakk@mozilla.com
push dateTue, 04 Feb 2014 01:06:49 +0000
treeherdermozilla-beta@60c04d0987f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps, ted
bugs942043
milestone28.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 942043 - Straighten up zlib linkage wrt shared js and system zlib. r=gps,r=ted
b2g/installer/Makefile.in
b2g/installer/package-manifest.in
browser/installer/Makefile.in
browser/installer/package-manifest.in
config/moz.build
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/b2g/installer/Makefile.in
+++ b/b2g/installer/Makefile.in
@@ -49,16 +49,20 @@ DEFINES += -DBINPATH=$(BINPATH)
 ifneq (,$(filter WINNT Darwin Android,$(OS_TARGET)))
 DEFINES += -DMOZ_SHARED_MOZGLUE=1
 endif
 
 ifneq (,$(filter rtsp,$(NECKO_PROTOCOLS)))
 DEFINES += -DMOZ_RTSP
 endif
 
+ifdef GKMEDIAS_SHARED_LIBRARY
+DEFINES += -DGKMEDIAS_SHARED_LIBRARY
+endif
+
 ifdef MOZ_PKG_MANIFEST_P
 $(MOZ_PKG_MANIFEST): $(MOZ_PKG_MANIFEST_P) FORCE
 	$(call py_action,preprocessor,$(DEFINES) $(ACDEFINES) $< -o $@)
 ifdef MOZ_CHROME_MULTILOCALE
 	printf "\n[multilocale]\n" >> $@
 	for LOCALE in $(MOZ_CHROME_MULTILOCALE) ;\
 	do \
 	  printf "$(BINPATH)/chrome/$$LOCALE$(JAREXT)\n" >> $@; \
--- a/b2g/installer/package-manifest.in
+++ b/b2g/installer/package-manifest.in
@@ -38,17 +38,17 @@
 @BINPATH@/dictionaries/*
 @BINPATH@/hyphenation/*
 #ifdef XP_WIN32
 @BINPATH@/uninstall/helper.exe
 #endif
 
 [xpcom]
 @BINPATH@/dependentlibs.list
-#ifdef XP_WIN32
+#ifdef GKMEDIAS_SHARED_LIBRARY
 @BINPATH@/@DLL_PREFIX@gkmedias@DLL_SUFFIX@
 #endif
 #ifndef MOZ_STATIC_JS
 @BINPATH@/@DLL_PREFIX@mozjs@DLL_SUFFIX@
 #endif
 #ifndef MOZ_FOLD_LIBS
 @BINPATH@/@DLL_PREFIX@plc4@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@plds4@DLL_SUFFIX@
--- a/browser/installer/Makefile.in
+++ b/browser/installer/Makefile.in
@@ -70,16 +70,20 @@ endif
 ifdef MOZ_JSDEBUGGER
 DEFINES += -DMOZ_JSDEBUGGER
 endif
 
 ifdef NECKO_WIFI
 DEFINES += -DNECKO_WIFI
 endif
 
+ifdef GKMEDIAS_SHARED_LIBRARY
+DEFINES += -DGKMEDIAS_SHARED_LIBRARY
+endif
+
 ifdef MOZ_PKG_MANIFEST_P
 MOZ_PKG_MANIFEST = package-manifest
 
 $(MOZ_PKG_MANIFEST): $(MOZ_PKG_MANIFEST_P) $(GLOBAL_DEPS)
 	$(call py_action,preprocessor,$(DEFINES) $(ACDEFINES) $< -o $@)
 
 GARBAGE += $(MOZ_PKG_MANIFEST)
 endif
--- 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/moz.build
+++ b/config/moz.build
@@ -19,8 +19,11 @@ CONFIGURE_SUBST_FILES += [
 ]
 
 if CONFIG['HOST_OS_ARCH'] != 'WINNT':
     HOST_SOURCES += [
         'nsinstall.c',
         'pathsub.c',
     ]
     HOST_PROGRAM = 'nsinstall_real'
+
+if CONFIG['GKMEDIAS_SHARED_LIBRARY']:
+    DEFINES['GKMEDIAS_SHARED_LIBRARY'] = True
--- 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,16 +114,16 @@ 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'
 
 DEFINES['ANGLE_DISABLE_TRACE'] = True
 DEFINES['ANGLE_COMPILE_OPTIMIZATION_LEVEL'] = 'D3DCOMPILE_OPTIMIZATION_LEVEL1'
 DEFINES['COMPILER_IMPLEMENTATION'] = True
--- a/gfx/graphite2/src/moz.build
+++ b/gfx/graphite2/src/moz.build
@@ -52,17 +52,17 @@ 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
     DEFINES['GRAPHITE2_EXPORTING'] = True
 else:
     # tell graphite2 not to export symbols, we'll be linking it directly with
     # thebes
     DEFINES['GRAPHITE2_STATIC'] = True
 
 FINAL_LIBRARY = 'gkmedias'
--- a/gfx/ots/src/moz.build
+++ b/gfx/ots/src/moz.build
@@ -44,17 +44,17 @@ 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'
 
 DEFINES['PACKAGE_VERSION'] = '"moz"'
 DEFINES['PACKAGE_BUGREPORT'] = '"http://bugzilla.mozilla.org/"'
 DEFINES['NOMINMAX'] = True
 DEFINES['MOZ_OTS_REPORT_ERRORS'] = True
--- 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
@@ -2989,16 +2989,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
@@ -50,12 +50,12 @@ if CONFIG['OS_TARGET'] == 'Android':
     if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
         SOURCES += [
             'cubeb_audiotrack.c',
         ]
         DEFINES['USE_AUDIOTRACK'] = True
 
 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,14 +27,15 @@ 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'
 
 # Use abort() instead of exception in SoundTouch.
 DEFINES['ST_NO_EXCEPTION_HANDLING'] = 1
--- a/media/libtheora/lib/moz.build
+++ b/media/libtheora/lib/moz.build
@@ -64,15 +64,15 @@ if CONFIG['GNU_AS']:
             DEFINES[var] = True
         # The Android NDK doesn't pre-define anything to indicate the OS it's
         # on, so do it for them.
         if CONFIG['OS_TARGET'] == 'Android':
             DEFINES['__linux__'] = True
 
 MSVC_ENABLE_PGO = True
 
-if CONFIG['OS_TARGET'] == 'WINNT':
+if CONFIG['GKMEDIAS_SHARED_LIBRARY']:
     NO_VISIBILITY_FLAGS = True
 
 FINAL_LIBRARY = 'gkmedias'
 
 # The encoder is currently not included.
 DEFINES['THEORA_DISABLE_ENCODE'] = True
--- 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,17 +85,17 @@ 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'
 
 DEFINES['HAVE_CONFIG_H'] = 'vpx_config.h'
 
 if CONFIG['OS_TARGET'] == 'Android':
     # Older versions of the Android NDK don't pre-define anything to indicate
--- a/media/mtransport/build/moz.build
+++ b/media/mtransport/build/moz.build
@@ -78,17 +78,17 @@ elif CONFIG['OS_TARGET'] == 'WINNT':
     DEFINES['WIN'] = True
     # for stun.h
     DEFINES['WIN32'] = True
     DEFINES['NOMINMAX'] = True
     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'
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
     DEFINES['USE_INTERFACE_PRIORITIZER'] = True
 
 for var in ('HAVE_STRDUP', 'NR_SOCKET_IS_VOID_PTR'):
--- a/media/mtransport/standalone/moz.build
+++ b/media/mtransport/standalone/moz.build
@@ -58,19 +58,16 @@ elif CONFIG['OS_TARGET'] == 'WINNT':
     DEFINES['WIN32'] = True
     DEFINES['NOMINMAX'] = True
     LOCAL_INCLUDES += [
         '/media/mtransport/third_party/nrappkit/src/port/win32/include',
     ]
 
 FORCE_STATIC_LIB = True
 
-if CONFIG['OS_TARGET'] == 'WINNT':
-    NO_VISIBILITY_FLAGS = True
-
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
     DEFINES['USE_INTERFACE_PRIORITIZER'] = True
 
 for var in ('HAVE_STRDUP', 'NR_SOCKET_IS_VOID_PTR'):
     DEFINES[var] = True
 
 DEFINES['R_DEFINED_INT2'] = 'int16_t'
 DEFINES['R_DEFINED_UINT2'] = 'uint16_t'
--- a/media/webrtc/signaling/test/Makefile.in
+++ b/media/webrtc/signaling/test/Makefile.in
@@ -148,20 +148,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
@@ -19,32 +19,39 @@ else
 SDK_LIBRARY = $(REAL_LIBRARY)
 endif
 endif
 
 endif
  
 MOZ_GLUE_LDFLAGS = # Don't link against ourselves
 
+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))
@@ -69,18 +76,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