forked from communi/libcommuni
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·310 lines (282 loc) · 8.98 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
#!/bin/sh
BUILD_TREE=`/bin/pwd`
SOURCE_TREE=`dirname $0`
SOURCE_TREE=`cd "$SOURCE_TREE"; /bin/pwd`
CONFIG_VARS="$BUILD_TREE/.config.vars"
INSTALL_PREFIX=
INSTALL_LIBS=
INSTALL_BINS=
INSTALL_HEADERS=
INSTALL_FEATURES=
INSTALL_IMPORTS=
INSTALL_QML=
BUILD_EXAMPLES=yes
BUILD_TESTS=yes
BUILD_UCHARDET=auto
BUILD_ICU=auto
QMAKE_CONFIG=
QMAKE_PARAMS=
QMAKE_DEBUG=
QMAKE_SPEC=
OPT_HELP=no
QMAKE=`which qmake || which qmake-qt4` 2>/dev/null
if [ -f "$CONFIG_VARS" ]; then
rm "$CONFIG_VARS"
fi
#-------------------------------------------------------------------------------
# parse command line arguments
#-------------------------------------------------------------------------------
# parse the arguments, setting things to "yes" or "no"
while [ "$#" -gt 0 ]; do
CURRENT_OPT="$1"
UNKNOWN_ARG=no
case "$1" in
#Autoconf style options
--enable-*)
VAR=`echo $1 | sed "s,^--enable-\(.*\),\1,"`
VAL=yes
;;
--disable-*)
VAR=`echo $1 | sed "s,^--disable-\(.*\),\1,"`
VAL=no
;;
--*=*)
VAR=`echo $1 | sed "s,^--\(.*\)=.*,\1,"`
VAL=`echo $1 | sed "s,^--.*=\(.*\),\1,"`
;;
--nomake|--make|--prefix|--libdir|--bindir|--headerdir|--featuredir|--importdir|--qmldir|--qmake|--spec|--config|--var)
VAR=`echo $1 | sed "s,^--\(.*\),\1,"`
shift
VAL="$1"
;;
--no-*)
VAR=`echo $1 | sed "s,^--no-\(.*\),\1,"`
VAL=no
;;
--*)
VAR=`echo $1 | sed "s,^--\(.*\),\1,"`
VAL=yes
;;
#Qt style options that pass an argument
-nomake|-make|-prefix|-libdir|-bindir|-headerdir|-featuredir|-importdir|-qmldir|-qmake|-spec|-config|-var)
VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
shift
VAL="$1"
;;
#Qt style no options
-no-uchardet|-no-icu)
VAR=`echo $1 | sed 's,^-no-\(.*\),\1,'`
VAL=no
;;
#Qt style yes options
-uchardet|-icu)
VAR=`echo $1 | sed 's,^-\(.*\),\1,'`
VAL=yes
;;
-*)
VAR=`echo $1 | sed 's,^-\(.*\),\1,'`
VAL=unknown
;;
*)
UNKNOWN_ARG=yes
;;
esac
if [ "$UNKNOWN_ARG" = "yes" ]; then
echo "$1: unknown argument"
OPT_HELP=yes
ERROR=yes
shift
continue
fi
shift
UNKNOWN_OPT=no
case "$VAR" in
prefix)
INSTALL_PREFIX="$VAL"
;;
libdir)
INSTALL_LIBS="$VAL"
;;
bindir)
INSTALL_BINS="$VAL"
;;
headerdir)
INSTALL_HEADERS="$VAL"
;;
featuredir)
INSTALL_FEATURES="$VAL"
;;
importdir)
INSTALL_IMPORTS="$VAL"
;;
qmldir)
INSTALL_QML="$VAL"
;;
nomake)
case "$VAL" in
examples)
BUILD_EXAMPLES=no
;;
tests)
BUILD_TESTS=no
;;
*)
CURRENT_OPT="$VAL"
UNKNOWN_OPT=yes
;;
esac
;;
make)
case "$VAL" in
examples)
BUILD_EXAMPLES=yes
;;
tests)
BUILD_TESTS=yes
;;
*)
CURRENT_OPT="$VAL"
UNKNOWN_OPT=yes
;;
esac
;;
verbose)
QMAKE_CONFIG="$QMAKE_CONFIG verbose"
;;
static)
QMAKE_CONFIG="$QMAKE_CONFIG static"
;;
qmake)
QMAKE="$VAL"
;;
spec)
QMAKE_SPEC="$VAL"
;;
config)
QMAKE_CONFIG="$QMAKE_CONFIG $VAL"
;;
var)
echo "$VAL" >> "$CONFIG_VARS"
;;
d)
QMAKE_DEBUG="$QMAKE_DEBUG -d"
;;
uchardet)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
BUILD_UCHARDET=$VAL
else
UNKNOWN_OPT=yes
fi
;;
icu)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
BUILD_ICU=$VAL
else
UNKNOWN_OPT=yes
fi
;;
h|help)
OPT_HELP=yes
;;
*)
UNKNOWN_OPT=yes
;;
esac
if [ "$UNKNOWN_OPT" = "yes" ]; then
echo "${CURRENT_OPT}: unknown option"
OPT_HELP=yes
ERROR=yes
fi
done
if [ "$OPT_HELP" = "yes" ]; then
cat << EOF
Usage: configure [options]
Installation options:
-prefix <dir> ............ The installation prefix
-libdir <dir> ............ Libraries will be installed to <dir>
(default QT_INSTALL_LIBS)
-bindir <dir> ............ Binaries will be installed to <dir>
(default QT_INSTALL_BINS)
-headerdir <dir> ......... Headers will be installed to <dir>
(default QT_INSTALL_HEADERS/Communi)
-featuredir <dir> ........ Features will be installed to <dir>
(default QT_INSTALL_DATA/mkspecs/features)
-importdir <dir> ......... Imports for QML1 will be installed to <dir>/Communi
(default QT_INSTALL_IMPORTS/Communi)
-qmldir <dir> ............ Imports for QML2 will be installed to <dir>/Communi
(default QT_INSTALL_QML/Communi)
Configure options:
-verbose ................. Verbose build output
-static .................. Build static library
-qmake ................... qmake to use
-config (config) ......... Additional configuration options recognized by qmake
(eg. -config warn_off)
-var (value) ............. Additional variables recognized by qmake
(eg. -var "QMAKE_LFLAGS += -L/path/to/icu")
-make (part) ............. Add part to the list of parts to be built at
make time (available parts: examples tests)
-nomake (part) ........... Exclude part from the list of parts to be built
Additional options:
-no-uchardet ............. Do not build uchardet support
-uchardet ................ Build uchardet support
-no-icu .................. Do not build ICU support
-icu ..................... Build ICU support
EOF
[ "x$ERROR" = "xyes" ] && exit 1
exit 0
fi
if [ ! -f "$QMAKE" ]; then
echo "ERROR: Unable to find qmake. Try $0 -qmake /path/to/qmake."
exit 1
fi
if [ "$INSTALL_PREFIX" != "" ]; then
[ "$INSTALL_LIBS" = "" ] && INSTALL_LIBS="$INSTALL_PREFIX/lib"
[ "$INSTALL_BINS" = "" ] && INSTALL_BINS="$INSTALL_PREFIX/bin"
[ "$INSTALL_HEADERS" = "" ] && INSTALL_HEADERS="$INSTALL_PREFIX/include"
[ "$INSTALL_FEATURES" = "" ] && INSTALL_FEATURES="$INSTALL_PREFIX/features"
[ "$INSTALL_IMPORTS" = "" ] && INSTALL_FEATURES="$INSTALL_PREFIX/imports"
[ "$INSTALL_QML" = "" ] && INSTALL_FEATURES="$INSTALL_PREFIX/qml"
fi
[ "$INSTALL_LIBS" != "" ] && QMAKE_PARAMS="$QMAKE_PARAMS IRC_INSTALL_LIBS=$INSTALL_LIBS"
[ "$INSTALL_BINS" != "" ] && QMAKE_PARAMS="$QMAKE_PARAMS IRC_INSTALL_BINS=$INSTALL_BINS"
[ "$INSTALL_HEADERS" != "" ] && QMAKE_PARAMS="$QMAKE_PARAMS IRC_INSTALL_HEADERS=$INSTALL_HEADERS"
[ "$INSTALL_FEATURES" != "" ] && QMAKE_PARAMS="$QMAKE_PARAMS IRC_INSTALL_FEATURES=$INSTALL_FEATURES"
[ "$INSTALL_IMPORTS" != "" ] && QMAKE_PARAMS="$QMAKE_PARAMS IRC_INSTALL_IMPORTS=$INSTALL_IMPORTS"
[ "$INSTALL_QML" != "" ] && QMAKE_PARAMS="$QMAKE_PARAMS IRC_INSTALL_QML=$INSTALL_QML"
[ "$INSTALL_LIBS" = "" ] && INSTALL_LIBS=`$QMAKE -query QT_INSTALL_LIBS`
[ "$INSTALL_BINS" = "" ] && INSTALL_BINS=`$QMAKE -query QT_INSTALL_BINS`
[ "$INSTALL_HEADERS" = "" ] && INSTALL_HEADERS=`$QMAKE -query QT_INSTALL_HEADERS`/Communi
[ "$INSTALL_FEATURES" = "" ] && INSTALL_FEATURES=`$QMAKE -query QT_INSTALL_DATA`/mkspecs/features
[ "$INSTALL_IMPORTS" = "" ] && INSTALL_IMPORTS=`$QMAKE -query QT_INSTALL_IMPORTS`
[ "$INSTALL_QML" = "" ] && INSTALL_QML=`$QMAKE -query QT_INSTALL_QML`
[ "$BUILD_EXAMPLES" = "no" ] && QMAKE_PARAMS="$QMAKE_PARAMS -config no_examples"
[ "$BUILD_TESTS" = "no" ] && QMAKE_PARAMS="$QMAKE_PARAMS -config no_tests"
[ "$BUILD_UCHARDET" = "no" ] && QMAKE_PARAMS="$QMAKE_PARAMS -config no_uchardet"
[ "$BUILD_ICU" = "no" ] && QMAKE_PARAMS="$QMAKE_PARAMS -config no_icu"
[ "$QMAKE_SPEC" != "" ] && QMAKE_SPEC="-spec $QMAKE_SPEC"
echo
echo "Running $QMAKE $QMAKE_SPEC..."
$QMAKE $QMAKE_SPEC $QMAKE_DEBUG $QMAKE_PARAMS "CONFIG+=$QMAKE_CONFIG" -r $SOURCE_TREE/libcommuni.pro
if [ $? != 0 ]; then
echo "ERROR: qmake run failed."
exit 1
fi
echo
echo "Communi build configuration:"
if [ "$QMAKE_CONFIG" != "" ]; then
echo "Configuration ...................$QMAKE_CONFIG"
fi
echo "uchardet support ................ $BUILD_UCHARDET"
echo "ICU support ..................... $BUILD_ICU"
echo "Examples ........................ $BUILD_EXAMPLES"
echo "Tests ........................... $BUILD_TESTS"
echo
echo "Install libs .................... $INSTALL_LIBS"
#echo "Install binaries ................ $INSTALL_BINS"
echo "Install headers ................. $INSTALL_HEADERS"
echo "Install features ................ $INSTALL_FEATURES"
echo "Install QML1 imports ............ $INSTALL_IMPORTS"
echo "Install QML2 imports ............ $INSTALL_QML"
echo
echo Communi is now configured for building. Just run \'make\'.
echo