#!/bin/sh INSTALL_DIR=/usr/lib/ao/plugins-2/ HAVE_ROAR=false while [ "$1" != '' ] do case "$1" in --install-dir|--inst-dir) INSTALL_DIR="$2" shift; ;; --pkg-config) PKG_CONFIG="$2" shift; ;; --force-have-roar) HAVE_ROAR=true ;; --help|-h) cat << EOF Usage: ./configure [OPTIONS]... Options: --help - Show this help --inst-dir DIR - Install dir --force-have-roar - Force to assume libroar is ok --pkg-config PKGCONF - Set filename for pkg-config EOF exit 0 ;; *) echo 'Unknown option. Try ./configure --help' exit 2 esac shift; done on_error () { rm -f Makefile.conf exit 1; } echo -n 'testing for C compiler... ' CC=$(which gcc cc 2> /dev/null | head -n 1) if [ -x "$CC" ] then echo $CC else echo no. on_error; fi echo -n "checking for pkg-config... " if [ "$PKG_CONFIG" = '' ] then PKG_CONFIG=$(which pkg-config false 2> /dev/null | grep ^/ | head -n 1) if $PKG_CONFIG --help > /dev/null 2> /dev/null then echo $PKG_CONFIG else PKG_CONFIG='' echo no on_error; fi else echo $PKG_CONFIG '(forced)' fi echo -n 'testing for libao... ' cat > tests.c << EOF #include #include int main (void) { return 0; } EOF if [ "$PKG_CONFIG" = '' ] then AO_LIBS='' AO_CFLAGS='' else AO_LIBS=`pkg-config --libs ao` AO_CFLAGS=`pkg-config --cflags ao` fi if [ "$AO_LIBS" = '' -a "$AO_CFLAGS" = '' ] then AO_LIBS='-lao' AO_CFLAGS='' fi $CC $AO_LIBS $AO_CFLAGS -o tests tests.c 2> /dev/null ./tests 2> /dev/null if [ "$?" = '0' ] then echo yes else echo no. on_error fi echo -n 'testing for libroar... ' if $HAVE_ROAR then echo 'yes (forced)' else cat > tests.c << EOF #include int main (void) { return 0; } EOF $CC -o tests tests.c -lroar 2> /dev/null ./tests 2> /dev/null if [ "$?" = '0' ] then echo yes else echo no. on_error fi fi rm -f tests tests.c echo creating Makefile.conf... { echo "CC=$CC" echo "INSTALL_DIR=$INSTALL_DIR" echo echo "AO_CFLAGS=$AO_CFLAGS" echo "AO_LIBS=$AO_LIBS" } > Makefile.conf #ll