-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure
executable file
·398 lines (318 loc) · 9.04 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
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
#! /bin/sh
#
# configure
#
# Configuration script for POCO.
#
# Invoke configure --help for help.
#
showhelp()
{
cat << ENDHELP
usage: configure {options}
Configure the POCO C++ Libraries.
Options:
--help
Display this help screen.
--config=<config_name>
Use the given build configuration.
Available configurations are:
"Linux"
"Linux32-gcc"
"Linux64-gcc"
"Linux-clang"
"Linux32-clang"
"Linux64-clang"
--prefix=<install_prefix>
Use the given install directory for make install.
Default is /usr/local.
--no-prefix
Do not use /usr/local as default install directory and do not
define POCO_PREFIX.
--stdcxx-base=<apache_stdcxx_install_prefix>
If (and only if) the $base/build/config selected with --config
uses the Apache stdcxx library, then apache_stdcxx_install_prefix
specifies the base directory where stdcxx is installed.
--no-tests
Do not build testsuites.
--no-samples
Do not build samples.
--minimal
Build only Foundation, XML, JSON, Util and Net.
--typical (default)
Build only Foundation, XML, JSON, Util, Net, Crypto, NetSSL, Data/SQLite and Zip.
--everything
Build everything.
--no-wstring
Compile with -DPOCO_NO_WSTRING.
Useful if your C++ compiler does not support std::wstring
(such as uClibc-based systems).
--no-fpenvironment
Compile with -DPOCO_NO_FPENVIRONMENT.
Useful if your C++ compiler has incomplete floating-point support
(such as uClibc-based systems).
--no-sharedmemory
Compile with -DPOCO_NO_SHAREDMEMORY.
For systems that don't support shared memory API's,
like uClibc-based Linux systems.
--no-sharedlibs
Compile with -DPOCO_NO_SHAREDLIBS.
For systems that don't support shared library loading.
--no-ipv6
Compile with -DPOCO_NET_NO_IPv6.
For systems that don't support IPv6.
--sqlite-fts=<path>
Compile with -DPOCO_DATA_SQLITE_FTS.
Compile SQLite with Full Text Search support.
--sqlite-thread-safe=<value>
Compile with -DSQLITE_THREADSAFE=<value>.
Valid values are:
- 0 single-thread, no thread safety
- 1 serial access, highest thread safety
- 2 multi-threaded, without session sharing support
--omit=<component>{,<component>}
Do not build the specified component(s).
Example: --omit=Data/MySQL,Data/ODBC,Zip
--include-path=<path>
Add search path for header files.
--library-path=<path>
Add search path for library files.
--odbc-lib=<path>
Specify the directory where ODBC library is located.
--odbc-include=<path>
Specify the directory where ODBC header files are located.
--cflags=<flags>
Pass additional flags to compiler.
Example: --cflags=-wall
--poquito
Omit a few features for smaller codesize when linking
statically for embedded targets.
--unbundled
Use system-provided zlib, pcre, expat and sqlite instead of
bundled ones.
--static
Build static libraries. Overrides default mode, which
depends upon target. Can be specified together
with --shared to build both.
--shared
Build shared libraries. Overrides default mode, which
depends upon target. Can be specified together
with --static to build both.
--branch=<branch>
Build specified git branch. Default is 'develop'.
--compiler-version
Use specified compiler version.
ENDHELP
}
# save cwd
build=`pwd`
# get directory where we are located
cd `dirname $0`
base=`pwd`
cd $build
tests=1
samples=1
noprefix=0
flags=""
includepath=""
librarypath=""
odbclib=""
odbcinclude=""
unbundled=""
static=""
shared=""
omitMinimal="Crypto NetSSL_OpenSSL Zip Data Data/SQLite Data/ODBC Data/MySQL Data/PostgreSQL MongoDB Redis PDF CppParser PageCompiler"
omitTypical="Data/ODBC Data/MySQL Data/PostgreSQL MongoDB Redis PDF CppParser"
omit=$omitTypical
branch="develop"
compiler="gcc"
compilerxx="g++"
compilerVersion=5
bits=64
# parse arguments
while [ $# -ge 1 ]; do
case "$1" in
--config=*)
config="`echo ${1} | awk '{print substr($0,10)}'`" ;;
--prefix=*)
prefix="`echo ${1} | awk '{print substr($0,10)}'`" ;;
--no-prefix)
noprefix=1 ;;
--stdcxx-base=*)
stdcxx_base="`echo ${1} | awk '{print substr($0,15)}'`" ;;
--omit=*)
omit="`echo ${1} | awk '{print substr($0,8)}' | tr ',;' ' '`" ;;
--include-path=*)
includepath="`echo ${1} | awk '{print substr($0,16)}' | tr ',;' ' '`" ;;
--library-path=*)
librarypath="`echo ${1} | awk '{print substr($0,16)}' | tr ',;' ' '`" ;;
--odbc-lib=*)
odbclib="`echo ${1} | awk '{print substr($0,12)}'`" ;;
--odbc-include=*)
odbcinclude="`echo ${1} | awk '{print substr($0,16)}'`" ;;
--cflags=*)
flags="$flags `echo ${1} | awk '{print substr($0,10)}'`" ;;
--no-samples)
samples="" ;;
--no-tests)
tests="" ;;
--no-wstring)
flags="$flags -DPOCO_NO_WSTRING" ;;
--no-fpenvironment)
flags="$flags -DPOCO_NO_FPENVIRONMENT" ;;
--no-sharedmemory)
flags="$flags -DPOCO_NO_SHAREDMEMORY" ;;
--no-sharedlibs)
flags="$flags -DPOCO_NO_SHAREDLIBS" ;;
--no-ipv6)
flags="$flags -DPOCO_NET_NO_IPv6" ;;
--sqlite-thread-safe=*)
flags="$flags -DSQLITE_THREADSAFE=`echo ${1} | awk '{print substr($0,22)}'`" ;;
--sqlite-fts)
flags="$flags -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS" ;;
--poquito)
flags="$flags -DPOCO_NO_FILECHANNEL -DPOCO_NO_SPLITTERCHANNEL -DPOCO_NO_SYSLOGCHANNEL -DPOCO_UTIL_NO_INIFILECONFIGURATION -DPOCO_UTIL_NO_JSONCONFIGURATION -DPOCO_UTIL_NO_XMLCONFIGURATION" ;;
--unbundled)
flags="$flags -DPOCO_UNBUNDLED"
unbundled=1
;;
--minimal)
omit=$omitMinimal ;;
--typical)
omit=$omitTypical ;;
--everything)
omit="" ;;
--static)
static=1 ;;
--shared)
shared=1 ;;
--branch=*)
branch="`echo ${1} | awk '{print substr($0,10)}'`" ;;
--compiler-version=*)
compilerVersion="`echo ${1} | awk '{print substr($0,20)}'`" ;;
--help)
showhelp
exit 0
;;
*)
showhelp
exit 1
;;
esac
shift
done
# default build environment
if [ "$config" = "" ] ; then
config="Linux"
fi
case "$config" in
Linux)
compiler="gcc"; compilerxx="g++" ;;
Linux32-gcc)
compiler="gcc"; compilerxx="g++"; bits=32 ;;
Linux64-gcc)
compiler="gcc"; compilerxx="g++" ;;
Linux-clang)
compiler="clang"; compilerxx="clang++" ;;
Linux32-clang)
compiler="clang"; compilerxx="clang++"; bits=32 ;;
Linux64-clang)
compiler="clang"; compilerxx="clang++" ;;
*)
echo "Unknown config: ${config}"
exit 1
;;
esac
if [ -z "$prefix" ] ; then
if [ $noprefix -eq 0 ] ; then
prefix=/usr/local
fi
fi
if [ -n "$static" -a -n "$shared" ] ; then
linkmode=BOTH
elif [ -n "$static" ] ; then
linkmode=STATIC
elif [ -n "$shared" ] ; then
linkmode=SHARED
else
linkmode=""
fi
# create config.make
echo '# config.make generated by configure script' >$build/config.make
echo "POCO_CONFIG=$config" >>$build/config.make
echo "POCO_FLAGS=$flags" >>$build/config.make
echo "POCO_GIT_BRANCH=$branch" >>$build/config.make
echo "POCO_CC_COMPILER=$compiler" >>$build/config.make
echo "POCO_CXX_COMPILER=$compilerxx" >>$build/config.make
echo "POCO_COMPILER_VERSION=$compilerVersion" >>$build/config.make
echo "POCO_BITS=$bits" >>$build/config.make
if [ -n "$prefix" ] ; then
echo "POCO_PREFIX=$prefix" >>$build/config.make
fi
echo "OMIT='$omit'" >>$build/config.make
omit=`echo "$omit" | tr ' ' ','`
echo "POCO_OMIT=$omit" >>$build/config.make
echo "POCO_CI_CONTAINER_NAME=poco-${branch}-${compiler}-${compilerVersion}-${config}" >>$build/config.make
if [ -n "$stdcxx_base" ] ; then
echo "STDCXX_BASE=$stdcxx_base" >>$build/config.make
fi
if [ -n "$includepath" ] ; then
echo "POCO_ADD_INCLUDE=$includepath" >>$build/config.make
fi
if [ -n "$librarypath" ] ; then
echo "POCO_ADD_LIBRARY=$librarypath" >>$build/config.make
fi
if [ -n "$odbclib" ] ; then
echo "POCO_ODBC_LIB=$odbclib" >>$build/config.make
fi
if [ -n "$odbcinclude" ] ; then
echo "POCO_ODBC_INCLUDE=$odbcinclude" >>$build/config.make
fi
if [ -n "$unbundled" ] ; then
echo "POCO_UNBUNDLED=1" >>$build/config.make
fi
if [ -n "$linkmode" ] ; then
echo "LINKMODE=$linkmode" >>$build/config.make
fi
cat <<__EOF__ >>$build/config.make
export POCO_CONFIG
export POCO_FLAGS
export POCO_GIT_BRANCH
export POCO_CC_COMPILER
export POCO_CXX_COMPILER
export POCO_COMPILER_VERSION
export POCO_BITS
export POCO_OMIT
export POCO_CI_CONTAINER_NAME
__EOF__
if [ -n "$prefix" ] ; then
echo "export POCO_PREFIX" >>$build/config.make
fi
if [ -n "$stdcxx_base" ] ; then
echo "export STDCXX_BASE" >>$build/config.make
fi
if [ -n "$includepath" ] ; then
echo "export POCO_ADD_INCLUDE" >>$build/config.make
fi
if [ -n "$librarypath" ] ; then
echo "export POCO_ADD_LIBRARY" >>$build/config.make
fi
if [ -n "$odbclib" ] ; then
echo "export POCO_ODBC_LIB" >>$build/config.make
fi
if [ -n "$odbcinclude" ] ; then
echo "export POCO_ODBC_INCLUDE" >>$build/config.make
fi
if [ -n "$unbundled" ] ; then
echo "export POCO_UNBUNDLED" >>$build/config.make
fi
if [ -n "$linkmode" ] ; then
echo "export LINKMODE" >>$build/config.make
fi
# create config.build
echo '# config.build generated by configure script' >$build/config.build
cat <<__EOF__ >>$build/config.build
export TESTS=$tests
export SAMPLES=$samples
__EOF__
echo "Configured for $config"