forked from tvheadend/tvheadend
-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure
executable file
·320 lines (278 loc) · 5.8 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
#!/bin/bash
#
# Tvheadend configure script
#
# Copyright (c) 2012 Adam Sutton <[email protected]>
#
# ###########################################################################
# Setup
# ###########################################################################
ROOTDIR=$(cd "$(dirname "$0")"; pwd)
#
# Options
#
OPTIONS=(
"cwc:yes"
"v4l:no"
"linuxdvb:yes"
"iptv:yes"
"tsfile:yes"
"dvbscan:yes"
"timeshift:yes"
"trace:yes"
"imagecache:auto"
"avahi:auto"
"zlib:auto"
"libav:auto"
"inotify:auto"
"curl:auto"
"epoll:auto"
"uriparser:auto"
"ccache:auto"
"bundle:no"
"dvbcsa:no"
"kqueue:no"
)
#
# Begin
#
. "$ROOTDIR/support/configure.inc"
parse_args $*
# ###########################################################################
# Checks
# ###########################################################################
echo "Checking support/features"
#
# Compiler
#
# Use ccache
if enabled_or_auto ccache; then
which ccache &> /dev/null
if [ $? -eq 0 ]; then
echo "$CC" | grep -q ccache || CC="ccache $CC"
enable ccache
elif enabled ccache; then
die "ccache not found, try --disable-ccache"
fi
fi
# Valiate compiler
check_cc || die 'No C compiler found'
check_cc_header execinfo
check_cc_option mmx
check_cc_option sse2
check_cc_snippet getloadavg '#include <stdlib.h>
void test() { getloadavg(NULL,0); }'
check_cc_snippet atomic64 '#include <stdint.h>
uint64_t test(uint64_t *ptr){
return __sync_fetch_and_add(ptr, 1);
}'
check_cc_snippet lockowner '
#include <sys/syscall.h>
#include <unistd.h>
#include <pthread.h>
#define TEST test
int ok = 1;
void *lockowner ( void *p)
{
pthread_mutex_t lock;
pthread_mutex_init(&lock, NULL);
pthread_mutex_lock(&lock);
if (lock.__data.__owner == syscall(SYS_gettid))
ok = 0;
return NULL;
}
int test ( void )
{
pthread_t tid;
pthread_create(&tid, NULL, lockowner, NULL);
pthread_join(tid, NULL);
return ok;
}' -lpthread
#
# Python
#
check_py || echo 'WARN: no python binary found'
check_py_import gzip
#
# Binaries
#
check_bin bzip2 || echo 'WARN: no bzip2 binary found'
#
# SSL
#
if [ ${PLATFORM} = "freebsd" ]; then
# FreeBSD has libssl in base
enable ssl
elif check_pkg openssl || check_pkg libssl; then
enable ssl
else
die "SSL development support not found"
fi
#
# DVB API
#
check_cc_header 'linux/dvb/version' dvbapi
if enabled_or_auto linuxdvb; then
if enabled dvbapi; then
enable linuxdvb
elif enabled linuxdvb; then
die "Linux DVB API not found (use --disable-linuxdvb)"
fi
fi
#
# Gzip
#
if enabled_or_auto zlib; then
if check_pkg zlib; then
enable zlib
elif enabled zlib; then
die "Zlib development support not found (use --disable-zlib)"
fi
fi
#
# CURL
#
if enabled_or_auto curl; then
if check_pkg libcurl; then
enable curl
elif enabled curl; then
die "Curl development support not foun (use --disable-curl)"
fi
fi
#
# uriparser
#
if enabled_or_auto uriparser; then
if check_pkg liburiparser; then
enable uriparser
elif enabled uriparser; then
die "liburiparser development support not found (use --disable-uriparser)"
fi
fi
#
# Bundling
#
if enabled bundle; then
if enabled zlib && ! enabled py_gzip; then
die "Python gzip module not found (use --disable-zlib or --disable-bundle)"
fi
fi
#
# Avahi
#
if enabled_or_auto avahi; then
if check_pkg avahi-client; then
enable avahi
elif enabled avahi; then
die "Avahi development support not found (use --disable-avahi)"
fi
fi
#
# libav
#
if enabled_or_auto libav; then
has_libav=true
if $has_libav && ! check_pkg libavcodec "<=55.0.0"; then
has_libav=false
fi
if $has_libav && ! check_pkg libavcodec ">=52.96.0"; then
has_libav=false
fi
if $has_libav && ! check_pkg libavutil ">=50.43.0"; then
has_libav=false
fi
if $has_libav && ! check_pkg libavformat "<=55.0.0"; then
has_libav=false
fi
if $has_libav && ! check_pkg libavformat ">=53.10.0"; then
has_libav=false
fi
if $has_libav && ! check_pkg libswscale ">=0.13.0"; then
has_libav=false
fi
if $has_libav; then
enable libav
elif enabled libav; then
die "libav development support not found (use --disable-libav)"
fi
fi
#
# Inotify
#
if enabled_or_auto inotify; then
if check_cc_header "sys/inotify" inotify_h; then
enable inotify
elif enabled inotify; then
die "Inotify support not found (use --disable-inotify)"
fi
fi
#
# libdvbcsa
#
if enabled cwc && enabled dvbcsa; then
(check_cc_header "dvbcsa/dvbcsa" dvbcsa_h &&\
check_cc_lib dvbcsa dvbcsa_l) ||\
die "Failed to find dvbcsa support (use --disable-dvbcsa)"
LDFLAGS="$LDFLAGS -ldvbcsa"
fi
#
# Icon caching
#
if enabled_or_auto imagecache; then
if enabled curl; then
enable imagecache
elif enabled imagecache; then
die "Libcurl support not found (use --disable-imagecache)"
fi
fi
#
# DVB scan
#
if enabled linuxdvb && enabled dvbscan; then
printf "${TAB}" "fetching dvb-scan files ..."
"${ROOTDIR}/support/getmuxlist"
if [ $? -ne 0 ]; then
echo "fail"
die "Failed to fetch dvb-scan data (use --disable-dvbscan)"
fi
echo "ok"
fi
#
# epoll
#
if [ ${PLATFORM} = "linux" ]; then
enable epoll
fi
#
# kqueue
#
if [ ${PLATFORM} = "freebsd" ]; then
enable kqueue
fi
#
# MPEGTS/PS support
#
disable mpegts
disable mpegps
if enabled linuxdvb || enabled iptv || enabled tsfile; then
enable mpegts
fi
if enabled v4l; then
enable mpegps
fi
# ###########################################################################
# Write config
# ###########################################################################
# Write config
write_config
cat >> "${CONFIG_H}" <<EOF
#define TVHEADEND_DATADIR "$(eval echo ${datadir})/tvheadend"
EOF
# Output config
print_config
echo "Final Binary:"
echo " $BUILDDIR/tvheadend"
echo ""
echo "Tvheadend Data Directory:"
echo " $(eval echo ${datadir}/tvheadend)"
echo ""