Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 681 lines (566 sloc) 14.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"
source support/configure.inc
CPU=generic
ARCH=`uname -m`
PREFIX=/usr/local
show_help(){
common_help
echo " --prefix=PREFIX Install in PREFIX [$PREFIX]"
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 " --release Stage for release"
echo " --enable-spotify=KEYFILE Compile support for Spotify (R) Core"
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 libspotify_load_runtime
enable dbus
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 font_liberation
#enable libxrandr -- code does not really work yet
for opt do
optval="${opt#*=}"
case "$opt" in
--prefix=*) PREFIX="$optval"
;;
--cpu=*) CPU="$optval"
;;
--help) show_help
;;
--release)
enable release
enable embedded_resources
;;
--cc=*) CC="$optval"
;;
--enable-all)
enable libgme
enable libsmbclient
enable libsidplay2
;;
--enable-spotify=*) SPOTIFY_KEYFILE="$optval"
;;
--glw-frontend=*) GLWFRONTEND="$optval"
;;
--pkg-config-path=*) export PKG_CONFIG_PATH="$optval"
;;
*)
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
#
# c compiler
#
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 [ "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 [ "x$CXX" != "x" ]; then
echo >${CONFIG_MAK} "CXX=$CXX"
else
CXX=c++
fi
if checkcxx; then
echo "Using C++ compiler: $CXX"
else
echo "C++ compiler ($CXX) is not working"
die
fi
echo >>${CONFIG_MAK} $CC_CONFIG_MAK
#
# libavcodec
#
if pkg-config --atleast-version 53.0.0 libavcodec; then
echo >>${CONFIG_MAK} "LDFLAGS_cfg += " `pkg-config --libs libavcodec`
echo >>${CONFIG_MAK} "CFLAGS_cfg += " `pkg-config --cflags libavcodec`
echo "Using libavcodec: `pkg-config --modversion libavcodec`"
else
echo "libavcodec 53.0.0 or newer not found."
die
fi
#
# libavformat
#
if pkg-config --atleast-version 53.0.0 libavformat; then
echo >>${CONFIG_MAK} "LDFLAGS_cfg += " `pkg-config --libs libavformat`
echo >>${CONFIG_MAK} "CFLAGS_cfg += " `pkg-config --cflags libavformat`
echo "Using libavformat: `pkg-config --modversion libavformat`"
else
echo "libavformat 53.0.0 or newer not found."
die
fi
#
# libavutil
#
if pkg-config --atleast-version 50.0.0 libavutil; then
echo >>${CONFIG_MAK} "LDFLAGS_cfg += " `pkg-config --libs libavutil`
echo >>${CONFIG_MAK} "CFLAGS_cfg += " `pkg-config --cflags libavutil`
echo "Using libavutil: `pkg-config --modversion libavutil`"
else
echo "libavutil 51.0.0 or newer not found."
die
fi
#
# libswscale
#
if pkg-config --atleast-version 0.11.0 libswscale; then
echo >>${CONFIG_MAK} "LDFLAGS_cfg += " `pkg-config --libs libswscale`
echo >>${CONFIG_MAK} "CFLAGS_cfg += " `pkg-config --cflags libswscale`
echo "Using libswscale: `pkg-config --modversion libswscale`"
else
echo "libswscale 0.11.0 or newer not found."
die
fi
#
# 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
#
# D-Bus
#
if enabled dbus; then
if pkg-config dbus-1; then
echo >>${CONFIG_MAK} "LDFLAGS_cfg += " `pkg-config --libs dbus-1`
echo >>${CONFIG_MAK} "CFLAGS_DBUS += " `pkg-config --cflags dbus-1`
echo "Using libdbus-1: `pkg-config --modversion dbus-1`"
else
echo "libdbus-1 not found. Unable to build with D-Bus 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
#
# libopenspc
#
if enabled libopenspc; then
check_header "openspc.h" || fatal "openspc" "Missing include file openspc.h"
check_lib "openspc" || fatal "openspc" "Unable to link with libopenspc"
echo >>${CONFIG_MAK} "LDFLAGS_cfg += -lopenspc"
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
#
# libsmbclient
#
if enabled libsmbclient; then
check_header "libsmbclient.h" || fatal "libsmbclient" "Missing include file libsmbclient.h"
check_lib "smbclient" || fatal "libsmbclient" "Unable to link with libsmbclient"
echo >>${CONFIG_MAK} "LDFLAGS_cfg += -lsmbclient"
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
#
# Configure paths, etc
#
if disabled release; then
echo Development build.
echo The generated binary will contain compiled-in paths to
echo the current build tree. If you plan to install the binary,
echo please reconfigure with '--release'.
fi
#
# Finalize
echo >>${CONFIG_MAK} INSTALLPREFIX=$PREFIX
echo >>${CONFIG_MAK} LDFLAGS_cfg += -lpthread -lrt -ldl
finalize
Jump to Line
Something went wrong with that request. Please try again.