build/autoconf/config.status.m4

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 dnl This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
michael@0 4
michael@0 5 dnl For use in AC_SUBST replacement
michael@0 6 define([MOZ_DIVERSION_SUBST], 11)
michael@0 7
michael@0 8 dnl Replace AC_SUBST to store values in a format suitable for python.
michael@0 9 dnl The necessary comma after the tuple can't be put here because it
michael@0 10 dnl can mess around with things like:
michael@0 11 dnl AC_SOMETHING(foo,AC_SUBST(),bar)
michael@0 12 define([AC_SUBST],
michael@0 13 [ifdef([AC_SUBST_SET_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_SET on the same variable ($1)])],
michael@0 14 [ifdef([AC_SUBST_LIST_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_LIST on the same variable ($1)])],
michael@0 15 [ifdef([AC_SUBST_$1], ,
michael@0 16 [define([AC_SUBST_$1], )dnl
michael@0 17 AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
michael@0 18 (''' $1 ''', r''' [$]$1 ''')
michael@0 19 AC_DIVERT_POP()dnl
michael@0 20 ])])])])
michael@0 21
michael@0 22 dnl Like AC_SUBST, but makes the value available as a set in python,
michael@0 23 dnl with values got from the value of the environment variable, split on
michael@0 24 dnl whitespaces.
michael@0 25 define([AC_SUBST_SET],
michael@0 26 [ifdef([AC_SUBST_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_SET on the same variable ($1)])],
michael@0 27 [ifdef([AC_SUBST_LIST$1], [m4_fatal([Cannot use AC_SUBST_LIST and AC_SUBST_SET on the same variable ($1)])],
michael@0 28 [ifdef([AC_SUBST_SET_$1], ,
michael@0 29 [define([AC_SUBST_SET_$1], )dnl
michael@0 30 AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
michael@0 31 (''' $1 ''', set(r''' [$]$1 '''.split()))
michael@0 32 AC_DIVERT_POP()dnl
michael@0 33 ])])])])
michael@0 34
michael@0 35 dnl Like AC_SUBST, but makes the value available as a list in python,
michael@0 36 dnl with values got from the value of the environment variable, split on
michael@0 37 dnl whitespaces.
michael@0 38 define([AC_SUBST_LIST],
michael@0 39 [ifdef([AC_SUBST_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_LIST on the same variable ($1)])],
michael@0 40 [ifdef([AC_SUBST_SET_$1], [m4_fatal([Cannot use AC_SUBST_SET and AC_SUBST_LIST on the same variable ($1)])],
michael@0 41 [ifdef([AC_SUBST_LIST_$1], ,
michael@0 42 [define([AC_SUBST_LIST_$1], )dnl
michael@0 43 AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
michael@0 44 (''' $1 ''', list(r''' [$]$1 '''.split()))
michael@0 45 AC_DIVERT_POP()dnl
michael@0 46 ])])])])
michael@0 47
michael@0 48 dnl Wrap AC_DEFINE to store values in a format suitable for python.
michael@0 49 dnl autoconf's AC_DEFINE still needs to be used to fill confdefs.h,
michael@0 50 dnl which is #included during some compile checks.
michael@0 51 dnl The necessary comma after the tuple can't be put here because it
michael@0 52 dnl can mess around with things like:
michael@0 53 dnl AC_SOMETHING(foo,AC_DEFINE(),bar)
michael@0 54 define([_MOZ_AC_DEFINE], defn([AC_DEFINE]))
michael@0 55 define([AC_DEFINE],
michael@0 56 [cat >> confdefs.pytmp <<\EOF
michael@0 57 (''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
michael@0 58 EOF
michael@0 59 ifelse($#, 2, _MOZ_AC_DEFINE([$1], [$2]), $#, 3, _MOZ_AC_DEFINE([$1], [$2], [$3]),_MOZ_AC_DEFINE([$1]))dnl
michael@0 60 ])
michael@0 61
michael@0 62 dnl Wrap AC_DEFINE_UNQUOTED to store values in a format suitable for
michael@0 63 dnl python.
michael@0 64 define([_MOZ_AC_DEFINE_UNQUOTED], defn([AC_DEFINE_UNQUOTED]))
michael@0 65 define([AC_DEFINE_UNQUOTED],
michael@0 66 [cat >> confdefs.pytmp <<EOF
michael@0 67 (''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
michael@0 68 EOF
michael@0 69 ifelse($#, 2, _MOZ_AC_DEFINE_UNQUOTED($1, $2), $#, 3, _MOZ_AC_DEFINE_UNQUOTED($1, $2, $3),_MOZ_AC_DEFINE_UNQUOTED($1))dnl
michael@0 70 ])
michael@0 71
michael@0 72 dnl Replace AC_OUTPUT to create and call a python config.status
michael@0 73 define([MOZ_CREATE_CONFIG_STATUS],
michael@0 74 [dnl Top source directory in Windows format (as opposed to msys format).
michael@0 75 WIN_TOP_SRC=
michael@0 76 encoding=utf-8
michael@0 77 case "$host_os" in
michael@0 78 mingw*)
michael@0 79 WIN_TOP_SRC=`cd $srcdir; pwd -W`
michael@0 80 encoding=mbcs
michael@0 81 ;;
michael@0 82 esac
michael@0 83 AC_SUBST(WIN_TOP_SRC)
michael@0 84
michael@0 85 dnl Used in all Makefile.in files
michael@0 86 top_srcdir=$srcdir
michael@0 87 AC_SUBST(top_srcdir)
michael@0 88
michael@0 89 dnl Picked from autoconf 2.13
michael@0 90 trap '' 1 2 15
michael@0 91 AC_CACHE_SAVE
michael@0 92
michael@0 93 test "x$prefix" = xNONE && prefix=$ac_default_prefix
michael@0 94 # Let make expand exec_prefix.
michael@0 95 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
michael@0 96
michael@0 97 trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
michael@0 98 : ${CONFIG_STATUS=./config.status}
michael@0 99
michael@0 100 dnl We're going to need [ ] for python syntax.
michael@0 101 changequote(<<<, >>>)dnl
michael@0 102 echo creating $CONFIG_STATUS
michael@0 103
michael@0 104 extra_python_path=${COMM_BUILD:+"'mozilla', "}
michael@0 105
michael@0 106 cat > $CONFIG_STATUS <<EOF
michael@0 107 #!${PYTHON}
michael@0 108 # coding=$encoding
michael@0 109
michael@0 110 import os
michael@0 111 import types
michael@0 112 dnl topsrcdir is the top source directory in native form, as opposed to a
michael@0 113 dnl form suitable for make.
michael@0 114 topsrcdir = '''${WIN_TOP_SRC:-$srcdir}'''
michael@0 115 if not os.path.isabs(topsrcdir):
michael@0 116 rel = os.path.join(os.path.dirname(<<<__file__>>>), topsrcdir)
michael@0 117 topsrcdir = os.path.abspath(rel)
michael@0 118 topsrcdir = os.path.normpath(topsrcdir)
michael@0 119
michael@0 120 topobjdir = os.path.abspath(os.path.dirname(<<<__file__>>>))
michael@0 121
michael@0 122 dnl All defines and substs are stored with an additional space at the beginning
michael@0 123 dnl and at the end of the string, to avoid any problem with values starting or
michael@0 124 dnl ending with quotes.
michael@0 125 defines = [(name[1:-1], value[1:-1]) for name, value in [
michael@0 126 EOF
michael@0 127
michael@0 128 dnl confdefs.pytmp contains AC_DEFINEs, in the expected format, but
michael@0 129 dnl lacks the final comma (see above).
michael@0 130 sed 's/$/,/' confdefs.pytmp >> $CONFIG_STATUS
michael@0 131 rm confdefs.pytmp confdefs.h
michael@0 132
michael@0 133 cat >> $CONFIG_STATUS <<\EOF
michael@0 134 ] ]
michael@0 135
michael@0 136 substs = [(name[1:-1], value[1:-1] if isinstance(value, types.StringTypes) else value) for name, value in [
michael@0 137 EOF
michael@0 138
michael@0 139 dnl The MOZ_DIVERSION_SUBST output diversion contains AC_SUBSTs, in the
michael@0 140 dnl expected format, but lacks the final comma (see above).
michael@0 141 sed 's/$/,/' >> $CONFIG_STATUS <<EOF
michael@0 142 undivert(MOZ_DIVERSION_SUBST)dnl
michael@0 143 EOF
michael@0 144
michael@0 145 dnl Add in the output from the subconfigure script
michael@0 146 for ac_subst_arg in $_subconfigure_ac_subst_args; do
michael@0 147 variable='$'$ac_subst_arg
michael@0 148 echo " (''' $ac_subst_arg ''', r''' `eval echo $variable` ''')," >> $CONFIG_STATUS
michael@0 149 done
michael@0 150
michael@0 151 cat >> $CONFIG_STATUS <<\EOF
michael@0 152 ] ]
michael@0 153
michael@0 154 dnl List of AC_DEFINEs that aren't to be exposed in ALLDEFINES
michael@0 155 non_global_defines = [
michael@0 156 EOF
michael@0 157
michael@0 158 if test -n "$_NON_GLOBAL_ACDEFINES"; then
michael@0 159 for var in $_NON_GLOBAL_ACDEFINES; do
michael@0 160 echo " '$var'," >> $CONFIG_STATUS
michael@0 161 done
michael@0 162 fi
michael@0 163
michael@0 164 cat >> $CONFIG_STATUS <<EOF
michael@0 165 ]
michael@0 166
michael@0 167 __all__ = ['topobjdir', 'topsrcdir', 'defines', 'non_global_defines', 'substs']
michael@0 168 EOF
michael@0 169
michael@0 170 # We don't want js/src/config.status to do anything in gecko builds.
michael@0 171 if test -z "$BUILDING_JS" -o -n "$JS_STANDALONE"; then
michael@0 172
michael@0 173 cat >> $CONFIG_STATUS <<EOF
michael@0 174 dnl Do the actual work
michael@0 175 if __name__ == '__main__':
michael@0 176 args = dict([(name, globals()[name]) for name in __all__])
michael@0 177 from mozbuild.config_status import config_status
michael@0 178 config_status(**args)
michael@0 179 EOF
michael@0 180
michael@0 181 fi
michael@0 182
michael@0 183 changequote([, ])
michael@0 184 ])
michael@0 185
michael@0 186 define([MOZ_RUN_CONFIG_STATUS],
michael@0 187 [
michael@0 188 chmod +x $CONFIG_STATUS
michael@0 189 rm -fr confdefs* $ac_clean_files
michael@0 190 dnl Execute config.status, unless --no-create was passed to configure.
michael@0 191 if test "$no_create" != yes && ! ${PYTHON} $CONFIG_STATUS; then
michael@0 192 trap '' EXIT
michael@0 193 exit 1
michael@0 194 fi
michael@0 195 ])
michael@0 196
michael@0 197 define([m4_fatal],[
michael@0 198 errprint([$1
michael@0 199 ])
michael@0 200 m4exit(1)
michael@0 201 ])
michael@0 202
michael@0 203 define([AC_OUTPUT], [ifelse($#_$1, 1_, [MOZ_CREATE_CONFIG_STATUS()
michael@0 204 MOZ_RUN_CONFIG_STATUS()],
michael@0 205 [m4_fatal([Use CONFIGURE_SUBST_FILES in moz.build files to create substituted files.])]
michael@0 206 )])
michael@0 207
michael@0 208 define([AC_CONFIG_HEADER],
michael@0 209 [m4_fatal([Use CONFIGURE_DEFINE_FILES in moz.build files to produce header files.])
michael@0 210 ])
michael@0 211
michael@0 212 AC_SUBST([MOZ_PSEUDO_DERECURSE])

mercurial