2009-03-25 20:49:50 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
2012-08-16 15:48:45 +01:00
|
|
|
# Tvheadend configure script
|
|
|
|
#
|
|
|
|
# Copyright (c) 2012 Adam Sutton <dev@adamsutton.me.uk>
|
|
|
|
#
|
2009-03-25 20:49:50 +00:00
|
|
|
|
2012-08-16 15:48:45 +01:00
|
|
|
# ###########################################################################
|
|
|
|
# Setup
|
|
|
|
# ###########################################################################
|
2010-01-06 21:24:16 +00:00
|
|
|
|
2013-03-07 20:16:54 -07:00
|
|
|
ROOTDIR=$(cd "$(dirname "$0")"; pwd)
|
2010-01-06 21:24:16 +00:00
|
|
|
|
2012-08-16 15:48:45 +01:00
|
|
|
#
|
|
|
|
# Options
|
|
|
|
#
|
2010-01-06 21:24:16 +00:00
|
|
|
|
2012-08-16 15:48:45 +01:00
|
|
|
OPTIONS=(
|
|
|
|
"cwc:yes"
|
2014-05-30 13:38:29 +02:00
|
|
|
"capmt:yes"
|
2013-06-17 17:31:29 +01:00
|
|
|
"v4l:no"
|
2012-08-16 15:48:45 +01:00
|
|
|
"linuxdvb:yes"
|
2014-04-09 19:52:23 +02:00
|
|
|
"satip_client:yes"
|
2013-04-25 18:48:48 +01:00
|
|
|
"iptv:yes"
|
2013-04-26 15:10:07 +01:00
|
|
|
"tsfile:yes"
|
2012-08-16 15:48:45 +01:00
|
|
|
"dvbscan:yes"
|
2013-01-09 21:26:40 +00:00
|
|
|
"timeshift:yes"
|
2013-04-07 13:09:55 +01:00
|
|
|
"trace:yes"
|
2012-12-30 20:09:27 +00:00
|
|
|
"imagecache:auto"
|
2012-08-16 15:48:45 +01:00
|
|
|
"avahi:auto"
|
|
|
|
"zlib:auto"
|
2013-01-07 19:52:48 +01:00
|
|
|
"libav:auto"
|
2013-01-10 17:04:31 +00:00
|
|
|
"inotify:auto"
|
2013-11-24 12:10:53 +00:00
|
|
|
"epoll:auto"
|
2013-11-24 13:26:03 +00:00
|
|
|
"uriparser:auto"
|
2013-12-12 22:28:45 +00:00
|
|
|
"ccache:auto"
|
2014-05-30 13:38:29 +02:00
|
|
|
"tvhcsa:auto"
|
2012-08-17 10:37:55 +01:00
|
|
|
"bundle:no"
|
2012-11-28 11:19:44 +00:00
|
|
|
"dvbcsa:no"
|
2013-05-04 13:56:24 +02:00
|
|
|
"kqueue:no"
|
2012-08-16 15:48:45 +01:00
|
|
|
)
|
2011-01-04 21:34:02 +01:00
|
|
|
|
2012-08-16 15:48:45 +01:00
|
|
|
#
|
|
|
|
# Begin
|
|
|
|
#
|
2011-01-04 21:34:02 +01:00
|
|
|
|
2013-03-07 20:16:54 -07:00
|
|
|
. "$ROOTDIR/support/configure.inc"
|
2012-08-16 15:48:45 +01:00
|
|
|
parse_args $*
|
2011-01-04 21:34:02 +01:00
|
|
|
|
2012-08-16 15:48:45 +01:00
|
|
|
# ###########################################################################
|
|
|
|
# Checks
|
|
|
|
# ###########################################################################
|
2009-03-25 20:49:50 +00:00
|
|
|
|
2013-01-11 20:50:19 +00:00
|
|
|
echo "Checking support/features"
|
|
|
|
|
2009-08-10 19:06:16 +00:00
|
|
|
#
|
2012-08-16 15:48:45 +01:00
|
|
|
# Compiler
|
2009-08-10 19:06:16 +00:00
|
|
|
#
|
2013-12-12 22:28:45 +00:00
|
|
|
|
|
|
|
# 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
|
2012-08-29 21:02:11 +01:00
|
|
|
check_cc || die 'No C compiler found'
|
2012-08-16 15:48:45 +01:00
|
|
|
check_cc_header execinfo
|
|
|
|
check_cc_option mmx
|
|
|
|
check_cc_option sse2
|
2009-08-10 19:06:16 +00:00
|
|
|
|
2014-05-16 23:18:53 +02:00
|
|
|
if check_cc '
|
|
|
|
#if !defined(__clang__)
|
|
|
|
#error this is not clang
|
|
|
|
#endif
|
|
|
|
'; then
|
|
|
|
COMPILER=clang
|
|
|
|
else
|
|
|
|
COMPILER=gcc
|
|
|
|
fi
|
|
|
|
|
2012-09-12 20:54:37 +02:00
|
|
|
check_cc_snippet getloadavg '#include <stdlib.h>
|
|
|
|
void test() { getloadavg(NULL,0); }'
|
|
|
|
|
2013-02-09 23:18:28 +00:00
|
|
|
check_cc_snippet atomic64 '#include <stdint.h>
|
|
|
|
uint64_t test(uint64_t *ptr){
|
|
|
|
return __sync_fetch_and_add(ptr, 1);
|
|
|
|
}'
|
|
|
|
|
2013-08-06 19:52:55 +01:00
|
|
|
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
|
|
|
|
|
2014-03-04 11:49:34 +00:00
|
|
|
check_cc_snippet qsort_r '
|
|
|
|
#include <stdlib.h>
|
|
|
|
#define TEST test
|
|
|
|
int test(void)
|
|
|
|
{
|
|
|
|
qsort_r(NULL, 0, 0, NULL, NULL);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
'
|
2014-04-16 11:37:18 +02:00
|
|
|
|
|
|
|
check_cc_snippet recvmmsg '
|
|
|
|
#define _GNU_SOURCE
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#define TEST test
|
|
|
|
int test(void)
|
|
|
|
{
|
|
|
|
recvmmsg(0, NULL, 0, 0, NULL);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
'
|
2014-05-27 15:35:27 +02:00
|
|
|
|
|
|
|
check_cc_snippet libiconv '
|
|
|
|
#include <iconv.h>
|
|
|
|
int test(void)
|
|
|
|
{
|
|
|
|
iconv_t ic = iconv_open("ASCII", "ASCII");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
' -liconv
|
|
|
|
|
2012-08-29 16:26:05 +01:00
|
|
|
#
|
|
|
|
# Python
|
|
|
|
#
|
2012-09-03 11:33:03 +01:00
|
|
|
check_py || echo 'WARN: no python binary found'
|
2012-10-08 21:22:44 +01:00
|
|
|
check_py_import gzip
|
|
|
|
|
|
|
|
#
|
|
|
|
# Binaries
|
|
|
|
#
|
|
|
|
check_bin bzip2 || echo 'WARN: no bzip2 binary found'
|
2012-08-29 16:26:05 +01:00
|
|
|
|
2012-08-16 15:48:45 +01:00
|
|
|
#
|
|
|
|
# SSL
|
|
|
|
#
|
2013-05-04 13:57:34 +02:00
|
|
|
if [ ${PLATFORM} = "freebsd" ]; then
|
|
|
|
# FreeBSD has libssl in base
|
|
|
|
enable ssl
|
|
|
|
elif check_pkg openssl || check_pkg libssl; then
|
2012-08-16 15:48:45 +01:00
|
|
|
enable ssl
|
2010-12-29 23:03:23 +00:00
|
|
|
else
|
2012-08-16 15:48:45 +01:00
|
|
|
die "SSL development support not found"
|
2010-12-29 23:03:23 +00:00
|
|
|
fi
|
|
|
|
|
2014-05-16 23:18:53 +02:00
|
|
|
#
|
|
|
|
# OS X
|
|
|
|
#
|
|
|
|
if [ ${PLATFORM} = "darwin" ]; then
|
|
|
|
disable linuxdvb
|
2014-05-31 00:47:17 +02:00
|
|
|
disable avahi
|
|
|
|
enable bonjour
|
2014-05-16 23:18:53 +02:00
|
|
|
fi
|
|
|
|
|
2013-05-09 16:33:53 +01:00
|
|
|
#
|
|
|
|
# DVB API
|
|
|
|
#
|
2014-03-30 21:46:43 +02:00
|
|
|
check_cc_header 'linux/dvb/version' linuxdvbapi
|
2013-05-21 20:06:30 +01:00
|
|
|
if enabled_or_auto linuxdvb; then
|
2014-03-30 21:46:43 +02:00
|
|
|
if enabled linuxdvbapi; then
|
2013-05-21 20:06:30 +01:00
|
|
|
enable linuxdvb
|
|
|
|
elif enabled linuxdvb; then
|
|
|
|
die "Linux DVB API not found (use --disable-linuxdvb)"
|
|
|
|
fi
|
|
|
|
fi
|
2013-05-09 16:33:53 +01:00
|
|
|
|
2012-08-03 13:27:54 +01:00
|
|
|
#
|
2012-08-16 15:48:45 +01:00
|
|
|
# Gzip
|
2012-08-03 13:27:54 +01:00
|
|
|
#
|
2012-08-16 15:48:45 +01:00
|
|
|
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)"
|
2012-08-03 13:27:54 +01:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2014-04-09 19:52:23 +02:00
|
|
|
#
|
|
|
|
# SAT>IP client
|
|
|
|
#
|
|
|
|
if enabled_or_auto satip_client; then
|
2014-04-15 19:35:12 +02:00
|
|
|
enable upnp
|
2014-04-09 19:52:23 +02:00
|
|
|
fi
|
|
|
|
|
2013-11-24 13:26:03 +00:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
|
2009-03-25 20:49:50 +00:00
|
|
|
#
|
2012-08-16 15:48:45 +01:00
|
|
|
# Bundling
|
2009-03-25 20:49:50 +00:00
|
|
|
#
|
2012-09-03 11:33:03 +01:00
|
|
|
if enabled bundle; then
|
2012-10-08 21:22:44 +01:00
|
|
|
if enabled zlib && ! enabled py_gzip; then
|
2012-09-03 11:33:03 +01:00
|
|
|
die "Python gzip module not found (use --disable-zlib or --disable-bundle)"
|
2012-08-16 15:48:45 +01:00
|
|
|
fi
|
|
|
|
fi
|
2009-03-30 20:00:39 +00:00
|
|
|
|
2012-08-16 15:48:45 +01:00
|
|
|
#
|
|
|
|
# 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
|
2009-03-25 20:49:50 +00:00
|
|
|
|
2013-01-07 19:52:48 +01:00
|
|
|
#
|
|
|
|
# libav
|
|
|
|
#
|
|
|
|
if enabled_or_auto libav; then
|
|
|
|
has_libav=true
|
|
|
|
|
2013-01-09 23:01:11 +01:00
|
|
|
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
|
|
|
|
|
2013-01-07 19:52:48 +01:00
|
|
|
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
|
|
|
|
|
2013-01-12 15:50:32 +01:00
|
|
|
if $has_libav && ! check_pkg libavformat ">=53.10.0"; then
|
2013-01-07 19:52:48 +01:00
|
|
|
has_libav=false
|
|
|
|
fi
|
|
|
|
|
2013-05-09 21:51:27 +02:00
|
|
|
if $has_libav && ! check_pkg libswscale ">=0.13.0"; then
|
|
|
|
has_libav=false
|
|
|
|
fi
|
|
|
|
|
2013-01-07 19:52:48 +01:00
|
|
|
if $has_libav; then
|
|
|
|
enable libav
|
|
|
|
elif enabled libav; then
|
|
|
|
die "libav development support not found (use --disable-libav)"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2013-01-10 17:04:31 +00:00
|
|
|
#
|
|
|
|
# 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
|
2013-01-07 19:52:48 +01:00
|
|
|
|
2012-11-28 11:19:44 +00:00
|
|
|
#
|
2014-05-30 13:38:29 +02:00
|
|
|
# libdvbcsa, tvhcsa
|
2012-11-28 11:19:44 +00:00
|
|
|
#
|
2014-05-30 13:38:29 +02:00
|
|
|
if enabled cwc || enabled capmt; then
|
|
|
|
enable tvhcsa
|
|
|
|
if 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
|
2012-11-28 11:19:44 +00:00
|
|
|
fi
|
2012-12-30 20:09:27 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Icon caching
|
|
|
|
#
|
|
|
|
if enabled_or_auto imagecache; then
|
2014-04-15 19:35:12 +02:00
|
|
|
enable imagecache
|
2012-12-30 20:09:27 +00:00
|
|
|
fi
|
2012-11-28 11:19:44 +00:00
|
|
|
|
2013-01-11 20:50:19 +00:00
|
|
|
#
|
|
|
|
# DVB scan
|
|
|
|
#
|
2014-05-27 23:45:15 +02:00
|
|
|
if enabled dvbscan; then
|
2013-01-11 20:50:19 +00:00
|
|
|
printf "${TAB}" "fetching dvb-scan files ..."
|
2013-03-07 20:16:54 -07:00
|
|
|
"${ROOTDIR}/support/getmuxlist"
|
2013-01-31 11:53:15 +00:00
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "fail"
|
|
|
|
die "Failed to fetch dvb-scan data (use --disable-dvbscan)"
|
2013-01-11 21:34:40 +00:00
|
|
|
fi
|
2013-01-11 20:50:19 +00:00
|
|
|
echo "ok"
|
|
|
|
fi
|
|
|
|
|
2013-05-04 13:56:24 +02:00
|
|
|
#
|
|
|
|
# epoll
|
|
|
|
#
|
2013-11-24 12:10:53 +00:00
|
|
|
if [ ${PLATFORM} = "linux" ]; then
|
|
|
|
enable epoll
|
2013-05-04 13:56:24 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# kqueue
|
|
|
|
#
|
2014-05-16 23:18:53 +02:00
|
|
|
if [ ${PLATFORM} = "freebsd" ] || [ ${PLATFORM} = "darwin" ]; then
|
2013-05-04 13:56:24 +02:00
|
|
|
enable kqueue
|
|
|
|
fi
|
|
|
|
|
2013-04-25 18:48:48 +01:00
|
|
|
#
|
|
|
|
# MPEGTS/PS support
|
|
|
|
#
|
|
|
|
disable mpegts
|
|
|
|
disable mpegps
|
2014-05-16 21:20:58 +01:00
|
|
|
disable mpegts_dvb
|
|
|
|
if enabled linuxdvb || enabled iptv || enabled tsfile || enabled satip_client;
|
|
|
|
then
|
2013-04-25 18:48:48 +01:00
|
|
|
enable mpegts
|
|
|
|
fi
|
2014-05-16 21:20:58 +01:00
|
|
|
if enabled linuxdvb || enabled satip_client; then
|
|
|
|
enable mpegts_dvb
|
|
|
|
fi
|
2013-04-25 18:48:48 +01:00
|
|
|
|
|
|
|
if enabled v4l; then
|
|
|
|
enable mpegps
|
|
|
|
fi
|
|
|
|
|
2012-08-16 15:48:45 +01:00
|
|
|
# ###########################################################################
|
|
|
|
# Write config
|
|
|
|
# ###########################################################################
|
|
|
|
|
|
|
|
# Write config
|
|
|
|
write_config
|
2013-03-07 20:16:54 -07:00
|
|
|
cat >> "${CONFIG_H}" <<EOF
|
2012-08-16 16:42:16 +01:00
|
|
|
#define TVHEADEND_DATADIR "$(eval echo ${datadir})/tvheadend"
|
2012-08-16 15:48:45 +01:00
|
|
|
EOF
|
2009-03-25 20:49:50 +00:00
|
|
|
|
2012-08-16 15:48:45 +01:00
|
|
|
# Output config
|
|
|
|
print_config
|
|
|
|
echo "Final Binary:"
|
|
|
|
echo " $BUILDDIR/tvheadend"
|
|
|
|
echo ""
|
2012-08-16 16:42:16 +01:00
|
|
|
echo "Tvheadend Data Directory:"
|
|
|
|
echo " $(eval echo ${datadir}/tvheadend)"
|
|
|
|
echo ""
|