#!/bin/bash # configure reset - resets probed config # configure static - build all builtin static libraries # configure shared - build only static libraries needed #edit global_config and set HAVE_var to override probe PROBED="STATIC_LIBRARIES HAVE_VIDEO4LINUX2 HAVE_DVB HAVE_GL" PROBED="$PROBED HAVE_DL HAVE_NUMA" if [ $# -gt 0 ]; then if [ "$1" = "reset" ]; then for v in $PROBED; do sed -e "s/^$v := .*/#$v := y/" -i global_config done echo "configuration reset" exit 0; fi if [ "$1" = "static" ]; then STATIC_LIBRARIES=y elif [ "$1" = "shared" ]; then STATIC_LIBRARIES=n else echo usage: "./configure " exit 1 fi fi if [ -z "$STATIC_LIBRARIES" ]; then STATIC_LIBRARIES=y fi for v in $PROBED; do vv=`grep "^$v := .*" global_config` if [ $? = 0 ]; then echo "config probe override: $vv" fi done # test for nasm OBJDIR=`uname -m` TOPDIR=`pwd` if [ $OBJDIR = i686 ]; then if [ ! -x /usr/bin/nasm -a ! -x /usr/local/bin/nasm ]; then echo " *** Nasm is required."; exit 1 fi fi if [ ! -x /usr/bin/yasm -a ! -x /usr/local/bin/yasm ]; then echo " *** Yasm is required."; exit 1 fi # test for videodev2.h rm -f a.out cat > conftest.c << EOF #include #include #include int main() { return 0; } EOF gcc conftest.c > /dev/null 2>&1 if [ -x a.out ]; then HAVE_VIDEO4LINUX2=y; else HAVE_VIDEO4LINUX2=n; fi # test for dvb rm -f a.out cat > conftest.c << EOF #include #include #include int main() { return 0; } EOF gcc conftest.c > /dev/null 2>&1 if [ -x a.out ]; then HAVE_DVB=y; else HAVE_DVB=n; fi rm -f a.out conftest.c # test for -msse support rm -f a.out cat > conftest.c << EOF int main() { return 0; } EOF gcc -msse conftest.c > /dev/null 2>&1 if [ -x a.out ]; then HAVE_GCC=y; else HAVE_GCC=n; fi rm -f a.out conftest.c if [ $HAVE_GCC = n ]; then echo " *** GCC 3.2.2 or greater is required. Download it from gcc.gnu.org"; exit 1 fi # test for OpenGL 2.0 rm -f a.out cat > conftest.c << EOF #include #include #include int main() { glUseProgram(0); return 0; } EOF gcc conftest.c -lGL -lGLU > /dev/null 2>&1 if [ -x a.out ]; then HAVE_GL=y; else HAVE_GL=n; fi rm -f a.out conftest.c # test for libdl rm -f a.out cat > conftest.c << EOF int main() { return 0; } EOF gcc conftest.c -ldl > /dev/null 2>&1 if [ -x a.out ]; then HAVE_DL=y; else HAVE_DL=n; fi rm -f a.out conftest.c # test for libnuma rm -f a.out cat > conftest.c << EOF int main() { return 0; } EOF gcc conftest.c -lnuma > /dev/null 2>&1 if [ -x a.out ]; then HAVE_NUMA=y; else HAVE_NUMA=n; fi rm -f a.out conftest.c # update global_config with probe data for v in $PROBED; do sed -e "s/^#$v := .*/$v := ${!v}/" -i global_config done # configure thirdparty build cd thirdparty case "$STATIC_LIBRARIES" in "y") ./configure static ;; "n") ./configure shared ;; *) echo "configuration failed"; exit 1;; esac if [ $? -ne 0 ]; then echo "Error in thirdparty configuration." exit 1 fi cd .. # configure libzmpeg3 build echo CONFIGURING LIBZMPEG3 cd libzmpeg3* && ./configure && cd .. if [ $? -ne 0 ]; then echo "Error in libzmpeg3 configuration." exit 1 fi # success echo "Configured successfully." echo "Type 'make' to build me." echo "If all ok, 'make install'";