tvheadend/configure

136 lines
2.5 KiB
Bash
Executable file

#!/bin/bash
#
# Tvheadend configure script
#
# Copyright (c) 2012 Adam Sutton <dev@adamsutton.me.uk>
#
# ###########################################################################
# Setup
# ###########################################################################
ROOTDIR=$(dirname $0)
#
# Options
#
OPTIONS=(
"cwc:yes"
"v4l:yes"
"linuxdvb:yes"
"dvbscan:yes"
"avahi:auto"
"zlib:auto"
"bundle:no"
)
#
# Begin
#
. $ROOTDIR/support/configure.inc
parse_args $*
# ###########################################################################
# Checks
# ###########################################################################
#
# 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); }'
#
# 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 check_pkg openssl || check_pkg libssl; then
enable ssl
else
die "SSL development support not found"
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
#
# 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
#
# DVB scan
#
if enabled linuxdvb && enabled dvbscan; then
if [ ! -d ${ROOTDIR}/data/dvb-scan ]; then
if ! enabled bin_bzip2; then
die "Bzip2 not found, fetch dvb-scan files (use --disable-dvbscan)"
fi
echo -n "Fetching dvb-scan files... "
if ${ROOTDIR}/support/getmuxlist &> /dev/null; then
echo "done"
else
echo
die "Failed to fetch dvb-scan files (use --disable-dvbscan to skip)"
fi
fi
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 ""