Commit 038f9f81 authored by Mike Hommey's avatar Mike Hommey
Browse files

Bug 1641790 - Move --with-system-nss to python configure. r=firefox-build-system-reviewers,rstewart

Version of NSS >= 3.27 have a pkg-config file. We're now requiring 3.53,
so while moving, just use pkg-config, which is simpler.

The old-configure check that rejected some untested platforms for
in-tree NSS is actually rejecting none: the accepted platforms cover all
the supported ones, so we remove that check.

And because building with system NSS without system NSPR doesn't make
sense, imply the latter when the former is used.

Differential Revision: https://phabricator.services.mozilla.com/D77428
parent 90885289
......@@ -7,7 +7,6 @@ builtin(include, build/autoconf/hotfixes.m4)dnl
builtin(include, build/autoconf/hooks.m4)dnl
builtin(include, build/autoconf/config.status.m4)dnl
builtin(include, build/autoconf/toolchain.m4)dnl
builtin(include, build/autoconf/nss.m4)dnl
builtin(include, build/autoconf/pkg.m4)dnl
builtin(include, build/autoconf/codeset.m4)dnl
builtin(include, build/autoconf/altoptions.m4)dnl
......
# -*- tab-width: 4; -*-
# Configure paths for NSS
# Public domain - Chris Seawood <cls@seawood.org> 2001-04-05
# Based upon gtk.m4 (also PD) by Owen Taylor
dnl AM_PATH_NSS([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for NSS, and define NSS_CFLAGS and NSS_LIBS
AC_DEFUN([AM_PATH_NSS],
[dnl
AC_ARG_WITH(nss-prefix,
[ --with-nss-prefix=PFX Prefix where NSS is installed],
nss_config_prefix="$withval",
nss_config_prefix="")
AC_ARG_WITH(nss-exec-prefix,
[ --with-nss-exec-prefix=PFX
Exec prefix where NSS is installed],
nss_config_exec_prefix="$withval",
nss_config_exec_prefix="")
if test -n "$nss_config_exec_prefix"; then
nss_config_args="$nss_config_args --exec-prefix=$nss_config_exec_prefix"
if test -z "$NSS_CONFIG"; then
NSS_CONFIG=$nss_config_exec_prefix/bin/nss-config
fi
fi
if test -n "$nss_config_prefix"; then
nss_config_args="$nss_config_args --prefix=$nss_config_prefix"
if test -z "$NSS_CONFIG"; then
NSS_CONFIG=$nss_config_prefix/bin/nss-config
fi
fi
unset ac_cv_path_NSS_CONFIG
AC_PATH_PROG(NSS_CONFIG, nss-config, no)
min_nss_version=ifelse([$1], ,3.0.0,$1)
AC_MSG_CHECKING(for NSS - version >= $min_nss_version)
no_nss=""
if test "$NSS_CONFIG" = "no"; then
no_nss="yes"
else
NSS_CFLAGS=`$NSS_CONFIG $nss_config_args --cflags`
NSS_LIBS=`$NSS_CONFIG $nss_config_args --libs`
nss_config_major_version=`$NSS_CONFIG $nss_config_args --version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\(\.\([[0-9]]*\)\)\{0,1\}/\1/'`
nss_config_minor_version=`$NSS_CONFIG $nss_config_args --version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\(\.\([[0-9]]*\)\)\{0,1\}/\2/'`
nss_config_micro_version=`$NSS_CONFIG $nss_config_args --version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\(\.\([[0-9]]*\)\)\{0,1\}/\4/'`
if test -z "$nss_config_micro_version"; then
nss_config_micro_version="0"
fi
min_nss_major_version=`echo $min_nss_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\(\.\([[0-9]]*\)\)\{0,1\}/\1/'`
min_nss_minor_version=`echo $min_nss_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\(\.\([[0-9]]*\)\)\{0,1\}/\2/'`
min_nss_micro_version=`echo $min_nss_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\(\.\([[0-9]]*\)\)\{0,1\}/\4/'`
if test -z "$min_nss_micro_version"; then
min_nss_micro_version="0"
fi
if test "$nss_config_major_version" -lt "$min_nss_major_version"; then
no_nss="yes"
elif test "$nss_config_major_version" -eq "$min_nss_major_version" &&
test "$nss_config_minor_version" -lt "$min_nss_minor_version"; then
no_nss="yes"
elif test "$nss_config_major_version" -eq "$min_nss_major_version" &&
test "$nss_config_minor_version" -eq "$min_nss_minor_version" &&
test "$nss_config_micro_version" -lt "$min_nss_micro_version"; then
no_nss="yes"
fi
fi
if test -z "$no_nss"; then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
ifelse([$3], , :, [$3])
fi
AC_SUBST_LIST(NSS_CFLAGS)
AC_SUBST_LIST(NSS_LIBS)
])
......@@ -243,10 +243,7 @@ def old_configure_options(*options):
'--with-branding',
'--with-distribution-id',
'--with-macbundlename-prefix',
'--with-nss-exec-prefix',
'--with-nss-prefix',
'--with-system-libevent',
'--with-system-nss',
'--with-system-png',
'--with-user-appdir',
'--x-includes',
......
......@@ -35,7 +35,7 @@ def pkg_config_version(pkg_config):
@template
def pkg_check_modules(var, package_desc, when=always,
allow_missing=False):
allow_missing=False, config=True):
if isinstance(package_desc, (tuple, list)):
package_desc = ' '.join(package_desc)
package_desc = dependable(package_desc)
......@@ -93,7 +93,8 @@ def pkg_check_modules(var, package_desc, when=always,
def pkg_info(cflags, libs):
return namespace(cflags=cflags, libs=libs)
set_config('%s_CFLAGS' % var, pkg_cflags)
set_config('%s_LIBS' % var, pkg_libs)
if config:
set_config('%s_CFLAGS' % var, pkg_cflags)
set_config('%s_LIBS' % var, pkg_libs)
return pkg_info
......@@ -46,7 +46,6 @@ _SUBDIR_CONFIG_ARGS="$ac_configure_args"
dnl Set the version number of the libs included with mozilla
dnl ========================================================
MOZPNG=10635
NSS_VERSION=3
dnl Set the minimum version of toolkit libs used by mozilla
dnl ========================================================
......@@ -1435,31 +1434,6 @@ LIBS=$_SAVE_LIBS
AC_SUBST(MOZ_SYSTEM_LIBEVENT)
dnl ========================================================
dnl = If NSS was not detected in the system,
dnl = use the one in the source tree (mozilla/security/nss)
dnl ========================================================
MOZ_ARG_WITH_BOOL(system-nss,
[ --with-system-nss Use system installed NSS],
_USE_SYSTEM_NSS=1 )
if test -n "$_USE_SYSTEM_NSS"; then
AM_PATH_NSS(3.53, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
fi
NSS_CFLAGS="$NSS_CFLAGS -I${DIST}/include/nss"
if test -z "$MOZ_SYSTEM_NSS"; then
case "${OS_ARCH}" in
# Only few platforms have been tested with GYP
WINNT|Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD|SunOS)
;;
*)
AC_MSG_ERROR([building in-tree NSS is not supported on this platform. Use --with-system-nss])
;;
esac
fi
if test -z "$SKIP_LIBRARY_CHECKS"; then
dnl ========================================================
......@@ -2852,8 +2826,6 @@ AC_SUBST(MOZ_SYSTEM_PNG)
AC_SUBST_LIST(MOZ_PNG_CFLAGS)
AC_SUBST_LIST(MOZ_PNG_LIBS)
AC_SUBST(MOZ_SYSTEM_NSS)
HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
......
......@@ -2082,3 +2082,26 @@ def default_agent_flag(enabled):
return True
set_config('MOZ_DEFAULT_BROWSER_AGENT', default_agent_flag)
# NSS
# ===
option('--with-system-nss', help='Use system NSS')
imply_option('--with-system-nspr', True, when='--with-system-nss')
nss_pkg = pkg_check_modules('NSS', 'nss >= 3.53', when='--with-system-nss', config=False)
set_config('MOZ_SYSTEM_NSS', True, when='--with-system-nss')
@depends(nss_pkg, check_build_environment)
def nss_config(nss_pkg, build_env):
cflags = ['-I%s' % os.path.join(build_env.dist, 'include', 'nss')]
libs = None
if nss_pkg:
cflags = list(nss_pkg.cflags) + cflags
libs = nss_pkg.libs
return namespace(cflags=cflags, libs=libs)
set_config('NSS_CFLAGS', nss_config.cflags)
set_config('NSS_LIBS', nss_config.libs)
add_old_configure_assignment('NSS_CFLAGS', nss_config.cflags)
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