Bug 763651 - Link the javascript engine against zlib. r=khuey

This commit is contained in:
Mike Hommey 2012-07-12 08:30:59 +02:00
Родитель 7c181001da
Коммит 125aebf06d
21 изменённых файлов: 152 добавлений и 72 удалений

Просмотреть файл

@ -53,6 +53,9 @@ tier_base_dirs += memory/jemalloc
endif
tier_base_dirs += memory/build
endif
ifndef MOZ_NATIVE_ZLIB
tier_base_dirs += modules/zlib
endif
tier_base_dirs += \
mozglue \
memory/mozalloc \

1
aclocal.m4 поставляемый
Просмотреть файл

@ -19,6 +19,7 @@ builtin(include, build/autoconf/compiler-opts.m4)dnl
builtin(include, build/autoconf/expandlibs.m4)dnl
builtin(include, build/autoconf/arch.m4)dnl
builtin(include, build/autoconf/android.m4)dnl
builtin(include, build/autoconf/zlib.m4)dnl
MOZ_PROG_CHECKMSYS()

54
build/autoconf/zlib.m4 Normal file
Просмотреть файл

@ -0,0 +1,54 @@
dnl This Source Code Form is subject to the terms of the Mozilla Public
dnl License, v. 2.0. If a copy of the MPL was not distributed with this
dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
dnl Usage: MOZ_ZLIB_CHECK([version])
AC_DEFUN([MOZ_ZLIB_CHECK],
[
MOZZLIB=$1
MOZ_ARG_WITH_STRING(system-zlib,
[ --with-system-zlib[=PFX]
Use system libz [installed at prefix PFX]],
ZLIB_DIR=$withval)
if test -z "$MOZ_ZLIB_LIBS$MOZ_ZLIB_CFLAGS$SKIP_LIBRARY_CHECKS"; then
_SAVE_CFLAGS=$CFLAGS
_SAVE_LDFLAGS=$LDFLAGS
_SAVE_LIBS=$LIBS
if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
MOZ_ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
MOZ_ZLIB_LIBS="-L${ZLIB_DIR}/lib"
CFLAGS="$MOZ_ZLIB_CFLAGS $CFLAGS"
LDFLAGS="$MOZ_ZLIB_LIBS $LDFLAGS"
fi
if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
MOZ_NATIVE_ZLIB=
else
AC_CHECK_LIB(z, gzread, [MOZ_NATIVE_ZLIB=1 MOZ_ZLIB_LIBS="$MOZ_ZLIB_LIBS -lz"],
[MOZ_NATIVE_ZLIB=])
if test "$MOZ_NATIVE_ZLIB" = 1; then
MOZZLIBNUM=`echo $MOZZLIB | awk -F. changequote(<<, >>)'{printf "0x%x\n", (((<<$>>1 * 16 + <<$>>2) * 16) + <<$>>3) * 16 + <<$>>4}'changequote([, ])`
AC_TRY_COMPILE([ #include <stdio.h>
#include <string.h>
#include <zlib.h> ],
[ #if ZLIB_VERNUM < $MOZZLIBNUM
#error "Insufficient zlib version ($MOZZLIBNUM required)."
#endif ],
MOZ_NATIVE_ZLIB=1,
AC_MSG_ERROR([Insufficient zlib version for --with-system-zlib ($MOZZLIB required)]))
fi
fi
CFLAGS=$_SAVE_CFLAGS
LDFLAGS=$_SAVE_LDFLAGS
LIBS=$_SAVE_LIBS
fi
AC_SUBST(MOZ_ZLIB_CFLAGS)
AC_SUBST(MOZ_ZLIB_LIBS)
AC_SUBST(MOZ_NATIVE_ZLIB)
])

Просмотреть файл

@ -54,7 +54,6 @@ dnl Set the version number of the libs included with mozilla
dnl ========================================================
MOZJPEG=62
MOZPNG=10511
MOZZLIB=1.2.3
NSPR_VERSION=4
NSS_VERSION=3
@ -1085,8 +1084,6 @@ MOZ_USER_DIR=".mozilla"
MOZ_JPEG_CFLAGS=
MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/media/libjpeg)'
MOZ_ZLIB_CFLAGS=
MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
MOZ_BZ2_CFLAGS=
MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
MOZ_PNG_CFLAGS=
@ -4034,51 +4031,22 @@ if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then
MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
fi
fi # SKIP_LIBRARY_CHECKS
dnl system ZLIB support
dnl ========================================================
MOZ_ARG_WITH_STRING(system-zlib,
[ --with-system-zlib[=PFX]
Use system libz [installed at prefix PFX]],
ZLIB_DIR=$withval)
MOZ_ZLIB_CHECK([1.2.3])
_SAVE_CFLAGS=$CFLAGS
_SAVE_LDFLAGS=$LDFLAGS
_SAVE_LIBS=$LIBS
if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
fi
if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
MOZ_NATIVE_ZLIB=
else
AC_CHECK_LIB(z, gzread, [MOZ_NATIVE_ZLIB=1 MOZ_ZLIB_LIBS="-lz"],
[MOZ_NATIVE_ZLIB=])
fi
if test "$MOZ_NATIVE_ZLIB" = 1; then
MOZZLIBNUM=`echo $MOZZLIB | awk -F. '{printf "0x%x\n", ((($1 * 16 + $2) * 16) + $3) * 16 + $4}'`
AC_TRY_COMPILE([ #include <stdio.h>
#include <string.h>
#include <zlib.h> ],
[ #if ZLIB_VERNUM < $MOZZLIBNUM
#error "Insufficient zlib version ($MOZZLIBNUM required)."
#endif ],
MOZ_NATIVE_ZLIB=1,
AC_MSG_ERROR([Insufficient zlib version for --with-system-zlib ($MOZZLIB required)]))
fi
CFLAGS=$_SAVE_CFLAGS
LDFLAGS=$_SAVE_LDFLAGS
LIBS=$_SAVE_LIBS
if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$MOZ_NATIVE_ZLIB" = 1; then
MOZ_ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
MOZ_ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
if test "$MOZ_NATIVE_ZLIB" != 1; then
MOZ_ZLIB_CFLAGS=
MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,'"$_objdir"'/modules/zlib/src)'
fi
if test "$MOZ_LINKER" = 1 -a "$MOZ_NATIVE_ZLIB" != 1; then
AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
fi
if test -z "$SKIP_LIBRARY_CHECKS"; then
dnl system BZIP2 Support
dnl ========================================================
MOZ_ARG_WITH_STRING(system-bz2,
@ -8524,14 +8492,11 @@ AC_SUBST(MOZ_NATIVE_MAKEDEPEND)
AC_SUBST(SYSTEM_LIBXUL)
AC_SUBST(MOZ_NATIVE_JPEG)
AC_SUBST(MOZ_NATIVE_PNG)
AC_SUBST(MOZ_NATIVE_ZLIB)
AC_SUBST(MOZ_NATIVE_BZ2)
AC_SUBST(MOZ_FLEXBOX)
AC_SUBST(MOZ_JPEG_CFLAGS)
AC_SUBST(MOZ_JPEG_LIBS)
AC_SUBST(MOZ_ZLIB_CFLAGS)
AC_SUBST(MOZ_ZLIB_LIBS)
AC_SUBST(MOZ_BZ2_CFLAGS)
AC_SUBST(MOZ_BZ2_LIBS)
AC_SUBST(MOZ_PNG_CFLAGS)
@ -9187,6 +9152,12 @@ 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
MOZ_ZLIB_LIBS=
fi
export MOZ_NATIVE_ZLIB
export MOZ_ZLIB_CFLAGS
export MOZ_ZLIB_LIBS
export MOZ_APP_NAME
export STLPORT_CPPFLAGS
export STLPORT_LDFLAGS

Просмотреть файл

@ -665,6 +665,9 @@ ifeq (,$(filter HP-UX WINNT OS2,$(OS_ARCH)))
EXTRA_LIBS += -lm
endif
CFLAGS += $(MOZ_ZLIB_CFLAGS)
EXTRA_LIBS += $(MOZ_ZLIB_LIBS)
# Prevent floating point errors caused by VC++ optimizations
ifdef _MSC_VER
# XXX We should add this to CXXFLAGS, too?

1
js/src/aclocal.m4 поставляемый
Просмотреть файл

@ -18,5 +18,6 @@ builtin(include, build/autoconf/compiler-opts.m4)dnl
builtin(include, build/autoconf/expandlibs.m4)dnl
builtin(include, build/autoconf/arch.m4)dnl
builtin(include, build/autoconf/android.m4)dnl
builtin(include, build/autoconf/zlib.m4)dnl
MOZ_PROG_CHECKMSYS()

Просмотреть файл

@ -0,0 +1,54 @@
dnl This Source Code Form is subject to the terms of the Mozilla Public
dnl License, v. 2.0. If a copy of the MPL was not distributed with this
dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
dnl Usage: MOZ_ZLIB_CHECK([version])
AC_DEFUN([MOZ_ZLIB_CHECK],
[
MOZZLIB=$1
MOZ_ARG_WITH_STRING(system-zlib,
[ --with-system-zlib[=PFX]
Use system libz [installed at prefix PFX]],
ZLIB_DIR=$withval)
if test -z "$MOZ_ZLIB_LIBS$MOZ_ZLIB_CFLAGS$SKIP_LIBRARY_CHECKS"; then
_SAVE_CFLAGS=$CFLAGS
_SAVE_LDFLAGS=$LDFLAGS
_SAVE_LIBS=$LIBS
if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
MOZ_ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
MOZ_ZLIB_LIBS="-L${ZLIB_DIR}/lib"
CFLAGS="$MOZ_ZLIB_CFLAGS $CFLAGS"
LDFLAGS="$MOZ_ZLIB_LIBS $LDFLAGS"
fi
if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
MOZ_NATIVE_ZLIB=
else
AC_CHECK_LIB(z, gzread, [MOZ_NATIVE_ZLIB=1 MOZ_ZLIB_LIBS="$MOZ_ZLIB_LIBS -lz"],
[MOZ_NATIVE_ZLIB=])
if test "$MOZ_NATIVE_ZLIB" = 1; then
MOZZLIBNUM=`echo $MOZZLIB | awk -F. changequote(<<, >>)'{printf "0x%x\n", (((<<$>>1 * 16 + <<$>>2) * 16) + <<$>>3) * 16 + <<$>>4}'changequote([, ])`
AC_TRY_COMPILE([ #include <stdio.h>
#include <string.h>
#include <zlib.h> ],
[ #if ZLIB_VERNUM < $MOZZLIBNUM
#error "Insufficient zlib version ($MOZZLIBNUM required)."
#endif ],
MOZ_NATIVE_ZLIB=1,
AC_MSG_ERROR([Insufficient zlib version for --with-system-zlib ($MOZZLIB required)]))
fi
fi
CFLAGS=$_SAVE_CFLAGS
LDFLAGS=$_SAVE_LDFLAGS
LIBS=$_SAVE_LIBS
fi
AC_SUBST(MOZ_ZLIB_CFLAGS)
AC_SUBST(MOZ_ZLIB_LIBS)
AC_SUBST(MOZ_NATIVE_ZLIB)
])

Просмотреть файл

@ -42,6 +42,11 @@ include $(topsrcdir)/config/config.mk
# Do not install util programs
NO_INSTALL=1
# Force wrap zlib system header if building js as a shared library.
ifdef JS_SHARED_LIBRARY
DEFINES += -DMOZ_NATIVE_ZLIB=1
endif
include $(topsrcdir)/config/rules.mk
HOST_CFLAGS += -DUNICODE -D_UNICODE

Просмотреть файл

@ -192,6 +192,9 @@ NSPR_CONFIG = @NSPR_CONFIG@
NSPR_CFLAGS = @NSPR_CFLAGS@
NSPR_LIBS = @NSPR_LIBS@
MOZ_ZLIB_LIBS = @MOZ_ZLIB_LIBS@
MOZ_ZLIB_CFLAGS = @MOZ_ZLIB_CFLAGS@
MOZ_NATIVE_FFI = @MOZ_NATIVE_FFI@
MOZ_FFI_LIBS = @MOZ_FFI_LIBS@
MOZ_FFI_CFLAGS = @MOZ_FFI_CFLAGS@

Просмотреть файл

@ -3324,6 +3324,14 @@ if test -n "$MOZ_NATIVE_NSPR"; then
CFLAGS=$_SAVE_CFLAGS
fi
dnl ========================================================
dnl system zlib Support
dnl ========================================================
dnl Standalone js defaults to system zlib
ZLIB_DIR=yes
MOZ_ZLIB_CHECK([1.2.3])
dnl ========================================================
dnl system libffi Support
dnl ========================================================

Просмотреть файл

@ -82,7 +82,7 @@ DEFINES += -DEXPORT_JS_API
# on its behalf.
DEFINES += -DIMPL_MFBT
LIBS = $(DEPTH)/$(LIB_PREFIX)js_static.$(LIB_SUFFIX) $(NSPR_LIBS)
LIBS = $(DEPTH)/$(LIB_PREFIX)js_static.$(LIB_SUFFIX) $(NSPR_LIBS) $(MOZ_ZLIB_LIBS)
LOCAL_INCLUDES += -I$(topsrcdir) -I..

Просмотреть файл

@ -23,7 +23,7 @@ DEFINES += -DEXPORT_JS_API
# on its behalf.
DEFINES += -DIMPL_MFBT
LIBS = $(NSPR_LIBS) $(EDITLINE_LIBS) $(DEPTH)/$(LIB_PREFIX)js_static.$(LIB_SUFFIX)
LIBS = $(NSPR_LIBS) $(EDITLINE_LIBS) $(DEPTH)/$(LIB_PREFIX)js_static.$(LIB_SUFFIX) $(MOZ_ZLIB_LIBS)
ifdef MOZ_NATIVE_FFI
EXTRA_LIBS += $(MOZ_FFI_LIBS)
endif

Просмотреть файл

@ -126,9 +126,6 @@ ifeq (WINNT,$(OS_TARGET))
EXTRA_DSO_LDOPTS = $(MOZALLOC_LIB) $(NSPR_LIBS)
OS_LIBS += $(call EXPAND_LIBNAME,usp10 ole32)
# OTS uses uncompress2() from libz, so we need to link with this
EXTRA_DSO_LDOPTS += $(MOZ_ZLIB_LIBS)
ifdef MOZ_WEBRTC
EXTRA_DSO_LDOPTS += \
-LIBPATH:"$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)" \

Просмотреть файл

@ -52,7 +52,6 @@ FORCE_STATIC_LIB = 1
include $(topsrcdir)/config/rules.mk
ifeq ($(OS_ARCH),WINNT)
DEFINES += -DZLIB_DLL
ifdef BUILD_DEBUG_GC
DEFINES += -DDEBUG_GC
endif

Просмотреть файл

@ -38,7 +38,3 @@ XPIDLSRCS = $(MODULES_LIBJAR_LXPIDLSRCS)
EXPORTS = $(MODULES_LIBJAR_LEXPORTS)
include $(topsrcdir)/config/rules.mk
ifeq ($(OS_ARCH),WINNT)
DEFINES += -DZLIB_DLL=1
endif

Просмотреть файл

@ -13,13 +13,6 @@ include $(srcdir)/objs.mk
MODULE = zlib
LIBRARY_NAME = mozz
GRE_MODULE = 1
LIBXUL_LIBRARY = 1
DIST_INSTALL = 1
ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
DEFINES += -DZLIB_DLL=1
endif
CSRCS = $(MODULES_ZLIB_SRC_LCSRCS)

Просмотреть файл

@ -6,8 +6,8 @@
#ifndef MOZZCONF_H
#define MOZZCONF_H
#if defined(XP_WIN) && defined(ZLIB_DLL)
#undef ZLIB_DLL
#if defined(XP_WIN)
#define ZLIB_DLL 1
#endif
/* Exported Symbols */

Просмотреть файл

@ -56,6 +56,8 @@ 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)
endif
ifeq (Android,$(OS_TARGET))

Просмотреть файл

@ -51,8 +51,4 @@ LOCAL_INCLUDES = \
include $(topsrcdir)/config/rules.mk
ifeq ($(OS_ARCH),WINNT)
DEFINES += -DZLIB_DLL
endif
DEFINES += -DIMPL_NS_NET

Просмотреть файл

@ -79,10 +79,6 @@ LOCAL_INCLUDES += -I$(topsrcdir)/widget/windows
LOCAL_INCLUDES += -I$(topsrcdir)/xpcom/base
endif
ifneq (,$(filter WINNT OS2,$(OS_ARCH)))
DEFINES += -DZLIB_DLL=1
endif
ifeq ($(OS_ARCH),OS2)
CPPSRCS += \
@ -356,7 +352,9 @@ ifdef MOZ_NATIVE_PNG
EXTRA_DSO_LDOPTS += $(MOZ_PNG_LIBS)
endif
ifneq (WINNT,$(OS_ARCH))
EXTRA_DSO_LDOPTS += $(MOZ_ZLIB_LIBS)
endif
ifdef MOZ_NATIVE_HUNSPELL
EXTRA_DSO_LDOPTS += $(MOZ_HUNSPELL_LIBS)

Просмотреть файл

@ -21,10 +21,6 @@ endif
tier_platform_dirs += xpcom
ifndef MOZ_NATIVE_ZLIB
tier_platform_dirs += modules/zlib
endif
tier_platform_dirs += \
modules/libpref \
intl \