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 2>&1 >/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>&1 >/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>&1 >/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} 2>&1 | sed -e "s%[[^0-9]]%%g"`
223 ffmpeg_minor_version=`$EGREP "define LIBAVCODEC_VERSION_MINOR " ${versionfile} 2>&1 | sed -e "s%[[^0-9]]%%g"`
224 ffmpeg_micro_version=`$EGREP "define LIBAVCODEC_VERSION_MICRO " ${versionfile} 2>&1 | 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} 2>&1 | 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'}' 2>&1 | sed -e "s%^[[0-9]]d\.%%"`
240 if test x"${ffmpeg_version}" = x ; then
241 ffmpeg_version=`$EGREP "define LIBAVCODEC_BUILD " ${versionfile} 2>&1 | 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 minimum supported libavcodec version = Debian stable one = currently Wheezy 7.0 53.35.00
260 if test -z "$ffmpeg_num_version" -o "$ffmpeg_num_version" -lt 533500; then
261 AC_MSG_WARN([Wrong ffmpeg/libavcodec version! 53.35.0 or greater required, $ffmpeg_version detected.])
263 ffmpeg_version_check=ok
267 AC_MSG_WARN([Could not check ffmpeg version (can't find avcodec.h file)])
268 # ffmpeg_version_check=ok # this is NOT ok, why would it be ?!
271 dnl Check if installed ffmpeg/libav already switched aac decoding from S16 to
272 dnl float planar format (FLTP). If recent enough, we'll recommend to install
273 dnl a dedicate resampling library to get aac properly decoded.
274 dnl Commit in question (3d3cf6745e2a5dc9c377244454c3186d75b177fa) corresponds
275 dnl to libavcodec ffmpeg version 54.77.100 / libav version 54.33.0.
276 dnl | ffmpeg | 1.0 (54.59.100) S16 | 1.1 (54.86.100) FLTP |
277 dnl | libav | 0.8 (53.35.0) S16 | 9 (54.35.0) FLTP |
279 if test ${ffmpeg_major_version} -ge 55 -o \
280 \( ${ffmpeg_major_version} -eq 54 -a ${ffmpeg_micro_version} -eq 0 \) -o \
281 \( ${ffmpeg_major_version} -eq 54 -a ${ffmpeg_minor_version} -ge 77 -a \
282 ${ffmpeg_micro_version} -ge 100 \); then
283 ffmpeg_aac_float_planar=yes
286 LIBAVCODEC_IDENT=${ffmpeg_version}
287 FFMPEG_CFLAGS="-D__STDC_CONSTANT_MACROS ${ac_cv_path_ffmpeg_incl}"
289 AC_MSG_CHECKING([for avformat.h])
290 if test -f "${ffmpeg_top_incl}/avformat.h"; then
291 AC_DEFINE(HAVE_FFMPEG_AVFORMAT_H, 1, [Define if avformat.h is found])
292 avformat_h="${ffmpeg_top_incl}/avformat.h"
294 if test -f "${ffmpeg_top_incl}/libavformat/avformat.h"; then
295 AC_DEFINE(HAVE_LIBAVFORMAT_AVFORMAT_H, 1, [Define if avformat.h is found])
296 avformat_h="${ffmpeg_top_incl}/libavformat/avformat.h"
301 AC_MSG_RESULT($avformat_h)
303 AC_MSG_CHECKING([for swscale.h])
304 have_ffmpeg_swscale=no
305 if test -f "${ffmpeg_top_incl}/ffmpeg/swscale.h"; then
306 have_ffmpeg_swscale=yes
307 AC_DEFINE(HAVE_FFMPEG_SWSCALE_H, 1, [Define if swscale.h is found])
309 if test -f "${ffmpeg_top_incl}/libswscale/swscale.h"; then
310 have_ffmpeg_swscale=yes
311 AC_DEFINE(HAVE_LIBSWSCALE_SWSCALE_H, 1, [Define if swscale.h is found])
313 if test -f "${ffmpeg_top_incl}/swscale.h"; then
314 have_ffmpeg_swscale=yes
315 AC_DEFINE(HAVE_SWSCALE_H, 1, [Define if swscale.h is found])
317 AC_MSG_RESULT($have_ffmpeg_swscale)
319 if test x"$have_ffmpeg_swscale" = "xno" -a 1$ffmpeg_num_version -ge 1"520000"; then
320 AC_MSG_WARN([Cannot find swscale.h, required for ffmpeg versions >= 52.0.0 (detected version: $ffmpeg_version)])
321 ffmpeg_version_check=
324 AC_MSG_CHECKING([for libavutil/opt.h])
325 have_ffmpeg_libavutil=no
326 if test -f "${ffmpeg_top_incl}/libavutil/opt.h"; then
327 have_ffmpeg_libavutil=yes
328 AC_DEFINE(HAVE_LIBAVUTIL_OPT_H, 1, [Define if libavutil/opt.h is found])
330 AC_MSG_RESULT($have_ffmpeg_libavutil)
332 AC_MSG_CHECKING([for swresample.h])
333 have_ffmpeg_swresample=no
334 if test -f "${ffmpeg_top_incl}/ffmpeg/swresample.h"; then
335 have_ffmpeg_swresample=yes
336 AC_DEFINE(HAVE_FFMPEG_SWRESAMPLE_H, 1, [Define if swresample.h is found])
338 if test -f "${ffmpeg_top_incl}/libswresample/swresample.h"; then
339 have_ffmpeg_swresample=yes
340 AC_DEFINE(HAVE_LIBSWRESAMPLE_SWRESAMPLE_H, 1, [Define if swresample.h is found])
342 if test -f "${ffmpeg_top_incl}/swresample.h"; then
343 have_ffmpeg_swresample=yes
344 AC_DEFINE(HAVE_SWRESAMPLE_H, 1, [Define if swresample.h is found])
346 AC_MSG_RESULT($have_ffmpeg_swresample)
348 AC_MSG_CHECKING([for avresample.h])
349 have_libav_avresample=no
350 if test -f "${ffmpeg_top_incl}/libav/avresample.h"; then
351 have_libav_avresample=yes
352 AC_DEFINE(HAVE_LIBAV_AVRESAMPLE_H, 1, [Define if avresample.h is found])
354 if test -f "${ffmpeg_top_incl}/libavresample/avresample.h"; then
355 have_libav_avresample=yes
356 AC_DEFINE(HAVE_LIBAVRESAMPLE_AVRESAMPLE_H, 1, [Define if avresample.h is found])
358 if test -f "${ffmpeg_top_incl}/avresample.h"; then
359 have_libav_avresample=yes
360 AC_DEFINE(HAVE_AVRESAMPLE_H, 1, [Define if avresample.h is found])
362 AC_MSG_RESULT($have_libav_avresample)
364 AC_MSG_CHECKING([for libavcodec/vaapi.h])
365 have_ffmpeg_vaapi="no"
366 if test -f "${ffmpeg_top_incl}/ffmpeg/vaapi.h"; then
367 have_ffmpeg_vaapi="yes"
368 AC_DEFINE(HAVE_FFMPEG_VAAPI_H, 1, [Defined if ffmpeg/vaapi.h is found])
370 if test -f "${ffmpeg_top_incl}/libavcodec/vaapi.h"; then
371 have_ffmpeg_vaapi="yes"
372 AC_DEFINE(HAVE_LIBAVCODEC_VAAPI_H, 1, [Defined if libavcodec/vaapi.h is found])
374 AC_MSG_RESULT($have_ffmpeg_vaapi)
376 dnl ---------------------------------
378 dnl FFMPEG libs checking
380 dnl ---------------------------------
384 dnl Did they tell us where the libs are ?
385 AC_ARG_WITH(ffmpeg_lib, AC_HELP_STRING([--with-ffmpeg-lib], [directory where ffmpeg libraries are]), with_ffmpeg_lib=${withval})
386 AC_CACHE_VAL(ac_cv_path_ffmpeg_lib, [
387 if test x"${with_ffmpeg_lib}" != x ; then
388 if test -f ${with_ffmpeg_lib}/libavcodec.a -o -f ${with_ffmpeg_lib}/libavcodec.${shlibext}; then
389 ac_cv_path_ffmpeg_lib="-L`(cd ${with_ffmpeg_lib}; pwd)`"
390 libavcodec="-lavcodec"
391 LIBS="${ac_cv_path_ffmpeg_lib} $LIBS" dnl <-- What is this needed for ?
392 top_lib_dir=${with_ffmpeg_lib}
394 AC_MSG_ERROR([${with_ffmpeg_lib} directory doesn't contain libavcodec libraries.])
396 if test -f ${with_ffmpeg_lib}/libavformat.a -o -f ${with_ffmpeg_lib}/libavformat.${shlibext}; then
397 ac_cv_path_ffmpeg_lib="-L`(cd ${with_ffmpeg_lib}; pwd)`"
398 libavformat="-lavformat"
399 top_lib_dir=${with_ffmpeg_lib}
401 AC_MSG_ERROR([${with_ffmpeg_lib} directory doesn't contain libavformat libraries.])
406 dnl Look for the AVCODEC library
408 dnl Try with pkg-config (if not cross-compiling)
409 if test x"${cross_compiling}" = xno; then
410 if test x"$PKG_CONFIG" != x -a x"${libavcodec}" = x; then
411 $PKG_CONFIG --exists libavcodec && libavcodec=`$PKG_CONFIG --libs libavcodec`
413 dnl WARNING: we won't be able to set top_lib_dir here, as pkg-config doesn't
414 dnl return any -L when not neeed.
415 dnl We won't need top_lib_dir either, as the only use for it
416 dnl is to look for other required libraries, while pkg-config
417 dnl probably include them all, so not a big deal.
422 if test x"${libavcodec}" != x; then
423 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} ${libavcodec}"
425 AC_MSG_CHECKING([for libavcodec library])
426 for i in $libslist; do
427 if test -f $i/libavcodec.a -o -f $i/libavcodec.${shlibext}; then
428 if test x${top_lib_dir} = x; then top_lib_dir=$i; fi
429 AC_MSG_RESULT(${top_lib_dir}/libavcodec)
430 if test ! x"$i" = x"/usr/lib" -a ! x"$i" = x"/usr/lib64"; then
431 ac_cv_path_ffmpeg_lib="-L$i -lavcodec"
434 ac_cv_path_ffmpeg_lib="-lavcodec"
440 if test x"${libavcodec}" = x; then
442 if test x${cross_compiling} = xno; then
443 dnl avcodec_decode_audio2 starts 51.29.0
444 AC_CHECK_LIB(avcodec, ff_eval, [ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -lavcodec"])
449 if test x$top_lib_dir != x; then
450 AC_MSG_NOTICE([ffmpeg top lib dir is $top_lib_dir])
453 dnl Start of all optional library tests {
455 dnl TODO: skip these tests if we got ac_cv_path_ffmpeg_lib
456 dnl from pkg-config, as it would likely bring all
457 dnl required libs in.
459 if test x"${ac_cv_path_ffmpeg_lib}" != x; then
461 dnl Look for the DTS library, which is required on some systems. {
463 dnl TODO: skip this if -ldts is already in due to pkg-config
465 AC_MSG_CHECKING([for libdts library])
466 if test x"$PKG_CONFIG" != x -a x${cross_compiling} = xno; then
467 $PKG_CONFIG --exists libdts && libdts=`$PKG_CONFIG --libs-only-l libdts`
471 if test x"${libdts}" = x; then
472 if test -f ${top_lib_dir}/libdts.a -o -f ${top_lib_dir}/libdts.${shlibext}; then
473 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -ldts"
474 AC_MSG_RESULT(${top_lib_dir}/libdts)
477 if test x${cross_compiling} = xno; then
478 AC_CHECK_LIB(dts, dts_init, [ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -ldts"])
482 AC_MSG_RESULT(${libdts})
483 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} ${libdts}"
485 dnl End of DTS library looking }
487 dnl Look for the VORBISENC library, which is required on some systems. {
488 AC_MSG_CHECKING([for libvorbisenc library])
489 if test x"$PKG_CONFIG" != x -a x${cross_compiling} = xno; then
490 $PKG_CONFIG --exists vorbisenc && libvorbisenc=`$PKG_CONFIG --libs-only-l vorbisenc`
494 if test x"${libvorbisenc}" = x; then
495 if test -f ${top_lib_dir}/libvorbisenc.a -o -f ${top_lib_dir}/libvorbisenc.${shlibext}; then
496 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -lvorbisenc"
497 AC_MSG_RESULT(${top_lib_dir}/libvorbisenc)
500 if test x${cross_compiling} = xno; then
501 AC_CHECK_LIB(vorbisenc, vorbis_encode_init, [ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -lvorbisenc"])
505 AC_MSG_RESULT(${libvorbisenc})
506 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} ${libvorbisenc}"
508 dnl End of VORBINSEC library looking }
511 dnl Look for the AVFORMAT library {
513 dnl TODO: libavformat be mandatory, thus linked in already ?
516 AC_MSG_CHECKING([for libavformat library])
518 dnl Try with pkg-config (if not cross-compiling)
519 if test x"${cross_compiling}" = xno; then
520 if test x"$PKG_CONFIG" != x -a x${libavformat} = x; then
521 $PKG_CONFIG --exists libavformat && libavformat=`$PKG_CONFIG --libs-only-l libavformat`
525 if test x"${libavformat}" = x; then
526 if test -f ${top_lib_dir}/libavformat.a -o -f ${top_lib_dir}/libavformat.${shlibext}; then
527 ac_cv_path_ffmpeg_lib="-lavformat ${ac_cv_path_ffmpeg_lib}"
528 AC_MSG_RESULT(${top_lib_dir}/libavformat)
531 if test x${cross_compiling} = xno; then
532 AC_CHECK_LIB(libavformat, av_open_input_file, [ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -lavformat"])
536 AC_MSG_RESULT(${libavformat})
537 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} ${libavformat}"
540 dnl End of AVFORMAT library looking }
542 dnl Look for the AVUTIL library, which is required on some systems. {
544 dnl TODO: skip this if -lavutil is already in due to pkg-config
546 AC_MSG_CHECKING([for libavutil library])
547 if test x"$PKG_CONFIG" != x -a x${cross_compiling} = xno; then
548 $PKG_CONFIG --exists libavutil && libavutil=`$PKG_CONFIG --libs-only-l libavutil`
552 if test x"${libavutil}" = x; then
553 if test -f ${top_lib_dir}/libavutil.a -o -f ${top_lib_dir}/libavutil.${shlibext}; then
554 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -lavutil"
555 AC_MSG_RESULT(${top_lib_dir}/libavutil)
558 if test x${cross_compiling} = xno; then
559 AC_CHECK_LIB(avutil, av_log, [ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -lavutil"])
563 AC_MSG_RESULT(${libavutil})
564 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} ${libavutil}"
566 dnl End of AVUTIL library looking }
568 dnl Look for the THEORA library, which is required on some systems. {
570 dnl TODO: skip this if -ltheora is already in due to pkg-config
572 AC_MSG_CHECKING([for libtheora library])
573 if test x"$PKG_CONFIG" != x -a x${cross_compiling} = xno; then
574 $PKG_CONFIG --exists theora && libtheora=`$PKG_CONFIG --libs-only-l theora`
578 if test x"${libtheora}" = x; then
579 if test -f ${top_lib_dir}/libtheora.a -o -f ${top_lib_dir}/libtheora.${shlibext}; then
580 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -ltheora"
581 AC_MSG_RESULT(${top_lib_dir}/libtheora)
584 if test x${cross_compiling} = xno; then
585 AC_CHECK_LIB(theora, theora_encode_init, [ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -ltheora"])
589 AC_MSG_RESULT(${libtheora})
590 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} ${libtheora}"
592 dnl End of THEORA library looking }
594 dnl Look for the GSM library, which is required on some systems. {
595 AC_MSG_CHECKING([for libgsm library])
596 if test x"$PKG_CONFIG" != x -a x${cross_compiling} = xno; then
597 $PKG_CONFIG --exists gsm && libgsm=`$PKG_CONFIG --libs-only-l gsm`
602 if test x"${libgsm}" = x; then
603 if test -f ${top_lib_dir}/libgsm.a -o -f ${top_lib_dir}/libgsm.${shlibext}; then
604 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -lgsm"
605 AC_MSG_RESULT(${top_lib_dir}/libgsm)
608 if test x${cross_compiling} = xno; then
609 AC_CHECK_LIB(gsm, gsm_destroy, [ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -lgsm"])
613 AC_MSG_RESULT(${libgsm})
616 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} ${libgsm}"
617 dnl End of GSM library looking }
619 dnl Look for the DC1394 library, which is required on some systems. {
621 dnl TODO: skip this if -ldc1394 is already in due to pkg-config
623 AC_MSG_CHECKING([for libdc1394 library])
624 if test x"$PKG_CONFIG" != x -a x${cross_compiling} = xno; then
625 $PKG_CONFIG --exists libdc && libdc=`$PKG_CONFIG --libs-only-l libdc1394`
629 if test x"${libdc}" = x; then
630 if test -f ${top_lib_dir}/libdc1394.a -o -f ${top_lib_dir}/libdc1394.${shlibext}; then
631 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -ldc1394"
632 AC_MSG_RESULT(${top_lib_dir}/libdc1394)
635 if test x${cross_compiling} = xno; then
636 AC_CHECK_LIB(dc1394_control, dc1394_is_camera, [ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -ldc1394_control"])
640 AC_MSG_RESULT(${libdc})
641 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} ${libdc}"
643 dnl End of DC1394 library looking }
645 dnl Look for the SWSCALE library {
647 dnl This is required on some system if ffmpeg is
648 dnl configured with --enable-gpl --enable-swscale.
649 AC_MSG_CHECKING([for libswscale library])
650 if test x"$PKG_CONFIG" != x -a x${cross_compiling} = xno; then
651 $PKG_CONFIG --exists libswscale && libsws=`$PKG_CONFIG --libs-only-l libswscale`
655 if test x"${libsws}" = x; then
656 if test -f ${top_lib_dir}/libswscale.a -o -f ${top_lib_dir}/libswscale.${shlibext}; then
657 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -lswscale"
661 if test x${cross_compiling} = xno; then
662 AC_CHECK_LIB(swscale, sws_scale, [ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -lswscale"])
666 AC_MSG_RESULT(${libsws})
667 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} ${libsws}"
669 dnl End of SWSCALE library looking }
671 dnl Look for the {SW,AV}RESAMPLE libraries {
673 AC_MSG_CHECKING([for libswresample library])
674 if test x"$PKG_CONFIG" != x -a x${cross_compiling} = xno; then
675 $PKG_CONFIG --exists libswresample && libswresample=`$PKG_CONFIG --libs-only-l libswresample`
679 if test x"${libswresample}" = x; then
680 if test -f ${top_lib_dir}/libswresample.a -o -f ${top_lib_dir}/libswresample.${shlibext}; then
681 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -lswresample"
685 if test x${cross_compiling} = xno; then
686 AC_CHECK_LIB(swresample, swresample, [ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -lswresample"])
690 AC_MSG_RESULT(${libswresample})
691 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} ${libswresample}"
694 AC_MSG_CHECKING([for libavresample library])
695 if test x"$PKG_CONFIG" != x -a x${cross_compiling} = xno; then
696 $PKG_CONFIG --exists libavresample && libavresample=`$PKG_CONFIG --libs-only-l libavresample`
700 if test x"${libavresample}" = x; then
701 if test -f ${top_lib_dir}/libavresample.a -o -f ${top_lib_dir}/libavresample.${shlibext}; then
702 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -lavresample"
706 if test x${cross_compiling} = xno; then
707 AC_CHECK_LIB(avresample, avresample, [ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} -lavresample"])
711 AC_MSG_RESULT(${libavresample})
712 ac_cv_path_ffmpeg_lib="${ac_cv_path_ffmpeg_lib} ${libavresample}"
714 dnl End of {SW,AV}RESAMPLE libraries looking }
717 dnl End of all optional library tests }
719 # Set final compilation flags, eliminating the pointless "-I/usr/include"
720 if test x"${ac_cv_path_ffmpeg_lib}" != x ; then
721 FFMPEG_LIBS="${ac_cv_path_ffmpeg_lib}"
726 AC_SUBST(LIBAVCODEC_IDENT)
727 AC_SUBST(FFMPEG_CFLAGS)
728 AC_SUBST(FFMPEG_LIBS)
731 CFLAGS="$backupCFLAGS"
737 # indent-tabs-mode: nil