#!/bin/bash # # HTS configure script # # Copyright (c) 2005-2009 Andreas Ă–man # # Based on FFmpeg's configure script: # # Copyright (c) 2000-2002 Fabrice Bellard # Copyright (c) 2005-2008 Diego Biurrun # Copyright (c) 2005-2008 Mans Rullgard # PLATFORM=linux source support/configure.inc CPU=generic ARCH=`uname -m` OSENV="posix" prefix=/usr/local bindir="\${prefix}/bin" mandir="\${prefix}/share/man" datadir="\${prefix}/share/tvheadend" show_help(){ echo "Usage: configure [options]" echo "Options: [defaults in brackets after descriptions]" echo echo "Standard options:" echo " --help print this message" echo " --prefix=PREFIX Install in PREFIX [$prefix]" echo " --bindir=DIR Install binaries in DIR [$bindir]" echo " --mandir=DIR Install man pages in DIR [$mandir]" echo " --datadir=DIR Install data files in DIR [$datadir]" echo echo " --arch=arch Build for this architecture [$ARCH]" echo " --cpu=cpu Build and optimize for specific CPU" echo " --cc=CC Build using the given compiler" echo " --release Stage for release" exit 1 } enable cwc enable avahi enable linuxdvb enable v4l for opt do optval="${opt#*=}" case "$opt" in --cpu=*) CPU="$optval" ;; --help) show_help ;; --release) RELEASE=yes ;; --cc=*) CC="$optval" ;; --prefix=*) prefix="$optval" ;; --bindir=*) bindir="$optval" ;; --mandir=*) mandir="$optval" ;; --datadir=*) datadir="$optval" ;; --includedir=*) ;; --infodir=*) ;; --sysconfdir=*) ;; --localstatedir=*) ;; --libexecdir=*) ;; --disable-maintainer-mode) ;; --disable-dependency-tracking) ;; --enable-?*|--disable-?*) eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g') $action $option ;; esac done setup_env # # c compiler # checkcc() { cat >$TMPDIR/1.c </dev/null $TMPDIR/1.c -o $TMPDIR/1.bin } checkccarg() { cat >$TMPDIR/1.c </dev/null $TMPDIR/1.c -o $TMPDIR/1.bin $1 } if [ "x$CC" != "x" ]; then echo >${CONFIG_MAK} "CC=$CC" else CC=cc fi if checkcc; then echo "Using C compiler: $CC" else echo "C compiler ($CC) is not working" die fi if checkccarg "-mmmx"; then enable mmx fi if checkccarg "-msse2"; then enable sse2 fi check_header_c() { cat >$TMPDIR/1.c < int main() { return 0; } EOF $CC 2>/dev/null $TMPDIR/1.c -o $TMPDIR/1.bin } check_header_c "execinfo.h" && enable execinfo echo >>${CONFIG_MAK} $CC_CONFIG_MAK # # AVAHI # if enabled avahi; then if pkg-config avahi-client; then # CFLAGS are included by Makefile echo >>${CONFIG_MAK} "LDFLAGS_cfg += " `pkg-config --libs avahi-client` echo >>${CONFIG_MAK} "CFLAGS_cfg += "`pkg-config --cflags avahi-client` echo "Using AVAHI client: `pkg-config --modversion avahi-client`" else echo "avahi-client not found. Unable to build with AVAHI support." echo "To compile without it, configure with: --disable-avahi" die fi fi if pkg-config openssl; then echo >>${CONFIG_MAK} "LDFLAGS_cfg += " `pkg-config --libs openssl` echo >>${CONFIG_MAK} "CFLAGS_cfg += " `pkg-config --cflags openssl` echo "Using openssl: `pkg-config --modversion openssl`" elif pkg-config libssl; then echo >>${CONFIG_MAK} "LDFLAGS_cfg += " `pkg-config --libs libssl` echo >>${CONFIG_MAK} "CFLAGS_cfg += " `pkg-config --cflags libssl` echo "Using libssl: `pkg-config --modversion libssl`" else echo "libssl or openssl not found" die fi # # Finalize # cat >> ${CONFIG_MAK} << EOF ARCH=$ARCH LDFLAGS_cfg += -lpthread EOF # # Finalize # echo echo "Installation paths:" echo " Prefix: ${prefix}" echo " Binaries: ${bindir}" echo " Man pages: ${mandir}" echo " Data files: ${datadir}" echo echo >>${CONFIG_MAK} "prefix=$prefix" echo >>${CONFIG_MAK} "bindir=\${DESTDIR}$bindir" echo >>${CONFIG_MAK} "mandir=\${DESTDIR}$mandir" echo >>${CONFIG_MAK} "datadir=\${DESTDIR}$datadir" echo >>${CONFIG_MAK} LDFLAGS_cfg += -lpthread -lrt -ldl eval datadirpath=${datadir} echo >>${CONFIG_H} "#define TVHEADEND_DATADIR \"${datadirpath}\"" finalize