]> git.sesse.net Git - mlt/blob - src/modules/sox/configure
9df730af6e8e259d65cef0820bc18cba7d7a68cd
[mlt] / src / modules / sox / configure
1 #!/bin/sh
2
3 if [ "$help" != "1" ]
4 then
5         # Determine how to lookup dependencies of executable for  OS
6         targetos=$(uname -s)
7         case $targetos in
8         Darwin)
9                 LDD="otool -L"
10                 ;;
11         Linux|FreeBSD)
12                 LDD="ldd"
13                 ;;
14         *)
15                 ;;
16         esac
17
18         pkg-config sox
19         if [ $? -eq 0 ]
20         then
21                 disable_sox=0
22                 echo "CFLAGS += $(pkg-config --cflags sox) -I$(pkg-config --variable=prefix sox)" > config.mak
23                 echo "LDFLAGS += $(pkg-config --libs sox)" >> config.mak
24                 [ $(pkg-config --modversion sox | cut -d. -f1) -gt 13 ] && echo "CFLAGS += -DSOX14" >> config.mak
25         else
26                 which libst-config > /dev/null 2>&1
27                 if [ $? -eq 0 ]
28                 then
29                         disable_sox=0
30
31                         # determine if we need libsndfile
32                         $LDD $(which sox) | grep libsndfile > /dev/null
33                         [ $? -eq 0 ] && libsndfile="-lsndfile"
34
35                         # determine if we need libsamplerate
36                         $LDD $(which sox) | grep libsamplerate > /dev/null
37                         [ $? -eq 0 ] && libsamplerate="-lsamplerate"
38
39                         echo "CFLAGS += $(libst-config --cflags) -I../.." > config.mak
40                         echo "LDFLAGS += -lst $(libst-config --libs) $libsndfile $libsamplerate" >> config.mak
41                 else
42                         sox --version 2> /dev/null | grep 'v14.' > /dev/null
43                         disable_sox=$?
44                         if [ $disable_sox -eq 0 ]
45                         then
46                                 LIBDIR=lib
47                                 bits=$(uname -m)
48                                 case $bits in
49                                 x86_64)
50                                         [ -d /usr/lib/lib64 ] && export LIBDIR=lib64 || export LIBDIR=lib
51                                         ;;
52                                 *)
53                                         export LIBDIR=lib
54                                         ;;
55                                 esac
56
57                                 sox=$(which sox)
58                                 # chop sox
59                                 soxdir=$(dirname $sox)
60                                 # chop bin
61                                 soxdir=$(dirname $soxdir)
62
63                                 # determine if we need libsamplerate
64                                 $LDD "$sox" | grep libsamplerate > /dev/null
65                                 [ $? -eq 0 ] && libsamplerate="-lsamplerate"
66
67                                 # determine if we need libsfx
68                                 $LDD $(which sox) | grep libsfx  > /dev/null
69                                 [ $? -eq 0 ] && libsfx="-lsfx"
70
71                                 echo "CFLAGS += -DSOX14 -I$soxdir/include" > config.mak
72                                 echo "LDFLAGS += -L$soxdir/$LIBDIR -lsox $libsfx $libsamplerate" >> config.mak
73                         fi
74                 fi
75         fi
76
77         if [ "$disable_sox" != "0" ]
78         then
79                 echo "- sox not found: disabling"
80                 touch ../disable-sox
81         fi
82
83         exit 0
84 fi