Commit eba22e22 authored by Mike Hommey's avatar Mike Hommey
Browse files

Bug 1641760 - Move --with-system-zlib to python configure. r=froydnj

As all versions of zlib >= 1.2.3.1 have a pkg-config file, and 1.2.3.1
is close to 14 years old, let's drop 1.2.3 and just use pkg-config, which
simplifies what we need to do dramatically.

Differential Revision: https://phabricator.services.mozilla.com/D77404
parent 8883f72d
......@@ -19,7 +19,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
builtin(include, build/autoconf/icu.m4)dnl
builtin(include, build/autoconf/clang-plugin.m4)dnl
builtin(include, build/autoconf/alloc.m4)dnl
......
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_SYSTEM_ZLIB=
else
AC_CHECK_LIB(z, gzread, [MOZ_SYSTEM_ZLIB=1 MOZ_ZLIB_LIBS="$MOZ_ZLIB_LIBS -lz"],
[MOZ_SYSTEM_ZLIB=])
if test "$MOZ_SYSTEM_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_SYSTEM_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_LIST(MOZ_ZLIB_CFLAGS)
AC_SUBST_LIST(MOZ_ZLIB_LIBS)
AC_SUBST(MOZ_SYSTEM_ZLIB)
])
......@@ -258,7 +258,6 @@ def old_configure_options(*options):
'--with-system-nspr',
'--with-system-nss',
'--with-system-png',
'--with-system-zlib',
'--with-user-appdir',
'--x-includes',
'--x-libraries',
......
......@@ -409,7 +409,9 @@ def dependable(obj):
return obj
if isfunction(obj):
return depends(when=True)(obj)
return depends(when=True)(lambda: obj)
# Depend on --help to make lint happy if the dependable is used as an input
# to an option().
return depends('--help', when=True)(lambda _: obj)
always = dependable(True)
......
......@@ -18,7 +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
builtin(include, ../../build/autoconf/icu.m4)dnl
builtin(include, ../../build/autoconf/clang-plugin.m4)dnl
builtin(include, ../../build/autoconf/alloc.m4)dnl
......
......@@ -1132,16 +1132,6 @@ MOZ_ARG_HEADER(External Packages)
MOZ_CONFIG_NSPR(js)
dnl ========================================================
dnl system zlib Support
dnl ========================================================
dnl Standalone js defaults to system zlib
if test -n "$JS_STANDALONE"; then
ZLIB_DIR=yes
fi
MOZ_ZLIB_CHECK([1.2.3])
if test -n "$ZLIB_IN_MOZGLUE"; then
AC_DEFINE(ZLIB_IN_MOZGLUE)
fi
......
......@@ -261,6 +261,8 @@ set_config('WASM_OBJ_SUFFIX', 'wasm')
# Make `profiling` available to this file even when js/moz.configure
# doesn't end up included.
profiling = dependable(False)
# Same for js_standalone
js_standalone = dependable(False)
include(include_project_configure)
......@@ -701,6 +703,25 @@ def strip_flags(flags, profiling, target):
set_config('STRIP_FLAGS', strip_flags)
@depends(js_standalone, target)
def system_zlib_default(js_standalone, target):
return js_standalone and target.kernel != 'WINNT'
js_option('--with-system-zlib', nargs='?', default=system_zlib_default,
help='{Use|Do not use} system libz')
@depends('--with-system-zlib')
def deprecated_system_zlib_path(value):
if len(value) == 1:
die('--with-system-zlib=PATH is not supported anymore. Please use '
'--with-system-zlib and set any necessary pkg-config environment variable.')
pkg_check_modules('MOZ_ZLIB', 'zlib >= 1.2.3', when='--with-system-zlib')
set_config('MOZ_SYSTEM_ZLIB', True, when='--with-system-zlib')
add_old_configure_assignment('MOZ_SYSTEM_ZLIB', True, when='--with-system-zlib')
# Please do not add configure checks from here on.
# Fallthrough to autoconf-based configure
......
......@@ -1473,10 +1473,6 @@ if test -z "$MOZ_SYSTEM_NSS"; then
esac
fi
dnl system ZLIB support
dnl ========================================================
MOZ_ZLIB_CHECK([1.2.3])
if test -z "$SKIP_LIBRARY_CHECKS"; then
dnl ========================================================
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment