2 dnl Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010,
3 dnl 2011 Free Software Foundation, Inc.
5 dnl This program is free software; you can redistribute it and/or modify
6 dnl it under the terms of the GNU General Public License as published by
7 dnl the Free Software Foundation; either version 3 of the License, or
8 dnl (at your option) any later version.
10 dnl This program is distributed in the hope that it will be useful,
11 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 dnl GNU General Public License for more details.
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program; if not, write to the Free Software
16 dnl Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 AC_DEFUN([GNASH_PATH_FFMPEG],
21 dnl Backup LIBS and CFLAGS vars, we'll add user-specified dirs there
23 backupCFLAGS="$CFLAGS"
28 dnl If the user specify an path to include headers from, we assume it's the full
29 dnl path to the header file, and not the top level path without the 'ffmpeg' node
30 dnl of the path. This is made more fun my the way ffmpeg changes directory layout
33 dnl ffmpeg_top_level - the top level directory without the ffmpeg specific part.
34 dnl ie... /usr/local/include/ffmpeg becomes /usr/local/include, and
35 dnl /usr/local/include/ffmpeg/libavcodec becomes /usr/local/include/ffmpeg.
36 dnl avcode_h - stores the path and file name for avcodec.h, which is used later on
37 dnl in this macro to extract the version number of ffmpeg we're using.
38 AC_ARG_WITH(ffmpeg_incl, AC_HELP_STRING([--with-ffmpeg-incl], [directory where avcodec.h is]), with_ffmpeg_incl=${withval})
39 AC_CACHE_VAL(ac_cv_path_ffmpeg_incl,[
40 if test x"${with_ffmpeg_incl}" != x ; then
41 dnl top level path for include files minus the last directory from the user
43 ffmpeg_top_incl=`dirname ${with_ffmpeg_incl}`
44 if test -f ${with_ffmpeg_incl}/avcodec.h; then
45 ac_cv_path_ffmpeg_incl="-I`(cd ${ffmpeg_top_incl}; pwd)`"
46 if test -f ${with_ffmpeg_incl}/version.h && $EGREP LIBAVCODEC_VERSION ${with_ffmpeg_incl}/version.h >/dev/null; then
47 avcodec_h=${with_ffmpeg_incl}/version.h
49 avcodec_h=${with_ffmpeg_incl}/avcodec.h
52 AC_MSG_ERROR([${with_ffmpeg_incl} directory does not contain the avcodec.h header])
54 if test -f ${with_ffmpeg_incl}/version.h; then
55 avcodec_version_h=${with_ffmpeg_incl}/version.h
60 dnl Try to find avcodec.h ourselves
61 if test x${ffmpeg_top_incl} = x; then
62 AC_MSG_CHECKING([location of avcodec.h])
63 dnl Try PKG_CONFIG if available
64 if test x"$PKG_CONFIG" != x; then dnl {
65 if $PKG_CONFIG --exists libavcodec; then dnl {
66 dnl Some systems return /usr/include/ffmpeg, others /usr/include.
67 dnl We use #include <ffmpeg/avcodec.h> everywhere so weed out funny
68 dnl values into the short form.
69 ffmpeg_pkg=`$PKG_CONFIG --cflags-only-I libavcodec`
70 ffmpeg_top_incl=`echo ${ffmpeg_pkg} | sed -e 's:-I::'`
71 dnl Make sure a header file really exists in the given path.
72 dnl Ubuntu like the headers here in the top level ffmpeg directory.
73 for i in "" ffmpeg libavcodec ffmpeg/libavcodec; do
74 if test -f ${ffmpeg_top_incl}/${i}/avcodec.h; then
75 ac_cv_path_ffmpeg_incl="-I`(cd ${ffmpeg_top_incl}; pwd)`"
76 if test -f ${ffmpeg_top_incl}/${i}/version.h && $EGREP LIBAVCODEC_VERSION ${ffmpeg_top_incl}/${i}/version.h 2>/dev/null; then
77 avcodec_h="${ffmpeg_top_incl}/${i}/version.h"
79 avcodec_h="${ffmpeg_top_incl}/${i}/avcodec.h"
81 if test -f ${ffmpeg_top_incl}/${i}/version.h; then
82 avcodec_version_h=${ffmpeg_top_incl}/${i}/version.h
91 dnl if pkg-config doesn't have the values we want, or they're plain wrong, look
92 dnl in several common places ourselves. Note that the variable ffmpeg_top_incl
93 dnl contains the value of the top level path that has been found.
94 if test x"${ac_cv_path_ffmpeg_incl}" = x ; then
95 newlist="/usr/include/ffmpeg $incllist"
96 for ffmpeg_top_incl in $newlist; do
97 for i in ffmpeg libavcodec ffmpeg/libavcodec; do
98 if test -f ${ffmpeg_top_incl}/${i}/avcodec.h; then
99 ac_cv_path_ffmpeg_incl="-I`(cd ${ffmpeg_top_incl}/${i}; pwd)`"
100 if test -f ${ffmpeg_top_incl}/${i}/version.h && $EGREP LIBAVCODEC_VERSION ${ffmpeg_top_incl}/${i}/version.h 2>/dev/null; then
101 avcodec_h=${ffmpeg_top_incl}/${i}/version.h
103 avcodec_h=${ffmpeg_top_incl}/${i}/avcodec.h
105 if test -f ${ffmpeg_top_incl}/${i}/version.h; then
106 avcodec_version_h=${ffmpeg_top_incl}/${i}/version.h
111 if test x"${ac_cv_path_ffmpeg_incl}" != x ; then
117 dnl Because the avcodec.h header file might be found by any one of
118 dnl the above ways, we set the version macros after all those tests
119 dnl are done so we only have to do it once.
120 newer_ffmpeg=`echo ${avcodec_h} | grep -c libavcodec`
121 if test ${newer_ffmpeg} -eq 0; then
122 AC_DEFINE(HAVE_FFMPEG_AVCODEC_H, 1, [Define if you have avcodec.h installed.])
124 AC_DEFINE(HAVE_LIBAVCODEC_AVCODEC_H, 1, [Define if you have avcodec.h installed.])
127 if test x"${ac_cv_path_ffmpeg_incl}" = x ; then
129 AC_MSG_RESULT(none found)
132 AC_MSG_RESULT(${ac_cv_path_ffmpeg_incl})
135 dnl Find and check libavcodec version number to make sure we have a usable
136 dnl version and to enable/disable features according to version.
137 dnl We need LIBAVCODEC VERSION of at least 51.29.0 to get avcodec_decode_audio2
139 dnl We try to get the avcodec version as a decimal number
140 dnl so that we can compare it numerically against what we require.
142 dnl This previous version makes ffmpeg fail and then grubs the version string
143 dnl out of the resulting usage message e.g. " libavcodec version: 51.40.2"
144 dnl Early versions of ffmpeg do not output this string at all.
146 dnl AC_PATH_PROG(FFMPEG, ffmpeg, ,[${pathlist}])
147 dnl if test "x$FFMPEG" = "x" ; then
148 dnl ffmpeg_version=`$FFMPEG uglyhack 2>&1 | grep "libavcodec version" | cut -d ' ' -f 5 | tr -d '.'`
149 dnl if test "$ffmpeg_version" -lt 51290; then
154 dnl These days we check avcodec.h and pick the version out of the constants,
155 dnl simply throwing away all non-digits.
157 dnl In earlier versions we have:
158 dnl #define FFMPEG_VERSION_INT 0x000409
159 dnl #define FFMPEG_VERSION "0.4.9-pre1"
160 dnl #define LIBAVCODEC_BUILD 4731
161 dnl #define LIBAVCODEC_VERSION_INT FFMPEG_VERSION_INT
162 dnl #define LIBAVCODEC_VERSION FFMPEG_VERSION
164 dnl elsewhere, FFMPEG_VERSION may also be the quoted string "CVS"
166 dnl This changed from the above to
167 dnl #define LIBAVCODEC_VERSION_INT ((49<<16)+(0<<8)+0)
168 dnl #define LIBAVCODEC_VERSION 49.0.0
169 dnl #define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT
170 dnl (note, LIBAVCODEC_VERSION also changes from a quoted string to unquoted)
171 dnl see http://lists.mplayerhq.hu/pipermail/ffmpeg-cvslog/2005-July/000570.html
174 dnl This changed from the above to
175 dnl #define LIBAVCODEC_VERSION_MAJOR 51
176 dnl #define LIBAVCODEC_VERSION_MINOR 54
177 dnl #define LIBAVCODEC_VERSION_MICRO 0
179 dnl #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
180 dnl LIBAVCODEC_VERSION_MINOR, \
181 dnl LIBAVCODEC_VERSION_MICRO)
182 dnl #define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \
183 dnl LIBAVCODEC_VERSION_MINOR, \
184 dnl LIBAVCODEC_VERSION_MICRO)
186 dnl Those deb-heads at Debian redefine LIBAVCODEC_VERSION in their versions to
187 dnl (e.g.) 1d.51.38.0 or dnl 0d.51.11.0 - we need to discard the prefixed
190 dnl Other values or LIBAVCODEC_VERSION spotted in the wild:
191 dnl 50.0.0 50.5.0 51.7.0 51.8.0 0d.51.8.0 51.40.4
192 dnl presumably this will change to 52.0.0 at some point...
194 dnl We can ignore the very early versions because 51.10.0 is necessary to decode
195 dnl Flash video at all. However the current solution will incorrectly succeed
196 dnl on early debian/ubuntu 1d.* version numbers and incorrectly fail
197 dnl when 52.0.0 happens.
199 dnl The most reliable way is to compile a test program to print the value of
200 dnl LIBAVCODEC_BUILD, which got up to dnl 4718 at version 0.4.9-pre1,
201 dnl then changed to (major<<16 + minor<<8 + micro) from then on.
202 dnl There is code to do this in transcode's configure.in, but when
203 dnl cross-compiling we cannot run a test program, which suggests that
204 dnl a modified form of grepping may be better, making sure all old kinds of
205 dnl version numbering fail gracefully.
209 dnl Check avcodec version number, if it was found
210 if test x"${avcodec_version_h}" != x; then
211 versionfile=${avcodec_version_h}
213 if test x"${avcodec_h}" != x; then
214 versionfile=${avcodec_h}
218 if test x"${versionfile}" != x; then
220 AC_MSG_CHECKING([ffmpeg version])
222 ffmpeg_major_version=`$EGREP "define LIBAVCODEC_VERSION_MAJOR " ${versionfile} | sed -e "s%[[^0-9]]%%g"`
223 ffmpeg_minor_version=`$EGREP "define LIBAVCODEC_VERSION_MINOR " ${versionfile} | sed -e "s%[[^0-9]]%%g"`
224 ffmpeg_micro_version=`$EGREP "define LIBAVCODEC_VERSION_MICRO " ${versionfile} | sed -e "s%[[^0-9]]%%g"`
226 if test x"${ffmpeg_major_version}" != x ; then
228 ffmpeg_version="${ffmpeg_major_version}.${ffmpeg_minor_version}.${ffmpeg_micro_version}"
232 dnl #define LIBAVCODEC_VERSION_TRIPLET 51,50,1
233 ffmpeg_version=`$EGREP "define LIBAVCODEC_VERSION_TRIPLET " ${versionfile} | awk '{print $'3'}' | sed -e "s%,%.%g"`
235 if test x"${ffmpeg_version}" = x ; then
237 dnl NOTE: the [0-9]*d. pattern discards deb-heads rubbish prefix
238 ffmpeg_version=`$EGREP "define LIBAVCODEC_VERSION " ${versionfile} | awk '{print $'3'}' | sed -e "s%^[[0-9]]d\.%%"`
240 if test x"${ffmpeg_version}" = x ; then
241 ffmpeg_version=`$EGREP "define LIBAVCODEC_BUILD " ${versionfile} | awk '{print $'3'}'`
245 if test x"${ffmpeg_version}" != x ; then
246 ffmpeg_major_version=`echo ${ffmpeg_version} | cut -d. -f1`
247 ffmpeg_minor_version=`echo ${ffmpeg_version} | cut -d. -f2`
248 ffmpeg_micro_version=`echo ${ffmpeg_version} | cut -d. -f3`
253 ffmpeg_num_version=`printf %02d%02d%02d $ffmpeg_major_version $ffmpeg_minor_version $ffmpeg_micro_version`
255 AC_MSG_RESULT($ffmpeg_version ($ffmpeg_num_version))
258 dnl AC_EGREP_HEADER(avcodec_decode_audio2, ${avcodec_h}, [avfound=yes], [avfound=no])
260 if test -z "$ffmpeg_num_version" -o "$ffmpeg_num_version" -lt 512800; then
261 AC_MSG_WARN([Wrong ffmpeg/libavcodec version! 51.28.0 or greater required, $ffmpeg_version detected.])
263 ffmpeg_version_check=ok
266 if test -z "$ffmpeg_num_version" -o "$ffmpeg_num_version" -lt 514900; then
267 dnl 51.49.0 or higher required
268 AC_MSG_WARN([This version of ffmpeg/libavcodec ($ffmpeg_version) is not able to play VP6A encoded video: 51.49.0 or higher required!])
270 AC_DEFINE(FFMPEG_VP6A, 1, [Define if ffmpeg can play VP6A.])
273 if test -z "$ffmpeg_num_version" -o "$ffmpeg_num_version" -lt 514600; then
274 dnl 51.46.0 (r10741) or higher required for CODEC_ID_NELLYMOSER
275 AC_MSG_WARN([This version of ffmpeg/libavcodec ($ffmpeg_version) is not able to decode NELLYMOSER encoded audio: 51.46.0 (r10741) or higher required!])
277 AC_DEFINE(FFMPEG_NELLYMOSER, 1, [Define if ffmpeg can decode NELLYMOSER audio])
280 AC_MSG_WARN([Could not check ffmpeg version (can't find avcodec.h file)])
281 # ffmpeg_version_check=ok # this is NOT ok, why would it be ?!
284 LIBAVCODEC_IDENT=${ffmpeg_version}
285 FFMPEG_CFLAGS="-D__STDC_CONSTANT_MACROS ${ac_cv_path_ffmpeg_incl}"
287 AC_MSG_CHECKING([for avformat.h])
288 if test -f "${ffmpeg_top_incl}/avformat.h"; then
289 AC_DEFINE(HAVE_FFMPEG_AVFORMAT_H, 1, [Define if avformat.h is found])
290 avformat_h="${ffmpeg_top_incl}/avformat.h"
292 if test -f "${ffmpeg_top_incl}/libavformat/avformat.h"; then
293 AC_DEFINE(HAVE_LIBAVFORMAT_AVFORMAT_H, 1, [Define if avformat.h is found])
294 avformat_h="${ffmpeg_top_incl}/libavformat/avformat.h"
299 AC_MSG_RESULT($avformat_h)
301 AC_MSG_CHECKING([for swscale.h])
302 have_ffmpeg_swscale=no
303 if test -f "${ffmpeg_top_incl}/ffmpeg/swscale.h"; then
304 have_ffmpeg_swscale=yes
305 AC_DEFINE(HAVE_FFMPEG_SWSCALE_H, 1, [Define if swscale.h is found])
307 if test -f "${ffmpeg_top_incl}/libswscale/swscale.h"; then
308 have_ffmpeg_swscale=yes
309 AC_DEFINE(HAVE_LIBSWSCALE_SWSCALE_H, 1, [Define if swscale.h is found])
311 if test -f "${ffmpeg_top_incl}/swscale.h"; then
312 have_ffmpeg_swscale=yes
313 AC_DEFINE(HAVE_SWSCALE_H, 1, [Define if swscale.h is found])
315 AC_MSG_RESULT($have_ffmpeg_swscale)
317 if test x"$have_ffmpeg_swscale" = "xno" -a 1$ffmpeg_num_version -ge 1"520000"; then
318 AC_MSG_WARN([Cannot find swscale.h, required for ffmpeg versions >= 52.0.0 (detected version: $ffmpeg_version)])
319 ffmpeg_version_check=
322 AC_MSG_CHECKING([for libavcodec/vaapi.h])
323 have_ffmpeg_vaapi="no"
324 if test -f "${ffmpeg_top_incl}/ffmpeg/vaapi.h"; then
325 have_ffmpeg_vaapi="yes"
326 AC_DEFINE(HAVE_FFMPEG_VAAPI_H, 1, [Defined if ffmpeg/vaapi.h is found])
328 if test -f "${ffmpeg_top_incl}/libavcodec/vaapi.h"; then
329 have_ffmpeg_vaapi="yes"
330 AC_DEFINE(HAVE_LIBAVCODEC_VAAPI_H, 1, [Defined if libavcodec/vaapi.h is found])
332 AC_MSG_RESULT($have_ffmpeg_vaapi)
334 dnl ---------------------------------
336 dnl FFMPEG libs checking
338 dnl ---------------------------------
342 dnl Did they tell us where the libs are ?
343 AC_ARG_WITH(ffmpeg_lib, AC_HELP_STRING([--with-ffmpeg-lib], [directory where ffmpeg libraries are]), with_ffmpeg_lib=${withval})
344 AC_CACHE_VAL(ac_cv_path_ffmpeg_lib, [
345 if test x"${with_ffmpeg_lib}" != x ; then
346 if test -f ${with_ffmpeg_lib}/libavcodec.a -o -f ${with_ffmpeg_lib}/libavcodec.${shlibext}; then
347 ac_cv_path_ffmpeg_lib="-L`(cd ${with_ffmpeg_lib}; pwd)`"
348 libavcodec="-lavcodec"
349 LIBS="${ac_cv_path_ffmpeg_lib} $LIBS" dnl <-- What is this needed for ?
350 top_lib_dir=${with_ffmpeg_lib}
352 AC_MSG_ERROR([${with_ffmpeg_lib} directory doesn't contain libavcodec libraries.])
354 if test -f ${with_ffmpeg_lib}/libavformat.a -o -f ${with_ffmpeg_lib}/libavformat.${shlibext}; then
355 ac_cv_path_ffmpeg_lib="-L`(cd ${with_ffmpeg_lib}; pwd)`"
356 libavformat="-lavformat"
357 top_lib_dir=${with_ffmpeg_lib}
359 AC_MSG_ERROR([${with_ffmpeg_lib} directory doesn't contain libavformat libraries.])
364 dnl Look for the AVCODEC library
366 dnl Try with pkg-config (if not cross-compiling)
367 if test x"${cross_compiling}" = xno; then
368 if test x"$PKG_CONFIG" != x -a x"${libavcodec}" = x; then
369 $PKG_CONFIG --exists libavcodec && libavcodec=`$PKG_CONFIG --libs libavcodec`
371 dnl WARNING: we won't be able to set top_lib_dir here, as pkg-config doesn't
372 dnl return any -L when not neeed.
373 dnl We won't need top_lib_dir either, as the only use for it
374 dnl is to look for other required libraries, while pkg-config
375 dnl probably include them all, so not a big deal.
380 if test x"${libavcodec}" != x; then
381 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} ${libavcodec}"
383 AC_MSG_CHECKING([for libavcodec library])
384 for i in $libslist; do
385 if test -f $i/libavcodec.a -o -f $i/libavcodec.${shlibext}; then
386 if test x${top_lib_dir} = x; then top_lib_dir=$i; fi
387 AC_MSG_RESULT(${top_lib_dir}/libavcodec)
388 if test ! x"$i" = x"/usr/lib" -a ! x"$i" = x"/usr/lib64"; then
389 ac_cv_path_ffmpeg_lib="-L$i -lavcodec"
392 ac_cv_path_ffmpeg_lib="-lavcodec"
398 if test x"${libavcodec}" = x; then
400 if test x${cross_compiling} = xno; then
401 dnl avcodec_decode_audio2 starts 51.29.0
402 AC_CHECK_LIB(avcodec, ff_eval, [ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -lavcodec"])
407 if test x$top_lib_dir != x; then
408 AC_MSG_NOTICE([ffmpeg top lib dir is $top_lib_dir])
411 dnl Start of all optional library tests {
413 dnl TODO: skip these tests if we got ac_cv_path_ffmpeg_lib
414 dnl from pkg-config, as it would likely bring all
415 dnl required libs in.
417 if test x"${ac_cv_path_ffmpeg_lib}" != x; then
419 dnl Look for the DTS library, which is required on some systems. {
421 dnl TODO: skip this if -ldts is already in due to pkg-config
423 AC_MSG_CHECKING([for libdts library])
424 if test x"$PKG_CONFIG" != x -a x${cross_compiling} = xno; then
425 $PKG_CONFIG --exists libdts && libdts=`$PKG_CONFIG --libs-only-l libdts`
429 if test x"${libdts}" = x; then
430 if test -f ${top_lib_dir}/libdts.a -o -f ${top_lib_dir}/libdts.${shlibext}; then
431 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -ldts"
432 AC_MSG_RESULT(${top_lib_dir}/libdts)
435 if test x${cross_compiling} = xno; then
436 AC_CHECK_LIB(dts, dts_init, [ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -ldts"])
440 AC_MSG_RESULT(${libdts})
441 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} ${libdts}"
443 dnl End of DTS library looking }
445 dnl Look for the VORBISENC library, which is required on some systems. {
446 AC_MSG_CHECKING([for libvorbisenc library])
447 if test x"$PKG_CONFIG" != x -a x${cross_compiling} = xno; then
448 $PKG_CONFIG --exists vorbisenc && libvorbisenc=`$PKG_CONFIG --libs-only-l vorbisenc`
452 if test x"${libvorbisenc}" = x; then
453 if test -f ${top_lib_dir}/libvorbisenc.a -o -f ${top_lib_dir}/libvorbisenc.${shlibext}; then
454 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -lvorbisenc"
455 AC_MSG_RESULT(${top_lib_dir}/libvorbisenc)
458 if test x${cross_compiling} = xno; then
459 AC_CHECK_LIB(vorbisenc, vorbis_encode_init, [ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -lvorbisenc"])
463 AC_MSG_RESULT(${libvorbisenc})
464 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} ${libvorbisenc}"
466 dnl End of VORBINSEC library looking }
469 dnl Look for the AVFORMAT library {
471 dnl TODO: libavformat be mandatory, thus linked in already ?
474 AC_MSG_CHECKING([for libavformat library])
476 dnl Try with pkg-config (if not cross-compiling)
477 if test x"${cross_compiling}" = xno; then
478 if test x"$PKG_CONFIG" != x -a x${libavformat} = x; then
479 $PKG_CONFIG --exists libavformat && libavformat=`$PKG_CONFIG --libs-only-l libavformat`
483 if test x"${libavformat}" = x; then
484 if test -f ${top_lib_dir}/libavformat.a -o -f ${top_lib_dir}/libavformat.${shlibext}; then
485 ac_cv_path_ffmpeg_lib="-lavformat ${ac_cv_path_ffmpeg_lib}"
486 AC_MSG_RESULT(${top_lib_dir}/libavformat)
489 if test x${cross_compiling} = xno; then
490 AC_CHECK_LIB(libavformat, av_open_input_file, [ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -lavformat"])
494 AC_MSG_RESULT(${libavformat})
495 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} ${libavformat}"
498 dnl End of AVFORMAT library looking }
500 dnl Look for the AVUTIL library, which is required on some systems. {
502 dnl TODO: skip this if -lavutil is already in due to pkg-config
504 AC_MSG_CHECKING([for libavutil library])
505 if test x"$PKG_CONFIG" != x -a x${cross_compiling} = xno; then
506 $PKG_CONFIG --exists libavutil && libavutil=`$PKG_CONFIG --libs-only-l libavutil`
510 if test x"${libavutil}" = x; then
511 if test -f ${top_lib_dir}/libavutil.a -o -f ${top_lib_dir}/libavutil.${shlibext}; then
512 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -lavutil"
513 AC_MSG_RESULT(${top_lib_dir}/libavutil)
516 if test x${cross_compiling} = xno; then
517 AC_CHECK_LIB(avutil, av_log, [ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -lavutil"])
521 AC_MSG_RESULT(${libavutil})
522 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} ${libavutil}"
524 dnl End of AVUTIL library looking }
526 dnl Look for the THEORA library, which is required on some systems. {
528 dnl TODO: skip this if -ltheora is already in due to pkg-config
530 AC_MSG_CHECKING([for libtheora library])
531 if test x"$PKG_CONFIG" != x -a x${cross_compiling} = xno; then
532 $PKG_CONFIG --exists theora && libtheora=`$PKG_CONFIG --libs-only-l theora`
536 if test x"${libtheora}" = x; then
537 if test -f ${top_lib_dir}/libtheora.a -o -f ${top_lib_dir}/libtheora.${shlibext}; then
538 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -ltheora"
539 AC_MSG_RESULT(${top_lib_dir}/libtheora)
542 if test x${cross_compiling} = xno; then
543 AC_CHECK_LIB(theora, theora_encode_init, [ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -ltheora"])
547 AC_MSG_RESULT(${libtheora})
548 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} ${libtheora}"
550 dnl End of THEORA library looking }
552 dnl Look for the GSM library, which is required on some systems. {
553 AC_MSG_CHECKING([for libgsm library])
554 if test x"$PKG_CONFIG" != x -a x${cross_compiling} = xno; then
555 $PKG_CONFIG --exists gsm && libgsm=`$PKG_CONFIG --libs-only-l gsm`
560 if test x"${libgsm}" = x; then
561 if test -f ${top_lib_dir}/libgsm.a -o -f ${top_lib_dir}/libgsm.${shlibext}; then
562 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -lgsm"
563 AC_MSG_RESULT(${top_lib_dir}/libgsm)
566 if test x${cross_compiling} = xno; then
567 AC_CHECK_LIB(gsm, gsm_destroy, [ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -lgsm"])
572 AC_MSG_RESULT(${libgsm})
573 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} ${libgsm}"
574 dnl End of GSM library looking }
576 dnl Look for the DC1394 library, which is required on some systems. {
578 dnl TODO: skip this if -ldc1394 is already in due to pkg-config
580 AC_MSG_CHECKING([for libdc1394 library])
581 if test x"$PKG_CONFIG" != x -a x${cross_compiling} = xno; then
582 $PKG_CONFIG --exists libdc && libdc=`$PKG_CONFIG --libs-only-l libdc1394`
586 if test x"${libdc}" = x; then
587 if test -f ${top_lib_dir}/libdc1394.a -o -f ${top_lib_dir}/libdc1394.${shlibext}; then
588 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -ldc1394"
589 AC_MSG_RESULT(${top_lib_dir}/libdc1394)
592 if test x${cross_compiling} = xno; then
593 AC_CHECK_LIB(dc1394_control, dc1394_is_camera, [ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -ldc1394_control"])
597 AC_MSG_RESULT(${libdc})
598 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} ${libdc}"
600 dnl End of DC1394 library looking }
602 dnl Look for the SWSCALE library {
604 dnl This is required on some system if ffmpeg is
605 dnl configured with --enable-gpl --enable-swscale.
606 AC_MSG_CHECKING([for libswscale library])
607 if test x"$PKG_CONFIG" != x -a x${cross_compiling} = xno; then
608 $PKG_CONFIG --exists libswscale && libsws=`$PKG_CONFIG --libs-only-l libswscale`
612 if test x"${libsws}" = x; then
613 if test -f ${top_lib_dir}/libswscale.a -o -f ${top_lib_dir}/libswscale.${shlibext}; then
614 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -lswscale"
618 if test x${cross_compiling} = xno; then
619 AC_CHECK_LIB(swscale, sws_scale, [ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -lswscale"])
623 AC_MSG_RESULT(${libsws})
624 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} ${libsws}"
626 dnl End of SWSCALE library looking }
629 dnl End of all optional library tests }
631 # Set final compilation flags, eliminating the pointless "-I/usr/include"
632 if test x"${ac_cv_path_ffmpeg_lib}" != x ; then
633 FFMPEG_LIBS="${ac_cv_path_ffmpeg_lib}"
638 AC_SUBST(LIBAVCODEC_IDENT)
639 AC_SUBST(FFMPEG_CFLAGS)
640 AC_SUBST(FFMPEG_LIBS)
643 CFLAGS="$backupCFLAGS"
649 # indent-tabs-mode: nil