1
dnl This Source Code Form is subject to the terms of the Mozilla Public
2
dnl License, v. 2.0. If a copy of the MPL was not distributed with this
3
dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
dnl For use in AC_SUBST replacement
6
define([MOZ_DIVERSION_SUBST], 11)
8
dnl Replace AC_SUBST to store values in a format suitable for python.
9
dnl The necessary comma after the tuple can't be put here because it
10
dnl can mess around with things like:
11
dnl AC_SOMETHING(foo,AC_SUBST(),bar)
13
[ifdef([AC_SUBST_$1], ,
14
[define([AC_SUBST_$1], )dnl
15
AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
16
(''' $1 ''', r''' [$]$1 ''')
20
dnl Wrap AC_DEFINE to store values in a format suitable for python.
21
dnl autoconf's AC_DEFINE still needs to be used to fill confdefs.h,
22
dnl which is #included during some compile checks.
23
dnl The necessary comma after the tuple can't be put here because it
24
dnl can mess around with things like:
25
dnl AC_SOMETHING(foo,AC_DEFINE(),bar)
26
define([_MOZ_AC_DEFINE], defn([AC_DEFINE]))
28
[cat >> confdefs.pytmp <<\EOF
29
(''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
31
ifelse($#, 2, _MOZ_AC_DEFINE([$1], [$2]), $#, 3, _MOZ_AC_DEFINE([$1], [$2], [$3]),_MOZ_AC_DEFINE([$1]))dnl
34
dnl Wrap AC_DEFINE_UNQUOTED to store values in a format suitable for
36
define([_MOZ_AC_DEFINE_UNQUOTED], defn([AC_DEFINE_UNQUOTED]))
37
define([AC_DEFINE_UNQUOTED],
38
[cat >> confdefs.pytmp <<EOF
39
(''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
41
ifelse($#, 2, _MOZ_AC_DEFINE_UNQUOTED($1, $2), $#, 3, _MOZ_AC_DEFINE_UNQUOTED($1, $2, $3),_MOZ_AC_DEFINE_UNQUOTED($1))dnl
44
dnl Replace AC_OUTPUT to create and call a python config.status
46
[dnl Top source directory in Windows format (as opposed to msys format).
51
WIN_TOP_SRC=`cd $srcdir; pwd -W`
57
dnl Used in all Makefile.in files
61
dnl Picked from autoconf 2.13
65
test "x$prefix" = xNONE && prefix=$ac_default_prefix
66
# Let make expand exec_prefix.
67
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
69
trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
71
: ${CONFIG_STATUS=./config.status}
73
dnl We're going to need [ ] for python syntax.
74
changequote(<<<, >>>)dnl
75
echo creating $CONFIG_STATUS
77
extra_python_path=${COMM_BUILD:+"'mozilla', "}
79
cat > $CONFIG_STATUS <<EOF
84
dnl topsrcdir is the top source directory in native form, as opposed to a
85
dnl form suitable for make.
86
topsrcdir = '''${WIN_TOP_SRC:-$srcdir}'''
87
if not os.path.isabs(topsrcdir):
88
topsrcdir = os.path.normpath(os.path.join(os.path.dirname(<<<__file__>>>), topsrcdir))
89
dnl Don't rely on virtualenv here. Standalone js doesn't use it.
90
sys.path.append(os.path.join(topsrcdir, ${extra_python_path}'build'))
91
from ConfigStatus import config_status
94
'topsrcdir': topsrcdir,
95
'topobjdir': os.path.dirname(<<<__file__>>>),
97
dnl All defines and substs are stored with an additional space at the beginning
98
dnl and at the end of the string, to avoid any problem with values starting or
99
dnl ending with quotes.
100
'defines': [(name[1:-1], value[1:-1]) for name, value in [
103
dnl confdefs.pytmp contains AC_DEFINEs, in the expected format, but
104
dnl lacks the final comma (see above).
105
sed 's/$/,/' confdefs.pytmp >> $CONFIG_STATUS
106
rm confdefs.pytmp confdefs.h
108
cat >> $CONFIG_STATUS <<\EOF
111
'substs': [(name[1:-1], value[1:-1]) for name, value in [
114
dnl The MOZ_DIVERSION_SUBST output diversion contains AC_SUBSTs, in the
115
dnl expected format, but lacks the final comma (see above).
116
sed 's/$/,/' >> $CONFIG_STATUS <<EOF
117
undivert(MOZ_DIVERSION_SUBST)dnl
120
cat >> $CONFIG_STATUS <<\EOF
123
dnl List of files to apply AC_SUBSTs to. This is the list of files given
124
dnl as an argument to AC_OUTPUT ($1)
129
echo " '$out'," >> $CONFIG_STATUS
132
cat >> $CONFIG_STATUS <<\EOF
135
dnl List of header files to apply AC_DEFINEs to. This is stored in the
136
dnl AC_LIST_HEADER m4 macro by AC_CONFIG_HEADER.
140
ifdef(<<<AC_LIST_HEADER>>>, <<<
141
HEADERS="AC_LIST_HEADER"
142
for header in $HEADERS; do
143
echo " '$header'," >> $CONFIG_STATUS
147
cat >> $CONFIG_STATUS <<\EOF
150
dnl List of AC_DEFINEs that aren't to be exposed in ALLDEFINES
151
'non_global_defines': [
154
if test -n "$_NON_GLOBAL_ACDEFINES"; then
155
for var in $_NON_GLOBAL_ACDEFINES; do
156
echo " '$var'," >> $CONFIG_STATUS
160
cat >> $CONFIG_STATUS <<\EOF
164
dnl Do the actual work
165
config_status(**args)
168
chmod +x $CONFIG_STATUS
169
rm -fr confdefs* $ac_clean_files
170
dnl Execute config.status, unless --no-create was passed to configure.
171
test "$no_create" = yes || ${PYTHON} $CONFIG_STATUS || exit 1