Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
executable file 640 lines (542 sloc) 13.7 KB
#!/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"
OSENV="posix"
DEFAULT_UI="glw"
GLWFRONTEND="x11"
CONFIGURE_POSTFIX="linux"
source support/configure.inc
CPU=generic
ARCH=`uname -m`
prefix=/usr/local
bindir="\${prefix}/bin"
mandir="\${prefix}/share/man"
datadir="\${prefix}/share/showtime"
libdir="\${prefix}/lib/showtime"
CC=cc
CXX=c++
show_help(){
common_help
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 " --libdir=DIR Install libraries in DIR [$libdir]"
echo " --arch=ARCH Build for this architecture [$ARCH]"
echo " --cpu=CPU Build and optimize for specific CPU"
echo " --cc=CC Build using compiler CC [$CC]"
echo " --glw-frontend=FRONTEND Build GLW for FRONTEND [$GLWFRONTEND]"
echo " x11 X11 Windows"
echo " none Disable GLW"
echo " --pkg-config-path=PATH Extra paths for pkg-config"
exit 1
}
check_header() {
cat >$TMPDIR/1.c <<EOF
#include <$1>
int main() {
return 0;
}
EOF
$CC 2>/dev/null $TMPDIR/1.c -o $TMPDIR/1.bin
}
check_header_cpp() {
cat >$TMPDIR/1.cpp <<EOF
#include <$1>
int main() {
return 0;
}
EOF
$CXX $TMPDIR/1.cpp -o $TMPDIR/1.bin
}
check_lib() {
cat >$TMPDIR/1.c <<EOF
int main() {
return 0;
}
EOF
$CC 2>/dev/null $TMPDIR/1.c -o $TMPDIR/1.bin -l$1
}
fatal() {
echo "$1: $2"
echo "configure with --disable-$1 to skip this module"
die
}
enable libfreetype
enable libfontconfig
enable libasound
enable libpulse
enable lirc
enable stdin
enable gu
enable avahi
enable spotify
enable libspotify_load_runtime
enable cdda
enable cddb
enable libxss
enable libxv
enable serdev
enable openssl
enable locatedb
enable vdpau
enable spidermonkey
enable libxxf86vm
enable httpserver
enable timegm
enable inotify
enable realpath
#enable libxrandr -- code does not really work yet
for opt do
optval="${opt#*=}"
case "$opt" in
--cpu=*) CPU="$optval"
;;
--help) show_help
;;
--cc=*) CC="$optval"
;;
--arch=*) ARCH="$optval"
;;
--enable-all)
enable libgme
enable libsidplay2
;;
--glw-frontend=*) GLWFRONTEND="$optval"
;;
--pkg-config-path=*) export PKG_CONFIG_PATH="$optval"
;;
--prefix=*)
prefix="$optval"
;;
--bindir=*)
bindir="$optval"
;;
--mandir=*)
mandir="$optval"
;;
--datadir=*)
datadir="$optval"
;;
--libdir=*)
libdir="$optval"
;;
--includedir=*)
;;
--infodir=*)
;;
--sysconfdir=*)
;;
--localstatedir=*)
;;
--libexecdir=*)
;;
--disable-maintainer-mode)
;;
--disable-dependency-tracking)
;;
*)
common_opt $opt $optval
esac
done
setup_env "$@"
enable libpthread
enable zlib
enable posix_networking
enable dvd
enable dvd_linux
#
# pkgconfig
#
which >/dev/null pkg-config
if [ $? -ne 0 ]; then
echo "pkg-config not found. Can not configure."
die
fi
#
# Check for compilers
#
checkcc() {
cat >$TMPDIR/1.c <<EOF
int main() {
return 0;
}
EOF
$CC 2>/dev/null $TMPDIR/1.c -o $TMPDIR/1.bin
}
checkcxx() {
cat >$TMPDIR/1.cpp <<EOF
int main() {
return 0;
}
EOF
$CXX 2>/dev/null $TMPDIR/1.cpp -o $TMPDIR/1.bin
}
if checkcc; then
echo "Using C compiler: $CC"
else
echo "C compiler ($CC) is not working"
die
fi
if checkcxx; then
echo "Using C++ compiler: $CXX"
else
echo "C++ compiler ($CXX) is not working"
die
fi
echo >>${CONFIG_MAK} "CC=$CC"
echo >>${CONFIG_MAK} "CXX=$CXX"
#
# libfreetype2
#
if enabled libfreetype; then
if pkg-config freetype2; then
echo >>${CONFIG_MAK} "LDFLAGS_cfg += " `pkg-config --libs freetype2`
echo >>${CONFIG_MAK} "CFLAGS_cfg += " `pkg-config --cflags freetype2`
echo "Using Freetype2: `pkg-config --modversion freetype2`"
else
echo "FreeType 2 not found"
echo "To compile without it, configure with: --disable-libfreetype"
die
fi
fi
#
# libfontconfig
#
if enabled libfontconfig; then
if pkg-config fontconfig; then
echo >>${CONFIG_MAK} "LDFLAGS_cfg += " `pkg-config --libs fontconfig`
echo >>${CONFIG_MAK} "CFLAGS_cfg += " `pkg-config --cflags fontconfig`
echo "Using libfontconfig: `pkg-config --modversion fontconfig`"
else
echo "libfontconfig not found"
echo "To compile without it, configure with: --disable-libfontconfig"
die
fi
fi
#
# libx11
#
if pkg-config x11; then
echo >>${CONFIG_MAK} "CFLAGS_cfg += " `pkg-config --cflags x11`
echo >>${CONFIG_MAK} "LDFLAGS_cfg += " `pkg-config --libs x11`
echo "Using libX11: `pkg-config --modversion x11`"
enable libx11
fi
#
# libxext
#
if pkg-config xext; then
echo >>${CONFIG_MAK} "CFLAGS_cfg += " `pkg-config --cflags xext`
echo >>${CONFIG_MAK} "LDFLAGS_cfg += " `pkg-config --libs xext`
echo "Using libXext: `pkg-config --modversion xext`"
enable libxext
fi
#
# GLW frontend
#
case "$GLWFRONTEND" in
x11)
enable glw_frontend_x11
;;
none)
;;
*)
echo "Invalid GLW frontend: $GLWFRONTEND"
die
esac
echo "Using GLW Frontend: $GLWFRONTEND"
#
# GLW on X11
#
if enabled glw_frontend_x11; then
if disabled libfreetype; then
echo "glw-x11 depends on libfreetype"
die
fi
if disabled libx11; then
echo "glw-x11 depends on libx11"
die
fi
if disabled libxext; then
echo "glw-x11 depends on libxext"
die
fi
check_header "X11/Xlib.h" || fatal "glw" "Missing X11 include file X11/Xlib.h"
if pkg-config gl ; then
echo >>${CONFIG_MAK} "CFLAGS_cfg += " `pkg-config --cflags gl`
echo >>${CONFIG_MAK} "LDFLAGS_cfg += " `pkg-config --libs gl`
echo "Using GL: `pkg-config --modversion gl`"
else
check_header "GL/gl.h" || fatal "glw-x11" "Missing OpenGL include file GL/gl.h"
check_header "GL/glx.h" || fatal "glw-x11" "Missing OpenGL include file GL/glx.h"
check_lib "GL" || fatal "glw-x11" "Unable to link with libGL"
echo >>${CONFIG_MAK} "LDFLAGS_cfg += -lGL"
fi
enable glw_backend_opengl
enable glw
else
disable vdpau
disable libxss
disable libxxf86vm
disable libxrandr
fi
#
# libasound (ALSA)
#
if enabled libasound; then
if pkg-config alsa; then
echo >>${CONFIG_MAK} "CFLAGS_cfg += " `pkg-config --cflags alsa`
echo >>${CONFIG_MAK} "LDFLAGS_cfg += " `pkg-config --libs alsa`
echo "Using ALSA: `pkg-config --modversion alsa`"
else
echo "libasound (ALSA) development files not found."
echo "To compile without it, configure with: --disable-libasound"
die
fi
fi
#
# libpulse (PulseAudio)
#
if enabled libpulse; then
if pkg-config libpulse; then
echo >>${CONFIG_MAK} "CFLAGS_cfg += " `pkg-config --cflags libpulse`
echo >>${CONFIG_MAK} "LDFLAGS_cfg += " `pkg-config --libs libpulse`
echo "Using libpulse: `pkg-config --modversion libpulse`"
else
echo "libpulse (PulseAudio) development files not found."
echo "To compile without it, configure with: --disable-libpulse"
die
fi
fi
#
# GTK2 UI
#
if enabled gu; then
if pkg-config gtk+-2.0 && pkg-config gthread-2.0; then
if disabled libx11; then
echo "GLW depends on libx11"
die
fi
if disabled libxext; then
echo "GLW depends on libxext"
die
fi
echo >>${CONFIG_MAK} "LDFLAGS_cfg += " `pkg-config --libs gtk+-2.0`
echo >>${CONFIG_MAK} "CFLAGS_GTK += " `pkg-config --cflags gtk+-2.0`
echo "Using GTK+: `pkg-config --modversion gtk+-2.0`"
echo >>${CONFIG_MAK} "LDFLAGS_cfg += " `pkg-config --libs gthread-2.0`
echo >>${CONFIG_MAK} "CFLAGS_GTK += " `pkg-config --cflags gthread-2.0`
echo "Using GTK Threading: `pkg-config --modversion gthread-2.0`"
else
echo "GTK2 not found. Unable to build GU (GTK user interface)."
echo "To compile without it, configure with: --disable-gu"
die
fi
else
disable libxv
fi
#
# libXss (Screen saver control library)
#
if enabled libxss; then
if pkg-config xscrnsaver; then
echo >>${CONFIG_MAK} "CFLAGS_cfg += " `pkg-config --cflags xscrnsaver`
echo >>${CONFIG_MAK} "LDFLAGS_cfg += " `pkg-config --libs xscrnsaver`
echo "Using libxscrnsaver: `pkg-config --modversion xscrnsaver`"
else
echo "libXss not found. Unable to build with screensaver disable support."
die
fi
fi
#
# libxxf86vm
#
if enabled libxxf86vm; then
if pkg-config xxf86vm; then
echo >>${CONFIG_MAK} "CFLAGS_cfg += " `pkg-config --cflags xxf86vm`
echo >>${CONFIG_MAK} "LDFLAGS_cfg += " `pkg-config --libs xxf86vm`
echo "Using libxxf86vm: `pkg-config --modversion xxf86vm`"
else
echo "libxxf86vm not found. Unable to build with X11 video mode control."
die
fi
fi
#
# libxrandr
#
if enabled libxrandr; then
if pkg-config xrandr; then
echo >>${CONFIG_MAK} "CFLAGS_cfg += " `pkg-config --cflags xrandr`
echo >>${CONFIG_MAK} "LDFLAGS_cfg += " `pkg-config --libs xrandr`
echo "Using libxrandr: `pkg-config --modversion xrandr`"
else
echo "libxrandr not found. Unable to build with X11 video mode control."
die
fi
fi
#
# libxv (Xvideo)
#
if enabled libxv; then
if pkg-config xv; then
echo >>${CONFIG_MAK} "CFLAGS_cfg += " `pkg-config --cflags xv`
echo >>${CONFIG_MAK} "LDFLAGS_cfg += " `pkg-config --libs xv`
echo "Using libXv: `pkg-config --modversion xv`"
else
echo "libXv not found. Unable to build with Xv support."
die
fi
fi
#
# libcdio_cdda
#
if enabled cdda; then
if pkg-config libcdio_cdda; then
echo >>${CONFIG_MAK} "LDFLAGS_cfg += " `pkg-config --libs libcdio_cdda`
echo "Using libcdio_cdda: `pkg-config --modversion libcdio_cdda`"
else
echo "libcdio_cdda not found. Unable to build with Audio CD support."
die
fi
fi
#
# libcddb
#
if enabled cddb; then
if pkg-config libcddb; then
echo >>${CONFIG_MAK} "LDFLAGS_cfg += " `pkg-config --libs libcddb`
echo "Using libcddb: `pkg-config --modversion libcddb`"
else
echo "libcddb not found. Unable to build with Audio CD metadata support."
die
fi
fi
#
# AVAHI
#
if enabled avahi; then
if pkg-config avahi-client; then
echo >>${CONFIG_MAK} "LDFLAGS_cfg += " `pkg-config --libs avahi-client`
echo >>${CONFIG_MAK} "CFLAGS_AVAHI += "`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
#
# polaressl
#
if enabled polarssl; then
enable librtmp
disable openssl
fi
#
# OpenSSL
#
if enabled openssl; then
if pkg-config openssl; then
echo >>${CONFIG_MAK} "LDFLAGS_cfg += " `pkg-config --libs openssl`
echo "Using openssl: `pkg-config --modversion openssl`"
elif pkg-config libssl; then
echo >>${CONFIG_MAK} "LDFLAGS_cfg += " `pkg-config --libs libssl`
echo "Using libssl: `pkg-config --modversion libssl`"
else
echo "libssl or openssl not found"
echo "To compile without it, configure with: --disable-ssl"
echo "To build with built-in version of polarssl, configure with --enable-polarssl"
die
fi
enable librtmp
fi
#
# VDPAU
#
if enabled vdpau; then
if pkg-config vdpau; then
echo >>${CONFIG_MAK} "LDFLAGS_cfg += " `pkg-config --libs vdpau`
echo "Using libvdpau: `pkg-config --modversion vdpau`"
else
echo "VDPAU not found"
echo "To compile without it, configure with: --disable-vdpau"
die
fi
fi
#
# NVCtrl
#
if enabled nvctrl; then
check_header "NVCtrl/NVCtrl.h" || fatal "nvctrl" "Missing include file NVCtrl/NVCtrl.h"
check_lib "XNVCtrl" || fatal "nvctrl" "Unable to link with libXNVCtrl"
echo >>${CONFIG_MAK} "LDFLAGS_cfg += -lXNVCtrl"
fi
#
# libgme
#
if enabled libgme; then
check_header "gme/gme.h" || fatal "libgme" "Missing include file gme/gme.h"
check_lib "gme" || fatal "libgme" "Unable to link with libgme"
echo >>${CONFIG_MAK} "LDFLAGS_cfg += -lgme"
fi
#
# libsidplay2 and libresid-builder
#
if enabled libsidplay2; then
check_header_cpp "sidplay/sidplay2.h" || fatal "libsidplay2" "Missing include file sidplay/sidplay2.h"
check_header_cpp "sidplay/builders/resid.h" || fatal "libsidplay2" "Missing include file sidplay/builders/resid.h"
echo >>${CONFIG_MAK} "LDFLAGS_cfg += -lsidplay2 -lresid-builder"
fi
#
# libspotify
#
LIBSPOTIFY_ARCH=""
case "$ARCH" in
x86_64)
LIBSPOTIFY_ARCH="Linux-x86_64"
;;
i686)
LIBSPOTIFY_ARCH="Linux-i686"
;;
esac
if [ "x$LIBSPOTIFY_ARCH" != "x" ] ; then
download_file https://developer.spotify.com/download/libspotify/libspotify-${LIBSPOTIFY_VERSION}-${LIBSPOTIFY_ARCH}-release.tar.gz libspotifytarball
tar -x -C "${BUILDDIR}" -f "$libspotifytarball"
P=${BUILDDIR}/libspotify-${LIBSPOTIFY_VERSION}-${LIBSPOTIFY_ARCH}-release
echo >>${CONFIG_H} "#define LIBSPOTIFY_PATH \"${P}\""
echo >>${CONFIG_MAK} "LIBSPOTIFY_PATH=${P}"
fi
libav_setup
#
# Finalize
#
echo
echo "Installation paths:"
echo " Prefix: ${prefix}"
echo " Binaries: ${bindir}"
echo " Man pages: ${mandir}"
echo " Data files: ${datadir}"
echo " Libraries: ${libdir}"
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} "libdir=\${DESTDIR}$libdir"
echo >>${CONFIG_MAK} LDFLAGS_cfg += -lpthread -lrt -ldl
eval datadirpath=${datadir}
echo >>${CONFIG_H} "#define SHOWTIME_DATADIR \"${datadirpath}\""
eval libdirpath=${libdir}
echo >>${CONFIG_H} "#define SHOWTIME_LIBDIR \"${libdirpath}\""
finalize
Jump to Line
Something went wrong with that request. Please try again.