-
Notifications
You must be signed in to change notification settings - Fork 13
/
configure
executable file
·283 lines (250 loc) · 6.2 KB
/
configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
#!/bin/bash
usage()
{
echo "Usage: `basename $0` project platform"
echo ""
echo " project -- one of: ecl, mpir, libatomic_ops, bdwgc, libatomic_ops"
echo " platform -- one of: host, iPhoneOS, iPhoneSimulator, android, androidx86, nacl_x86_32_glibc, nacl_x86_64_glibc"
}
[ $# == 2 ] || { usage; exit 1; }
project=$1
platform=$2
PROJECT_ROOT=$(cd $(dirname ${0}) && pwd -P)
ECL_INSTALL_ROOT_DIR=$PROJECT_ROOT/local-install
PROJECT_INSTALL_DIR=$ECL_INSTALL_ROOT_DIR/$platform
export PKG_CONFIG_PATH=$PROJECT_INSTALL_DIR/lib/pkgconfig
case $platform in
nacl*|pnacl)
template_config=platforms/nacl/cross_config_$platform.in
;;
*)
template_config=platforms/$platform/cross_config.in
;;
esac
cross_compiler_platform=host
host_platform=$($PROJECT_ROOT/config.guess)
builddir=$PROJECT_ROOT/build/$platform/$project
if [ ! -d ${builddir} ] ; then
echo Creating directory "\`${builddir}'"
mkdir -p ${builddir}
fi
case $platform in
host|hostnothreads)
export CFLAGS="-m32 -g -O2"
export LDFLAGS="-m32 -g -O2"
;;
host*64*)
;;
android|androidx86)
. $PROJECT_ROOT/platforms/android/config.sh $platform || exit 1
CFLAGS="$CFLAGS -g -O2 -DANDROID -DPLATFORM_ANDROID"
;;
iPhoneOS|iPhoneSimulator)
. $PROJECT_ROOT/platforms/$platform/config.sh || exit 1
CFLAGS="$CFLAGS -g -O2"
;;
nacl*|pnacl)
. $PROJECT_ROOT/platforms/nacl/config.sh $platform || exit 1
CFLAGS="$CFLAGS -g -O2 -DNACL"
;;
*)
usage; exit 1
;;
esac
export CFLAGS
ecl_to_run=$ECL_INSTALL_ROOT_DIR/${cross_compiler_platform}/bin/ecl
case $project in
ecl)
srcdir=$PROJECT_ROOT/ecl/src
CFLAGS="$CFLAGS -I$PROJECT_INSTALL_DIR/include"
case $platform in
nacl*)
# export LIBS="$LIBS -lpthread -lnosys"
export LIBS="$LIBS -L$PROJECT_INSTALL_DIR/lib -lgc -lpthread -lnosys"
;;
pnacl)
export LIBS="$LIBS -L$PROJECT_INSTALL_DIR/lib -lgc -lpthread -lnosys"
;;
*)
export LIBS="$LIBS -L$PROJECT_INSTALL_DIR/lib -lgc -latomic_ops"
;;
esac
case $platform in
android|androidx86|iPhoneOS|iPhoneSimulator)
(cat $template_config; echo "ECL_TO_RUN=$ecl_to_run") > $builddir/cross_config
config_opts="\
--with-cross-config=$builddir/cross_config \
--with-gmp-prefix=$PROJECT_INSTALL_DIR \
--enable-threads=yes \
--disable-longdouble \
--enable-boehm=system \
--with-dffi=no \
--with-cmp=no \
--with-asdf=builtin \
--with-bytecmp=builtin \
--with-serve-event=yes \
--disable-shared"
;;
nacl*|pnacl)
(cat $template_config; echo "ECL_TO_RUN=$ecl_to_run") > $builddir/cross_config
config_opts="\
--with-gmp-prefix=$PROJECT_INSTALL_DIR \
--enable-threads=no \
--disable-longdouble \
--enable-boehm=system \
--with-dffi=no \
--with-cmp=no \
--with-asdf=builtin \
--with-bytecmp=builtin \
--with-tcp=no \
--with-serve-event=no \
--disable-shared"
;;
host)
export ABI=32
config_opts="\
--with-gmp-prefix=$PROJECT_INSTALL_DIR \
--enable-threads=yes \
--disable-longdouble \
--enable-boehm=included \
--with-dffi=no"
;;
hostnothreads)
export ABI=32
config_opts="\
--with-gmp-prefix=$PROJECT_INSTALL_DIR \
--enable-threads=no \
--disable-longdouble \
--enable-boehm=included \
--with-dffi=no"
;;
host64)
config_opts="\
--with-gmp-prefix=$PROJECT_INSTALL_DIR \
--enable-threads=yes \
--enable-boehm=system \
--with-dffi=included"
;;
host64nothreads)
config_opts="\
--with-gmp-prefix=$PROJECT_INSTALL_DIR \
--enable-threads=no \
--disable-longdouble \
--enable-boehm=system \
--with-dffi=included"
;;
host64nodl)
config_opts="\
--with-gmp-prefix=$PROJECT_INSTALL_DIR \
--enable-threads=yes \
--enable-boehm=system \
--with-dffi=no \
--with-cmp=builtin \
--disable-shared"
;;
esac
;;
mpir)
srcdir=$PROJECT_ROOT/mpir
base_config_opts="\
--enable-gmpcompat \
--disable-shared"
case $platform in
host|hostnothreads)
export ABI=32
config_opts="\
--with-pic \
${base_config_opts}"
# MPIR-2.5.1: must use applenopic on sandybridge
if [[ "${host_platform}" = *"-apple-darwin"* ]]; then
host=core2-apple-darwin
fi
;;
pnacl)
export CFLAGS="$CFLAGS -DHAVE_DOUBLE_IEEE_LITTLE_ENDIAN=1"
host=none-pc-nacl
config_opts="\
--with-pic \
${base_config_opts}"
;;
nacl*x86_32*)
# export ABI=32
host=none-pc-nacl # The ASM version compiles for nacl but not on 64 bits
config_opts="\
--with-pic \
${base_config_opts}"
;;
nacl*x86_64*)
host=none-pc-nacl
config_opts="\
--with-pic \
${base_config_opts}"
;;
host64*)
config_opts="\
--with-pic \
${base_config_opts}"
;;
*)
config_opts="${base_config_opts}"
;;
esac
;;
libatomic_ops)
config_opts="--disable-shared"
srcdir=$PROJECT_ROOT/libatomic_ops
;;
bdwgc)
srcdir=$PROJECT_ROOT/bdwgc
case $platform in
host)
export CFLAGS="$CFLAGS -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC -D_THREAD_SAFE"
config_opts="\
--disable-shared \
--enable-large-config \
--enable-handle-fork=no \
--enable-threads=posix"
;;
android*)
export CFLAGS="$CFLAGS -DUSE_GET_STACKBASE_FOR_MAIN -DIGNORE_DYNAMIC_LOADING -DGC_LINUX_THREADS -D_REENTRANT"
config_opts="\
--disable-shared \
--enable-large-config \
--enable-handle-fork=no \
--enable-threads=posix"
;;
nacl*)
CFLAGS="$CFLAGS -D_GNU_SOURCE"
config_opts="\
--disable-shared \
--enable-large-config \
--enable-handle-fork=no \
--enable-threads=no"
srcdir=$PROJECT_ROOT/nacl/libgc
;;
pnacl)
CFLAGS="$CFLAGS -D_GNU_SOURCE"
config_opts="\
--disable-shared \
--enable-large-config \
--enable-handle-fork=no \
--enable-threads=no"
srcdir=$PROJECT_ROOT/nacl/libgc
;;
esac
;;
*)
usage; exit 1
;;
esac
if [ ! -f ${srcdir}/configure ] ; then
echo "Running autogen.sh in ${srcdir} (autotools needed)"
(cd ${srcdir} && ./autogen.sh)
fi
cd ${builddir}
${srcdir}/configure --srcdir=${srcdir} --prefix=$PROJECT_INSTALL_DIR --target=${host} --host=${host} ${config_opts}
if [[ $? == 0 ]]; then
echo "$project configured in ${builddir}."
echo "To build do:"
echo "cd ${builddir}; make && make install"
fi