]> git.sesse.net Git - mlt/commitdiff
sox/configure: add OS X and Debian (future?) pkg-config support to sox configuration
authorddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Wed, 5 Mar 2008 06:11:11 +0000 (06:11 +0000)
committerddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Wed, 5 Mar 2008 06:11:11 +0000 (06:11 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@1098 d19143bc-622f-0410-bfdd-b5b2a6649095

src/modules/sox/configure

index 104e874b15e33960f656892e0c24c9a5928d5dd3..5336c6906149c422f1f12479fe9c5186852b5cd8 100755 (executable)
@@ -2,6 +2,18 @@
 
 if [ "$help" != "1" ]
 then
+       # Determine how to lookup dependencies of executable for  OS
+       targetos=$(uname -s)
+       case $targetos in
+       Darwin)
+               LDD="otool -L"
+               ;;
+       Linux)
+               LDD="ldd"
+               ;;
+       *)
+               ;;
+       esac
 
        which libst-config > /dev/null 2>&1
        if [ $? -eq 0 ]
@@ -9,43 +21,50 @@ then
                disable_sox=0
 
                # determine if we need libsndfile
-               ldd $(which sox) | grep libsndfile > /dev/null
+               $LDD $(which sox) | grep libsndfile > /dev/null
                [ $? -eq 0 ] && libsndfile="-lsndfile"
 
                # determine if we need libsamplerate
-               ldd $(which sox) | grep libsamplerate > /dev/null
+               $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 ]
+               pkg-config sox
+               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)
-
-                       # determine if we need libsamplerate
-                       ldd "$sox" | grep libsamplerate > /dev/null
-                       [ $? -eq 0 ] && libsamplerate="-lsamplerate"
-
-                       echo "CFLAGS += -DSOX14 -I$soxdir/include" > config.mak
-                       echo "LDFLAGS += -L$soxdir/$LIBDIR -lsox -lsfx $libsamplerate" >> config.mak
+                       echo "CFLAGS += $(pkg-config --cflags sox)" > config.mak
+                       echo "LDFLAGS += $(pkg-config --libs sox)" > 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"
+
+                               echo "CFLAGS += -DSOX14 -I$soxdir/include" > config.mak
+                               echo "LDFLAGS += -L$soxdir/$LIBDIR -lsox -lsfx $libsamplerate" >> config.mak
+                       fi
                fi
        fi