]> git.sesse.net Git - mlt/blob - src/modules/avformat/configure
src/framework/mlt_frame.c
[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-cvs          - Obtain ffmpeg from CVS
10   --avformat-shared=path  - Link against a shared installation of ffmpeg (default)
11   --avformat-static=path  - Link against a static ffmpeg dev tree
12   --avformat-ldextra=libs - Provide additional libs to link with
13   --avformat-suffix=suff  - Specify a custom suffix for an ffmpeg shared build
14
15 EOF
16
17 else
18         targetos=$(uname -s)
19         case $targetos in
20         Darwin)
21                 export LIBSUF=.dylib
22                 ;;
23         Linux)
24                 export LIBSUF=.so
25                 ;;
26         *)
27                 ;;
28         esac
29                 
30         echo > config.mak
31
32         export static_ffmpeg=
33         export shared_ffmpeg=`which ffmpeg`
34         export extra_libs=
35         export cvs_ffmpeg=
36         export avformat_suffix=
37
38         if [ "$shared_ffmpeg" != "" ]
39         then
40                 # Chop ffmpeg 
41                 shared_ffmpeg=`dirname $shared_ffmpeg`
42                 # Chop bin 
43                 shared_ffmpeg=`dirname $shared_ffmpeg`
44         fi
45
46         for i in "$@"
47         do
48                 case $i in
49                         --avformat-static=* )   static_ffmpeg="${i#--avformat-static=}" ;;
50                         --avformat-shared=* )   shared_ffmpeg="${i#--avformat-shared=}" ;;
51                         --avformat-ldextra=* )  extra_libs="${i#--avformat-ldextra=}" ;;
52                         --avformat-cvs )                cvs_ffmpeg=true ;;
53                         --avformat-suffix=* )   avformat_suffix="${i#--avformat-suffix=}" ;;
54                 esac
55         done
56
57         if [ "$cvs_ffmpeg" != "" ]
58         then
59                 [ ! -d "ffmpeg" ] && ( 
60                         echo
61                         echo "Checking out ffmpeg/avformat - no password required"
62                         echo
63                         cvs -z9 -d:pserver:anonymous@mplayerhq.hu:/cvsroot/ffmpeg login
64                         cvs -z9 -d:pserver:anonymous@mplayerhq.hu:/cvsroot/ffmpeg co ffmpeg
65                 )
66                 [ -d "ffmpeg" ] && ( cd ffmpeg ; ./configure --enable-shared --build-suffix="$avformat_suffix" )
67                 #[ ! -f "ffmpeg/ffmpeg.patch" ] && ( cd ffmpeg ; cp ../ffmpeg.patch . ; patch -p0 < ffmpeg.patch )
68                 echo "CFLAGS+=-I`pwd`/ffmpeg/libavformat -I`pwd`/ffmpeg/libavcodec -I`pwd`/ffmpeg/libavutil" >> config.mak
69                 echo "LOCAL_FFMPEG=1" >> config.mak
70                 extra_libs="$extra_libs -lz"
71         elif [ "$static_ffmpeg" != "" ]
72         then 
73                 if [ -d "$static_ffmpeg" ]
74                 then
75                         echo "CFLAGS+=-I$static_ffmpeg/libavformat -I$static_ffmpeg/libavcodec -I$static_ffmpeg/libavutil" >> config.mak
76                         echo "LDFLAGS+=-L$static_ffmpeg/libavformat -L$static_ffmpeg/libavcodec -L$static_ffmpeg/libavutil" >> config.mak
77                         [ $targetos = "Darwin" ] &&
78                                 echo "LDFLAGS+=-single_module" >> config.mak
79                 else
80                         echo "avformat: Invalid path specified: $static_ffmpeg"
81                         touch ../disable-avformat
82                         echo 0
83                 fi
84         else 
85                 if [ -d "$shared_ffmpeg/include/ffmpeg" -a -f "$shared_ffmpeg/lib/libavformat$LIBSUF" ]
86                 then
87                         echo "CFLAGS+=-I$shared_ffmpeg/include/ffmpeg " >> config.mak
88                         echo "LDFLAGS+=-L$shared_ffmpeg/lib" >> config.mak
89                 else
90                         echo "avformat: No build environment found. "
91                         echo "          Try configuring mlt with --avformat-cvs."
92                         touch ../disable-avformat
93                         exit 0
94                 fi
95         fi
96
97         echo "EXTRA_LIBS=$extra_libs" >> config.mak
98         echo "AVFORMAT_SUFFIX=$avformat_suffix" >> config.mak
99
100 cat << EOF >> ../producers.dat
101 avformat                libmltavformat$LIBSUF
102 EOF
103
104 cat << EOF >> ../filters.dat
105 avdeinterlace   libmltavformat$LIBSUF
106 avresample              libmltavformat$LIBSUF
107 avcolour_space  libmltavformat$LIBSUF
108 EOF
109
110 cat << EOF >> ../consumers.dat
111 avformat                libmltavformat$LIBSUF
112 EOF
113
114 fi
115