-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure
executable file
·390 lines (343 loc) · 9.83 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
#!/bin/sh
# --------------------------------------------------------------
#
# Script : configure
#
# Description : configures the ickstream player deamon
#
# Comments : -
#
# Date : 13.02.2013
#
# Updates : 28.03.2013 added help option, be less verbose //MAF
# 04.09.2013 new libickp2p //MAF
#
# Author : //maf
#
# Remarks : -
#
#
# Copyright (c) 2013 ickStream GmbH.
# All rights reserved.
# ------------------------------------------------------------------------
contact='sales@ickstream.com'
PCKNAME=ickpd
PWD=`pwd`
#echo Distribution: `git rev-list --all | head -1`
# ----------------------------------------
# Interpret arguments
while test $# -gt 0; do
# build for debugging
if test "$1" = "help"; then
help=true
# build for debugging
elif test "$1" = "debug"; then
debug=true
# static linking
elif test "$1" = "static"; then
linkstatic=true
# suppress alsa
elif test "$1" = "noalsa"; then
noalsa=true
# suppress pulse audio
elif test "$1" = "nopulse"; then
nopulse=true
# select hmi source
elif echo "$1" | grep -q "^hmi="; then
HMISRC=`echo "$1" | sed 's/^hmi=\(.*\)$/hmi\1\.c/g'`
if [ ! -e "daemon/$HMISRC" ]; then
echo "Source file $HMISRC not found!"
exit 1;
fi
# unknown option
else
echo "$0: unknown parameter \"$1\""
echo
help=true
fi
shift
done
# ----------------------------------------
if ${help:-false}; then
echo "Usage: $0 [args ...]"
echo ""
echo "Possible arguments:"
echo " help - this help"
echo " debug - build for debugging"
echo " static - link statically"
echo " hmi=X - Use HMI X (one of Generic, NCurses)"
echo " noalsa - Don't use alsa audio backend"
echo " nopulse - Don't use pulse audio backend"
echo
exit 1
fi
# ----------------------------------------
LIBDIR="$PWD/lib"
DEPLIBS="$LIBDIR/libickutils.a"
# ----------------------------------------
echo
echo -n 'Determine system type : '
systype=`uname -s`
mchtype=`uname -m`
reltype=`uname -r`
mchname=`uname -n`
# generic parameters
CC="cc"
CFLAGS="-Wall"
if ${linkstatic:-false}; then
LDFLAGS="-static"
else
LDFLAGS="-rdynamic"
fi
RANLIB="ranlib"
INCLUDES="${PWD}/include"
EXTRALIBS=""
EXTRASRCS=""
MAKEDIRS="ickutils daemon"
case $systype-$reltype-$mchname in
Linux-*)
echo "this seems to be a Linux machine, fine."
if ${debug:-false}; then
CFLAGS="-g -pipe -Wall -DICK_DEBUG"
LDFLAGS="-g $LDFLAGS"
else
CFLAGS="-pipe -Wall"
fi
;;
*)
echo "so far your system is neither known nor supported by the"
echo "ickstream team. We'll proceed with generic settings."
echo "Feel free to add optimized settings for $systype-$reltype-$mchname"
if ${debug:-false}; then
CFLAGS="-g $CFLAGS -DICK_DEBUG"
LDFLAGS="-g $LDFLAGS"
fi
;;
esac
# ----------------------------------------
if echo "#include <pthread.h> \n int a=PTHREAD_MUTEX_ERRORCHECK;" | gcc -o /dev/null -c -x c -; then
CFLAGS="$CFLAGS -DICK_HASMUTEXERRORCHECK"
fi
# ----------------------------------------
echo -n 'Check for makedepend : '
MAKEDEPEND=true
IFS="${IFS= }"; saveIFS="$IFS"; IFS="${IFS}:"
for path in $PATH; do
if test -r $path/makedepend; then
MAKEDEPEND=makedepend
break;
fi
done
IFS="${saveIFS}"
if test $MAKEDEPEND = 'true'; then
echo not found
else
echo found
fi
# ----------------------------------------
echo -n 'Check for ickstream libraries : '
for i in $ICK_ROOT $PWD/ickstream-p2p $PWD/../ickstream-p2p;
do
if readlink -f /dev/null >/dev/null; then
i=$(readlink -f "$i")
fi
if test -r $i/lib/libickp2p.a\
-a -r $i/include/ickP2p.h; then
_ICK_ROOT=$i
break;
fi
done
if [ -z "$_ICK_ROOT" ]; then
echo please define '$ICK_ROOT' in your environment
echo " ... or install the libickp2p package in ./libickp2p or ../libickp2p"
echo " you'll need lib/libickp2p.a and include/ickP2p.h in this directory"
exit 1
else
echo $_ICK_ROOT
fi
ICK_ROOT=$_ICK_ROOT
DEPLIBS="$DEPLIBS $ICK_ROOT/lib/libickp2p.a"
# ----------------------------------------
echo -n 'Check for cURL : '
if echo "#include <curl/curl.h>" | gcc -o /dev/null -E -x c - 2>/dev/null; then
echo "found `curl-config --version`"
#broken in curl-config: CFLAGS="$CFLAGS `curl-config --cflags`"
#don't need -L part: EXTRALIBS="$EXTRALIBS `curl-config --libs`"
EXTRALIBS="$EXTRALIBS -lcurl"
else
echo "please install libcurl and retry..."
exit 1
fi
# ----------------------------------------
echo -n 'Check for libUUID : '
if echo "#include <uuid/uuid.h>" | gcc -o /dev/null -E -x c - 2>/dev/null; then
echo "found"
CFLAGS="$CFLAGS -DICK_UUID"
EXTRALIBS="$EXTRALIBS -luuid"
else
echo "please install libuuid and retry..."
exit 1
fi
# ----------------------------------------
echo -n 'Check for alsa : '
if ${noalsa:-false}; then
echo "ignored"
elif echo "#include <alsa/asoundlib.h>" | gcc -o /dev/null -E -x c - 2>/dev/null; then
CFLAGS="$CFLAGS -DICK_ALSA"
EXTRASRCS="$EXTRASRCS audioAlsa.c"
EXTRALIBS="$EXTRALIBS -lasound"
echo "found"
else
echo "not found"
fi
# ----------------------------------------
echo -n 'Check for pulse audio : '
if ${nopulse:-false}; then
echo "ignored"
elif echo "#include <pulse/pulseaudio.h>" | gcc -o /dev/null -E -x c - 2>/dev/null; then
CFLAGS="$CFLAGS -DICK_PULSEAUDIO"
EXTRASRCS="$EXTRASRCS audioPulse.c"
EXTRALIBS="$EXTRALIBS -lpulse"
echo "found"
else
echo "not found"
fi
# ----------------------------------------
echo -n 'Check for libsndfile : '
if echo "#include <sndfile.h>" | gcc -o /dev/null -E -x c - 2>/dev/null; then
CFLAGS="$CFLAGS -DICK_LIBSNDFILE"
EXTRASRCS="$EXTRASRCS codecSndFile.c"
EXTRALIBS="$EXTRALIBS -lsndfile"
echo "found"
else
echo "not found"
fi
# ----------------------------------------
echo -n 'Check for mpg123 : '
if echo "#include <mpg123.h>" | gcc -o /dev/null -E -x c - 2>/dev/null; then
CFLAGS="$CFLAGS -DICK_MPG123"
EXTRASRCS="$EXTRASRCS codecMpg123.c"
EXTRALIBS="$EXTRALIBS -lmpg123"
echo "found"
else
echo "not found"
fi
# ----------------------------------------
echo -n 'Check for flac : '
if echo "#include <FLAC/stream_decoder.h>" | gcc -o /dev/null -E -x c - 2>/dev/null; then
CFLAGS="$CFLAGS -DICK_FLAC"
EXTRASRCS="$EXTRASRCS codecFlac.c"
EXTRALIBS="$EXTRALIBS -lFLAC"
echo "found"
else
echo "not found"
fi
# ----------------------------------------
if [ "$HMISRC" = "hmiDirectFB.c" ]; then
echo -n 'Check for directFB : '
DFBFLAGS=`directfb-config --cflags 2>/dev/null`
if [ -n "$DFBFLAGS" ] && echo "#include <directfb.h>" | gcc -o /dev/null $DFBFLAGS -E -x c - 2>/dev/null; then
echo "found `directfb-config --version`"
MAKEDIRS="dfbtools $MAKEDIRS"
CFLAGS="$CFLAGS -DICK_DIRECTFB $DFBFLAGS"
#don't need -L part: EXTRALIBS="$EXTRALIBS `directfb-config --libs`"
EXTRALIBS="-ldfbtools -ldirectfb -lfusion -ldirect -lfreetype $EXTRALIBS"
else
echo "please install libdirectfb and retry..."
exit 1
fi
DEPLIBS="$DEPLIBS $LIBDIR/libdfbtools.a"
fi
# ----------------------------------------
echo -n 'using HMI module : '
if [ -z "$HMISRC" ]; then
echo "None"
CFLAGS="$CFLAGS -DICK_NOHMI"
else
echo $HMISRC
EXTRASRCS="$EXTRASRCS $HMISRC"
fi
if test "$HMISRC" = "hmiNCurses.c"; then
echo -n 'Check for ncurses : '
if echo "#include <ncurses.h>" | gcc -o /dev/null -E -x c - 2>/dev/null; then
EXTRALIBS="$EXTRALIBS -lcurses"
echo "found"
else
echo "please install libcurses and retry..."
exit 1
fi
fi
# ----------------------------------------
INCLUDES="$INCLUDES $ICK_ROOT/include"
echo 'Used include directories :' $INCLUDES
for path in $INCLUDES
do
CINCL="$CINCL -I$path"
done
CONFIG_INFO="# DO NOT EDIT (generated on `date` by $PWD/configure)"
# ----------------------------------------
echo -n 'Debugging : '
if ${debug:-false}; then
echo "enabled"
else
echo "disabled"
fi
echo 'Used compiler flags :' $CFLAGS
echo 'Used linker flags :' $LDFLAGS
echo 'Used extra sources :' $EXTRASRCS
echo 'Used extra libs :' $EXTRALIBS
echo 'Running make in subdirs :' $MAKEDIRS
# ----------------------------------------
# Process templates
#echo
mkdir -p scripts
cat > scripts/config.status << eof
#!/bin/sh
dest=\`basename \$1 .in\`
if test -r \$dest; then
mv -f \$dest \$dest.bak
fi
#echo Creating \$dest from \$1
sed -e 's,@cinfo@,$CONFIG_INFO,g' \\
-e 's,@icklibroot@,$ICK_ROOT,g' \\
-e 's,@pkgname@,$PKGNAME,g' \\
-e 's,@ickpdroot@,$PWD,g' \\
-e 's,@libdir@,$LIBDIR,g' \\
-e 's,@includes@,$CINCL,g' \\
-e 's,@ranlib@,$RANLIB,g' \\
-e 's,@cc@,$CC,g' \\
-e 's,@extralibs@,$EXTRALIBS,g' \\
-e 's,@deplibs@,$DEPLIBS,g' \\
-e 's,@extrasrcs@,$EXTRASRCS,g' \\
-e 's,@makedirs@,$MAKEDIRS,g' \\
-e 's,@cflags@,$CFLAGS,g' \\
-e 's,@makedepend@,$MAKEDEPEND,g' \\
-e 's,@ldflags@,$LDFLAGS,g' \\
< \$1 > \$dest
if [ -x \$1 ]; then
chmod +x \$dest
fi
eof
chmod +x scripts/config.status
# ----------------------------------------
# echo 'Running config.status : '
ROOTDIR=$PWD
for a in *.in `find $MAKEDIRS -name '*.in' -print`; do
# echo -n "./`dirname $a` : "
cd `dirname $a`
$ROOTDIR/scripts/config.status `basename $a`
cd $ROOTDIR
done
# ----------------------------------------
if test $MAKEDEPEND != 'true'; then
make depend
fi
echo '*************************************************************'
echo
echo "Makefiles are configured for your system environment now. Type"
echo " make"
echo "to build the library and executables"
echo
echo "Have fun! <c>2013 //MAF, ickstream GmbH"
echo
# ======================== END OF SCRIPT ======================