File mozilla-bindgen-systemlibs.patch of Package MozillaFirefox

# HG changeset patch
# Parent  e85dde0eabf214916c69924aa49192ab412e00a1

diff --git a/build/autoconf/config.status.m4 b/build/autoconf/config.status.m4
--- a/build/autoconf/config.status.m4
+++ b/build/autoconf/config.status.m4
@@ -40,16 +40,31 @@ define([AC_SUBST_LIST],
 [ifdef([AC_SUBST_SET_$1], [m4_fatal([Cannot use AC_SUBST_SET and AC_SUBST_LIST on the same variable ($1)])],
 [ifdef([AC_SUBST_LIST_$1], ,
 [define([AC_SUBST_LIST_$1], )dnl
 AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
     (''' $1 ''', list(r''' [$]$1 '''.split()))
 AC_DIVERT_POP()dnl
 ])])])])
 
+dnl Like AC_SUBST, but makes the value available as a string of quoted strings
+dnl in python, with values got from the value of the environment variable,
+dnl split on whitespaces. The value is suitable for embedding into a .toml
+dnl list.
+define([AC_SUBST_TOML_LIST],
+[ifdef([AC_SUBST_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_LIST on the same variable ($1)])],
+[ifdef([AC_SUBST_SET_$1], [m4_fatal([Cannot use AC_SUBST_SET and AC_SUBST_LIST on the same variable ($1)])],
+[ifdef([AC_SUBST_LIST_$1], ,
+[define([AC_SUBST_LIST_$1], )dnl
+AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
+    (''' $1 ''', r''' %s ''' % str(', '.join("'%s'" % s for s in r''' [$]$1 '''.split())))
+AC_DIVERT_POP()dnl
+])])])])
+
+
 dnl Ignore AC_SUBSTs for variables we don't have use for but that autoconf
 dnl itself exports.
 define([AC_SUBST_CFLAGS], )
 define([AC_SUBST_CPPFLAGS], )
 define([AC_SUBST_CXXFLAGS], )
 define([AC_SUBST_FFLAGS], )
 define([AC_SUBST_DEFS], )
 define([AC_SUBST_LDFLAGS], )
diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -897,25 +897,24 @@ def check_have_64_bit(have_64_bit, compi
         configure_error('The target compiler does not agree with configure '
                         'about the target bitness.')
 
 option(env='BINDGEN_CFLAGS',
        nargs=1,
        help='Options bindgen should pass to the C/C++ parser')
 
 @depends('BINDGEN_CFLAGS')
-@checking('bindgen cflags', lambda s: s if s and s.strip() else 'no')
+@checking('bindgen cflags', lambda s: s if s and s[0].strip() else 'no')
 def bindgen_cflags(value):
     if value and len(value):
         # Reformat the env value for substitution into a toml list.
         flags = value[0].split()
-        return ', '.join('"' + flag + '"' for flag in flags)
-    return ''
+        return flags
 
-set_config('BINDGEN_CFLAGS', bindgen_cflags)
+add_old_configure_assignment('_BINDGEN_CFLAGS', bindgen_cflags)
 
 @depends(c_compiler)
 def default_debug_flags(compiler_info):
     # Debug info is ON by default.
     if compiler_info.type in ('msvc', 'clang-cl'):
         return '-Zi'
     return '-g'
 
diff --git a/layout/style/bindgen.toml.in b/layout/style/bindgen.toml.in
--- a/layout/style/bindgen.toml.in
+++ b/layout/style/bindgen.toml.in
@@ -1,4 +1,4 @@
 [build]
 args = [
-    @BINDGEN_CFLAGS@
+    @BINDGEN_SYSTEM_FLAGS@
 ]
diff --git a/old-configure.in b/old-configure.in
--- a/old-configure.in
+++ b/old-configure.in
@@ -4453,16 +4453,19 @@ android)
 esac
 
 AC_SUBST(MOZ_TREE_CAIRO)
 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
 AC_SUBST(MOZ_TREE_PIXMAN)
 
+BINDGEN_SYSTEM_FLAGS="$_BINDGEN_CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $MOZ_PIXMAN_CFLAGS $MOZ_CAIRO_CFLAGS"
+AC_SUBST_TOML_LIST(BINDGEN_SYSTEM_FLAGS)
+
 dnl ========================================================
 dnl disable xul
 dnl ========================================================
 MOZ_ARG_DISABLE_BOOL(xul,
 [  --disable-xul           Disable XUL],
     MOZ_XUL= )
 if test "$MOZ_XUL"; then
   AC_DEFINE(MOZ_XUL)