2012-08-04 10:47:28 +04:00
|
|
|
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 For use in AC_SUBST replacement
|
|
|
|
define([MOZ_DIVERSION_SUBST], 11)
|
|
|
|
|
|
|
|
dnl Replace AC_SUBST to store values in a format suitable for python.
|
|
|
|
dnl The necessary comma after the tuple can't be put here because it
|
|
|
|
dnl can mess around with things like:
|
|
|
|
dnl AC_SOMETHING(foo,AC_SUBST(),bar)
|
|
|
|
define([AC_SUBST],
|
2013-11-12 02:52:32 +04:00
|
|
|
[ifdef([AC_SUBST_SET_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_SET on the same variable ($1)])],
|
2014-03-20 05:55:00 +04:00
|
|
|
[ifdef([AC_SUBST_LIST_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_LIST on the same variable ($1)])],
|
2012-08-04 10:47:28 +04:00
|
|
|
[ifdef([AC_SUBST_$1], ,
|
|
|
|
[define([AC_SUBST_$1], )dnl
|
|
|
|
AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
|
2012-08-29 10:55:58 +04:00
|
|
|
(''' $1 ''', r''' [$]$1 ''')
|
2012-08-04 10:47:28 +04:00
|
|
|
AC_DIVERT_POP()dnl
|
2014-03-20 05:55:00 +04:00
|
|
|
])])])])
|
2013-11-12 02:52:32 +04:00
|
|
|
|
|
|
|
dnl Like AC_SUBST, but makes the value available as a set in python,
|
|
|
|
dnl with values got from the value of the environment variable, split on
|
|
|
|
dnl whitespaces.
|
|
|
|
define([AC_SUBST_SET],
|
|
|
|
[ifdef([AC_SUBST_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_SET on the same variable ($1)])],
|
2014-03-20 05:55:00 +04:00
|
|
|
[ifdef([AC_SUBST_LIST$1], [m4_fatal([Cannot use AC_SUBST_LIST and AC_SUBST_SET on the same variable ($1)])],
|
2013-11-12 02:52:32 +04:00
|
|
|
[ifdef([AC_SUBST_SET_$1], ,
|
|
|
|
[define([AC_SUBST_SET_$1], )dnl
|
|
|
|
AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
|
2015-09-29 09:03:26 +03:00
|
|
|
(''' $1 ''', unique_list(r''' [$]$1 '''.split()))
|
2013-11-12 02:52:32 +04:00
|
|
|
AC_DIVERT_POP()dnl
|
2014-03-20 05:55:00 +04:00
|
|
|
])])])])
|
|
|
|
|
|
|
|
dnl Like AC_SUBST, but makes the value available as a list in python,
|
|
|
|
dnl with values got from the value of the environment variable, split on
|
|
|
|
dnl whitespaces.
|
|
|
|
define([AC_SUBST_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 ''', list(r''' [$]$1 '''.split()))
|
|
|
|
AC_DIVERT_POP()dnl
|
|
|
|
])])])])
|
2012-08-04 10:47:28 +04:00
|
|
|
|
2014-07-23 03:40:12 +04:00
|
|
|
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], )
|
|
|
|
define([AC_SUBST_LIBS], )
|
|
|
|
|
2012-08-04 10:47:28 +04:00
|
|
|
dnl Wrap AC_DEFINE to store values in a format suitable for python.
|
|
|
|
dnl autoconf's AC_DEFINE still needs to be used to fill confdefs.h,
|
|
|
|
dnl which is #included during some compile checks.
|
|
|
|
dnl The necessary comma after the tuple can't be put here because it
|
|
|
|
dnl can mess around with things like:
|
|
|
|
dnl AC_SOMETHING(foo,AC_DEFINE(),bar)
|
|
|
|
define([_MOZ_AC_DEFINE], defn([AC_DEFINE]))
|
|
|
|
define([AC_DEFINE],
|
|
|
|
[cat >> confdefs.pytmp <<\EOF
|
2012-08-29 10:55:58 +04:00
|
|
|
(''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
|
2012-08-04 10:47:28 +04:00
|
|
|
EOF
|
|
|
|
ifelse($#, 2, _MOZ_AC_DEFINE([$1], [$2]), $#, 3, _MOZ_AC_DEFINE([$1], [$2], [$3]),_MOZ_AC_DEFINE([$1]))dnl
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl Wrap AC_DEFINE_UNQUOTED to store values in a format suitable for
|
|
|
|
dnl python.
|
|
|
|
define([_MOZ_AC_DEFINE_UNQUOTED], defn([AC_DEFINE_UNQUOTED]))
|
|
|
|
define([AC_DEFINE_UNQUOTED],
|
|
|
|
[cat >> confdefs.pytmp <<EOF
|
2012-08-29 10:55:58 +04:00
|
|
|
(''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
|
2012-08-04 10:47:28 +04:00
|
|
|
EOF
|
|
|
|
ifelse($#, 2, _MOZ_AC_DEFINE_UNQUOTED($1, $2), $#, 3, _MOZ_AC_DEFINE_UNQUOTED($1, $2, $3),_MOZ_AC_DEFINE_UNQUOTED($1))dnl
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl Replace AC_OUTPUT to create and call a python config.status
|
2014-02-11 05:37:47 +04:00
|
|
|
define([MOZ_CREATE_CONFIG_STATUS],
|
2012-08-04 10:47:28 +04:00
|
|
|
[dnl Top source directory in Windows format (as opposed to msys format).
|
|
|
|
WIN_TOP_SRC=
|
2012-08-05 14:42:59 +04:00
|
|
|
encoding=utf-8
|
2012-08-04 10:47:28 +04:00
|
|
|
case "$host_os" in
|
|
|
|
mingw*)
|
|
|
|
WIN_TOP_SRC=`cd $srcdir; pwd -W`
|
2012-08-05 14:42:59 +04:00
|
|
|
encoding=mbcs
|
2012-08-04 10:47:28 +04:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
AC_SUBST(WIN_TOP_SRC)
|
|
|
|
|
|
|
|
dnl Used in all Makefile.in files
|
|
|
|
top_srcdir=$srcdir
|
|
|
|
AC_SUBST(top_srcdir)
|
|
|
|
|
|
|
|
dnl Picked from autoconf 2.13
|
|
|
|
trap '' 1 2 15
|
|
|
|
AC_CACHE_SAVE
|
|
|
|
|
|
|
|
trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
|
|
|
|
: ${CONFIG_STATUS=./config.status}
|
|
|
|
|
|
|
|
dnl We're going to need [ ] for python syntax.
|
|
|
|
changequote(<<<, >>>)dnl
|
|
|
|
echo creating $CONFIG_STATUS
|
|
|
|
|
2012-08-18 13:17:29 +04:00
|
|
|
extra_python_path=${COMM_BUILD:+"'mozilla', "}
|
|
|
|
|
2012-08-04 10:47:28 +04:00
|
|
|
cat > $CONFIG_STATUS <<EOF
|
|
|
|
#!${PYTHON}
|
2012-08-05 14:42:59 +04:00
|
|
|
# coding=$encoding
|
2012-08-04 10:47:28 +04:00
|
|
|
|
2012-08-29 10:55:58 +04:00
|
|
|
import os
|
2013-11-12 02:52:32 +04:00
|
|
|
import types
|
2012-08-04 10:47:28 +04:00
|
|
|
dnl topsrcdir is the top source directory in native form, as opposed to a
|
|
|
|
dnl form suitable for make.
|
|
|
|
topsrcdir = '''${WIN_TOP_SRC:-$srcdir}'''
|
|
|
|
if not os.path.isabs(topsrcdir):
|
2013-02-21 22:55:55 +04:00
|
|
|
rel = os.path.join(os.path.dirname(<<<__file__>>>), topsrcdir)
|
2014-02-11 05:37:47 +04:00
|
|
|
topsrcdir = os.path.abspath(rel)
|
|
|
|
topsrcdir = os.path.normpath(topsrcdir)
|
2012-08-04 10:47:28 +04:00
|
|
|
|
2013-05-20 20:45:54 +04:00
|
|
|
topobjdir = os.path.abspath(os.path.dirname(<<<__file__>>>))
|
2012-08-04 10:47:28 +04:00
|
|
|
|
2015-09-29 09:03:26 +03:00
|
|
|
def unique_list(l):
|
|
|
|
result = []
|
|
|
|
for i in l:
|
|
|
|
if l not in result:
|
|
|
|
result.append(i)
|
|
|
|
return result
|
|
|
|
|
2012-08-04 10:47:28 +04:00
|
|
|
dnl All defines and substs are stored with an additional space at the beginning
|
|
|
|
dnl and at the end of the string, to avoid any problem with values starting or
|
|
|
|
dnl ending with quotes.
|
2012-08-29 10:55:58 +04:00
|
|
|
defines = [(name[1:-1], value[1:-1]) for name, value in [
|
2012-08-04 10:47:28 +04:00
|
|
|
EOF
|
|
|
|
|
|
|
|
dnl confdefs.pytmp contains AC_DEFINEs, in the expected format, but
|
|
|
|
dnl lacks the final comma (see above).
|
|
|
|
sed 's/$/,/' confdefs.pytmp >> $CONFIG_STATUS
|
|
|
|
rm confdefs.pytmp confdefs.h
|
|
|
|
|
|
|
|
cat >> $CONFIG_STATUS <<\EOF
|
2012-08-29 10:55:58 +04:00
|
|
|
] ]
|
2012-08-04 10:47:28 +04:00
|
|
|
|
2013-11-12 02:52:32 +04:00
|
|
|
substs = [(name[1:-1], value[1:-1] if isinstance(value, types.StringTypes) else value) for name, value in [
|
2012-08-04 10:47:28 +04:00
|
|
|
EOF
|
|
|
|
|
|
|
|
dnl The MOZ_DIVERSION_SUBST output diversion contains AC_SUBSTs, in the
|
|
|
|
dnl expected format, but lacks the final comma (see above).
|
|
|
|
sed 's/$/,/' >> $CONFIG_STATUS <<EOF
|
|
|
|
undivert(MOZ_DIVERSION_SUBST)dnl
|
|
|
|
EOF
|
|
|
|
|
2013-02-26 23:45:52 +04:00
|
|
|
dnl Add in the output from the subconfigure script
|
|
|
|
for ac_subst_arg in $_subconfigure_ac_subst_args; do
|
|
|
|
variable='$'$ac_subst_arg
|
|
|
|
echo " (''' $ac_subst_arg ''', r''' `eval echo $variable` ''')," >> $CONFIG_STATUS
|
|
|
|
done
|
|
|
|
|
2012-08-04 10:47:28 +04:00
|
|
|
cat >> $CONFIG_STATUS <<\EOF
|
2012-08-29 10:55:58 +04:00
|
|
|
] ]
|
2012-08-04 10:47:28 +04:00
|
|
|
|
|
|
|
dnl List of AC_DEFINEs that aren't to be exposed in ALLDEFINES
|
2012-08-29 10:55:58 +04:00
|
|
|
non_global_defines = [
|
2012-08-04 10:47:28 +04:00
|
|
|
EOF
|
|
|
|
|
|
|
|
if test -n "$_NON_GLOBAL_ACDEFINES"; then
|
|
|
|
for var in $_NON_GLOBAL_ACDEFINES; do
|
2012-08-29 10:55:58 +04:00
|
|
|
echo " '$var'," >> $CONFIG_STATUS
|
2012-08-04 10:47:28 +04:00
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2012-08-29 10:55:58 +04:00
|
|
|
cat >> $CONFIG_STATUS <<EOF
|
|
|
|
]
|
|
|
|
|
2013-10-24 01:43:32 +04:00
|
|
|
__all__ = ['topobjdir', 'topsrcdir', 'defines', 'non_global_defines', 'substs']
|
2014-02-11 05:37:47 +04:00
|
|
|
EOF
|
|
|
|
|
|
|
|
# We don't want js/src/config.status to do anything in gecko builds.
|
|
|
|
if test -z "$BUILDING_JS" -o -n "$JS_STANDALONE"; then
|
2012-08-04 10:47:28 +04:00
|
|
|
|
2014-02-11 05:37:47 +04:00
|
|
|
cat >> $CONFIG_STATUS <<EOF
|
2012-08-04 10:47:28 +04:00
|
|
|
dnl Do the actual work
|
2012-08-29 10:55:58 +04:00
|
|
|
if __name__ == '__main__':
|
|
|
|
args = dict([(name, globals()[name]) for name in __all__])
|
2013-12-18 03:07:11 +04:00
|
|
|
from mozbuild.config_status import config_status
|
2012-08-29 10:55:58 +04:00
|
|
|
config_status(**args)
|
2012-08-04 10:47:28 +04:00
|
|
|
EOF
|
2014-02-11 05:37:47 +04:00
|
|
|
|
|
|
|
fi
|
|
|
|
|
2012-08-04 10:47:28 +04:00
|
|
|
changequote([, ])
|
2014-05-01 05:57:49 +04:00
|
|
|
|
|
|
|
chmod +x $CONFIG_STATUS
|
2014-02-11 05:37:47 +04:00
|
|
|
])
|
|
|
|
|
|
|
|
define([MOZ_RUN_CONFIG_STATUS],
|
|
|
|
[
|
2014-11-04 07:50:18 +03:00
|
|
|
|
|
|
|
MOZ_RUN_ALL_SUBCONFIGURES()
|
|
|
|
|
2012-08-04 10:47:28 +04:00
|
|
|
rm -fr confdefs* $ac_clean_files
|
|
|
|
dnl Execute config.status, unless --no-create was passed to configure.
|
2013-08-15 18:45:08 +04:00
|
|
|
if test "$no_create" != yes && ! ${PYTHON} $CONFIG_STATUS; then
|
|
|
|
trap '' EXIT
|
|
|
|
exit 1
|
|
|
|
fi
|
2012-08-04 10:47:28 +04:00
|
|
|
])
|
2013-09-20 05:44:11 +04:00
|
|
|
|
2013-10-24 01:43:32 +04:00
|
|
|
define([m4_fatal],[
|
|
|
|
errprint([$1
|
|
|
|
])
|
|
|
|
m4exit(1)
|
|
|
|
])
|
|
|
|
|
2014-02-11 05:37:47 +04:00
|
|
|
define([AC_OUTPUT], [ifelse($#_$1, 1_, [MOZ_CREATE_CONFIG_STATUS()
|
|
|
|
MOZ_RUN_CONFIG_STATUS()],
|
2013-10-24 01:43:32 +04:00
|
|
|
[m4_fatal([Use CONFIGURE_SUBST_FILES in moz.build files to create substituted files.])]
|
|
|
|
)])
|
|
|
|
|
|
|
|
define([AC_CONFIG_HEADER],
|
|
|
|
[m4_fatal([Use CONFIGURE_DEFINE_FILES in moz.build files to produce header files.])
|
|
|
|
])
|
2015-09-25 02:29:46 +03:00
|
|
|
|
|
|
|
define([MOZ_BUILD_BACKEND],
|
|
|
|
[
|
2016-01-22 08:23:03 +03:00
|
|
|
dnl For now, only enable the unified hybrid build system on artifact builds,
|
|
|
|
dnl otherwise default to RecursiveMake /and/ FasterMake.
|
2016-01-22 10:15:10 +03:00
|
|
|
if test -n "$MOZ_ARTIFACT_BUILDS"; then
|
2016-01-22 08:23:03 +03:00
|
|
|
BUILD_BACKENDS="FasterMake+RecursiveMake"
|
|
|
|
else
|
|
|
|
BUILD_BACKENDS="RecursiveMake FasterMake"
|
|
|
|
fi
|
2015-09-25 02:29:46 +03:00
|
|
|
|
|
|
|
MOZ_ARG_ENABLE_STRING(build-backend,
|
2016-01-20 05:07:58 +03:00
|
|
|
[ --enable-build-backend={$($(dirname ]$[0)/$1/mach python -c "from mozbuild.backend import backends; print ','.join(sorted(backends))")}
|
2015-09-25 02:29:46 +03:00
|
|
|
Enable additional build backends],
|
2016-01-22 08:23:03 +03:00
|
|
|
[ BUILD_BACKENDS="$BUILD_BACKENDS `echo $enableval | sed 's/,/ /g'`"])
|
2015-09-25 02:29:46 +03:00
|
|
|
|
2015-09-29 09:08:58 +03:00
|
|
|
AC_SUBST_SET([BUILD_BACKENDS])
|
2015-09-25 02:29:46 +03:00
|
|
|
])
|