FFMPEG revisions to match current CVS (part 1)
[melted] / 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
14 EOF
15
16 else
17         targetos=$(uname -s)
18         case $targetos in
19         Darwin)
20                 export LIBSUF=.dylib
21                 ;;
22         Linux)
23                 export LIBSUF=.so
24                 ;;
25         *)
26                 ;;
27         esac
28                 
29         echo > config.mak
30
31         export static_ffmpeg=
32         export shared_ffmpeg=`whereis ffmpeg | cut -f 2 -d' '`
33         export extra_libs=
34         export cvs_ffmpeg=
35
36         if [ "$shared_ffmpeg" != "" ]
37         then
38                 # Chop ffmpeg 
39                 shared_ffmpeg=`dirname $shared_ffmpeg`
40                 # Chop bin 
41                 shared_ffmpeg=`dirname $shared_ffmpeg`
42         fi
43
44         for i in "$@"
45         do
46                 case $i in
47                         --avformat-static=* )   static_ffmpeg="${i#--avformat-static=}" ;;
48                         --avformat-shared=* )   shared_ffmpeg="${i#--avformat-shared=}" ;;
49                         --avformat-ldextra=* )  extra_libs="${i#--avformat-ldextra=}" ;;
50                         --avformat-cvs )                cvs_ffmpeg=true ;;
51                 esac
52         done
53
54         if [ "$cvs_ffmpeg" != "" ]
55         then
56                 [ ! -d "ffmpeg" ] && cvs -z9 -d:pserver:anonymous@mplayerhq.hu:/cvsroot/ffmpeg co ffmpeg
57                 [ -d "ffmpeg" ] && ( cd ffmpeg ; ./configure --enable-shared )
58                 #[ ! -f "ffmpeg/ffmpeg.patch" ] && ( cd ffmpeg ; cp ../ffmpeg.patch . ; patch -p0 < ffmpeg.patch )
59                 echo "CFLAGS+=-I`pwd`/ffmpeg/libavformat -I`pwd`/ffmpeg/libavcodec" >> config.mak
60                 echo "LOCAL_FFMPEG=1" >> config.mak
61                 extra_libs="$extra_libs -lz"
62         elif [ "$static_ffmpeg" != "" ]
63         then 
64                 if [ -d "$static_ffmpeg" ]
65                 then
66                         echo "CFLAGS+=-I$static_ffmpeg/libavformat -I$static_ffmpeg/libavcodec" >> config.mak
67                         echo "LDFLAGS+=-L$static_ffmpeg/libavformat -L$static_ffmpeg/libavcodec" >> config.mak
68                         [ $targetos = "Darwin" ] &&
69                                 echo "LDFLAGS+=-single_module" >> config.mak
70                 else
71                         echo "avformat: Invalid path specified: $static_ffmpeg"
72                         touch ../disable-avformat
73                         echo 0
74                 fi
75         else 
76                 if [ -d "$shared_ffmpeg/include/ffmpeg" -a -f "$shared_ffmpeg/lib/libavformat.so" ]
77                 then
78                         echo "CFLAGS+=-I$shared_ffmpeg/include/ffmpeg " >> config.mak
79                         echo "LDFLAGS+=-L$shared_ffmpeg/lib" >> config.mak
80                 else
81                         echo "avformat: No build environment found. "
82                         echo "          Try configuring mlt with --avformat-cvs."
83                         touch ../disable-avformat
84                         exit 0
85                 fi
86         fi
87
88         echo "EXTRA_LIBS=$extra_libs" >> config.mak
89
90 cat << EOF >> ../producers.dat
91 avformat                libmltffmpeg$LIBSUF
92 EOF
93
94 cat << EOF >> ../filters.dat
95 avdeinterlace   libmltffmpeg$LIBSUF
96 avresample              libmltffmpeg$LIBSUF
97 avcolour_space  libmltffmpeg$LIBSUF
98 EOF
99
100 cat << EOF >> ../consumers.dat
101 avformat                libmltffmpeg$LIBSUF
102 EOF
103
104 fi
105