build/autoconf/config.status.m4

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/build/autoconf/config.status.m4	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,212 @@
     1.4 +dnl This Source Code Form is subject to the terms of the Mozilla Public
     1.5 +dnl License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 +dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
     1.7 +
     1.8 +dnl For use in AC_SUBST replacement
     1.9 +define([MOZ_DIVERSION_SUBST], 11)
    1.10 +
    1.11 +dnl Replace AC_SUBST to store values in a format suitable for python.
    1.12 +dnl The necessary comma after the tuple can't be put here because it
    1.13 +dnl can mess around with things like:
    1.14 +dnl    AC_SOMETHING(foo,AC_SUBST(),bar)
    1.15 +define([AC_SUBST],
    1.16 +[ifdef([AC_SUBST_SET_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_SET on the same variable ($1)])],
    1.17 +[ifdef([AC_SUBST_LIST_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_LIST on the same variable ($1)])],
    1.18 +[ifdef([AC_SUBST_$1], ,
    1.19 +[define([AC_SUBST_$1], )dnl
    1.20 +AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
    1.21 +    (''' $1 ''', r''' [$]$1 ''')
    1.22 +AC_DIVERT_POP()dnl
    1.23 +])])])])
    1.24 +
    1.25 +dnl Like AC_SUBST, but makes the value available as a set in python,
    1.26 +dnl with values got from the value of the environment variable, split on
    1.27 +dnl whitespaces.
    1.28 +define([AC_SUBST_SET],
    1.29 +[ifdef([AC_SUBST_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_SET on the same variable ($1)])],
    1.30 +[ifdef([AC_SUBST_LIST$1], [m4_fatal([Cannot use AC_SUBST_LIST and AC_SUBST_SET on the same variable ($1)])],
    1.31 +[ifdef([AC_SUBST_SET_$1], ,
    1.32 +[define([AC_SUBST_SET_$1], )dnl
    1.33 +AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
    1.34 +    (''' $1 ''', set(r''' [$]$1 '''.split()))
    1.35 +AC_DIVERT_POP()dnl
    1.36 +])])])])
    1.37 +
    1.38 +dnl Like AC_SUBST, but makes the value available as a list in python,
    1.39 +dnl with values got from the value of the environment variable, split on
    1.40 +dnl whitespaces.
    1.41 +define([AC_SUBST_LIST],
    1.42 +[ifdef([AC_SUBST_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_LIST on the same variable ($1)])],
    1.43 +[ifdef([AC_SUBST_SET_$1], [m4_fatal([Cannot use AC_SUBST_SET and AC_SUBST_LIST on the same variable ($1)])],
    1.44 +[ifdef([AC_SUBST_LIST_$1], ,
    1.45 +[define([AC_SUBST_LIST_$1], )dnl
    1.46 +AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
    1.47 +    (''' $1 ''', list(r''' [$]$1 '''.split()))
    1.48 +AC_DIVERT_POP()dnl
    1.49 +])])])])
    1.50 +
    1.51 +dnl Wrap AC_DEFINE to store values in a format suitable for python.
    1.52 +dnl autoconf's AC_DEFINE still needs to be used to fill confdefs.h,
    1.53 +dnl which is #included during some compile checks.
    1.54 +dnl The necessary comma after the tuple can't be put here because it
    1.55 +dnl can mess around with things like:
    1.56 +dnl    AC_SOMETHING(foo,AC_DEFINE(),bar)
    1.57 +define([_MOZ_AC_DEFINE], defn([AC_DEFINE]))
    1.58 +define([AC_DEFINE],
    1.59 +[cat >> confdefs.pytmp <<\EOF
    1.60 +    (''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
    1.61 +EOF
    1.62 +ifelse($#, 2, _MOZ_AC_DEFINE([$1], [$2]), $#, 3, _MOZ_AC_DEFINE([$1], [$2], [$3]),_MOZ_AC_DEFINE([$1]))dnl
    1.63 +])
    1.64 +
    1.65 +dnl Wrap AC_DEFINE_UNQUOTED to store values in a format suitable for
    1.66 +dnl python.
    1.67 +define([_MOZ_AC_DEFINE_UNQUOTED], defn([AC_DEFINE_UNQUOTED]))
    1.68 +define([AC_DEFINE_UNQUOTED],
    1.69 +[cat >> confdefs.pytmp <<EOF
    1.70 +    (''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
    1.71 +EOF
    1.72 +ifelse($#, 2, _MOZ_AC_DEFINE_UNQUOTED($1, $2), $#, 3, _MOZ_AC_DEFINE_UNQUOTED($1, $2, $3),_MOZ_AC_DEFINE_UNQUOTED($1))dnl
    1.73 +])
    1.74 +
    1.75 +dnl Replace AC_OUTPUT to create and call a python config.status
    1.76 +define([MOZ_CREATE_CONFIG_STATUS],
    1.77 +[dnl Top source directory in Windows format (as opposed to msys format).
    1.78 +WIN_TOP_SRC=
    1.79 +encoding=utf-8
    1.80 +case "$host_os" in
    1.81 +mingw*)
    1.82 +    WIN_TOP_SRC=`cd $srcdir; pwd -W`
    1.83 +    encoding=mbcs
    1.84 +    ;;
    1.85 +esac
    1.86 +AC_SUBST(WIN_TOP_SRC)
    1.87 +
    1.88 +dnl Used in all Makefile.in files
    1.89 +top_srcdir=$srcdir
    1.90 +AC_SUBST(top_srcdir)
    1.91 +
    1.92 +dnl Picked from autoconf 2.13
    1.93 +trap '' 1 2 15
    1.94 +AC_CACHE_SAVE
    1.95 +
    1.96 +test "x$prefix" = xNONE && prefix=$ac_default_prefix
    1.97 +# Let make expand exec_prefix.
    1.98 +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
    1.99 +
   1.100 +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
   1.101 +: ${CONFIG_STATUS=./config.status}
   1.102 +
   1.103 +dnl We're going to need [ ] for python syntax.
   1.104 +changequote(<<<, >>>)dnl
   1.105 +echo creating $CONFIG_STATUS
   1.106 +
   1.107 +extra_python_path=${COMM_BUILD:+"'mozilla', "}
   1.108 +
   1.109 +cat > $CONFIG_STATUS <<EOF
   1.110 +#!${PYTHON}
   1.111 +# coding=$encoding
   1.112 +
   1.113 +import os
   1.114 +import types
   1.115 +dnl topsrcdir is the top source directory in native form, as opposed to a
   1.116 +dnl form suitable for make.
   1.117 +topsrcdir = '''${WIN_TOP_SRC:-$srcdir}'''
   1.118 +if not os.path.isabs(topsrcdir):
   1.119 +    rel = os.path.join(os.path.dirname(<<<__file__>>>), topsrcdir)
   1.120 +    topsrcdir = os.path.abspath(rel)
   1.121 +topsrcdir = os.path.normpath(topsrcdir)
   1.122 +
   1.123 +topobjdir = os.path.abspath(os.path.dirname(<<<__file__>>>))
   1.124 +
   1.125 +dnl All defines and substs are stored with an additional space at the beginning
   1.126 +dnl and at the end of the string, to avoid any problem with values starting or
   1.127 +dnl ending with quotes.
   1.128 +defines = [(name[1:-1], value[1:-1]) for name, value in [
   1.129 +EOF
   1.130 +
   1.131 +dnl confdefs.pytmp contains AC_DEFINEs, in the expected format, but
   1.132 +dnl lacks the final comma (see above).
   1.133 +sed 's/$/,/' confdefs.pytmp >> $CONFIG_STATUS
   1.134 +rm confdefs.pytmp confdefs.h
   1.135 +
   1.136 +cat >> $CONFIG_STATUS <<\EOF
   1.137 +] ]
   1.138 +
   1.139 +substs = [(name[1:-1], value[1:-1] if isinstance(value, types.StringTypes) else value) for name, value in [
   1.140 +EOF
   1.141 +
   1.142 +dnl The MOZ_DIVERSION_SUBST output diversion contains AC_SUBSTs, in the
   1.143 +dnl expected format, but lacks the final comma (see above).
   1.144 +sed 's/$/,/' >> $CONFIG_STATUS <<EOF
   1.145 +undivert(MOZ_DIVERSION_SUBST)dnl
   1.146 +EOF
   1.147 +
   1.148 +dnl Add in the output from the subconfigure script
   1.149 +for ac_subst_arg in $_subconfigure_ac_subst_args; do
   1.150 +  variable='$'$ac_subst_arg
   1.151 +  echo "    (''' $ac_subst_arg ''', r''' `eval echo $variable` ''')," >> $CONFIG_STATUS
   1.152 +done
   1.153 +
   1.154 +cat >> $CONFIG_STATUS <<\EOF
   1.155 +] ]
   1.156 +
   1.157 +dnl List of AC_DEFINEs that aren't to be exposed in ALLDEFINES
   1.158 +non_global_defines = [
   1.159 +EOF
   1.160 +
   1.161 +if test -n "$_NON_GLOBAL_ACDEFINES"; then
   1.162 +  for var in $_NON_GLOBAL_ACDEFINES; do
   1.163 +    echo "    '$var'," >> $CONFIG_STATUS
   1.164 +  done
   1.165 +fi
   1.166 +
   1.167 +cat >> $CONFIG_STATUS <<EOF
   1.168 +]
   1.169 +
   1.170 +__all__ = ['topobjdir', 'topsrcdir', 'defines', 'non_global_defines', 'substs']
   1.171 +EOF
   1.172 +
   1.173 +# We don't want js/src/config.status to do anything in gecko builds.
   1.174 +if test -z "$BUILDING_JS" -o -n "$JS_STANDALONE"; then
   1.175 +
   1.176 +    cat >> $CONFIG_STATUS <<EOF
   1.177 +dnl Do the actual work
   1.178 +if __name__ == '__main__':
   1.179 +    args = dict([(name, globals()[name]) for name in __all__])
   1.180 +    from mozbuild.config_status import config_status
   1.181 +    config_status(**args)
   1.182 +EOF
   1.183 +
   1.184 +fi
   1.185 +
   1.186 +changequote([, ])
   1.187 +])
   1.188 +
   1.189 +define([MOZ_RUN_CONFIG_STATUS],
   1.190 +[
   1.191 +chmod +x $CONFIG_STATUS
   1.192 +rm -fr confdefs* $ac_clean_files
   1.193 +dnl Execute config.status, unless --no-create was passed to configure.
   1.194 +if test "$no_create" != yes && ! ${PYTHON} $CONFIG_STATUS; then
   1.195 +    trap '' EXIT
   1.196 +    exit 1
   1.197 +fi
   1.198 +])
   1.199 +
   1.200 +define([m4_fatal],[
   1.201 +errprint([$1
   1.202 +])
   1.203 +m4exit(1)
   1.204 +])
   1.205 +
   1.206 +define([AC_OUTPUT], [ifelse($#_$1, 1_, [MOZ_CREATE_CONFIG_STATUS()
   1.207 +MOZ_RUN_CONFIG_STATUS()],
   1.208 +[m4_fatal([Use CONFIGURE_SUBST_FILES in moz.build files to create substituted files.])]
   1.209 +)])
   1.210 +
   1.211 +define([AC_CONFIG_HEADER],
   1.212 +[m4_fatal([Use CONFIGURE_DEFINE_FILES in moz.build files to produce header files.])
   1.213 +])
   1.214 +
   1.215 +AC_SUBST([MOZ_PSEUDO_DERECURSE])

mercurial