~ubuntu-branches/ubuntu/saucy/mozjs17/saucy

« back to all changes in this revision

Viewing changes to js/src/build/autoconf/config.status.m4

  • Committer: Package Import Robot
  • Author(s): Rico Tzschichholz
  • Date: 2013-05-25 12:24:23 UTC
  • Revision ID: package-import@ubuntu.com-20130525122423-zmxucrhtensw90xy
Tags: upstream-17.0.0
ImportĀ upstreamĀ versionĀ 17.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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/.
 
4
 
 
5
dnl For use in AC_SUBST replacement
 
6
define([MOZ_DIVERSION_SUBST], 11)
 
7
 
 
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)
 
12
define([AC_SUBST],
 
13
[ifdef([AC_SUBST_$1], ,
 
14
[define([AC_SUBST_$1], )dnl
 
15
AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
 
16
        (''' $1 ''', r''' [$]$1 ''')
 
17
AC_DIVERT_POP()dnl
 
18
])])
 
19
 
 
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]))
 
27
define([AC_DEFINE],
 
28
[cat >> confdefs.pytmp <<\EOF
 
29
        (''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
 
30
EOF
 
31
ifelse($#, 2, _MOZ_AC_DEFINE([$1], [$2]), $#, 3, _MOZ_AC_DEFINE([$1], [$2], [$3]),_MOZ_AC_DEFINE([$1]))dnl
 
32
])
 
33
 
 
34
dnl Wrap AC_DEFINE_UNQUOTED to store values in a format suitable for
 
35
dnl python.
 
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 '))
 
40
EOF
 
41
ifelse($#, 2, _MOZ_AC_DEFINE_UNQUOTED($1, $2), $#, 3, _MOZ_AC_DEFINE_UNQUOTED($1, $2, $3),_MOZ_AC_DEFINE_UNQUOTED($1))dnl
 
42
])
 
43
 
 
44
dnl Replace AC_OUTPUT to create and call a python config.status
 
45
define([AC_OUTPUT],
 
46
[dnl Top source directory in Windows format (as opposed to msys format).
 
47
WIN_TOP_SRC=
 
48
encoding=utf-8
 
49
case "$host_os" in
 
50
mingw*)
 
51
    WIN_TOP_SRC=`cd $srcdir; pwd -W`
 
52
    encoding=mbcs
 
53
    ;;
 
54
esac
 
55
AC_SUBST(WIN_TOP_SRC)
 
56
 
 
57
dnl Used in all Makefile.in files
 
58
top_srcdir=$srcdir
 
59
AC_SUBST(top_srcdir)
 
60
 
 
61
dnl Picked from autoconf 2.13
 
62
trap '' 1 2 15
 
63
AC_CACHE_SAVE
 
64
 
 
65
test "x$prefix" = xNONE && prefix=$ac_default_prefix
 
66
# Let make expand exec_prefix.
 
67
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
 
68
 
 
69
trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
 
70
 
 
71
: ${CONFIG_STATUS=./config.status}
 
72
 
 
73
dnl We're going to need [ ] for python syntax.
 
74
changequote(<<<, >>>)dnl
 
75
echo creating $CONFIG_STATUS
 
76
 
 
77
extra_python_path=${COMM_BUILD:+"'mozilla', "}
 
78
 
 
79
cat > $CONFIG_STATUS <<EOF
 
80
#!${PYTHON}
 
81
# coding=$encoding
 
82
 
 
83
import os, sys
 
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
 
92
 
 
93
args = {
 
94
    'topsrcdir': topsrcdir,
 
95
    'topobjdir': os.path.dirname(<<<__file__>>>),
 
96
 
 
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 [
 
101
EOF
 
102
 
 
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
 
107
 
 
108
cat >> $CONFIG_STATUS <<\EOF
 
109
    ] ],
 
110
 
 
111
    'substs': [(name[1:-1], value[1:-1]) for name, value in [
 
112
EOF
 
113
 
 
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
 
118
EOF
 
119
 
 
120
cat >> $CONFIG_STATUS <<\EOF
 
121
    ] ],
 
122
 
 
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)
 
125
    'files': [
 
126
EOF
 
127
 
 
128
for out in $1; do
 
129
  echo "        '$out'," >> $CONFIG_STATUS
 
130
done
 
131
 
 
132
cat >> $CONFIG_STATUS <<\EOF
 
133
    ],
 
134
 
 
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.
 
137
    'headers': [
 
138
EOF
 
139
 
 
140
ifdef(<<<AC_LIST_HEADER>>>, <<<
 
141
HEADERS="AC_LIST_HEADER"
 
142
for header in $HEADERS; do
 
143
  echo "        '$header'," >> $CONFIG_STATUS
 
144
done
 
145
>>>)dnl
 
146
 
 
147
cat >> $CONFIG_STATUS <<\EOF
 
148
    ],
 
149
 
 
150
dnl List of AC_DEFINEs that aren't to be exposed in ALLDEFINES
 
151
    'non_global_defines': [
 
152
EOF
 
153
 
 
154
if test -n "$_NON_GLOBAL_ACDEFINES"; then
 
155
  for var in $_NON_GLOBAL_ACDEFINES; do
 
156
    echo "        '$var'," >> $CONFIG_STATUS
 
157
  done
 
158
fi
 
159
 
 
160
cat >> $CONFIG_STATUS <<\EOF
 
161
    ]
 
162
}
 
163
 
 
164
dnl Do the actual work
 
165
config_status(**args)
 
166
EOF
 
167
changequote([, ])
 
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
 
172
])