X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Fsox%2Fconfigure;h=9df730af6e8e259d65cef0820bc18cba7d7a68cd;hb=e89b21b07607ae485f56b32f3e67f83f528f2ae6;hp=c29d40a1762d2a8eec829f18bc3b08b068276b64;hpb=16b6d374cf80004b192aae74a55b0452c7ee809d;p=melted diff --git a/src/modules/sox/configure b/src/modules/sox/configure index c29d40a..9df730a 100755 --- a/src/modules/sox/configure +++ b/src/modules/sox/configure @@ -2,36 +2,75 @@ if [ "$help" != "1" ] then + # Determine how to lookup dependencies of executable for OS + targetos=$(uname -s) + case $targetos in + Darwin) + LDD="otool -L" + ;; + Linux|FreeBSD) + LDD="ldd" + ;; + *) + ;; + esac - which libst-config > /dev/null 2>&1 + pkg-config sox if [ $? -eq 0 ] then disable_sox=0 - echo "CFLAGS += $(libst-config --cflags) -I../../" > config.mak - echo "LDFLAGS += -lst $(libst-config --libs)" >> config.mak + echo "CFLAGS += $(pkg-config --cflags sox) -I$(pkg-config --variable=prefix sox)" > config.mak + echo "LDFLAGS += $(pkg-config --libs sox)" >> config.mak + [ $(pkg-config --modversion sox | cut -d. -f1) -gt 13 ] && echo "CFLAGS += -DSOX14" >> config.mak else - sox --version 2> /dev/null | grep 'v14.' > /dev/null - disable_sox=$? - if [ $disable_sox -eq 0 ] + which libst-config > /dev/null 2>&1 + if [ $? -eq 0 ] then - LIBDIR=lib - bits=$(uname -m) - case $bits in - x86_64) - [ -d /usr/lib/lib64 ] && export LIBDIR=lib64 || export LIBDIR=lib - ;; - *) - export LIBDIR=lib - ;; - esac - - sox=$(which sox) - # chop sox - soxdir=$(dirname $sox) - # chop bin - soxdir=$(dirname $soxdir) - echo "CFLAGS += -DSOX14 -I$soxdir/include" > config.mak - echo "LDFLAGS += -L$soxdir/$LIBDIR -lsox -lsfx" >> config.mak + disable_sox=0 + + # determine if we need libsndfile + $LDD $(which sox) | grep libsndfile > /dev/null + [ $? -eq 0 ] && libsndfile="-lsndfile" + + # determine if we need libsamplerate + $LDD $(which sox) | grep libsamplerate > /dev/null + [ $? -eq 0 ] && libsamplerate="-lsamplerate" + + echo "CFLAGS += $(libst-config --cflags) -I../.." > config.mak + echo "LDFLAGS += -lst $(libst-config --libs) $libsndfile $libsamplerate" >> config.mak + else + sox --version 2> /dev/null | grep 'v14.' > /dev/null + disable_sox=$? + if [ $disable_sox -eq 0 ] + then + LIBDIR=lib + bits=$(uname -m) + case $bits in + x86_64) + [ -d /usr/lib/lib64 ] && export LIBDIR=lib64 || export LIBDIR=lib + ;; + *) + export LIBDIR=lib + ;; + esac + + sox=$(which sox) + # chop sox + soxdir=$(dirname $sox) + # chop bin + soxdir=$(dirname $soxdir) + + # determine if we need libsamplerate + $LDD "$sox" | grep libsamplerate > /dev/null + [ $? -eq 0 ] && libsamplerate="-lsamplerate" + + # determine if we need libsfx + $LDD $(which sox) | grep libsfx > /dev/null + [ $? -eq 0 ] && libsfx="-lsfx" + + echo "CFLAGS += -DSOX14 -I$soxdir/include" > config.mak + echo "LDFLAGS += -L$soxdir/$LIBDIR -lsox $libsfx $libsamplerate" >> config.mak + fi fi fi