]> git.sesse.net Git - mlt/blob - src/modules/avformat/configure
move binary modules to libdir - affects MLT_REPOSITORY
[mlt] / src / modules / avformat / configure
1 #!/bin/sh
2
3
4 if [ "$help" = "1" ]
5 then
6         cat << EOF
7 FFMPEG/avformat options:
8
9   --avformat-svn          - Obtain ffmpeg from Subversion
10   --avformat-svn-extra    - Add extra configure options for --avformat-svn
11   --avformat-shared=path  - Link against a shared installation of ffmpeg (default)
12   --avformat-static=path  - Link against a static ffmpeg dev tree
13   --avformat-ldextra=libs - Provide additional libs to link with
14   --avformat-suffix=suff  - Specify a custom suffix for an ffmpeg shared build
15   --avformat-swscale      - Use ffmpeg libswcale instead of img_convert
16
17 EOF
18
19 else
20         targetos=$(uname -s)
21         case $targetos in
22         Darwin)
23                 export LIBSUF=.dylib
24                 ;;
25         Linux)
26                 export LIBSUF=.so
27                 ;;
28         *)
29                 ;;
30         esac
31                 
32         bits=$(uname -m)
33         case $bits in
34         x86_64)
35                 [ -d /usr/lib/lib64 ] && export LIBDIR=lib64 || export LIBDIR=lib
36                 ;;
37         *)
38                 export LIBDIR=lib
39                 ;;
40         esac
41
42         echo > config.mak
43
44         export static_ffmpeg=
45         export shared_ffmpeg=`which ffmpeg`
46         export extra_libs=
47         export svn_ffmpeg=
48         export svn_ffmpeg_extra=
49         export avformat_suffix=
50         export swscale=
51
52         if [ "$shared_ffmpeg" != "" -a -f "$shared_ffmpeg" ]
53         then
54                 # Chop ffmpeg 
55                 shared_ffmpeg=`dirname $shared_ffmpeg`
56                 # Chop bin 
57                 shared_ffmpeg=`dirname $shared_ffmpeg`
58         fi
59
60         for i in "$@"
61         do
62                 case $i in
63                         --avformat-static=* )   static_ffmpeg="${i#--avformat-static=}" ;;
64                         --avformat-shared=* )   shared_ffmpeg="${i#--avformat-shared=}" ;;
65                         --avformat-ldextra=* )  extra_libs="${i#--avformat-ldextra=}" ;;
66                         --avformat-svn )                svn_ffmpeg=true ;;
67                         --avformat-svn-extra=* ) svn_ffmpeg_extra="${i#--avformat-svn-extra=}" ;;
68                         --avformat-cvs )                svn_ffmpeg=true ;;
69                         --avformat-suffix=* )   avformat_suffix="${i#--avformat-suffix=}" ;;
70                         --avformat-swscale )    swscale=true ;;
71                         --avformat-swscaler )   swscale=true ;;
72                 esac
73         done
74
75         if [ "$svn_ffmpeg" != "" ]
76         then
77                 if [ "$gpl" = "true" ]
78                 then
79                         enable_gpl="--enable-gpl"
80                         if [ "$swscale" != "" ]
81                         then
82                                         enable_swscale="--enable-swscaler"
83                                         echo "SWSCALE=1" >> config.mak
84                         fi
85                 elif [ "$swscale" != "" ]
86                 then
87                         echo
88                         echo "ERROR        ERROR        ERROR        ERROR        ERROR        ERROR"
89                         echo "--enable-gpl is required to use --avformat-swscale with --avformat-svn!"
90                         echo
91                         exit
92                 fi
93                 if [ ! -d "ffmpeg" ]
94                 then
95                         echo
96                         echo "Checking out ffmpeg/avformat - no password required"
97                         echo
98                         svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
99                 fi
100                 [ -d "ffmpeg" ] && ( cd ffmpeg ; ./configure $enable_gpl $enable_swscale $svn_ffmpeg_extra )
101                 #[ ! -f "ffmpeg/ffmpeg.patch" ] && ( cd ffmpeg ; cp ../ffmpeg.patch . ; patch -p0 < ffmpeg.patch )
102                 echo "CFLAGS+=-I`pwd`/ffmpeg/libavformat -I`pwd`/ffmpeg/libavcodec -I`pwd`/ffmpeg/libavutil -I`pwd`/ffmpeg/libswscale" >> config.mak
103                 echo "LDFLAGS+=-L`pwd`/ffmpeg/libavformat -L`pwd`/ffmpeg/libavcodec -L`pwd`/ffmpeg/libavutil -L`pwd`/ffmpeg/libswscale" >> config.mak
104                 [ $targetos = "Darwin" ] &&
105                         echo "LDFLAGS+=-single_module" >> config.mak
106                 echo "LOCAL_FFMPEG=1" >> config.mak
107                 extra_libs="$extra_libs -lz"
108         elif [ "$static_ffmpeg" != "" ]
109         then 
110                 if [ -d "$static_ffmpeg" ]
111                 then
112                         echo "CFLAGS+=-I$static_ffmpeg/libavformat -I$static_ffmpeg/libavcodec -I$static_ffmpeg/libavutil" >> config.mak
113                         echo "LDFLAGS+=-L$static_ffmpeg/libavformat -L$static_ffmpeg/libavcodec -L$static_ffmpeg/libavutil" >> config.mak
114                         [ $targetos = "Darwin" ] &&
115                                 echo "LDFLAGS+=-single_module" >> config.mak
116                         if [ "$swscale" != "" ]
117                         then
118                                 echo "CFLAGS+=-I$static_ffmpeg/libswscale" >> config.mak
119                                 echo "LDFLAGS+=-L$static_ffmpeg/libswscale" >> config.mak
120                                 echo "SWSCALE=1" >> config.mak
121                         fi
122                 else
123                         echo "avformat: Invalid path specified: $static_ffmpeg"
124                         touch ../disable-avformat
125                         echo 0
126                 fi
127         else 
128                 if [ -d "$shared_ffmpeg/include/ffmpeg" -a -e "$shared_ffmpeg/$LIBDIR/libavformat$avformat_suffix$LIBSUF" ]
129                 then
130                         echo "CFLAGS+=-I$shared_ffmpeg/include/ffmpeg " >> config.mak
131                         echo "LDFLAGS+=-L$shared_ffmpeg/$LIBDIR" >> config.mak
132                         [ "$swscale" != "" ] && echo "SWSCALE=1" >> config.mak
133                 else
134                         echo "avformat: No build environment found. "
135                         echo "          Try configuring mlt with --avformat-svn."
136                         touch ../disable-avformat
137                         exit 0
138                 fi
139         fi
140
141         echo "EXTRA_LIBS=$extra_libs" >> config.mak
142         echo "AVFORMAT_SUFFIX=$avformat_suffix" >> config.mak
143
144 cat << EOF >> ../producers.dat
145 avformat                libmltavformat$LIBSUF
146 EOF
147
148 cat << EOF >> ../filters.dat
149 avdeinterlace   libmltavformat$LIBSUF
150 avresample              libmltavformat$LIBSUF
151 avcolour_space  libmltavformat$LIBSUF
152 EOF
153
154 cat << EOF >> ../consumers.dat
155 avformat                libmltavformat$LIBSUF
156 EOF
157
158 fi
159