X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmodules%2Fsox%2Fconfigure;h=c1790be0c6c2ee8506a90d420791d4eb5fd588da;hb=958a967d28fa1bb484deb288ba4bc2d08286d0a1;hp=15aa439d13e07805af207ae7d0ea01d8fb5924b0;hpb=42e3082637998150a8dc0251c5b846f78e1d4772;p=mlt diff --git a/src/modules/sox/configure b/src/modules/sox/configure index 15aa439d..c1790be0 100755 --- a/src/modules/sox/configure +++ b/src/modules/sox/configure @@ -2,9 +2,83 @@ 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|NetBSD) + LDD="ldd" + ;; + *) + ;; + esac -cat << EOF >> ../filters.dat -sox libmltsox.so -EOF + pkg-config sox + if [ $? -eq 0 ] + then + disable_sox=0 + 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 + which libst-config > /dev/null 2>&1 + if [ $? -eq 0 ] + then + 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 + + if [ "$disable_sox" != "0" ] + then + echo "- sox not found: disabling" + touch ../disable-sox + fi + + exit 0 fi